|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.dse.base.DSEHandler | +--com.ibm.dse.automaton.DSEState
Implementation of a state inside the automaton.
The State will start processing the eventQueue after the entryActions are done. Note that after a suspend, abort or terminate method is invoked, the State WILL finish processing the current event's actions before stopping. If it is waiting for an event from the queue, it will stop waiting and return.
A suspended state will be sleeping for a period of SUSPENDTIME until it checks for the RunningModeFlag again. It can be woken up by calling the resume() method. A suspended State will wake up and exit when terminate or abort is called.
Field Summary | |
static int |
ABORT_PROCESS
|
protected Vector |
actionHandlers
|
static int |
CHANGE_STATE
|
static int |
CONTINUE
|
static java.lang.String |
DEFAULT_TYPE
|
protected boolean |
done
|
protected Vector |
entryActionsTags
|
static int |
EXECUTE_ACTION_AND_CHANGESTATE
|
protected Vector |
exitActionsTags
|
protected java.lang.String |
exitEventName
|
static java.lang.String |
FINAL_TYPE
|
protected boolean |
ignoreEntryActions
|
static java.lang.String |
INITIAL_TYPE
|
protected java.lang.String |
name
|
static java.lang.String |
PAGE_TYPE
|
protected java.lang.Thread |
pqThread
|
protected Processor |
processor
|
protected boolean |
runningModeFlag
|
protected Hashtable |
sharedNotifiers
|
static int |
SKIP_ACTION
|
static int |
SKIP_ALL_ACTIONS
|
static int |
SKIP_CONDITIONS
|
static java.lang.String |
SUBFLOW_TYPE
|
protected java.lang.Thread |
suspendedThread
|
protected static int |
SUSPENDTIME
|
protected Tag |
tag
|
protected Hashtable |
transitions
|
protected java.lang.String |
type
|
protected java.lang.String |
typeIdInfo
|
Constructor Summary | |
DSEState()
|
Method Summary | |
void |
abort()
Aborts the State. |
void |
activate()
Activates the State. |
protected boolean |
addHandlersForAction(Action action,
Vector triggers)
A utility method that adds handlers to the supplied Action object, using event names from the supplied triggers. |
Handler |
dispatchEvent(DSEEventObject anEvent)
Puts the event anEvent into a processor's event queue. |
protected void |
doEntryActions(Vector otherTrigs)
An internal routine for Activate() that executes the entryActions. |
protected void |
doExitActions()
An internal routine for Activate() that executes the exitActions. |
Externalizer |
externalizer()
This method gets the externalizer instance used to build. |
protected void |
fireDSEChangeStateEvent(java.lang.String targetStateName)
Calls the other fireDSEChangeStateEvent(String, boolean), passing in the targetStateName, and the default false for the isIgnoreEntryActions flag. |
protected void |
fireDSEChangeStateEvent(java.lang.String targetStateName,
java.lang.Boolean isIgnoreEntryActions)
Fires the internal DSEChangeStateEvent with a hashtable containing the values for the targetStateName and isIgnoreEntryActions. |
protected void |
fireDSEChangeStateEvent(java.lang.String targetStateName,
java.lang.Boolean isIgnoreEntryActions,
java.lang.Boolean isIgnoreExitActions)
Fires the internal DSEChangeStateEvent with a hashtable containing the values for the targetStateName, ignoreEntryActions and ignoreExitActions |
Vector |
getEntryActions()
Returns the vector of entryActionsTags. |
Vector |
getExitActions()
Returns the vector of exitActionsTags. |
protected int |
getGuardConditionResult(Action action,
GuardCondition condition)
Evaluates the guardcondition to true or false, and returns the appropriate constant int equavalent for the value of the flow modifier defined in the external file. |
Action |
getInstanceOfAction(Tag actionTag)
Returns an instance of the action from Tag actionTag by calling convertTagToObject(), which in turn calls initializeFrom(Tag). |
java.lang.String |
getName()
Returns the value of the State's name property. |
Processor |
getProcessor()
Returns the value of the processor property. |
Tag |
getTag()
Returns the value of the tag property. |
Hashtable |
getTransitions()
Returns the value of the transitions property. |
java.lang.String |
getType()
Returns the value of the State's type property. |
java.lang.String |
getTypeIdInfo()
Returns the value of the State's typeIdInfo property. |
java.lang.Object |
initializeFrom(Tag aTag)
This method begins by resetting the state attributes to null, so the state object can be reused, then the method uses the Tag of the current state to initialize a State with an Id, type, and the typeIdInfo. |
boolean |
isIgnoreEntryActions()
Returns the value of the ignoreEntryActions flag. |
boolean |
isRunningModeFlag()
Returns the value of the runningModeFlag property. |
protected void |
processEventQueue(Vector otherTrigs)
An internal routine for Activate() Loops and processes the eventQueue: -gets an event out of the eventQueue -checks to see if the event is changeState (if so, executes the change) -gets the transitions for the event -loops the actions for those transitions -instantiates the Action -chains or assigns its context -registers the Automaton's interest in events fired by the Action (IF there are any events) by adding the current State to its handlerslist -loops through any conditions the action may have, instantiating and evaluating each condition one by one -executes the action the loop is on -removes the handler and event(s) from its list IF it registered the Automaton's interest -unchains its context IF it was chained -closes the action -lastly, changes to the next state (by adding a "changeState" event to the queue) IF there is nothing else to do in this state (i.e. |
void |
readExternal()
This method will find the tag that corresponds to the name of THIS entity. |
void |
readExternal(java.io.ObjectInput in)
Invokes the object creation from an ObjectInput. |
void |
removeExternal()
Removes the Externalizer. |
protected boolean |
removeHandlersForAction(Action action)
This method removes the DSEState and DSEEvent pair that was added to the action's handlerslist when the action was created. |
protected boolean |
removeHandlersForAction(Action action,
Vector triggers)
Deprecated. |
void |
resume()
Method to resume the processor. |
void |
setEntryActions(Vector newEntryActions)
Sets the value of the entryActions property. |
void |
setExitActions(Vector newExitActions)
Sets the value of the exitActions property. |
void |
setIgnoreEntryActions(boolean newIgnoreEntryActions)
Sets the value of the ignoreEntryActions flag. |
void |
setName(java.lang.String newName)
Sets the value of the name property. |
void |
setProcessor(Processor newProcessor)
Sets the value of the processor property. |
void |
setTag(Tag newTag)
Sets the value of the tag property. |
void |
setTransitions(Hashtable newTransitions)
Sets the value of the transitions property. |
void |
setType(java.lang.String newType)
Sets the value of the type property. |
void |
setTypeIdInfo(java.lang.String newTypeIdInfo)
Sets the value of the typeIdInfo property. |
protected Vector |
subscribeToShareNotifiers()
A subroutine for Activate(). |
void |
suspend()
Suspends the State. |
void |
terminate()
Provides a housekeeping process for the DSEState as a notifier instance. |
java.lang.String |
toString()
Returns a String representing the state. |
Vector |
toStrings()
Returns a Vector with the String representation of the object. |
Vector |
toTags()
Returns a Vector with the object represented as a Tag. |
protected void |
unsubscribeToSharedNotifiers()
Invoked to loop through the list of TransitionDescriptors and try to remove interest for the events generated by a Notifier or Service in the context. |
void |
writeExternal()
Writes this instance (converted into tags) to a file. |
void |
writeExternal(java.io.ObjectOutput out)
Provides concrete serialization handling for DSEState. |
Methods inherited from class com.ibm.dse.base.DSEHandler |
handleEvent,
handleEvent,
stopHandlingEvent,
stopHandlingEvent |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected boolean runningModeFlag
protected Processor processor
protected Vector entryActionsTags
protected Vector exitActionsTags
protected java.lang.String name
protected Hashtable transitions
public static final int CONTINUE
public static final int SKIP_CONDITIONS
public static final int SKIP_ACTION
public static final int SKIP_ALL_ACTIONS
public static final int ABORT_PROCESS
public static final int CHANGE_STATE
public static final int EXECUTE_ACTION_AND_CHANGESTATE
protected Tag tag
protected java.lang.Thread pqThread
protected boolean done
protected java.lang.Thread suspendedThread
protected static final int SUSPENDTIME
protected boolean ignoreEntryActions
public static final java.lang.String DEFAULT_TYPE
public static final java.lang.String PAGE_TYPE
public static final java.lang.String SUBFLOW_TYPE
public static final java.lang.String FINAL_TYPE
public static final java.lang.String INITIAL_TYPE
protected java.lang.String type
protected java.lang.String typeIdInfo
protected java.lang.String exitEventName
protected Vector actionHandlers
protected Hashtable sharedNotifiers
Constructor Detail |
public DSEState()
Method Detail |
public void abort() throws DSEProcessorException
public void activate() throws DSEInvalidArgumentException, DSEProcessorException
When it is suspended, a State will sleep for a SUSPENDTIME so that it will not hog up CPU time. It can be awakened by resume(), abort() or terminate().
protected boolean addHandlersForAction(Action action, Vector triggers)
action
- com.ibm.dse.html.automaton.Actiontriggers
- java.util.Vectorpublic Handler dispatchEvent(DSEEventObject anEvent)
anEvent contains relevant data to be used by the event handler held in a Hashtable, the source of the event and the event name. Any handler is responsible for implementing this method, to check if it is interested in the event and/or pass it to the next interested handler in the chain that is waiting for it.
If the method returns this, the notifier passes the event to the following handler in the chain waiting for it. If the method returns null, the event is not propagated.
The default event processing is to pass the event to the following handler.
anEvent
- DSEEventObjectprotected void doEntryActions(Vector otherTrigs) throws DSEInvalidArgumentException, DSEProcessorException
triggerList
- com.ibm.dse.base.Vectorprotected void doExitActions() throws DSEInvalidArgumentException, DSEProcessorException
public Externalizer externalizer() throws java.io.IOException
protected void fireDSEChangeStateEvent(java.lang.String targetStateName) throws DSEProcessorException
targetStateName
- java.lang.Stringprotected void fireDSEChangeStateEvent(java.lang.String targetStateName, java.lang.Boolean isIgnoreEntryActions) throws DSEProcessorException
targetStateName
- java.lang.Stringprotected void fireDSEChangeStateEvent(java.lang.String targetStateName, java.lang.Boolean isIgnoreEntryActions, java.lang.Boolean isIgnoreExitActions) throws DSEProcessorException
targetStateName
- java.lang.StringisIgnoreEntryActions
- java.lang.BooleanisIgnoreExitActions
- java.lang.Booleanpublic Vector getEntryActions()
public Vector getExitActions()
protected int getGuardConditionResult(Action action, GuardCondition condition) throws DSEProcessorException
action
- com.ibm.dse.automaton.Actioncondition
- com.ibm.dse.automaton.GuardConditionpublic Action getInstanceOfAction(Tag actionTag) throws DSEProcessorException
actionTag
- com.ibm.dse.base.Tagpublic java.lang.String getName()
public Processor getProcessor()
public Tag getTag()
public Hashtable getTransitions()
public java.lang.String getType()
public java.lang.String getTypeIdInfo()
public java.lang.Object initializeFrom(Tag aTag) throws java.io.IOException, DSEException
aTag
- com.ibm.dse.base.Tag Contains the name and attributes of the object to be created.public boolean isIgnoreEntryActions()
public boolean isRunningModeFlag()
protected void processEventQueue(Vector otherTrigs) throws DSEInvalidArgumentException, DSEProcessorException
otherTrigs
- com.ibm.dse.base.Vectorpublic void readExternal() throws java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- java.io.ObjectInputpublic void removeExternal() throws java.io.IOException
protected boolean removeHandlersForAction(Action action)
action
- com.ibm.dse.automaton.Actiontriggers
- java.util.Vectorprotected boolean removeHandlersForAction(Action action, Vector triggers)
public void resume()
public void setEntryActions(Vector newEntryActions)
newEntryActions
- com.ibm.dse.base.Vectorpublic void setExitActions(Vector newExitActions)
newEntryActions
- com.ibm.dse.base.Vectorpublic void setIgnoreEntryActions(boolean newIgnoreEntryActions)
newIgnoreEntryActions
- booleanpublic void setName(java.lang.String newName)
newName
- java.lang.Stringpublic void setProcessor(Processor newProcessor)
newProcessor
- com.ibm.dse.automaton.Processorpublic void setTag(Tag newTag)
newTag
- com.ibm.dse.base.Tagpublic void setTransitions(Hashtable newTransitions)
newTransitions
- com.ibm.dse.base.Hashtablepublic void setType(java.lang.String newType)
newType
- java.lang.Stringpublic void setTypeIdInfo(java.lang.String newTypeIdInfo)
newTypeIdInfo
- java.lang.Stringprotected Vector subscribeToShareNotifiers() throws DSEInvalidArgumentException
public void suspend()
public void terminate()
public java.lang.String toString()
public Vector toStrings()
public Vector toTags() throws java.io.IOException
protected void unsubscribeToSharedNotifiers()
public void writeExternal() throws java.io.IOException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
out
- java.io.ObjectOutput
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |