Changes for page EOGenerator

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

From version 60.1
edited by zak_burke
on 2008/01/28 11:35
Change comment: There is no comment for this version
To version 62.1
edited by Pascal Robert
on 2007/12/21 20:44
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.zak_burke
1 +XWiki.probert
Content
... ... @@ -1,4 +1,4 @@
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.
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 3  === History and Context ===
4 4  
... ... @@ -5,86 +5,22 @@
5 5  (from Pierce T Wetter III)
6 6  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.
7 7  
8 -[[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.
8 +EOGenerator, written in objc, relied on an objc-EOF framework to parse the model. That's broken in 5.4, not sure about 5.3/Leopard but I think so. It uses MiscMerge templates, an open source objc library.
9 9  
10 -[[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.
10 +What people are calling JavaEOGenerator is an Apple replacement that uses WO style templates (.html, .wod, etc.), which means its 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.
11 11  
12 -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).
12 +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, Velocity being an open source Java library. It's main advantage is that its 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).
13 13  
14 14  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.
15 15  
16 16  === Tutorial ===
17 17  
18 -There are two ways: create eclipse-wide settings, or create settings per project.
19 -
20 -==== eclipse-wide settings for EOGeneration ====
21 -
22 -~1. Download the templates that Mike Schrag made from [[http://webobjects.mdimension.com/wolips/EOGenerator/Velocity%20EOGenerator%20Templates/]]
23 -
24 -and place them in a folder. In my case that was in
25 -
26 -/Applications/Developing/VelocityEOGeneratorTemplates
27 -
28 -Inside this folder you will have two standard templates: Entity.java en Entity.java. Do not change them for the moment.
29 -
30 -2. Go to Preferences > WOLips > EOGenerator
31 -
32 -In EOGenerator Template Folder, fill in the folder you have placed the templates
33 -In EOGenerator Java Template fill in Entity.java
34 -In EOGenerator Subclass Java Template fill in Entity.java
35 -
36 -This is how it looks in my settings:
37 -
38 -{{panel bgColor="#d8e4f1"}}
39 -
40 -\\ !VEOGeneratorSettingsEclipse.png|align=center!\\
41 -
42 -{{/panel}}
43 -
44 -3. Go to the eomodel from which you want to create classes and subclasses in the WOPackage sidebar of Eclipse
45 -
46 -4. Right click and choose WOLips Tools > Create EOGenerator File from the contextual menu, (it's a submenu)
47 -
48 -{{panel bgColor="#d8e4f1"}}
49 -
50 -\\ !CreateEOGenContextualMenu.png|align=center!\\
51 -
52 -{{/panel}}
53 -
54 -Now a eogen file is created which has the name of the EOModel and an .eogen extension.
55 -If there is already an eogen file, then another one will be created, with a number between the EOModel name and the extension.
56 -The one with the highest number will be the newest (unless you decided to throw earlier ones away, then the numbering starts all over again).
57 -
58 -{{panel bgColor="#d8e4f1"}}
59 -
60 -\\ !MoreEogenfiles.png|align=center!\\
61 -
62 -{{/panel}}
63 -
64 -5. Go to the eogen file, right click and choose EOGenerate... from the contextual menu.
65 -
66 -{{panel bgColor="#d8e4f1"}}
67 -
68 -\\ !EOGenerateContextualMenu.png|align=center!\\
69 -
70 -{{/panel}}
71 -
72 -If you have some definitions in your EOModel that have a Class Name that is not an EOGenericRecord, then the appropriate java class and subclass will be generated.
73 -
74 -For instance: a Person class name in EOModel will result in a Person.java file (which will be overwritten the next time EOGeneration will take place) and a Person.java file. The java file without the underscore is the file that will not be overwritten the next time. This file is the file that you would add your own methods. The next time the model changes, the underscore.java file will be overwritten, but your methods are safe.
75 -
76 -6. Check if everything worked out fine. If not (e.g. you made a typing error and a java file happens to be empty) throw away the generated file yo do not want, and restart the process.
77 -
78 -7. If you are fine, you can start fine tuning your templates, or start defining templates per project.
79 -
80 -==== making Velocity EOGenerator settings per project ====
81 -
82 82  ~1. Under Preferences > WOLips > EOGenerator
83 83  ~> Remove all entries (this is not strictly necessary, but it rules out any errors at the project level)
84 84  
85 85  {{panel bgColor="#d8e4f1"}}
86 86  
87 -\\ !1. EOGenerator Project.png|align=center!\\
23 +!1. EOGenerator Project.png|align=center!
88 88  
89 89  {{/panel}}
90 90  
... ... @@ -94,7 +94,7 @@
94 94  
95 95  {{panel bgColor="#d8e4f1"}}
96 96  
97 -\\ !2. Directory Structure.png|align=center!\\
33 +!2. Directory Structure.png|align=center!
98 98  
99 99  {{/panel}}
100 100  
... ... @@ -109,7 +109,7 @@
109 109  
110 110  {{panel bgColor="#d8e4f1"}}
111 111  
112 -\\ !3. Entities Snapshot.png|align=center!\\
48 +!3. Entities Snapshot.png|align=center!
113 113  
114 114  {{/panel}}
115 115  
... ... @@ -117,16 +117,15 @@
117 117  
118 118  {{panel bgColor="#d8e4f1"}}
119 119  
120 -\\ !4. Config Overview.png|align=center!\\
56 +!4. Config Overview.png|align=center!
121 121  
122 122  {{/panel}}
123 123  
124 124  5. Double check, and open the .eogen file using open with > text editor:
125 125  
126 -{{panel}}
62 +{{panel bgColor="#d8e4f1"}}
127 127  
128 - 
129 -!5. Text Config.png|align=center!\\
64 +!5. Text Config.png|align=center!
130 130  
131 131  {{/panel}}
132 132  
... ... @@ -134,7 +134,7 @@
134 134  
135 135  {{panel bgColor="#d8e4f1"}}
136 136  
137 -\\ !select.png|align=center!\\
72 +!select.png|align=center!
138 138  
139 139  {{/panel}}
140 140  
... ... @@ -142,6 +142,6 @@
142 142  
143 143  {{panel bgColor="#d8e4f1"}}
144 144  
145 -\\ !filters.png|align=center!\\
80 +!filters.png|align=center!
146 146  
147 147  {{/panel}}