2.3. The MetaData Explorer

The MetaData tab in the Explorer pane contains the MetaData Explorer. This component represents the currently mounted JDO metadata files in the system, and in turn, the persistent classes Kodo Workbench knows about. On this component, context menus along the metadata tree hierarchy will provide access points for all metadata related actions such as running the enhancer, opening metadata to edit, and mounting and unmounting metadata files.

Individual class nodes from the explorer can be dragged and dropped into class text fields, such as assigning a persistence capable superclass.

First lets create a simple metadata file to give our system a single class to work with. Right click on MetaData and you will be presented with a context menu. This context menu holds Root MetaData Actions. These actions are those that apply to the entire metadata repository (vs. individual classes and their corresponding metadata).

Select Create MetaData. This will initiate a wizard for creating new JDO metadata. Select Class - level .jdo and then next. The second screen of the wizard will allow you to choose classes to create metadata for. Enter samples.ide.Passenger and press Add. Press the Next button to bring the final screen where you can tailor the metadata before it gets written to file. Select Finish for now.

You have created metadata for the Passenger class. You should see Passenger listed in Kodo Workbench's explorer represented by a blue Kodo K under a yellow label of the package name. This K will be the icon for JDO metadata throughout the system.

This metadata file is now persistently part of Kodo Workbench. If one were to exit Kodo Workbench and return, Kodo Workbench would automatically remount the file on startup. To unmount the file later, select the Unmount Files Root MetaData Action.

By right clicking on the class, a new set of actions are now available. This popup menu contains MetaData Actions. These actions represent actions that can be done to one or more selected classes. There are a number of MetaData Actions to try and use, all of which will be detailed further in a later section.

MetaData Actions are where we can open editors for JDO metadata and Kodo mapping information. We could also remove the Passenger metadata from both the metadata repository and filesystem by selecting Remove MetaData.

For now, open the metadata editor for Passenger by right clicking on the node and select Edit MetaData. The editor includes access to all the major JDO metadata attributes, as well as integrating components that control commonly used Kodo extensions.

Select the luggage field from the top drop down. Now the field-level editor will be the focus of the editor. We'll be specifying the element type for this java.util.Set field. Enter java.lang.String in the corresponding text field. Note that the tab representing the editor is now marked with a (*) indicating that the editor needs to be saved. Save your changes now by selecting Save from the File menu.

Now that our metadata is now tailored the way we want, we can now enhance our class. Re-select Passenger and select Enhance. This will trigger the enhancer to act on our new persistent class. You should see messages in the Tool category.

We'll now create mappings for the class. Having selected Passenger, select Add - Recreate Mapping Info. This will cause Kodo to create some default mapping information as well as edit Kodo Workbench's schema which we will go into detail in the next section.