CloudTran Home

 
  
 
Contents  >   5.  Defining Applications In Eclipse
 


5.2 How To Model

This section gives general information about using the Eclipse-based editor to edit the .osm file. The .osm file is a specific variant of XML for modelling CloudTran applications. The model editor allows the modeller to add the data in a structured way based on an underlying meta-model; this avoids syntax and some structural errors (like names being spelt incorrectly).

 5.2.1  Opening A Model
 5.2.2  Adding Model Objects
 5.2.3  Setting Properties
 5.2.3.1      Property Values

5.2.1  Opening A Model
To open a model simply double click on model (the .osm file) you wish to open.

This will open the file in the osm editor view

Expand the model and then add addtional model object or model properties. This is described in more detail in the following sections


5.2.2  Adding Model Objects
"Model object" is the modelling term for the XML elements that make up the model - beans, processing units etc. "Property" is the modelling term for the attributes on the model objects.

The OSM file always has an Application as the root object. You can add a model either as a child or as a sibling of another model object, by right-clicking on that model object.

To add a child, use "New Child":

To add a sibling, use "New Sibling":


5.2.3  Setting Properties
Properties can be specified for model objects. The structured Eclipse editor allows you to specify only those properties that are defined for the particular model object: the available properties will vary depending on the model object selected. To set model properties, select the model object and the available properties are shown in the properties view.

If the properties view is not displayed Right Click on the model Object -> Show Properties View.


5.2.3.1  Property Values
The value of a property is by default a string. To amend a string property, select the property and in the value column enter the appropriate text string. Move the cursor off the value or press enter for the value to be accepted.

Sometimes the value of the property is a choice, such as a Boolean, or an enumeration. In this case the value column will change to a drop-down, presenting the options that can be selected. To change the value, select the new value in the drop-down and move the cursor off the value or press enter for the value to be accepted.

When a property is a 'type', this can be a simple type - this case is covered here. There are also properties that can be references to other objects in the model. In this case the value column will change to a drop-down, presenting the options that can be selected. To change the value, select the new value in the drop-down and move the cursor off the value or press enter for the value to be accepted.

The final situation for properties is where the property can be a reference to objects in the model, or to an external class. This situation is indicated by a pair of properties, with one property having a base name (e.g. "Return Type") and the other property having 'Object' appended (e.g. "Return Type Object").

The base name allows you to specify the type of the property by entering a string. The text that goes into the code is precisely as entered here. This allows you to cover the whole range of possible types - built-in Java types, fully-qualified classes from any available API, arrays or modelled classes referenced by name.

For example if you wanted the return type of a method to be a Date array you would enter in the Return Type field 'Date[]'. Here's a simpler example, specifying a Boolean.

The property with 'Object' on the end of it is an explicit reference to an appropriate type/class in this model. This allows you to unambiguously specify the type by reference. If you change the name of the target type, the reference will still point to the same object - renaming doesn't break the link as it will do in typing it in.

Type Objects have precedence over Types, so if you enter property values for both "X Object" and "X" the Type ("X") will be ignored.


Copyright (c) 2001-2011 CloudTran Inc.