IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.automaton
Class DSEProcessor

java.lang.Object
  extended by com.ibm.btt.base.DSENotifier
      extended by com.ibm.btt.automaton.DSEProcessor
All Implemented Interfaces:
Executable, Processor, Cacheable, Notifier, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
BTTXUIProcessor, DSEHtmlProcessor, DSEOperationProcessor

public class DSEProcessor
extends DSENotifier
implements Processor, Externalizable, Cacheable

This class is the default implementation of a Processor.

Events fired by a DSEProcessor:

See Also:
Serialized Form

Field Summary
static java.lang.String ABORTED
           
protected  ProcessorStatusChangedListener aProcessorStatusChangedListener
           
static java.lang.String CHANGESTATE
           
static java.lang.String CLEAN_EVENTS_QUEUE_ON_SWITCH
           
protected  boolean cleanQueueOnSwitch
           
static java.lang.String COMPLETED
           
protected  Context context
           
protected  State currentState
           
protected  Queue eventQueue
           
static ProcessorExternalizer externalizer
           
static java.lang.String INITIALIZED
           
static java.lang.String NOT_INITIALIZED
           
protected  java.lang.String processorId
           
protected  java.lang.String processorName
           
static java.lang.String RUNNING
           
protected  Tag stateTag
           
protected  java.lang.String status
           
static java.lang.String STATUSCHANGEEVENT
           
static java.lang.String SUSPENDED
           
static java.lang.String TERMINATEEVENT
           
 
Fields inherited from class com.ibm.btt.base.DSENotifier
handlersList, name
 
Fields inherited from interface com.ibm.btt.automaton.Processor
COMPID
 
Constructor Summary
DSEProcessor()
          Creates an instance of type DSEProcessor.
DSEProcessor(boolean mustRegister)
          Creates an instance of type DSEProcessor.
DSEProcessor(java.lang.String aName)
          Creates an instance of type DSEProcessor.
DSEProcessor(java.lang.String aName, java.lang.String aTID)
          Creates an instance of type DSEProcessor.
 
Method Summary
 void abort()
          Ends the flow of the processor using the current State.
 void addProcessorStatusChangedListener(ProcessorStatusChangedListener param)
          Adds a listener to the processor's STATUSCHANGEEVENT and TERMINATEDEVENT.
 void changeState(java.lang.String newState)
          Terminates the currentState, gets the Tag (using the newState param passed in) to reinitialize the currentState object with the newState.
 void changeState(java.lang.String newState, boolean ignoreEntryActionsValue)
          Terminates the currentState, gets the Tag (using the newState param passed in) to reinitialize the currentState object with the newState.
 void cleanEventQueue()
          Clears the events in the eventQueue by replacing with a new Queue!
 void clearKeyedCollection(boolean keepKCollStatus, boolean clearOnlyValues)
          This method clears both the typed and non-typed elements in the processor context.
 void close()
          Unchains the context and closes the action, which releases the currentState and eventQueue objects.
 void execute()
          Executes the Processor.
 Externalizer externalizer()
          Gets the externalizer instance used to build the processor.
protected  void fireProcessorStatusChangedEvent(ProcessorStatusChangedEvent event)
          Supports listener events.
protected  void fireProcessorTerminatedEvent(ProcessorTerminatedEvent event)
          Supports listener events.
 Context getContext()
          Returns the value of the context property.
 State getCurrentState()
          Returns the value of the currentState property.
 java.lang.String getCurrentStateType()
          Returns the current State's Type.
 Queue getEventQueue()
          Returns the value of the eventQueue property.
static ProcessorExternalizer getExternalizer()
          Gets the externalizer instance used to build the processor.
 Tag getInitialStateTag()
          Gets the current processor's Tag using getTag(), extracts the State's subTags from it, and iterates through those subTags to find and return the one that matches the tagName passed in as a String.
 java.lang.String getProcessorId()
          Returns the value of the processorId property.
 java.lang.String getProcessorName()
          Returns the value of the processorName property.
 java.util.Map getRefServiceTags()
           
 Service getService(java.lang.String aServiceName)
          Returns the service named aServiceName from the processor.
 Tag getStateTag(java.lang.String tagName)
          Gets the current processor's Tag using getTag(), extracts the State's subTags from it, and iterates through those subTags to find and return the one that matches the tagName passed in as a String.
 Vector getStateTagList()
          Returns a vector of the state Tags for a processor.
 java.lang.String getStatus()
          Returns the value of the status property.
 Tag getTag()
          Returns the stateTag field.
 void initialize()
          Initializes the Processor by looking for the "initial" state Tag, instantiates that Tag into an object, and sets it into the currentState.
 java.lang.Object initializeFrom(Tag aTag)
          Uses the processor's Tag attributes to initialize a Processor with an Id, the cleanEventQueueOnSwitch field, and a context.
 java.lang.Object initializeKeyedCollectionValueFrom(Tag aTag)
          Initializes a collection of values from aTag.
 boolean isCacheable()
          Checks whether this particular object can be cached.
 boolean isCleanQueueOnSwitch()
          Returns the value of the isCleanQueueOnSwitch property.
 void readExternal()
          Initializes a dataElement with its external value.
 void readExternal(java.io.ObjectInput in)
          Invokes the object creation from an ObjectInput.
static java.lang.Object readObject(java.lang.String aName)
          Returns an Object, which is instance of the operation named aName.
 void reinitialize()
          Reinitializes THIS object.
 void removeExternal()
          Removes the Externalizer.
 void resume()
          Resumes a suspended processor.
 void setCleanQueueOnSwitch(boolean newCleanQueueOnSwitch)
          Returns the value of the setCleanQueueOnSwitch property.
 void setContext(Context newContext)
          Sets the value of the context property.
 void setCurrentState(State newState)
          Sets the value of the currentState property.
 void setCurrentStateType(java.lang.String newStateType)
          Sets the value of the CurrentStateType property.
 void setEventQueue(Queue newEventQueue)
          Sets the value of the eventQueue property.
static void setExternalizer(ProcessorExternalizer anExternalizer)
          Sets the externalizer instance used to build.
 void setProcessorId(java.lang.String newProcessorId)
          Sets the value of the processorId property.
 void setProcessorName(java.lang.String newProcessorName)
          Sets the value of the processorName property.
 void setStatus(java.lang.String newStatus)
          Sets the value of the status property.
 void setTag(Tag aTag)
          Sets the tag used to initialize a DSEState object to the tag passed in as a parameter.
 void suspend()
          Suspends the process.
 void terminate()
          Provides a housekeeping processor for the notifier (DSEProcessor) instance.
 java.lang.String toString()
          Returns a String representing the processor.
 Vector toStrings()
          Returns a Vector with the String representation of the object.
 Vector toTags()
          Returns a Vector with the object represented as a Tag.
 void writeExternal()
          Writes this instance (converted into tags) to a file.
 void writeExternal(java.io.ObjectOutput out)
          Provides concrete serialization handling for DSEProcessor.
 
Methods inherited from class com.ibm.btt.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
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.Processor
addHandler, getHandlersList, signalEvent
 
Methods inherited from interface com.ibm.btt.base.Cacheable
getName
 
Methods inherited from interface com.ibm.btt.base.Externalizable
getName, setName
 

Field Detail

externalizer

public static ProcessorExternalizer externalizer

currentState

protected State currentState

NOT_INITIALIZED

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

INITIALIZED

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

RUNNING

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

ABORTED

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

SUSPENDED

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

COMPLETED

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

CHANGESTATE

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

status

protected java.lang.String status

context

protected Context context

processorId

protected java.lang.String processorId

processorName

protected java.lang.String processorName

stateTag

protected Tag stateTag

eventQueue

protected Queue eventQueue

cleanQueueOnSwitch

protected boolean cleanQueueOnSwitch

STATUSCHANGEEVENT

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

TERMINATEEVENT

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

CLEAN_EVENTS_QUEUE_ON_SWITCH

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

aProcessorStatusChangedListener

protected transient ProcessorStatusChangedListener aProcessorStatusChangedListener
Constructor Detail

DSEProcessor

public DSEProcessor()
Creates an instance of type DSEProcessor.


DSEProcessor

public DSEProcessor(java.lang.String aName)
Creates an instance of type DSEProcessor.

Parameters:
aName - java.lang.String

DSEProcessor

public DSEProcessor(java.lang.String aName,
                    java.lang.String aTID)
Creates an instance of type DSEProcessor.

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

DSEProcessor

public DSEProcessor(boolean mustRegister)
Creates an instance of type DSEProcessor.

Parameters:
mustRegister - boolean
Method Detail

abort

public void abort()
           throws DSEProcessorException
Ends the flow of the processor using the current State.

Specified by:
abort in interface Processor
Throws:
DSEProcessorException

addProcessorStatusChangedListener

public void addProcessorStatusChangedListener(ProcessorStatusChangedListener param)
Adds a listener to the processor's STATUSCHANGEEVENT and TERMINATEDEVENT.

Specified by:
addProcessorStatusChangedListener in interface Processor
Parameters:
param - com.ibm.btt.automaton.ProcessorStatusChangedListener

changeState

public void changeState(java.lang.String newState)
                 throws DSEProcessorException
Terminates the currentState, gets the Tag (using the newState param passed in) to reinitialize the currentState object with the newState. The method then checks to see if the value cleanQueueOnSwitch is set to true, and if so, cleans the event queue before activating the state, otherwise (that is, if cleanEventQueueOnSwitch is false) the new State is activated without a call to the cleanEventQueue method. See changeState(String, boolean)

Parameters:
newState - java.lang.String
Throws:
DSEProcessorException

changeState

public void changeState(java.lang.String newState,
                        boolean ignoreEntryActionsValue)
                 throws DSEProcessorException
Terminates the currentState, gets the Tag (using the newState param passed in) to reinitialize the currentState object with the newState. The method then checks to see if the value cleanQueueOnSwitch is set to true, and if so, cleans the event queue before activating the state, otherwise (that is, if cleanEventQueueOnSwitch is false) the new State is activated without a call to the cleanEventQueue method.

Specified by:
changeState in interface Processor
Parameters:
newState - java.lang.String
ignoreEntryActionsValue - boolean
Throws:
DSEProcessorException

cleanEventQueue

public void cleanEventQueue()
Clears the events in the eventQueue by replacing with a new Queue!


clearKeyedCollection

public void clearKeyedCollection(boolean keepKCollStatus,
                                 boolean clearOnlyValues)
                          throws java.io.IOException
This method clears both the typed and non-typed elements in the processor context. It can clear only the elements of the kColl and keep the kColl attributes. and for the kColl elements it is possible to clear only the values or to clear all the attributes.

Parameters:
keepKCollStatus - boolean (false - clear also the context kColl attributes; true - keep the context kColl attributes and clear only the kColl data elements)
clearOnlyValues - boolean (false - clear all attributes of the context kColl data elements; true - clear only kColl data elements values)
Throws:
java.io.IOException - - this exception occurs if the keyed collection is not defined neither in the generic files nor in the self defined file

close

public void close()
           throws DSEInvalidRequestException,
                  DSEObjectNotFoundException
Unchains the context and closes the action, which releases the currentState and eventQueue objects.

Specified by:
close in interface Processor
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException

execute

public void execute()
             throws DSEInvalidArgumentException,
                    DSEProcessorException
Executes the Processor.

Specified by:
execute in interface Executable
Throws:
DSEInvalidRequestException
DSEObjectNotFoundException
DSEInvalidArgumentException
DSEProcessorException

externalizer

public Externalizer externalizer()
                          throws java.io.IOException
Gets the externalizer instance used to build the processor. This method is an Externalizable interface method.

Returns:
com.ibm.btt.base.Externalizer
Throws:
java.lang.IOException
java.io.IOException

fireProcessorStatusChangedEvent

protected void fireProcessorStatusChangedEvent(ProcessorStatusChangedEvent event)
Supports listener events.

Parameters:
event - com.ibm.btt.automaton.ProcessorStatusChangedEvent

fireProcessorTerminatedEvent

protected void fireProcessorTerminatedEvent(ProcessorTerminatedEvent event)
Supports listener events.

Parameters:
event - com.ibm.btt.automaton.ProcessorTerminatedEvent

getContext

public Context getContext()
Returns the value of the context property.

Specified by:
getContext in interface Processor
Returns:
com.ibm.btt.base.Context

getCurrentState

public State getCurrentState()
Returns the value of the currentState property.

Specified by:
getCurrentState in interface Processor
Returns:
com.ibm.btt.automaton.State

getCurrentStateType

public java.lang.String getCurrentStateType()
Returns the current State's Type.

Specified by:
getCurrentStateType in interface Processor
Returns:
java.lang.String

getEventQueue

public Queue getEventQueue()
Returns the value of the eventQueue property.

Specified by:
getEventQueue in interface Processor
Returns:
com.ibm.btt.automaton.Queue

getExternalizer

public static ProcessorExternalizer getExternalizer()
                                             throws java.io.IOException
Gets the externalizer instance used to build the processor. This method is an Externalizable interface method.

Returns:
com.ibm.btt.automaton.ProcessorExternalizer
Throws:
java.io.IOException

getInitialStateTag

public Tag getInitialStateTag()
Gets the current processor's Tag using getTag(), extracts the State's subTags from it, and iterates through those subTags to find and return the one that matches the tagName passed in as a String.

Specified by:
getInitialStateTag in interface Processor
Returns:
com.ibm.btt.base.Tag

getProcessorId

public java.lang.String getProcessorId()
Returns the value of the processorId property.

Specified by:
getProcessorId in interface Processor
Returns:
java.lang.String

getProcessorName

public java.lang.String getProcessorName()
Returns the value of the processorName property.

Specified by:
getProcessorName in interface Processor
Returns:
java.lang.String

getStateTag

public Tag getStateTag(java.lang.String tagName)
Gets the current processor's Tag using getTag(), extracts the State's subTags from it, and iterates through those subTags to find and return the one that matches the tagName passed in as a String.

Specified by:
getStateTag in interface Processor
Parameters:
tagName - java.lang.String
Returns:
com.ibm.btt.base.Tag

getStateTagList

public Vector getStateTagList()
Returns a vector of the state Tags for a processor.

Specified by:
getStateTagList in interface Processor
Returns:
com.ibm.btt.base.Vector

getStatus

public java.lang.String getStatus()
Returns the value of the status property.

Specified by:
getStatus in interface Processor
Returns:
java.lang.String

getTag

public Tag getTag()
Returns the stateTag field.

Specified by:
getTag in interface Processor
Returns:
com.ibm.btt.base.Tag

initialize

public void initialize()
                throws java.io.IOException,
                       DSEException,
                       DSEProcessorException
Initializes the Processor by looking for the "initial" state Tag, instantiates that Tag into an object, and sets it into the currentState.

Specified by:
initialize in interface Processor
Throws:
java.io.IOException
DSEException
DSEProcessorException

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException,
                                       DSEProcessorException
Uses the processor's Tag attributes to initialize a Processor with an Id, the cleanEventQueueOnSwitch field, and a context. The method also sets the procId field with a unique hash id, and the processor's Notifier name (inherited from BTTProcessorNotifier). After completing this, the processor's Tag is stored in an instance variable so that when a State is ready to be instantiated, the State subTags can be extracted from this tag. Before exiting, the method calls initialize().

This method is an Externalizable interface method.

Parameters:
aTag - com.ibm.btt.base.Tag Contains the name and attributes of the object to be created.
Returns:
Object - An instance of DSEProcessor.
Throws:
java.io.IOException - The object can not be created.
DSEException
DSEProcessorException

initializeKeyedCollectionValueFrom

public java.lang.Object initializeKeyedCollectionValueFrom(Tag aTag)
                                                    throws java.io.IOException
Initializes a collection of values from aTag.

Parameters:
aTag - com.ibm.btt.base.Tag
Returns:
java.lang.Object
Throws:
java.io.IOException

isCacheable

public boolean isCacheable()
Checks whether this particular object can be cached.

Specified by:
isCacheable in interface Cacheable
Returns:
boolean - True if the object can be cached

isCleanQueueOnSwitch

public boolean isCleanQueueOnSwitch()
Returns the value of the isCleanQueueOnSwitch property.

Returns:
boolean

readExternal

public void readExternal()
                  throws java.io.IOException
Initializes a dataElement with its external value. This instance requires an id (name) and the Externalizer and its tagInputStream are initialized. This method is an Externalizable interface method.

Throws:
java.io.IOException - Signals that an I/O exception of some sort has occurred.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Invokes the object creation from an ObjectInput.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - java.io.ObjectInput
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readObject

public static java.lang.Object readObject(java.lang.String aName)
                                   throws java.io.IOException
Returns an Object, which is instance of the operation named aName. The operation Externalizer reads the corresponding definition file to find the object. This method throws an IOException if the externalizer is not initialized.

This method is an Externalizable interface method.

Throws:
java.io.IOException

reinitialize

public void reinitialize()
Reinitializes THIS object. This method should be called immediately after being extracted from the cache.

Specified by:
reinitialize in interface Cacheable

removeExternal

public void removeExternal()
                    throws java.io.IOException
Removes the Externalizer. This method is an Externalizable interface method.

Throws:
java.lang.IOException
java.io.IOException

resume

public void resume()
Resumes a suspended processor.

Specified by:
resume in interface Processor

setCleanQueueOnSwitch

public void setCleanQueueOnSwitch(boolean newCleanQueueOnSwitch)
Returns the value of the setCleanQueueOnSwitch property.

Parameters:
newCleanQueueOnSwitch - boolean

setContext

public void setContext(Context newContext)
Sets the value of the context property.

Specified by:
setContext in interface Processor
Parameters:
newContext - com.ibm.btt.base.Context

setCurrentState

public void setCurrentState(State newState)
Sets the value of the currentState property.

Specified by:
setCurrentState in interface Processor
Parameters:
newState - State

setCurrentStateType

public void setCurrentStateType(java.lang.String newStateType)
Sets the value of the CurrentStateType property.

Specified by:
setCurrentStateType in interface Processor
Parameters:
newStateType - java.lang.String

setEventQueue

public void setEventQueue(Queue newEventQueue)
Sets the value of the eventQueue property.

Parameters:
newEventQueue - com.ibm.btt.automaton.Queue

setExternalizer

public static void setExternalizer(ProcessorExternalizer anExternalizer)
Sets the externalizer instance used to build. This method is an Externalizable interface method.


setProcessorId

public void setProcessorId(java.lang.String newProcessorId)
Sets the value of the processorId property.

Specified by:
setProcessorId in interface Processor
Parameters:
newProcessorId - java.lang.String

setProcessorName

public void setProcessorName(java.lang.String newProcessorName)
Sets the value of the processorName property.

Specified by:
setProcessorName in interface Processor
Parameters:
newProcessorName - java.lang.String

setStatus

public void setStatus(java.lang.String newStatus)
Sets the value of the status property. The method fires a DSEProcess.STATUSCHANGEEVENT with the parameter "status" = newStatus

Specified by:
setStatus in interface Processor
Parameters:
newStatus - java.lang.String

setTag

public void setTag(Tag aTag)
Sets the tag used to initialize a DSEState object to the tag passed in as a parameter.

Specified by:
setTag in interface Processor
Parameters:
newTag - com.ibm.btt.base.Tag

suspend

public void suspend()
Suspends the process.

Specified by:
suspend in interface Processor

terminate

public void terminate()
               throws DSEException,
                      DSEProcessorException
Provides a housekeeping processor for the notifier (DSEProcessor) instance. This is called either from the application or from the context when it is destroyed or unchained. Status is set to COMPLETED, and a "terminate event" event object is instantiated.

Subclasses should overwrite this implementation to perform the actions required to release the resources acquired by the notifier.

Specified by:
terminate in interface Processor
Specified by:
terminate in interface Notifier
Overrides:
terminate in class DSENotifier
Throws:
DSEException
com.ibm.btt.base.DSEProcessorException
DSEProcessorException

toString

public java.lang.String toString()
Returns a String representing the processor.

Overrides:
toString in class java.lang.Object
Returns:
java.lang.String.

toStrings

public Vector toStrings()
Returns a Vector with the String representation of the object. This method is an Externalizable interface method.

Returns:
com.ibm.btt.base.Vector

toTags

public Vector toTags()
              throws java.io.IOException
Returns a Vector with the object represented as a Tag. This method is an Externalizable interface method.

Returns:
com.ibm.btt.base.Vector
Throws:
java.io.IOException

writeExternal

public void writeExternal()
                   throws java.io.IOException
Writes this instance (converted into tags) to a file. This method is an Externalizable interface method.

Throws:
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Provides concrete serialization handling for DSEProcessor.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - java.io.ObjectOutput
Throws:
java.io.IOException

getRefServiceTags

public java.util.Map getRefServiceTags()
Returns:
Returns the serviceTags.

getService

public Service getService(java.lang.String aServiceName)
                   throws DSEObjectNotFoundException
Returns the service named aServiceName from the processor.

This method throws a DSEObjectNotFoundException if the service is not found.

Throws:
DSEObjectNotFoundException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2010