Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WOLips encapsulates the functionality of EOGenerator so that the Java classes can be generated from within Eclipse. WOLips can create an .eogen definition for you when the model is created or you can create one after the model has been created by going to File - New - Other... and selecting EOGenerator. To use the WOLips built-in option, see Velocity EOGenerator.

Install and Configure EOGenerator

Warning

EOGenerator doesn't work on Mac OS X 10.5.  You either have to use JavaEOGenerator or Velocity EOGenerator.

Before you can generate Java classes you will need to download (from http://www.rubicode.com/Software/EOGenerator/) and install EOGenerator. EOGenerator is not part of Eclipse or WOLips. It is a command line tool which needs a number of parameters/preferences to run. Do not use EOGenerator's instructions for installation as an Eclipse builder. EOGenerator is run using a WOLips configuration. After it is installed, tell Eclipse/WOLips where it is in preferences:

Image Removed

Later you can put project specific templates in your project. This might be a preferred method for team development where projects are under version control to make sure everyone is using the same and latest templates. See http://wiki.objectstyle.org/confluence/display/WO/Programming__WebObjects-EOF-Using+EOF-EOGenerator for ideas of how to make useful changes to your EOGenerator templates.

Setup Configuration for a Model

The next step is to fill in the .eogen configuration for your model.

Info
titleMultiple Models

If you have multiple models that you need to generate Java classes for, and they need different settings (templates, destination directories etc), each of these will need its own .eogen configuration.

...

titleAutogenerating

...

has the ability to generate .java files for the Entities in your project's EOModel files. In Project Builder and Xcode, and really old versions of WOLips, you had to do this yourself by using Rubicode's EOGenerator. WOLips now has it's own built-in EOGenerator. It has a different templating engine (Velocity instead of MiscMerge)

Create an .eogen file for your EOModel

  1. Right-click on your EOModel in WOLips and select WOLips Tools=>Create EOGenerator File.
    Image Added
  2. Double click on the <ModelName>.eogen icon in the Package Explorer or Navigator:

...

Image Removed

...

  1. Image Added
  2. In the "Models" section, add the EOModel(s) that have Entities that you want to generate Java classes for.
  3. In the "Referenced Models" section, include any other EOModels that contain Prototypes or Entities that are used or referenced by the EOModels in the "Models" section. Java classes will not be generated for Entities in these EOModels

The File Names settings can be ignored unless you need to generate oddly formed file names. You will usually want to Create Packages (place the generated files in a directory corresponding to their package). It can useful to have different Destination and Subclass Destination directories. The totally generated classes in the Destination directory are not very interesting and can be tucked away out of sight.

...

The Templates determine how the Java code is generated. The setting should be self explanatory. The Defines are useful for extending the templates with custom values.

Generate the Classes

The Simplest Way is Set it on Automatic

Use the WOLips build preferences to ensure your classes are regenerated every time you save changes to the EOModel

Panel

Manual Generation during Development

To generate the Java classes manually, simply right (control) click on the .eogen configuration and select EOGenerate... from the context menu. A dialog window will be shown when EOGenerator finishes so that you can verify what it did.

Troubleshooting

Note
titleEOGenerator Not Running?

Nothing happens? Just see a flicker of a progress bar at the bottom right? Go back to the Preferences. The path to the eogenerator executable is missing or incorrect.