Initializing ODA metadata

After Business Object Wizard calls the ODA's getAgentProperties() method, it calls the getMetaData() method to initialize the ODA metadata. The getMetaData() method is defined in the ODA base class, ODKAgentBase2, then inherited by your ODA class. It returns an AgentMetaData object, which contains the ODA's metadata, including the generated content it supports.

Important:
The getMetaData() method is an abstract method. As part of the implementation of your ODA class, you must implement a getMetaData() method.

The AgentMetaData object provides the information in Table 29 to the ODA runtime when it needs to obtain metadata for the ODA.

Table 29. Contents of an AgentMetaData object

Member variable Description

 agentVersion
 

The version of the ODA

searchableNodes, searchPatternDesc

Information to specify the ODA search pattern, which the user can specify to reduce the number of tree nodes from the data source that are displayed


 supportedContent
 

A description of the generated content that the ODA can support

To initialize the ODA metadata, you implement the getMetaData() method, which involves the following steps:

Figure 56 shows the implementation of the getMetaData() method (defined in the ArmyAgent2 class from the sample Roman Army ODA).

Figure 56. Initializing ODA metadata

public AgentMetaData getMetaData(){
    odkUtil.trace(TRACELEVEL1, XRD_TRACE, "Entering getMetaData()...");
    AgentMetaData amdObj = new AgentMetaData(this, "Sample ODA v1.0.0");
 
   //Initialize search-pattern feature for tree nodes
    amd.searchableNodes = true;
    amd.searchPatternDesc = "Enter the first letter to search by. For example, " +
       "\"A\", \"k\", "\Z\". Only names that start with this letter will be " +
       "returned."
 
   return amd;
 }
 

Because the getMetaData() method in Figure 56 is inherited by the ArmyAgent3 class (which implements the IGeneratesBoDefs interface), the call to the AgentMetaData() constructor in this code fragment initializes the content type and its associated content protocol for the ODA. After getMetaData() starts in ArmyAgent3, the ODA's content type is initialized to ContentType.BusinessObject and its content protocol to "on request". For more information, see Determining the ODA generated content.

This getMetaData() method also provides support for the search-pattern feature by initializing the searchableNodes and searchPatternDesc member variables. The searchPatternDesc variable contains the text that displays in the Enter the Search Pattern dialog box (see Figure 46).

Copyright IBM Corp. 1997, 2003