IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Adapter Toolkit > Implementing code from the IBM WebSphere Adapter Toolkit > Outbound support > Use command patterns > Implementing Command Manager

Command factory implementations

The command factory creates operation-specific command instances and establishes when the instance is processed.

Given an operation name and metadata, the command factory is responsible for creating command instances. The command factory must also set the execution order that specifies when a command should be processed in relation to its parent. This value can be either BEFORE_PARENT, or AFTER_PARENT.

The interface you must implement is as follows:

public CommandForCursor createCommand(String nodeLevelOperation)
throws ResourceException;

The code to implement a command factory will resemble the following, where EIS Simulator (EISS) is the name of the Enterprise Information System.

public CommandForCursor createCommand(String functionName, Type metadata)
throws ResourceException {
<AdapterPrefixName>BaseCommand command = null;
Adapter Toolkit 99
try {
if (functionName.equals(NodeLevelOperations.CREATE_NODE)) {
command = new <AdapterPrefixName>CreateCommand();} else if (functionName.equals(NodeLevelOperations.DELETE_NODE)) {
command = new <AdapterPrefixName>DeleteCommand();} else if (functionName.equals(NodeLevelOperations.UPDATE_NODE)) {
command = new <AdapterPrefixName>UpdateCommand();} else if (functionName.equals(NodeLevelOperations.RETRIEVE_STRUCTURE)) {
command = new <AdapterPrefixName>RetrieveCommand();} else if (functionName.equals(NodeLevelOperations.RETRIEVE_ALL)) {
command = new <AdapterPrefixName>RetrieveAllCommand();} else {
command = new <AdapterPrefixName>BaseCommand();} 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 Command Manager