IBM WebSphere Adapters Network Card User Manual


 
public Interaction createInteraction() throws ResourceException
{
return new TwineBallInteraction(this);
}
Note: If you want to provide your own implementation of ConnectionMetadata,
you must override method WBIConnection#getMetadata.
javax.resource.cci.ConnectionSpec:
Clients use a javax.resource.cci.ConnectionSpec instance to pass request-specific
connection properties to the getConnection method of the ConnectionFactory.
To add EIS request-specific properties, the resource adapter should implement the
ConnectionSpec interface directly. The sample below extends
WBIConnectionRequestInfo to inherit the properties userName and password, and
then adds its own EIS-specific properties.
public class TwineBallConnectionSpec extends WBIConnectionRequestInfo implements
ConnectionSpec {
private boolean xa;
public TwineBallConnectionSpec(String userid, String password, boolean xa)
{
setUserid(userid);
setPassword(password);
this.xa = xa;
}
}
WBIInteraction:
A javax.resource.cci.Interaction instance enables client components to execute
EIS-specific operations. WBIInteraction implements an interaction interface to
provide implementations for noncritical methods. Subclasses implement the
execution interfaces.
Subclass methods to implement
Record execute(InteractionSpec ispec, Record inputRecord)
execute(InteractionSpec ispec, Record inRecord, Record outRecord)
The inRecord is the input record, and outRecord is the output record. The
difference between the two is that the output record is passed in, so the code in
interaction.execute updates that output record instead of creating a new record
to return.
Executes an EIS operation represented by the InteractionSpec and returns an
output Record. The following example makes use of the command patterns to
simplify processing.
public class TwineBallInteraction extends WBIInteraction {
private CommandManager commandManager;
private Interpreter interpreter;
private TwineBallConnection connection;
private TwineBallCommandFactory factory;
public TwineBallInteraction(WBIConnection connection) throws ResourceException {
super(connection);
this.connection = (TwineBallConnection) connection;
interpreter = new Interpreter(this.getLogUtils());
TwineBallResourceAdapter resourceAdapter =
102 WebSphere Adapters: WebSphere Adapter Toolkit User Guide