com.ibm.dse.automaton.ext
Class ExecuteOperationAct

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.automaton.DSEAction
              |
              +--com.ibm.dse.automaton.ext.ExecuteOperationAct

public class ExecuteOperationAct
extends DSEAction
implements OperationRepliedListener

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

See Also:
Serialized Form

Field Summary
protected  Semaphore operationRepliedSemaphore
           
 
Fields inherited from class com.ibm.dse.automaton.DSEAction
context, inputMapFmtTag, operationTag, outputMapFmtTag, sourceEvent, tag
 
Fields inherited from class com.ibm.dse.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 processorContext, java.lang.String contextName)
          This method checks to see if the operation has a context, if not then we need to assign one.
protected  Context determineContextToLinkTo(java.lang.String contextName)
          This method uses the value of the linkContextTo attribute to determine which context out of three possibilities should be returned to the ExecuteOperationAct's chainOrAssignContext().
 void execute()
          This method 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.
 void handleOperationRepliedEvent(OperationRepliedEvent event)
          This method signals the semaphore that the operation fired by the ExecuteOperationAct's execute() has finished execution and replied.
 void refreshActiveView()
          If the refreshActiveView param is true, this methed is called to refresh the active view after having executed the operation.
 
Methods inherited from class com.ibm.dse.automaton.DSEAction
chainOrAssignContext, chainOrAssignContext, close, close, evaluateGuardCondition, externalizer, getContext, getGuardConditions, getInputMapFmtTag, getOperationTag, getOutputMapFmtTag, getParms, getProcessor, 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.dse.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
 

Field Detail

operationRepliedSemaphore

protected Semaphore operationRepliedSemaphore
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 processorContext,
                                    java.lang.String contextName)
This method checks to see if the operation has a context, if not then we need to assign one. If the operation already has a context, we need to chain the operation context to an existing context. In either case the value of the linkContextTo attribute is the context to be used. If the context was assigned, this method returns true.
Parameters:
thisOp - com.ibm.dse.base.Operation
contextName - java.lang.String
Returns:
boolean

determineContextToLinkTo

protected Context determineContextToLinkTo(java.lang.String contextName)
This method uses the value of the linkContextTo attribute to determine which context out of three possibilities should be returned to the ExecuteOperationAct's chainOrAssignContext(). The processor context is the default value if none is specified, but the value could also be activeView or parentActiveView.
Parameters:
contextName - java.lang.String
Returns:
com.ibm.dse.base.Context

execute

public void execute()
             throws java.lang.Exception
This method 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.
Overrides:
execute in class DSEAction
Tags copied from class: DSEAction
Throws:
java.lang.Exception - The implementor of this class must decide when to throw an exception occurred to the automaton.

handleOperationRepliedEvent

public void handleOperationRepliedEvent(OperationRepliedEvent event)
This method signals the semaphore that the operation fired by the ExecuteOperationAct's execute() has finished execution and replied.
Specified by:
handleOperationRepliedEvent in interface OperationRepliedListener
Parameters:
event - com.ibm.dse.base.OperationRepliedEvent

refreshActiveView

public void refreshActiveView()
If the refreshActiveView param is true, this methed is called to refresh the active view after having executed the operation. The active view is obtained from the navigation controller which is available in the processor's context.