Regardless of the context in which a data handler is called, the data
handler is instantiated by the createHandler() method. How
that method is called in each context is as follows:
- A connector explicitly calls createHandler() to
instantiate a data handler.
- An access client calls createHandler()
implicitly; the Server Access Interface actually calls
createHandler() when the access client initiates a data-handler
call through one of the following Server Access Interface methods:
ItoExternalForm() or IcreateBusinessObjectFrom().
Figure 7 shows an example of data handler instantiation when the data
handler is called in the context of a connector.
Figure 7. Data handler instantiation in the connector context

To instantiate a data handler called in the context of a connector, the
connector takes the following steps:
- Meta-objects are read into memory when the connector starts up, as long as
the meta-objects are included on the list of supported objects for the
connector.
Meta-objects are stored in the repository along with business
objects. The meta-object definitions, like business object definitions,
must exist in memory for the data handler to be able to access them.
When these meta-objects are in memory as part of the connector process, the
meta-objects are accessible by a data handler called in the context of a
connector.
- The connector calls the
setConfigMOName() static method in the DataHandler base class
to set a static property in the data handler base class to the name of the
top-level
meta-object for the data handler.
This top-level meta-object is the connector meta-object (
MO_DataHandler_Default by default). The top-level
meta-object must be part of the connector's supported objects list.
- Note:
- How the connector obtains the name of the data handler top-level meta-object
is determined as part of the connector design. For more information,
see Configuring a connector.
- The connector calls the
createHandler() static method in the DataHandler base class
to create an instance of the DataHandler base class that performs
the required data conversion. The name of the class to be created is
determined in one of two ways:
- If the connector passes in a class name as an argument, the
createHandler() method instantiates a data handler of that class
name. A connector can explicitly specify a class name when it calls
createHandler().
- If the
MIME type is passed in instead of the class name, createHandler()
derives the class name from the MIME type.
The createHandler() method converts the MIME type to a MIME-type
string and obtains the name of the data handler's top-level meta-object
from a static property in the DataHandler base class. From
this top-level meta-object, createHandler() obtains the name of the
child meta-object for the data handler. This child meta-object contains
configuration information, including the name of the class to
instantiate. For information on how this derivation occurs, see Identifying the data-handler class.
- The data handler performs the required data conversion. The
connector agent calls the appropriate DataHandler method to perform
the required conversion:
- The getBO() method for a string-to-business-object
conversion.
- The getStringFromBO() method for a business-object-to-string
conversion or the getStreamFromBO() method for a
business-object-to-stream conversion.
- The data handler returns the appropriate format to the connector
agent.
Figure 8 shows an example of data handler instantiation when the data
handler is called in the context of the Server Access Interface.
Figure 8. Data handler instantiation in the Server Access Interface context

To instantiate a data handler called in the context of the Server Access
Interface, the Server Access Interface takes the following steps:
- Meta-objects are read into memory when the server starts up, along with
all other business object definitions in the repository.
Meta-objects are stored in the repository along with business
objects. The meta-object definitions, like business object definitions,
must exist in memory for the data handler to be able to access them.
Once these meta-objects are in memory as part of the InterChange Server (and
Server Access Interface) process, the meta-objects are accessible by a data
handler called in the context of the Server Access Interface.
- An access client initiates creation of an instance of a data handler with
one of the Server Access Interface methods:
IcreateBusinessObjectFrom() or
ItoExternalForm().
These methods pass the MIME type of the data to be converted.
- Note:
- Access clients must use Server Access Interface methods to call a data
handler. Although these methods indirectly call data handler interface
methods, the methods provide only a subset of the data handler
interface. For information on the Server Access Interface methods, see
the Access Development Guide. For information on the methods
provided in the data handler interface, see "Data Handler base class methods".
- The Server Access Interface sets the name of the top-level
meta-object for the data handler to
MO_Server_DataHandler.
- The Server Access Interface creates an instance of a
DataHandler subclass to perform the required data conversion (using
the
createHandler() method of the DataHandler base class).
When called in the context of the Server Access Interface, the
createHandler() method does not specify a class
name. Instead, createHandler() converts the MIME type to a
MIME-type string and obtains the name of the data handler's top-level
meta-object. From this top-level meta-object,
createHandler() obtains the name of the child meta-object for the
data handler. This child meta-object contains configuration
information, including the name of the class to instantiate. For
information on how this derivation occurs, see Identifying the data-handler class.
- The data handler performs the required data conversion. The Server
Access Interface calls the appropriate DataHandler method to
perform the required conversion:
- The getBO() method for a string-to-business-object conversion
- The getStringFromBO() method for a business-object-to-string
conversion or the getStreamFromBO() method for a
business-object-to-stream conversion.
- The data handler returns the requested format to the Server Access
Interface.
- The Server Access Interface returns the requested format to the access
client.
