IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.automaton.ext
Class ExecuteOperationAct

java.lang.Object
  extended by com.ibm.btt.base.DSENotifier
      extended by com.ibm.btt.automaton.DSEAction
          extended by com.ibm.btt.automaton.ext.ExecuteOperationAct
All Implemented Interfaces:
Action, Notifier, OperationRepliedListener, java.io.Externalizable, java.io.Serializable, java.util.EventListener

@ATTR(value={"operationName#String#IMPLIED","linkContextTo#String#IMPLIED","inputMapFmt#String#IMPLIED","outputMapFmt#String#IMPLIED","refreshActiveView#Boolean#IMPLIED"})
public class ExecuteOperationAct
extends DSEAction
implements OperationRepliedListener

This class provides the behavior for a sample DSEAction to create and execute operations from the automaton.

See Also:
Serialized Form

Field Summary
 java.lang.String DSEEXCEPTION
           
 java.lang.String ERROR
           
static java.lang.String EXIT_EVENT_NAME
          Name of the parameter in which the operation stores the event name that the automaton uses to go on with the flow.
protected  java.lang.String exitEventName
           
 java.lang.String OK
           
protected  Semaphore operationRepliedSemaphore
           
 
Fields inherited from class com.ibm.btt.automaton.DSEAction
context, inputMapFmtTag, operationTag, outputMapFmtTag, sourceEvent, tag
 
Fields inherited from class com.ibm.btt.base.DSENotifier
handlersList, name
 
Constructor Summary
ExecuteOperationAct()
          Creates an object of type ExecuteOperationAct.
ExecuteOperationAct(boolean mustRegister)
          Creates an object of type ExecuteOperationAct.
ExecuteOperationAct(java.lang.String aName)
          Creates an object of type ExecuteOperationAct.
ExecuteOperationAct(java.lang.String aName, java.lang.String aTID)
          Creates an object of type ExecuteOperationAct.
 
Method Summary
 boolean chainOrAssignContext(Operation thisOp, Context actionContext, java.lang.String contextName)
          Verifies whether the operation has a context.
 void execute()
          Instantiates and executes the operation indicated by the parameter name: Creates the instance of the operation, using the operation externalizer Chains or assigns the operation context Copies the data from the action context to the operation context Executes the operation Waits for the "Operation Replied Event" from the operation, and then continues Copies data back from the operation context to the processor context Closes the operation and unchains its context if it was not assigned (which implies it was chained instead) Refreshes the active panel in the context's navigation controller IF the value for the refreshActiveView attribute is true Signals an "ok" event of completion if all of the above were executed without exception, otherwise an "error" event is fired
protected  Operation getOperation()
          Returns an operation instance obtained from the action's externalized definition.
 void handleOperationRepliedEvent(OperationRepliedEvent event)
          Signals the semaphore when the state's activate method is waiting for the operation end.
 
Methods inherited from class com.ibm.btt.automaton.DSEAction
chainOrAssignContext, chainOrAssignContext, close, close, evaluateGuardCondition, externalizer, getContext, getGuardConditions, getInputMapFmtTag, getOperationTag, getOutputMapFmtTag, getParms, getProcessor, getService, getSourceEvent, initializeFrom, mapTheInput, mapTheOutput, preProcess, readExternal, readExternal, removeExternal, setContext, setGuardConditions, setInputMapFmtTag, setOperationTag, setOutputMapFmtTag, setParms, setProcessor, setSourceEvent, toString, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.btt.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.btt.automaton.Action
getName, setName
 
Methods inherited from interface com.ibm.btt.base.Notifier
addHandler, getHandlersList, removeHandler, signalEvent, signalEvent, terminate
 
Methods inherited from interface com.ibm.btt.base.Externalizable
getName, setName
 

Field Detail

operationRepliedSemaphore

protected Semaphore operationRepliedSemaphore

exitEventName

protected java.lang.String exitEventName

OK

public final java.lang.String OK
See Also:
Constant Field Values

ERROR

public final java.lang.String ERROR
See Also:
Constant Field Values

DSEEXCEPTION

public final java.lang.String DSEEXCEPTION
See Also:
Constant Field Values

EXIT_EVENT_NAME

public static final java.lang.String EXIT_EVENT_NAME
Name of the parameter in which the operation stores the event name that the automaton uses to go on with the flow. This parameter is passed within the operationRepliedEvent.

See Also:
Constant Field Values
Constructor Detail

ExecuteOperationAct

public ExecuteOperationAct()
Creates an object of type ExecuteOperationAct.


ExecuteOperationAct

public ExecuteOperationAct(java.lang.String aName)
Creates an object of type ExecuteOperationAct.

Parameters:
aName - java.lang.String

ExecuteOperationAct

public ExecuteOperationAct(java.lang.String aName,
                           java.lang.String aTID)
Creates an object of type ExecuteOperationAct.

Parameters:
aName - java.lang.String
aTID - java.lang.String

ExecuteOperationAct

public ExecuteOperationAct(boolean mustRegister)
Creates an object of type ExecuteOperationAct.

Parameters:
mustRegister - boolean
Method Detail

chainOrAssignContext

public boolean chainOrAssignContext(Operation thisOp,
                                    Context actionContext,
                                    java.lang.String contextName)
Verifies whether the operation has a context. If it does not, this method assigns the context identified the linkContextTo property. If the operation already has a context, this method chains the operation context to the linkContextTo context. If the method assigns the context, this method returns true.

Parameters:
thisOp - com.ibm.btt.base.Operation
contextName - java.lang.String
Returns:
boolean - True if the context is assigned

execute

public void execute()
             throws java.lang.Exception
Instantiates and executes the operation indicated by the parameter name:
  1. Creates the instance of the operation, using the operation externalizer
  2. Chains or assigns the operation context
  3. Copies the data from the action context to the operation context
  4. Executes the operation
  5. Waits for the "Operation Replied Event" from the operation, and then continues
  6. Copies data back from the operation context to the processor context
  7. Closes the operation and unchains its context if it was not assigned (which implies it was chained instead)
  8. Refreshes the active panel in the context's navigation controller IF the value for the refreshActiveView attribute is true
  9. Signals an "ok" event of completion if all of the above were executed without exception, otherwise an "error" event is fired

Specified by:
execute in interface Action
Specified by:
execute in class DSEAction
Throws:
java.lang.Exception - The implementor of this class must decide when to throw an exception occurred to the automaton.

getOperation

protected Operation getOperation()
                          throws java.lang.Exception
Returns an operation instance obtained from the action's externalized definition.

Returns:
com.ibm.btt.base.Operation
Throws:
java.lang.Exception

handleOperationRepliedEvent

public void handleOperationRepliedEvent(OperationRepliedEvent event)
Signals the semaphore when the state's activate method is waiting for the operation end. This method must get the name of the event that will be used to change state from the event received.

Specified by:
handleOperationRepliedEvent in interface OperationRepliedListener
Parameters:
event - com.ibm.btt.base.OperationRepliedEvent

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2010