Creating data-handler meta-objects
If you write a custom data handler that uses data-handler
meta-objects, you must:
- Create a child data-handler meta-object that contains attributes
for the configuration information of the custom data handler.
- Modify the top-level data-handler meta-object to include the
supported MIME type so that your data handler can be configured
when it is instantiated.
- Set up the meta-objects in the business integration system.
Note:
For information on how to determine whether to use
meta-objects in the data-handler design, see
Using data-handler meta-objects.
Creating the child meta-object
The child meta-object contains the configuration information
for the data handler. The createHandler() method uses this information to initialize the newly instantiated
data handler. For more detailed information on this process, see Using a MIME type.
To create a child meta-object for a custom data handler:
- Create a child meta-object to represent an instance of the data
handler.
You can use the Business Object Designer Express tool
to create this child meta-object. The meta-object must contain attributes
to define the configuration information that your data handler requires.
At a minimum, the child meta-object must have
a ClassName attribute.
- Determine whether you need to specify the name of the data handler
class in the ClassName attribute.
- For a data handler that is in the default format, you do not
need to specify a value for ClassName. The default format is:
com.crossworlds.DataHandlers.MimeTypeString
However, you can specify the class name for the data handler
in the ClassName attribute's default value.
- For a data handler class that is not in the default format,
you must specify the full class name for the data handler instance.
Otherwise, the createHandler() method cannot locate your data handler class when it tries
to instantiate the data handler.
- Set the default values of the appropriate attributes in the
child meta-object to configure how the data handler instance will
process data.
Modifying the top-level meta-object
When a caller supplies a MIME type to the createHandler() method, createHandler() determines which data handler to instantiate with these steps:
- Locate the name of the top-level meta-object that is associated
with the data handler.
- Look in this top-level meta-object for a MIME type that matches
the data to convert.
- If this MIME type exists, find the name of the associated child
meta-object, which contains the configuration information.
For a more detailed explanation of this process, see Using a MIME type. For this process to be successful, createHandler() must be able to locate the MIME type associated with data.
Therefore, you must edit the top-level data-handler meta-object
to include an attribute for the MIME type of the data that your data
handler converts. This attribute must include:
As an example, Figure 43 shows a top-level
connector meta-object that is configured for a custom HTML data handler.
Figure 43. Example top-level connector meta-object for a custom data handler
In Figure 43, the default top-level
meta-object for a connector (MO_DataHandler_Default) has been modified to support a new MIME type: HTML. In support
of this MIME type, the MO_DataHandler_Default meta-object contains the following attribute properties:
Attribute Name = text_html
Attribute Type = MO_DataHandler_HTMLConfig
Important:
The name of the MIME type is limited to alphanumeric characters
and underscores (_). No other special characters can be used for
the MIME type.
Setting up meta-objects in the business integration system
Once you have created the data-handler meta-objects, you
must set up these meta-objects in the WebSphere Business Integration
Server Express system, as follows:
- Load the new meta-objects
into the repository.
- Modify the appropriate meta-object depending on the context
in which the data handler will be called:
- If the data handler is to execute in the context of a connector,
add the data handler meta-object as a child to the top-level data
handler meta-object. Then add support for the top-level data handler meta-object
to the connector definition.
- If using InterChange Server Express and
the data handler is to execute in the context of the Server Access
Interface, add the data handler meta-object as a child to the top-level
server meta-object MO_Server_Datahandler.
