IBM Branch Transformation Toolkit Javadoc

com.ibm.dse.automaton.ext.client
Class ExecuteOperationAct

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

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.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.
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 by doing the following: 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.
 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
 
Methods inherited from interface com.ibm.dse.automaton.Action
getName, setName
 
Methods inherited from interface com.ibm.dse.base.Notifier
addHandler, getHandlersList, removeHandler, signalEvent, signalEvent, terminate
 
Methods inherited from interface com.ibm.dse.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 processorContext,
                                    java.lang.String contextName)
This method checks to see if the operation has a context. If it does not, this method assigns one. If the operation already has a context, this method chains the operation context to an existing context. In either case, this method uses the value of the linkContextTo attribute as 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 - True if the context is already assigned

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 by doing the following:

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.dse.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.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. It obtains the active view from the navigation controller that is available in the processor's context.


IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005