The adapter provides an option for creating custom data bindings
to meet your environment needs. A custom data binding is a Java class that
you write to convert a stream of data to a business object during inbound
processing and a business object to a stream of data during outbound processing.
The enterprise information system (EIS) and JMS exports and imports can be
configured to invoke custom data bindings.
About this task
The following steps guide you through the process of creating custom
data bindings.
How to perform this task
- Implement the custom data binding using the commonj.connector.runtime.RecordHolderDataBinding
interface. This interface is located in the commonj.connector.jar file,
which is contained in the WebSphere Process Server runtime libraries.
- Create the custom data bindings using either the inbound or outbound
information shown below.
- To convert a stream of data to a business object for inbound
processing, the adapter calls the public void setRecord(Record arg0) and public
DataObject getDataObject() methods of the custom data binding. It first calls
setRecord and then calls getDataObject.
- The setRecord method takes an com.ibm.j2ca.base.UnstructuredRecord as
a parameter. This class is part of the Adapter Foundation class jar file.
The business object record, as text or byte[], is sent to the custom data
binding in this method. Other required information is also sent.
- The getDataObject() gets the business object record, set as mentioned
above, does the necessary data transformation and returns the
required business object.
- The getRecordName() present in the unstructured record gets the fully
qualified namespace with which we can instantiate the business object and
extract (as mentioned in step 3) any required ASI present in the annotation.
This ASI is used by the data binding. For example:
recordName =
http://www.ibm.com/xmlns/prod/websphere/j2ca/ftp/customerwrapperbg/CustomerWrapperBG
namespace
= http://www.ibm.com/xmlns/prod/websphere/j2ca/ftp/customerwrapperbg
object
name = CustomerWrapperBG
- To convert a business object to a stream of data for outbound
processing, the adapter calls the public void setDataObject(DataObject dataObject)
and public Record getRecord() methods of the custom data binding. It first
calls setDataObject and then calls getRecord.
- The setDataObject method takes the business object as a parameter. The
output of getRecord must be of type com.ibm.j2ca.base.UnstructuredRecord.
- Application-specific information is obtained from the input business object
as mentioned in step 3.
- The getRecord method does the necessary transformation and returns the
native data in the form of an unstructured record.
An example of EIS native data with delimited text is: Employee~Create~sarath~IBM~Bangalore~560071
Business
object schema:
complexType name="Employee"
sequence maxOccurs="1" minOccurs="1"
element maxOccurs="1" minOccurs="0" name="name" type="string"/
element maxOccurs="1" minOccurs="0" name="company" type="string"/
element maxOccurs="1" minOccurs="0" name="city" type="string"/
element maxOccurs="1" minOccurs="0" name="zip" type="string"/
/sequence
/complexType
- To access application-specific information in the annotation of
the business object, use the CWYBS_AdapterFoundation.jar file,
which contains a class named com.ibm.j2ca.base.AdapterBOUtil. This class contains
the method to extract the application-specific information from the business
object.
- Use the business object application programming interface (API)
methods to extract each value contained in the annotation. The
output is a business object representing the application-specific information.
- For inbound, instantiate the business object from the recordName value
contained in the unstructured record.
- For outbound, call the getMetadataForObject() by
passing the business object as a parameter.
What to do next
Configure the custom data bindings using the detailed instructions
located in
WPS_install_directory\samples\doc\CustomEISDataBinding\index.html.
Terms of use |
Last updated: Mon 30 Oct 2006 03:48:54
(c) Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)