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.
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
To initialize the ODA metadata, you implement the getMetaData() method, which involves the following steps:
Use either of the forms of the AgentMetaData() constructor. Both forms require that you pass in a this reference to the ODA object (an instance of your ODA class). The constructor queries the ODA object to obtain information about the content-generation interface (or interfaces) that the ODA implements. It then uses this information to initialize the supportedContent member variable with the content protocols that the ODA supports for each of its supported content types. For more information on the ODA's supported content, see Determining the ODA generated content.
Optionally, you can also provide the ODA version as an argument to the constructor to initialize the agentVersion member variable.
For your ODA to support the search-pattern feature, you must explicitly initialize the searchableNodes and searchPatternDesc member variables after the AgentMetaData object is instantiated. For more information, see Implementing the search-pattern feature.
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).