Changes for page EOGenerator

Last modified by David Avendasora on 2011/08/25 00:02

From version 76.1
edited by David Avendasora
on 2011/08/25 00:02
Change comment: There is no comment for this version
To version 78.1
edited by Chuck Hill
on 2008/07/31 18:13
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -EOGenerator
1 +Velocity EOGenerator (Veogen)
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.avendasora
1 +XWiki.chillatgvc
Content
... ... @@ -1,18 +1,29 @@
1 -The WOLips EOGenerator is an integral part of WOLips and shares its codebase with Entity Modeler. It uses release 1.5 of the [[Velocity Templating Engine>>http://velocity.apache.org]] and template files that use the [[Velocity Template Language>>http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html]]. This templating language is similar to the original Rubicode EOGenerator that many developers used with WebObjects 5.3 and earlier so migrating old templates to the new language is time consuming, but not difficult.
1 +This is a basic guide to getting the Velocity Generator to work under Leopard, using Eclipse 3.3.1.1 and WOLips 3.3.4669, later versions should work. The guide is basic in that it should work the way it's detailed below, it doesn't represent the only way, nor probably an optimized way to work with Velocity Generator.
2 2  
3 -=== Default Setup ===
3 +See also [[EOGenerator Templates & Additions>>EOGenerator Templates and Additions]] for detailed information on template contents.
4 4  
5 -If you don't specify a custom template name in your .eogen file, then the WOLips EOGenerator will simply use the built-in ones. This is the way all developers should start out. You can always grab those templates and modify them, or use some of the many modifications shared by other WebObjects developers on the [[WOL:EOGenerator Templates and Additions]] page.
5 +=== History and Context ===
6 6  
7 -=== Customizing ===
7 +(from Pierce T Wetter III)
8 +EOModeler had built in code generation, which always sucked, because it didn't use the [[Generation Gap Pattern>>http://www.research.ibm.com/designpatterns/pubs/gg.html]]. It used some kind of Apple-specific template format.
8 8  
10 +[[EOGenerator>>http://www.rubicode.com/Software/EOGenerator/]], written in objc, relied on an objc-EOF framework to parse the model. That's broken in Mac OS 10.5, (WO 5.4), even if you have the 5.3 frameworks installed, because the Java-objc bridge it uses is not available on 10.5. It uses MiscMerge templates, an open source objc library.
11 +
12 +[[JavaEOGenerator>>http://developer.apple.com/samplecode/JavaEOGenerator/]] is an Apple replacement that uses WO style templates (.html, .wod, etc.), which means it's actually written as a .woa. It uses the WO code to parse the model. The advantage of it is that if Apple changes the model file format, presumably they might change JavaEOGenerator. The disadvantage is that you have to rewrite your templates anyways.
13 +
14 +What people are calling VelocityGenerator is built into WOLips, and uses the code from EntityModeler inside WOLips to parse the model. Given that Apple is funding EntityModeler these days, presumably it will be inherently compatible with any/all .eomodel files going forward. It uses a template library in [[Velocity format>>http://velocity.apache.org/engine/releases/velocity-1.5/vtl-reference-guide.html]], [[Velocity>>http://velocity.apache.org/]] being an open source Java library. It's main advantage is that it's built into WOLips, so there's nothing else to install, and it has some useful built-in defaults (like looking in a templates folder for the templates).
15 +
16 +My decision: After considering the above, I went with the Velocity templates. They were built in, the .eogen default was to use that anyways, so I'll have zero-config issues with the other team members, and Mike Shrag's public much-more-capable template examples were in that format anyways.
17 +
18 +=== Tutorial ===
19 +
9 9  There are two ways: create eclipse-wide settings, or create settings per project.
10 10  
11 -Note: There is actually no need to download Mike's templates as described below unless you want to customize them. WOLips includes two sets of default templates in the .jar files (so don't bother searching your file system for them) - one as described below and another for use with WOnder. If you are using WOnder, you need to follow Mike's instructions for their use: "Where it says "Entity.java" and "//Entity.java" you can use WonderEntity.java and WonderEntity.java ... If your individual .eogen files override that, you will have to set it in there also". If you leave the "EOGenerator Template Folder" field empty, it will use the default templates...//
22 +Note: There is actually no need to download Mike's templates as described below unless you want to customize them. WOLips includes two sets of default templates in the .jar files (so don't bother searching your file system for them) - one as described below and another for use with WOnder. If you are using WOnder, you need to follow Mike's instructions for their use: "Where it says "Entity.java" and "//Entity.java" you can use WonderEntity.java and //WonderEntity.java ... If your individual .eogen files override that, you will have to set it in there also". If you leave the "EOGenerator Template Folder" field empty, it will use the default templates...
12 12  
13 13  ==== eclipse-wide settings for EOGeneration ====
14 14  
15 -~1. Download the templates that Mike Schrag made from [[https://github.com/wolips/wolips/tree/master/wolips/core/plugins/org.objectstyle.wolips.eogenerator.core/templates]]
26 +~1. Download the templates that Mike Schrag made from [[http://webobjects.mdimension.com/wolips/EOGenerator/Velocity%20EOGenerator%20Templates/]]
16 16  
17 17  and place them in a folder. In my case that was in
18 18  
... ... @@ -35,7 +35,6 @@
35 35  \\ !VEOGeneratorSettingsEclipse.png|align=center!\\
36 36  \\
37 37  \\
38 -\\
39 39  
40 40  {{/panel}}
41 41  
... ... @@ -48,7 +48,6 @@
48 48  \\ !CreateEOGenContextualMenu.png|align=center!\\
49 49  \\
50 50  \\
51 -\\
52 52  
53 53  {{/panel}}
54 54  
... ... @@ -61,7 +61,6 @@
61 61  \\ !MoreEogenfiles.png|align=center!\\
62 62  \\
63 63  \\
64 -\\
65 65  
66 66  {{/panel}}
67 67  
... ... @@ -72,7 +72,6 @@
72 72  \\ !EOGenerateContextualMenu.png|align=center!\\
73 73  \\
74 74  \\
75 -\\
76 76  
77 77  {{/panel}}
78 78  
... ... @@ -94,7 +94,6 @@
94 94  \\ !1. EOGenerator Project.png|align=center!\\
95 95  \\
96 96  \\
97 -\\
98 98  
99 99  {{/panel}}
100 100  
... ... @@ -107,7 +107,6 @@
107 107  \\ !2. Directory Structure.png|align=center!\\
108 108  \\
109 109  \\
110 -\\
111 111  
112 112  {{/panel}}
113 113  
... ... @@ -116,7 +116,9 @@
116 116  * inside your eogen file you need to set template path to the folder containing Entity.java, and if it's named something other than Entity.java, you need to also set template name. Note that template name is ONLY a name, not a full path.
117 117  * or locate the template files in one of the paths that Velocity EOGenerator looks in by default (,,/Library/Application Support/WOLips/EOGenerator///Entity.java, for example).//,,
118 118  
119 -3. Double check your model. It used to be true that none of your entities could extend EOGenericRecord. That is no longer true and you can use either custom classes or EOGenericRecord as a class, or a mix of the two. We suggest that your entity classes should be in packages for this all to work optimally, such as "your//com.projectname.eo//class". If you use a class that is not in a package, there may be a number of errors in the resulting Java class files.
124 +3. Double check your model, so that none of your entities extend EOGenericRecord,
125 +otherwise the generation gap pattern won't work, as the velocity generator generates all files,
126 +rather than just those extending custom classes. this is a change from the old eogenerator. Also, your entities should be in packages for this all to work optimally. In the example "projectname.eo.class". When it was tried with no package (class) there were a number of errors in the resulting Java class files.
120 120  
121 121  {{panel bgColor="#d8e4f1"}}
122 122  
... ... @@ -123,7 +123,6 @@
123 123  \\ !3. Entities Snapshot.png|align=center!\\
124 124  \\
125 125  \\
126 -\\
127 127  
128 128  {{/panel}}
129 129  
... ... @@ -134,7 +134,6 @@
134 134  \\ !4. Config Overview.png|align=center!\\
135 135  \\
136 136  \\
137 -\\
138 138  
139 139  {{/panel}}
140 140  
... ... @@ -163,7 +163,6 @@
163 163  \\ !select.png|align=center!\\
164 164  \\
165 165  \\
166 -\\
167 167  
168 168  {{/panel}}
169 169  
... ... @@ -174,6 +174,5 @@
174 174  \\ !filters.png|align=center!\\
175 175  \\
176 176  \\
177 -\\
178 178  
179 179  {{/panel}}