IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.automaton.ext
Class DSEBaseState

java.lang.Object
  extended by com.ibm.btt.base.DSEHandler
      extended by com.ibm.btt.automaton.DSEState
          extended by com.ibm.btt.automaton.ext.DSEBaseState
All Implemented Interfaces:
FormatEnabledState, State, Handler, Traceable, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
DSEConditionState, DSEOperationState

public abstract class DSEBaseState
extends DSEState
implements FormatEnabledState

See Also:
Serialized Form

Field Summary
static java.lang.String EXIT_EVENT_NAME
          Name of the parameter in which the state stores the name of the event that the automaton uses to go on with the flow.
 Tag inputFormatTag
          Map format used to map data from the calling processor context to the context of the processor that this state executes.
 Tag outputFormatTag
          Map format used to map data from the context of the processor that this state executes to the calling processor context.
 
Fields inherited from class com.ibm.btt.automaton.DSEState
ABORT_PROCESS, actionHandlers, CHANGE_STATE, CONDITIONS, CONTINUE, DEFAULT_TYPE, done, ENTRY_ACTIONS, entryActionsTags, EXECUTE_ACTION_AND_CHANGESTATE, EXIT_ACTIONS, exitActionsTags, exitEventName, FINAL_TYPE, ignoreEntryActions, INITIAL_TYPE, name, PAGE_TYPE, pqThread, processor, runningModeFlag, sharedNotifiers, SKIP_ACTION, SKIP_ALL_ACTIONS, SKIP_CONDITIONS, SUBFLOW_TYPE, suspendedThread, SUSPENDTIME, tag, transitions, TRANSITIONS, type, TYPE, TYPE_ID_INFO, typeIdInfo
 
Constructor Summary
DSEBaseState()
           
 
Method Summary
 void activate()
          Activates an state.
protected  void afterActivate()
          The dispose logic after state activation, here to release resources used by this state.
protected  void beforeActivate()
          The preparation for state activation, it will be invoked after entry actions and before input mapping.
protected  void changeProcessorState(DSEEventObject event)
          This utility method is used to change the state of a processor in response to a change state event.
protected abstract  void doActivate()
          Execute the main logic for this state, also handle the exitEventName to navigate to next state.
protected  void doDataMapping(DataMapperFormat format, Context sourceCtx, Context targetCtx)
          This utility method maps data from the source context to the target context using the supplied DataMapperFormat.
protected  void fireDSEChangeStateEvent(java.lang.String targetStateName, boolean ignoreEntryActionsFlag, boolean ignoreExitActionsFlag, java.lang.String transitionName)
          Dispatches a change state event with required information.
protected abstract  Context getContext()
          Get the context of state which will be used by input and output mapping.
 Tag getInputFormatTag()
          Returns the input format tag attribute of this class.
 Tag getOutputFormatTag()
          Returns the output format tag attribute of this class.
protected  void processEventQueue(Vector otherTrigs)
          Provides an internal routine for the activate() method.
protected  void processQueue(Vector otherTrigs)
          Processes the events queue of the processor.
 void setInputFormatTag(Tag newInputFormatTag)
          Sets the input format tag property.
 void setOutputFormatTag(Tag newOutputFormatTag)
          Sets the output format tag property.
protected  void signalEvent()
          Creates and signals the event that the state processes.
 
Methods inherited from class com.ibm.btt.automaton.DSEState
abort, addHandlersForAction, dispatchEvent, doEntryActions, doExitActions, externalizer, fireDSEChangeStateEvent, fireDSEChangeStateEvent, fireDSEChangeStateEvent, getEntryActions, getExitActions, getGuardConditionResult, getInstanceOfAction, getName, getProcessor, getTag, getTraceMessage, getTransitions, getType, getTypeIdInfo, initializeFrom, isIgnoreEntryActions, isRunningModeFlag, readExternal, readExternal, removeExternal, removeHandlersForAction, removeHandlersForAction, resume, setEntryActions, setExitActions, setIgnoreEntryActions, setName, setProcessor, setTag, setTransitions, setType, setTypeIdInfo, subscribeToShareNotifiers, suspend, terminate, toString, toStrings, toTags, unsubscribeToSharedNotifiers, writeExternal, writeExternal
 
Methods inherited from class com.ibm.btt.base.DSEHandler
handleEvent, handleEvent, stopHandlingEvent, stopHandlingEvent
 
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.State
abort, getEntryActions, getName, getProcessor, getTransitions, getType, getTypeIdInfo, initializeFrom, resume, setEntryActions, setIgnoreEntryActions, setName, setProcessor, setTransitions, setType, setTypeIdInfo, suspend, terminate
 
Methods inherited from interface com.ibm.btt.base.Handler
dispatchEvent, handleEvent, handleEvent, stopHandlingEvent, stopHandlingEvent
 

Field Detail

EXIT_EVENT_NAME

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

See Also:
Constant Field Values

inputFormatTag

public Tag inputFormatTag
Map format used to map data from the calling processor context to the context of the processor that this state executes.


outputFormatTag

public Tag outputFormatTag
Map format used to map data from the context of the processor that this state executes to the calling processor context.

Constructor Detail

DSEBaseState

public DSEBaseState()
Method Detail

activate

public void activate()
              throws DSEInvalidArgumentException,
                     DSEProcessorException
Activates an state. The state must fire an event and this class listens for it. The event raised from the state must contain event information that is used to change the state.

This method waits until this event is received. It then tries to raise the event created from the information received from the state. The state processes this event and put it on the queue. Processing the event queue provokes a state change.

Specified by:
activate in interface State
Overrides:
activate in class DSEState
Throws:
DSEInvalidArgumentException
DSEProcessorException

beforeActivate

protected void beforeActivate()
                       throws DSEInvalidArgumentException,
                              DSEProcessorException
The preparation for state activation, it will be invoked after entry actions and before input mapping.

Throws:
DSEInvalidArgumentException
DSEProcessorException

doActivate

protected abstract void doActivate()
                            throws DSEInvalidArgumentException,
                                   DSEProcessorException
Execute the main logic for this state, also handle the exitEventName to navigate to next state.

Throws:
DSEInvalidArgumentException
DSEProcessorException

afterActivate

protected void afterActivate()
                      throws DSEInvalidArgumentException,
                             DSEProcessorException
The dispose logic after state activation, here to release resources used by this state. It will be invoked after output mapping and before navigate to next state.

Throws:
DSEInvalidArgumentException
DSEProcessorException

getContext

protected abstract Context getContext()
Get the context of state which will be used by input and output mapping.

Returns:

changeProcessorState

protected void changeProcessorState(DSEEventObject event)
                             throws DSEProcessorException
This utility method is used to change the state of a processor in response to a change state event. It extracts required information from the event object and uses this information to change state.

Parameters:
event - com.ibm.btt.base.DSEEventObject
Throws:
DSEProcessorException

getInputFormatTag

public Tag getInputFormatTag()
Returns the input format tag attribute of this class.

Specified by:
getInputFormatTag in interface FormatEnabledState
Returns:
com.ibm.btt.base.Tag

setInputFormatTag

public void setInputFormatTag(Tag newInputFormatTag)
Sets the input format tag property.

Specified by:
setInputFormatTag in interface FormatEnabledState
Parameters:
newInputFormatTag - com.ibm.btt.base.Tag

getOutputFormatTag

public Tag getOutputFormatTag()
Returns the output format tag attribute of this class.

Specified by:
getOutputFormatTag in interface FormatEnabledState
Returns:
com.ibm.btt.base.Tag

setOutputFormatTag

public void setOutputFormatTag(Tag newOutputFormatTag)
Sets the output format tag property.

Specified by:
setOutputFormatTag in interface FormatEnabledState
Parameters:
newOutputFormatTag - com.ibm.btt.base.Tag

processQueue

protected void processQueue(Vector otherTrigs)
                     throws DSEInvalidArgumentException,
                            DSEProcessorException
Processes the events queue of the processor. The behavior is the same as the parent's behavior so take care when changing the parent's activate method.

Parameters:
otherTrigs - Vector
Throws:
DSEInvalidArgumentException
DSEProcessorException

processEventQueue

protected void processEventQueue(Vector otherTrigs)
                          throws DSEInvalidArgumentException,
                                 DSEProcessorException
Provides an internal routine for the activate() method. It loops and processes the eventQueue:
  1. Gets an event out of the eventQueue
  2. Checks to see if the event is changeState (if so, executes the change)
  3. Gets the transitions for the event
  4. Loops the actions for those transitions
    1. Instantiates the Action
    2. Chains or assigns its context
    3. Registers the Automaton's interest in events fired by the Action (if there are any events) by adding the current State to its handlerslist
    4. Loops through any conditions the action may have, instantiating and evaluating each condition
    5. Executes the action the loop is on
    6. Removes the handler and event(s) from its list if it registered the Automaton's interest
    7. Unchains its context if it was chained
    8. Closes the action
  5. Lastly, changes to the next state (by adding a "changeState" event to the queue) if there is nothing else to do in this state (that is, no more event/transition pairs to cycle through this method) and there is a targetState specified in the last transition

Overrides:
processEventQueue in class DSEState
Parameters:
otherTrigs - com.ibm.btt.base.Vector
Throws:
DSEInvalidArgumentException
DSEProcessorException

doDataMapping

protected void doDataMapping(DataMapperFormat format,
                             Context sourceCtx,
                             Context targetCtx)
                      throws DSEException
This utility method maps data from the source context to the target context using the supplied DataMapperFormat.

Parameters:
format - com.ibm.btt.base.DataMapperFormat
sourceCtx - com.ibm.btt.base.Context
targetCtx - com.ibm.btt.base.Context
Throws:
DSEException

signalEvent

protected void signalEvent()
                    throws DSEProcessorException
Creates and signals the event that the state processes. This method builds the event from event information received from the state. The constructed event is used to change the state.

Throws:
DSEProcessorException

fireDSEChangeStateEvent

protected void fireDSEChangeStateEvent(java.lang.String targetStateName,
                                       boolean ignoreEntryActionsFlag,
                                       boolean ignoreExitActionsFlag,
                                       java.lang.String transitionName)
                                throws DSEProcessorException
Dispatches a change state event with required information.

Parameters:
targetStateName - java.lang.String
ignoreEntryActionsFlag - boolean
ignoreExitActionsFlag - boolean
transitionName - java.lang.String
Throws:
DSEProcessorException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011