Changes for page EOGenerator
Last modified by David Avendasora on 2011/08/25 00:02
From version 72.1
edited by chuckhill
on 2008/03/05 12:30
on 2008/03/05 12:30
Change comment:
There is no comment for this version
To version 71.1
edited by Johan Henselmans
on 2008/01/17 15:27
on 2008/01/17 15:27
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. chuckhill1 +XWiki.johanhenselmans - Content
-
... ... @@ -1,42 +1,36 @@ 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 -See also [[EOGenerator Templates & Additions>>WOL:*EOGenerator Templates & Additions]] for detailed information on template contents. 4 - 5 5 === History and Context === 6 6 7 7 (from Pierce T Wetter III) 8 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. 9 9 10 - [[EOGenerator>>http://www.rubicode.com/Software/EOGenerator/]], written in objc, relied on an objc-EOF framework to parse the model. That's broken inMac OS 10.5, (WO 5.4),evenif youhave the5.3frameworks installed,becausetheJava-objcbridge itusesisnotavailableon 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. 11 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.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. 13 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).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). 15 15 16 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 17 18 18 === Tutorial === 19 19 20 -There are two ways: create eclipse-wide settings, or create settings per project. 18 +There are two ways: create eclipse-wide settings, or create settings per project. 21 21 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... 23 - 24 24 ==== eclipse-wide settings for EOGeneration ==== 25 25 26 26 ~1. Download the templates that Mike Schrag made from [[http://webobjects.mdimension.com/wolips/EOGenerator/Velocity%20EOGenerator%20Templates/]] 27 27 28 -and place them in a folder. In my case that was in 24 +and place them in a folder. In my case that was in 29 29 30 30 /Applications/Developing/VelocityEOGeneratorTemplates 31 31 32 -Inside this folder you will have two standard templates: Entity.java en Entity.java. Do not change them for the moment. 28 +Inside this folder you will have two standard templates: //Entity.java en Entity.java. Do not change them for the moment. // 33 33 34 -(Additional templates and a reference are available [[here>>*EOGenerator Templates & Additions]]) 35 - 36 36 2. Go to Preferences > WOLips > EOGenerator 37 37 38 38 In EOGenerator Template Folder, fill in the folder you have placed the templates 39 -In EOGenerator Java Template fill in Entity.java 33 +In EOGenerator Java Template fill in Entity.java 40 40 In EOGenerator Subclass Java Template fill in Entity.java 41 41 42 42 This is how it looks in my settings: ... ... @@ -43,53 +43,45 @@ 43 43 44 44 {{panel bgColor="#d8e4f1"}} 45 45 46 -\\ !VEOGeneratorSettingsEclipse.png|align=center!\\ 47 -\\ 48 -\\ 40 +!VEOGeneratorSettingsEclipse.png|align=center! 49 49 50 50 {{/panel}} 51 51 52 -3. Go to the eomodel from which you want to create classes and subclasses in the WOPackage sidebar of Eclipse 44 +3. Go to the eomodel from which you want to create classes and subclasses in the WOPackage sidebar of Eclipse 53 53 54 -4. Right click and choose WOLips Tools > Create EOGenerator File from the contextual menu, (it's a submenu) 46 +4. Right click and choose WOLips Tools > Create EOGenerator File from the contextual menu, (it's a submenu) 55 55 56 56 {{panel bgColor="#d8e4f1"}} 57 57 58 -\\ !CreateEOGenContextualMenu.png|align=center!\\ 59 -\\ 60 -\\ 50 +!CreateEOGenContextualMenu.png|align=center! 61 61 62 62 {{/panel}} 63 63 64 -Now a eogen file is created which has the name of the EOModel and an .eogen extension. 65 -If there is already an eogen file, then another one will be created, with a number between the EOModel name and the extension. 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. 66 66 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). 67 67 68 68 {{panel bgColor="#d8e4f1"}} 69 69 70 -\\ !MoreEogenfiles.png|align=center!\\ 71 -\\ 72 -\\ 60 +!MoreEogenfiles.png|align=center! 73 73 74 74 {{/panel}} 75 75 76 -5. Go to the eogen file, right click and choose EOGenerate... from the contextual menu. 64 +5. Go to the eogen file, right click and choose EOGenerate... from the contextual menu. 77 77 78 78 {{panel bgColor="#d8e4f1"}} 79 79 80 -\\ !EOGenerateContextualMenu.png|align=center!\\ 81 -\\ 82 -\\ 68 +!EOGenerateContextualMenu.png|align=center! 83 83 84 84 {{/panel}} 85 85 86 -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. 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. 87 87 88 -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. 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. 89 89 90 -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. 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. 91 91 92 -7. If you are fine, you can start fine tuning your templates, or start defining templates per project. 78 +7. If you are fine, you can start fine tuning your templates, or start defining templates per project. 93 93 94 94 ==== making Velocity EOGenerator settings per project ==== 95 95 ... ... @@ -98,9 +98,7 @@ 98 98 99 99 {{panel bgColor="#d8e4f1"}} 100 100 101 -\\ !1. EOGenerator Project.png|align=center!\\ 102 -\\ 103 -\\ 87 +!1. EOGenerator Project.png|align=center! 104 104 105 105 {{/panel}} 106 106 ... ... @@ -110,9 +110,7 @@ 110 110 111 111 {{panel bgColor="#d8e4f1"}} 112 112 113 -\\ !2. Directory Structure.png|align=center!\\ 114 -\\ 115 -\\ 97 +!2. Directory Structure.png|align=center! 116 116 117 117 {{/panel}} 118 118 ... ... @@ -127,9 +127,7 @@ 127 127 128 128 {{panel bgColor="#d8e4f1"}} 129 129 130 -\\ !3. Entities Snapshot.png|align=center!\\ 131 -\\ 132 -\\ 112 +!3. Entities Snapshot.png|align=center! 133 133 134 134 {{/panel}} 135 135 ... ... @@ -137,27 +137,15 @@ 137 137 138 138 {{panel bgColor="#d8e4f1"}} 139 139 140 -\\ !4. Config Overview.png|align=center!\\ 141 -\\ 142 -\\ 120 +!4. Config Overview.png|align=center! 143 143 144 144 {{/panel}} 145 145 146 -5. Double check, and open the .eogen file using open with > text editor . The whole command must all be on a single line; this is formatted for clarity:124 +5. Double check, and open the .eogen file using open with > text editor: 147 147 148 148 {{panel bgColor="#d8e4f1"}} 149 149 150 -{code} 151 -1. -destination Sources 152 - -java 153 - -javaTemplate _Entity.java 154 - -model Resources/SF.eomodeld 155 - -packagedirs 156 - -subclassDestination Sources 157 - -subclassJavaTemplate Entity.java 158 - -templatedir templates 159 - -verbose 160 -{code} 128 +!5. Text Config.png|align=center! 161 161 162 162 {{/panel}} 163 163 ... ... @@ -165,9 +165,7 @@ 165 165 166 166 {{panel bgColor="#d8e4f1"}} 167 167 168 -\\ !select.png|align=center!\\ 169 -\\ 170 -\\ 136 +!select.png|align=center! 171 171 172 172 {{/panel}} 173 173 ... ... @@ -175,8 +175,6 @@ 175 175 176 176 {{panel bgColor="#d8e4f1"}} 177 177 178 -\\ !filters.png|align=center!\\ 179 -\\ 180 -\\ 144 +!filters.png|align=center! 181 181 182 182 {{/panel}}