IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Adapter Toolkit > Implementing code from the IBM WebSphere Adapter Toolkit > Enterprise Metadata Discovery interfaces and implementation for technology adapters
Implementing Enterprise Metadata Discovery to build an interface
The com.ibm.j2ca.extension.emd.build.* package allows a simpler way to build services with an adapter from existing types. Instead of the EMD process generating types, it will import them and use them in a service.
Extend the adapter foundation classes to build services
Creating services that use technology-style adapters relies on being able to implement the interfaces in the commonj.connector.metadata.build.* package or by extending the AFC classes in com.ibm.j2ca.extension.emd.build.* package, or a combination thereof.
To implement the interfaces that allow you to build services, you need to extend the following adapter foundation classes:
- WBIMetadataBuild
- WBIFunctionBuilder
- WBIMetadataType (optional)
When you extend WBIMetadataBuild, you will need to implement the following methods:
- FunctionBuilder createFunctionBuilder(String functionSelector)
CreateFunctionBuilder returns your FunctionBuilder instance.
- String[] getConnectionSpecClassName();
getConnectionSpecClassName returns the class name of your J2CA connection spec.
- InteractionSpec getDefaultInteractionSpec();
getDefaultInteractionSpec returns the class name of the J2CA interaction spec that is most commonly used for your adapter.
- QName[] getAdapterSchemaTypes();
getAdapterSchemaTypes returns any common schemas; for example, schemas used independently of the operation.
- SchemaDefinition[] getSchemasForQName(QName type);
getSchemasForQName returns the SchemaDefinition[s] for any Qnames that you provide for schemas in the build process.
When you extend WBIFunctionBuilder, you will need to implement the following methods:
- FunctionType[] getFunctionTypes();
This method returns the function type(s) for the selected operation. This is particularly useful for determining whether this is input/output, the input or output are the same or different.
- String getDefaultDataBindingClassName();
This method returns the default data binding class for this adapter.
- updateInputDataDescription(DataDescription dataDescription, FunctionDescription functionDescription);
This method gives your adapter a chance to update the data description for input.
- String[] getSupportedOperationNames();
This method returns the list of operations that the adapter foundation classes display to the user. The user can select one of these per added function.
- String[] getRecordInterfaces();
This method returns the record interfaces that your adapter can deal with, for instance InputStreamRecord.
- InteractionSpec getInteractionSpec(String methodName, QName inputData, QName outputData)
This method returns a populated the interaction spec, containing the necessary information about the function to be run. This is used in building the service description.
WBIMetadataTypeIf your adapter requires the ability to generate its own types (or wrappers), you should either extend WBIMetadataType or implement the MetadataType interface directly.
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:
- public abstract String getDefaultNamespace();
This method returns a default namespace for your adapter.
- 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 your “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>WebSphere Sample Adapter for Enterprise Information System Simulator <j2ee:description> <j2ee:display-name>WebSphere Sample Adapter for Enterprise Information System Simulator </j2ee:display-name> <emd:vendor-name xsi:type ="j2ee:xsdStringType>IBM</emd:vendor-name> <emd:version xsi:type="j2ee:xsdStringType"> @adapter-version@@adapter-version@> <emd:spec-version>1.1/emd:spec-version> <emd:discoveryService-class xsi:type= "j2ee:fully-qualified-classType"> com.ibm.j2ca.eissa.emd.discovery.EISSAMetadataDiscovery </emd:discoveryService-class> <emd:metadataEdit-class xsi:type= "j2ee:fully-qualified-classType"> com.ibm.j2ca.eissa.emd.discovery.EISSAMetadataEdit </emd:metadataEdit-class> <emd:application-specific-schema> <j2ee:description> PeopleSoft ASI schema</j2ee:description> <j2ee:displayname>PeopleSoft ASI schema</j2ee:display-name> <emd:asiNSURI>http://www.ibm.com/xmlns/prod /websphere/j2ca/peoplesoft/metadata </emd:asiNSURI><emd:asiSchemaLocation> PeopleSoftASI.xsdemd:asiSchemaLocation> PeopleSoftASI.xsd> </emd:application-specific-schema> </emd:discoveryService>
Enterprise Metadata Discovery interfaces and implementation for technology adapters