If a data handler is to run in the context of a connector, you
must configure the connector to use a data handler:
- A connector must have access to the data-handler meta-object in
order to instantiate a data handler.
Before invoking a data handler for the first time, a connector
sets a static property in the data handler base class to the name
of a top-level data-handler meta-object. From this top-level
meta-object, the data handler obtains its configuration
information. Each time the data handler is subsequently
instantiated, the configuration properties for that data handler
instance are obtained. The data handler must have access to this
configuration information to do its work.
- To instantiate the data handler, the connector must know either
the name for the data handler class or the MIME type of the data.
When a connector calls
createHandler() to invoke a data handler, it passes in
either the class name or the MIME type for the data.
- If the connector passes in the MIME type, the createHandler() method checks the
top-level data-handler meta-object for an attribute whose name
matches the MIME type. If a matching attribute is found, the
createHandler() method
checks for the value of the
ClassName attribute in the child meta-object that is
associated with the MIME type.
- If the connector passes in a class name, the createHandler() method instantiates a
data handler of that class name.
If the connector does not pass in the correct class name or MIME
type, the instantiation process fails. For more information, see
Identifying the data-handler
class.
Connectors are configured to obtain this configuration
information in different ways. For example:
- The Adapter for XML has a configuration property,
DataHandlerConfigMO, that specifies the name of the
top-level meta-object. If this property is not filled in, the
connector cannot find the meta-object. In addition, any top-level
business object for the XML connector must have a MimeType
attribute that specifies the MIME type of the data in the business
object. The connector uses the MimeType attribute value to
invoke the appropriate data handler.
- The Adapter for JText has its own configuration meta-object,
which has ClassName, DataHandlerConfigMO and
MimeType attributes to specify the name of the class,
data-handler meta-object, and the MIME type for a file,
respectively.
Other connectors may have different ways of configuring the use
of a data handler. See the adapter guide for the connector for more
information.
If the connector cannot find the data handler top-level
meta-object, or it cannot determine the class name or MIME type,
then it cannot create the data handler. Therefore, when you are
configuring a connector to use a data handler, be sure to:
- Determine how to configure the name of the top-level
data-handler meta-object for the connector. Make sure that the
spelling of the meta-object name is correct.
- Determine how to configure the MIME type. Make sure that the
MIME type is spelled correctly.
- Make sure that the top-level data-handler meta-object is in the
supported objects list for the connector.
- Make sure that the child meta-object for the data handler has
the value of the data handler class name (in the ClassName
attribute) specified correctly.
