The main task of a connector is to convert data between an application-specific form and a business object. Often, the connector must perform this conversion directly. For example, it can create the appropriate database statements to create or access the data as a row in a table of an application database. However, a connector might handle serialized data in a common
Multipurpose Internet Mail Extensions (MIME) format.
Rather than have each connector perform the conversions between a particular MIME format and a business object, WebSphere Business Integration Adapters provides data handlers to perform these common conversions. A data handler is a special Java class instance that converts between a particular serialized data format and a business object. For example, WebSphere Business Integration Adapters provides a data handler that converts between the XML format and business objects.
The Java connector library provides the data-handler methods in Table 30 so that a connector can call a data handler to convert
between a particular string format and a business object. These methods
are defined in the CWConnectorUtil class.
Table 30. Methods to call data handlers
Conversion | Method |
---|---|
Business-object-to-string | boToString() |
String-to-business-object | stringToBo() |
Each system on which data handlers are installed has a meta-object to describe the available data handlers. A meta-object is a special business object that contains configuration information. For data handlers, the top-level meta-object contains the the available data handlers and the associated MIME type that each data handler supports.
To determine which data handler to execute, the data-handler methods in Table 30 refer to this top-level meta-object. To obtain the name of the top-level meta-object, these methods check the value of the DataHandlerMetaObjectName connector configuration property. If this property is not set, the methods throw the PropertyNotSetException exception.
If a data handler can be located for the specified MIME type, the data-handler method tries to instantiate it:
If the data handler cannot perform the conversion, the data-handler method throws the ParseException exception.