Wiki source code of Project WONDER-Quickstart

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

Hide last authors
Pascal Robert 16.1 1 == Quickstart ==
David Avendasora 10.1 2
Pascal Robert 31.1 3 Using Project WONDER is surprisingly easy. There are only a few steps to get up-and-running:
David Avendasora 10.1 4
Pascal Robert 33.1 5 1. [[Download and install>>doc:WEB.Home.Getting Started.Getting the Wonder Source Code.WebHome]] the Project WONDER frameworks;
David Avendasora 10.1 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
Pascal Robert 31.1 15 **"No ERX_MARKER field in NSMutableArray found."**
David Avendasora 10.1 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
Pascal Robert 31.1 31 That's it! You are now using Project WONDER and you've begun your journey to easier WO application development.
David Avendasora 10.1 32
Pascal Robert 16.1 33 == Notes from David Teran ==
David Avendasora 10.1 34
Pascal Robert 16.1 35 From David Teran Dec 1 2004: **Pointers for getting your head around the frameworks**
David Avendasora 10.1 36
Pascal Robert 16.1 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.
David Avendasora 10.1 38
Pascal Robert 16.1 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.
David Avendasora 10.1 40
Pascal Robert 31.1 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."
David Avendasora 10.1 42
Pascal Robert 16.1 43 == Notes from Chris Meyer ==
David Avendasora 10.1 44
Pascal Robert 16.1 45 === Internationalization and Localization ===
David Avendasora 10.1 46
47 Practical WebObjects outlines one technique for handling internationalization. It is incompatible with Project WONDER.
48
Pascal Robert 16.1 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:
Pascal Robert 31.1 50 ERXMessageEncoding.setDefaultEncodingForAllLanguages("UTF-8");
David Avendasora 10.1 51
Pascal Robert 16.1 52 === Logging ===
David Avendasora 10.1 53
54 Practical WebObjects outlines one technique for SQL logging. Project WONDER uses an entirely different technique.
55
Pascal Robert 31.1 56 In Project WONDER, put this in one of the properties files (I use ~~/WebObjects.properties)
David Avendasora 10.1 57
Pascal Robert 16.1 58 {{code}}
David Avendasora 10.1 59
Pascal Robert 16.1 60 # turn off annoying INFO logs
David Avendasora 10.1 61 log4j.logger.er=INFO
62 log4j.logger.er.extensions.ERXExtensions=OFF
63
Pascal Robert 16.1 64 # Enable delegate to emit SQL debugging info. The Logger used is
David Avendasora 10.1 65 log4j.category.er.extensions.ERXAdaptorChannelDelegate.sqlLogging=DEBUG
Pascal Robert 16.1 66 # put this to true if you want to log sql stuff
David Avendasora 10.1 67 er.extensions.ERXAdaptorChannelDelegate.enabled=true
Pascal Robert 16.1 68 # How long a statement must run to cause a log message. Messages with longer than
69 # error also emit a stack-trace
David Avendasora 10.1 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
Pascal Robert 16.1 74 # MaxLength of the message
David Avendasora 10.1 75 er.extensions.ERXAdaptorChannelDelegate.trace.maxLength = 30000
Pascal Robert 16.1 76 # What entities to watch
77 er.extensions.ERXAdaptorChannelDelegate.trace.entityMatchPattern = .*
David Avendasora 10.1 78
Pascal Robert 16.1 79 {{/code}}
David Avendasora 10.1 80
Pascal Robert 16.1 81 === Backtracking ===
David Avendasora 10.1 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
Kieran Kelleher 18.1 89 /**
Pascal Robert 16.1 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 }
David Avendasora 10.1 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
Kieran Kelleher 18.1 104 if (this.didBacktrack())
Pascal Robert 16.1 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 }
David Avendasora 10.1 111
112 {{/code}}
113
Pascal Robert 16.1 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.
David Avendasora 10.1 115
Pascal Robert 16.1 116 === Javadocs ===
David Avendasora 10.1 117
Pascal Robert 16.1 118 ==== Prebuilt ====
David Avendasora 10.1 119
Pascal Robert 31.1 120 * [[http:~~/~~/wocommunity.org/documents/javadoc/wonder/latest>>url:http://wocommunity.org/documents/javadoc/wonder/latest||shape="rect"]]
David Avendasora 10.1 121
Pascal Robert 16.1 122 ==== Creating javadocs from the Wonder source (not using Eclipse) ====
David Avendasora 10.1 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.
Pascal Robert 16.1 127 1. Once you untar it you'll have a Wonder folder created.
Pascal Robert 31.1 128 1. In the terminal application, type:
Pascal Robert 33.1 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
Pascal Robert 31.1 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:
Pascal Robert 33.1 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
Kieran Kelleher 26.1 133
Pascal Robert 16.1 134 ==== Creating javadocs from the Wonder source (using Eclipse) ====
David Avendasora 10.1 135
Pascal Robert 31.1 136 Someone else will have to fill in this section...\\
David Avendasora 10.1 137
Pascal Robert 16.1 138 {{code}}
David Avendasora 10.1 139
Pascal Robert 16.1 140 ERXWORepetition
141
142 {{/code}}