2.3. The MetaData Explorer
Prev | Chapter 2. Getting Started with Kodo Development Workbench | Next

## 2.3. The MetaData Explorer

### 2.3.1. MetaData Explorer Basics

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. These actions are mirrored in the `MetaData` menu item.

Individual class nodes from the explorer can be dragged and dropped into class text fields, such as assigning a persistence capable superclass or the element type for a collection field.

### 2.3.2. Creating JDO MetaData

First let's 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`. Once you have selected the class, you can press `Finish`.

### 2.3.3. Using The MetaData Explorer

You have created metadata for the `Passenger` class. You should see `Passenger` node listed once you expand the `samples.ide` node in Kodo Workbench's explorer. This metadata file is now also persistently part of Kodo Workbench. If you 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. 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`. There are a number of MetaData Actions to try and use, all of which will be detailed further in a later section.

### 2.3.4. Editing 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 want this field to hold a collection of `String`s, so we'll be specifying the element type for this `java.util.Set` field. Enter `java.lang.String` in the Element Type 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.

### 2.3.5. Additional MetaData Explorer Actions

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 Create Default Mapping. 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.

Prev | Up | Next
2.2. Getting Familiar with Kodo Development Workbench | Home | 2.4. The Schema Explorer