This section provides the following information on the issues you need to consider when determining the content that your ODA can generate:
The ODK API identifies the valid content types that an ODA can support with
the
ContentType class. This class contains static member
variables for each of the supported content types, as Table 31 shows.
Table 31. How content types are represented
Content type | ContentType member variable |
---|---|
Business object definitions |
BusinessObject
|
Binary files |
BinaryFile
|
The ContentType class simulates an enumerated list of the supported ODA content types. For example, a content-type object that represents business object definitions would use only the BusinessObject member variable, as follows:
ContentType.BusinessObject
To provide support for generation of a particular content type, an ODA must
implement the appropriate
content-generation interface, as listed in Table 17. Every ODA must support generation of business object
definitions. It can optionally also support generation of binary files
as its content. The content-generation interfaces contain the kinds of
methods listed in Table 32. As part of the implementation of the
content-generation interface, you must implement these methods.
To determine which content-generation interface's method to call, Business Object Wizard checks the ODA's meta-data. One of the components of this meta-data is the supportedContent member variable, which is initialized by the AgentMetaData() constructor, called within the ODA's getMetaData() method. For more information, see Initializing ODA meta-data.
Table 33 shows the information that this chapter provides on how to
implement methods in a content-generation interface.
Table 33. How to develop a content-generation interface
Content-generation interface | For more information |
---|---|
IGeneratesBoDefs | Generating business object definitions as content |
IGeneratesBinFiles | Generating binary files as content |
An ODA can generate a particular content type using either of the
content protocols listed in Table 34. The content protocol determines how the ODA
interacts with Business Object Wizard to generate the supported content;
that is, it determines whether Business Object Wizard can explicitly initiate
content generation from the ODA.
Table 34. Content protocols for an ODA
To support content protocols, your ODA must take the following steps:
Both the IGeneratesBoDefs and IGeneratesBinFiles interfaces are extensions of the IGeneratesContent interface. Therefore, they both inherit the single method that IGeneratesContent defines, getContentProtocol(). As part of the implementation of the ODA's content-generation interface, you must implement the getContentProtocol() method to indicate which of the content protocols your ODA will use for its supported content types.
The getContentProtocol() method accepts as an argument a ContentType object, which identifies a content type that the ODA supports. The getContentProtocol() method returns the content protocol that the ODA supports for this specified content type. It returns the supported content protocol as one of the content-protocol constants (shown in Table 34). These constants are defined in the ODKConstant interface.
Figure 61 shows an implementation of getContentProtocol() that indicates the ODA supports the callback protocol for the generation of files and the on-request protocol for the generation of business object definitions.
Figure 61. Indicating supported content protocols
public long getContentProtocol(ContentType contentType) { if (contentType == ContentType.BinaryFile) return ODKConstant.CONTENT_PROTOCOL_CALLBACK; else return ODKConstant.CONTENT_PROTOCOL_ONREQUEST; }
The implementation of the content-generation method depends on the content
protocol that the content type supports, as Table 35 shows.
Table 35. Content protocols and the content-generation method
Table 36 shows the information that this chapter provides on how to
implement the content-generation methods.
Table 36. How to develop a content-generation method
Content-generation method | For more information |
---|---|
IGeneratesBoDefs.generateBODefs() | Defining the generateBoDefs() method |
IGeneratesBinFiles.generateBinFiles() | Defining the generateBinFiles() method |