beautypg.com

Data binding implementation – IBM WebSphere Adapters User Manual

Page 172

background image

The method should first extract the value from backend object representation
defined through Xpath and use OutputCursor and OutputAccessor interfaces to
populate values in runtime data structure.

Sample

Data binding implementation

Adapters must provide implementations for DataBinding interface in order to
work with WebSphere Process Server. The marshalling of data from SDO to CCI
record and from CCI record to SDO occurs through DataBinding implementation.

Interfaces

Adapters should implement the following interfaces:

v

commonj.connector.runtime

v

RecordHolderDataBinding

The following sections describe the methods that need implementation.

setDataObject

public void setDataObject(DataObject arg0) throws DataBindingException

This method builds an instance of adapter record instance and initializes with the
metadata that represents input SDO.

public void setDataObject(DataObject arg0) throws DataBindingException
{

// TODO Auto-generated method stub
try {

record = new TwineBallStructuredRecord();
inputBG = arg0;
DEFactorySDO binding = new DEFactorySDO();
DataObject dataObject = arg0.getDataObject(WPSServiceHelper.getRootBusinessObjectProperty

(arg0.getType()));

binding.setBoundObject(dataObject);
record.initializeInput(binding, dataObject);

}
catch (Exception e) {

throw new DataBindingException("Failed to initialize cursor", e);

}

}

getDataObject

public DataObject getDataObject() throws DataBindingException

This method builds an instance of SDO with the data that is returned from the
backend application. For example, when an adapter executes a Retrieve operation,
the data returned from the backend application is held in the adapter structured
record implementation. In this method the adapter reads data from the backend
application and builds and SDO instance.

To perform this task the adapter should use DESPI APIs. Initialize the record with
initializeOutput(), then call getNext() to build data in SDO.

This method should take care of building an instance of BG is the methods
getNamespaceURI()and getBusinessObjectName() return a type BG.

166

WebSphere Adapters: WebSphere Adapter Toolkit User Guide