processed. A custom function selector can use the information in the
InboundInteractionSpec
to generate a native function.
For a custom adapter, you can create either a
smart
function selector that utilizes
the data or metadata to perform function selection, with or without configuration;
or you can implement a
simple
function selector that always returns a static
function name. Implementing a simple function selector restricts your inbound
service to a single function. This, in turn, restricts the service to dealing with a
single data type; unless
anyType
is used in the WSDL, which is discouraged
because a WSDL that contains an
anyType
schema is difficult to use in WebSphere
Process Server or WebSphere ESB (due to the fact that it does not indicate the
actual type emitted).
Implementing a data binding
A data binding implements the interface
commonj.connector.runtime.RecordHolderDataBinding
. This interface contains four
methods as follows:
v
Record getRecord();
v
void setRecord(Record record);
v
DataObject getDataObject();
v
void setDataObject(DataObject object);
These methods perform the mediation between the record that the adapter needs
(for example an
InputStreamRecord
), and the data object specified in the service
(WSDL).
The data binding can call a data handler to perform low-level transformation on an
input stream. The adapter foundation classes provide a base class, named
BaseDataBinding
that adapters can extend to handle the low-level details of calling
a data handler. The
BaseDataBinding
data handler has three methods as follows:
v
InputStream transformToInputStream(DataObject object);
v
DataObject transformToDataObject(InputStream stream, QName expectedType);
v
void setChildDataHandler(Qname bindingConfiguration);
To use these methods, call
setChildDataHandler
first with a data handler
configuration, then call one of the transform methods. The
expectedType
parameter on
transformToDataObject
should match the type of the DataObject you
want the transformation to produce. You can derive this from the expected type
that the data binding is passed in the
BindingContext
interface described in the
Binding context and configuration.
Binding context and configuration
Data handlers, data bindings and function selectors can be context-enabled and
may be configurable.
BindingContext
is a
mix-in
interface that provides access to contextual information,
such as the configuration of this binding, the expected type for data handlers and
data bindings and the type of service being used.
The
BindingContext
interface has several constants and one method as follows:
v
void setBindingContext(Map context);
WebSphere Adapter development overview
159
Summary of Contents for WebSphere Adapters
Page 2: ......
Page 6: ...iv WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 220: ...214 WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 224: ...218 WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 225: ......
Page 226: ...Printed in USA...