5 minutes starter guide

First go to perperation instraction to use Maven with openCube.org Maven repository. Then follow these 5 steps to get a short overview of the basic functionality of odal. Please have a look at the javadoc for more information.

Instantiate omsData

Properties connectionData = new Properties();
connectionData.put("ds_type","oracle");
connectionData.put("ds_username","${username}");
connectionData.put("ds_password","${password}");
connectionData.put("ds_url","jdbc:oracle:thin:@${host}:1521:${serviceName}");
connectionData.put("ds_class","org.opencube.data.oracle.Oracle");
OMSData omsData = new OMSData(connectionData);

First configure the database access. You can read the connection data from a resource file. With the "ds_class" parameter you can change the access type. There are implementations for rmi and soap.

Load data

OMSStructure rootStructure = omsData.getOMSStructureByWhere("elm_bookmark='root'");
OMSElement rootNode = rootStructure.getElementByBookmark("root");

The simplest way to load an object is "getOMSStructureByWhere". If you want a more fine control of load behavior use "getOMSStructureByStatement".

Create a new element

OMSElement childNode = rootStructure.createElement("/omscube","Container");
rootNode.compose("containers",elm1);
omsData.saveOMSStructure(rootStructure);

First you must create an new element with "createElement". You have to define the namespace and the scheme name of the new element. Than compose it under another element und the specified complex attribute. And finally store it back to the database.

Change data

childNode.setBookmark("my first childNode");
childNode.setDisplayName("my first childNode");
omsData.saveOMSStructure(rootStructure);

To change values just set them and store it back with "saveOMSStructure".

Move a node

OMSElement secondChildNode = rootStructure.createElement(rootNode,"/omscube","Container");
secondChildNode.moveCompositionAppend(childNode, "containers");
omsData.saveOMSStructure(rootStructure);

To change the relationships between the elements call moveCompositionAppend or moveAssociationAppend.