IBM WebSphere Adapters User Manual page 120

Version 6 release 2
Table of Contents

Advertisement

if (functionName.equals(NodeLevelOperations.CREATE_NODE)) {
command = new TwineBallCreateCommand();
} else if (functionName.equals(NodeLevelOperations.DELETE_NODE)) {
command = new TwineBallDeleteCommand();
} else if (functionName.equals(NodeLevelOperations.UPDATE_NODE)) {
command = new TwineBallUpdateCommand();
} else if (functionName.equals(NodeLevelOperations.RETRIEVE_STRUCTURE)) {
command = new TwineBallRetrieveCommand();
} else if (functionName.equals(NodeLevelOperations.RETRIEVE_ALL)) {
command = new TwineBallRetrieveAllCommand();
} else {
command = new TwineBallBaseCommand();
}
command.setObjectSerializer(objectSerializer);
command.setObjectNaming(objectNaming);
command.setMaxRecords(maxRecords);
command.setMetadata(metadata);
if (functionName == NodeLevelOperations.DELETE_NODE) {
command.setExecutionOrder(CommandForCursor.BEFORE_PARENT);
} else {
command.setExecutionOrder(CommandForCursor.AFTER_PARENT);
}
}catch (Exception e) {
throw new ResourceException(e);
}
return command;
}
Implementing Interaction.execute():
To enable the command pattern capability, you implement a class from the
InteractionSpec with a call to the Command Manager. The InteractionSpec is part
of the JCA CCI interface.
The interaction class is part of the JCA CCI interface and processes records as
input and output. This is the API that is exposed for manipulating data in
outbound operations:
You want to call the Command Manager to produce the command structure, then
the interpreter to execute each command in the structure. A simplified version of
the resulting interaction code will resemble the following:
public Record execute(InteractionSpec ispec, Record inRecord) throws ResourceException {
WBIStructuredRecord wbiRecord = (WBIStructuredRecord) inRecord;
String functionName = ((WBIInteractionSpec) ispec).getFunctionName();
CommandForCursor topLevelCommand = commandManagerForCursor.produceCommands(wbiRecord, functionName);
interpreter.execute(topLevelCommand);
WBIStructuredRecord outRecord = new WBIStructuredRecord();
outRecord.setOperationName(functionName);
outRecord.setTwineBallConnection(connection.getEISConnection());
outRecord.setEISRepresentation(topLevelCommand.getEisRepresentation());
return outRecord;
}
Notice that you need not "walk" the incoming object structure, or the command
structure– the command manager and interpreter perform this function.
114
WebSphere Adapters: WebSphere Adapter Toolkit User Guide
public Record execute(InteractionSpec ispec, Record inRecord)
throws ResourceException;

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Websphere adapter toolkit

Table of Contents