IBM WebSphere Adapters Benutzerhandbuch

Seite von 226
Extend WBIMetadataType if your adapter needs a simple wrapper object around a
payload object, similar to the IBM WebSphere Adapter for Flat Files and the IBM
WebSphere Adapter for FTP. The WBIMetadataType interface allows you to select a
payload type, and optionally generate a business graph structure in addition to a
plain wrapper. Implement MetadataType interface directly if you need to deal with
a more complex object structure.
To extend WBIMetadataType, implement the following methods:
v
public abstract String getDefaultNamespace();
This method returns a default namespace for your adapter.
v
public abstract SchemaDefinition[] getSchemaDefinitions();
This method returns the generated schema definitions, based on the payload.
The following helper methods enable you to do this:
– getImportedSchemaLocationString();
This helper method returns the relative location of the selected schema.
– getImportedSchema()
This helper method returns the Qname of the selected schema.
– getNamespace()
This helper method returns the namespace that the user has entered.
Discovery-service.xml
For the tool to detect and use your adapter, you need a discovery-service.xml file
in yor “meta-in” folder.
Here is an example of the discovery-service.xml file:
<?xml version="1.0" encoding="utf-8"?>
<emd:discoveryService xmlns:emd="commonj.connector"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd">
<j2ee:description>My Adapter</j2ee:description>
<j2ee:display-name>My Adapter</j2ee:display-name>
<emd:vendor-name xsi:type="j2ee:xsdStringType">My vendor </emd:vendor-name>
<emd:version xsi:type="j2ee:xsdStringType">My Version</emd:version>
<emd:spec-version>1.1</emd:spec-version>
<emd:metadataBuild-class xsi:type="j2ee:fully-qualified-classType">
mypackage.myadapter.MetadataBuild</emd:metadataBuild-class>
<emd:metadataEdit-class xsi:type="j2ee:fully-qualified-classType">
mypackage.myadapter.MetadataEdit</emd:metadataEdit-class>
<emd:metadataType-class xsi:type="j2ee:fully-qualified-classType">
mypackage.myadapter.MetadataType</emd:metadataType-class>
<emd:application-specific-schema>
</emd:application-specific-schema></emd:discoveryService>
Structured record implementation
StructuredRecord class needs to be implemented by adapters when the data
exchanged with backend application can be well defined. Extend foundation class
com.ibm.j2ca.base.WBIStructuredRecord
and implement the associated methods.
162
WebSphere Adapters: WebSphere Adapter Toolkit User Guide