Calling the data handler

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:

Instantiation in the context of a connector

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:

  1. 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.

  2. 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.
  3. 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:
  4. The data handler performs the required data conversion. The connector agent calls the appropriate DataHandler method to perform the required conversion:
  5. The data handler returns the appropriate format to the connector agent.

Instantiation in the context of the Server Access Interface

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:

  1. 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.

  2. 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".
  3. The Server Access Interface sets the name of the top-level meta-object for the data handler to MO_Server_DataHandler.
  4. 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.

  5. The data handler performs the required data conversion. The Server Access Interface calls the appropriate DataHandler method to perform the required conversion:
  6. The data handler returns the requested format to the Server Access Interface.
  7. The Server Access Interface returns the requested format to the access client.

Copyright IBM Corp. 1997, 2004