To create an ODA, you extend the ODA base class, ODKAgentBase2, to create your own ODA class. The ODKAgentBase2 class includes methods for initialization, setup, and termination of the ODA. To implement your own ODA, you must extend this ODA base class to create your ODA class.
To derive an ODA class, follow these steps:
ODAname.java
where ODAname uniquely identifies the ODA and has the format of the ODA's source data with the ODA extension (srcDataNameODA). For information about source-data names, see Naming the ODA. For example, to create an ODA for HTML objects, you create an ODA-class file called HTMLODA.java.
com.ibm.oda.srcDataName.ODAname
In the format above, ODAname is the same as defined in step 1 and srcDataName is the same as in step 1 except that it is in lowercase letters. For example, the package name of an ODA for HTML objects could be defined in the ODA class as follows:
package com.ibm.oda.html.HTMLODA;
import com.crossworlds.ODK.*;
To access the methods of the ODK API, the ODA class must import the ODK package, which is contained in the CwODK.jar file in the lib subdirectory of the product directory. If you create several files to hold the ODA-class code, you must import the classes of the ODK package into every source file.
For example, suppose that the ODA for HTML implements only the required the IGeneratesBoDefs interface. Its definition would be as follows:
public class HTMLODA extends ODKAgentBase2 implements IGeneratesBoDefs {
For more information about content-generation interfaces, see Determining the ODA generated content.
Table 26. Extending abstract methods of the ODKAgentBase2 class
Abstract ODKAgentBase2 method | Description | For more information |
---|---|---|
getAgentProperties() |
This method performs the following tasks:
|
Obtaining configuration properties |
getMetaData() | Instantiate the AgentMetaData object that contains the ODA's metadata, including its ability to generate content. | Initializing ODA metadata |
init() | Initialize the ODA, including allocation of resources and connection to the data source. | Initializing the ODA start |
terminate() | Perform cleanup, including disconnecting from the data source and releasing any resources that the ODA uses. | Shutting down the ODA |
Table 27. Defining methods of the content-generation interface
Content-generation interface | Description | For more information |
---|---|---|
IGeneratesBoDefs | getContentProtocol() | Determining the ODA generated content |
getTreeNodes() generateBoDefs() getBoDefs() |
Generating business object definitions as content | |
IGeneratesBinFiles | getContentProtocol() | Determining the ODA generated content |
generateBinFiles() getBinFile() |
Generating binary files as content |