Wiki source code of Project WONDER-Quickstart

Last modified by Pascal Robert on 2012/02/11 08:27

Show last authors
1 == Quickstart ==
2
3 Using Project WONDER is surprisingly easy. There are only a few steps to get up-and-running:
4
5 1. [[Download and install>>doc:WEB.Home.Getting Started.Getting the Wonder Source Code.WebHome]] the Project WONDER frameworks;
6 1. Add the ERJars.framework and ERExtensions.framework to your WebObjects project;
7 1. Change your Application class to extend er.extensions.ERXApplication instead of WOApplication;
8 1. Change your Application.main method to call er.extensions.ERXApplication.main instead of WOApplication.main;
9 1. Change your Session class to extend er.extensions.ERXSession instead of WOSession;
10 1. Change your DirectAction class to extend er.extensions.ERXDirectAction instead of WODirectAction;
11 1. Build.
12
13 When using Xcode out of the box, there will be an error upon launching this application (as of Feb 6, 2007):
14
15 **"No ERX_MARKER field in NSMutableArray found."**
16
17 This means your class path is incorrect. Adjust it so that ERExtensions come before JavaFoundation. To do this, you must change the order of your classpath so that ERExtensions appears above JavaFoundation. In my default classpath, JavaFoundation appears first in the list. If you are using Xcode, follow Jerry Walker's instructions:
18
19 1. Select "Application Server" in your Active Target popdown menu at the top left of your Xcode window.
20 1. Type command-option-e or choose the Project->Edit Active Target 'Application Server' menu item. This will open a target editing window.
21 1. Select 'Link Binary With Libraries' under 'Build Phases' in the left-hand view.
22 1. You can edit the framework load order by dragging framework up or down in the list on the right. Drag the ERExtensions.framework to the top.
23 1. Rearrange these frameworks in the editing pane into any order that you desire by dragging and dropping them within the editing pane.
24 1. Set your Active Target popdown menu back to the name of your project. <b>THIS IS IMPORTANT.</b>
25 1. Clean and rebuild your app and your classpath settings should be rearranged accordingly.
26
27 This error only occurs with Xcode and, obviously, this workaround applies to Xcode and not Eclipse. Also, there is also an Xcode project template for an ERXApplication available. (from where?)
28
29 If you are using WOLips, you can create a new "Project Wonder Application" which will setup a project with these steps already performed.
30
31 That's it! You are now using Project WONDER and you've begun your journey to easier WO application development.
32
33 == Notes from David Teran ==
34
35 From David Teran Dec 1 2004: **Pointers for getting your head around the frameworks**
36
37 "PW consists of different frameworks, the most important one is ERExtensions, then for D2W apps additionally ERDirectToWeb, some if not all people are using ERCoreBusinessLogic. The other frameworks are build on top of one or multiple from these.
38
39 BUT: i would start reading the class description and then the javadoc, its generated from the sourcecode with eclipse within a second ( ok, maybe 60... ) and its read in about 1 - 3 hours.
40
41 Then i would take a look ERXApplication, ERXSession, ERXGenericRecord, ERXEC (very interesting!), ERXThreadStorage (very interesting, too), ERExtensions, ... and the various utility classes: ERXEOControlUtilities, ERXEOAccessUtilities, ERXArrayUtilities and so on."
42
43 == Notes from Chris Meyer ==
44
45 === Internationalization and Localization ===
46
47 Practical WebObjects outlines one technique for handling internationalization. It is incompatible with Project WONDER.
48
49 To handle internationalization in Project WONDER, delete the takeValuesFromRequest from your Session class (which should now be derived from ERXSession). Likewise, delete the createResponseInContext method from your Application class (which should now be derived from ERXApplication). Then add the following call to your Application constructor:
50 ERXMessageEncoding.setDefaultEncodingForAllLanguages("UTF-8");
51
52 === Logging ===
53
54 Practical WebObjects outlines one technique for SQL logging. Project WONDER uses an entirely different technique.
55
56 In Project WONDER, put this in one of the properties files (I use ~~/WebObjects.properties)
57
58 {{code}}
59
60 # turn off annoying INFO logs
61 log4j.logger.er=INFO
62 log4j.logger.er.extensions.ERXExtensions=OFF
63
64 # Enable delegate to emit SQL debugging info. The Logger used is
65 log4j.category.er.extensions.ERXAdaptorChannelDelegate.sqlLogging=DEBUG
66 # put this to true if you want to log sql stuff
67 er.extensions.ERXAdaptorChannelDelegate.enabled=true
68 # How long a statement must run to cause a log message. Messages with longer than
69 # error also emit a stack-trace
70 er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.debug=0
71 er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.info=50
72 er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.warn=1000
73 er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.error=5000
74 # MaxLength of the message
75 er.extensions.ERXAdaptorChannelDelegate.trace.maxLength = 30000
76 # What entities to watch
77 er.extensions.ERXAdaptorChannelDelegate.trace.entityMatchPattern = .*
78
79 {{/code}}
80
81 === Backtracking ===
82
83 Project WONDER offers a few techniques to deal with backtracking.
84
85 My recommended way is to add a method to your WOComponent:
86
87 {{code}}
88
89 /**
90 * Determine whether the user backtracked.
91 * @return true or false indicating whether the user backtracked
92 */
93 public boolean didBacktrack()
94 {
95 return ((Session)session()).didBacktrack();
96 }
97
98 {{/code}}
99
100 Then anywhere a form is submitted where backtracking might be a problem, add this code to the action method:
101
102 {{code}}
103
104 if (this.didBacktrack())
105 {
106 ec.revert();
107 // handle and prepare to report errors
108 // this.errors.addObject("Unable to process page after back button was pressed.");
109 return this.context().page();
110 }
111
112 {{/code}}
113
114 ERXWORepetition also contains some code to deal with backtracking. As of Project WONDER 3.0, the code seems to work inconsistently. When the page is backtracked and the form submitted, values in the form are just passed as null. This tends to cause more problems than it is worth, although your situation may be different. Also, there is an option to throw an exception when the page is backtracked, but this exception doesn't seem to be thrown consistently.
115
116 === Javadocs ===
117
118 ==== Prebuilt ====
119
120 * [[http:~~/~~/wocommunity.org/documents/javadoc/wonder/latest>>url:http://wocommunity.org/documents/javadoc/wonder/latest||shape="rect"]]
121
122 ==== Creating javadocs from the Wonder source (not using Eclipse) ====
123
124 If you want to create the javadoc and you haven't got Eclipse going yet:
125
126 1. Get the latest source from the nightly build server.
127 1. Once you untar it you'll have a Wonder folder created.
128 1. In the terminal application, type:
129 1. {{code}}cd Wonder/Build/build
130 ant -f build-doc.xml{{/code}}Wait several minutes while some good stuff scrolls by in your terminal window. If ant gives you errors, you may have to set it to use ant 1.4 instead of 1.5 by exporting: JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4/Home
131 1. Find the new dist/wonder-4.0/Documentation/api/index.html page that has been created. The dist directory is at the same level as the top-level Wonder directory. So, you may try:
132 1. {{code}}open ../../../dist/wonder-4.0/Documentation/api/index.html{{/code}}Or you can double-click the index.html page and the javadocs will open in your favorite browser
133
134 ==== Creating javadocs from the Wonder source (using Eclipse) ====
135
136 Someone else will have to fill in this section...\\
137
138 {{code}}
139
140 ERXWORepetition
141
142 {{/code}}