com.instantbank.servicing.control.ejb
Class StateMachine

java.lang.Object
  |
  +--com.instantbank.servicing.control.ejb.StateMachine
All Implemented Interfaces:
java.io.Serializable

public class StateMachine
extends java.lang.Object
implements java.io.Serializable

This class is a Universal front back end of an application which ties all EJB components together dynamically at runtime. It is a javaBean which works for Controller EJB. This class should not be updated to handle various event types. This class will use StateHandler objects to handle events that require processing beyond the scope of this class. A second option to event handling is to do so in the XML descriptor itself. State may be stored in the attributeMap Configuration of this file is via an XML descriptor.

Author:
Instant-bank (Consuelo Franky)
See Also:
Serialized Form

Field Summary
private  java.util.HashMap attributeMap
           
private  Debug debug
           
private  java.util.HashMap handlerMap
           
private  ModelUpdateManager mum
           
private  javax.ejb.SessionContext sc
           
private  ServicingControllerEJB sccejb
           
 
Constructor Summary
StateMachine(ServicingControllerEJB sccejb, javax.ejb.SessionContext sc)
          constructor: instances attributes
 
Method Summary
 java.lang.Object getAttribute(java.lang.String key)
          get value of user session attribute
private  java.lang.String getHandlerName(java.lang.String eventName)
          get in context the name of handler class for the event
 ServicingControllerEJB getServicingControllerEJB()
          get reference to controller ejb
 javax.ejb.SessionContext getSessionContext()
          get SessionContext
 java.util.Collection handleEvent(ServicingEvent ese)
          process event corresponding to user request, through associated handler
 void setAttribute(java.lang.String key, java.lang.Object value)
          register a attribute of the user session
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

sccejb

private ServicingControllerEJB sccejb

mum

private ModelUpdateManager mum

attributeMap

private java.util.HashMap attributeMap

handlerMap

private java.util.HashMap handlerMap

sc

private javax.ejb.SessionContext sc

debug

private Debug debug
Constructor Detail

StateMachine

public StateMachine(ServicingControllerEJB sccejb,
                    javax.ejb.SessionContext sc)
constructor: instances attributes
Parameters:
sccejb - controller ejb
sc - context
Method Detail

handleEvent

public java.util.Collection handleEvent(ServicingEvent ese)
                                 throws java.rmi.RemoteException,
                                        ServicingEventException
process event corresponding to user request, through associated handler
Parameters:
ese - event corresponding to user request
Returns:
list of names of model objects that changed with the event processing; this list is builded by num (ModelUpdateManager). In addition, the first element of the list contains the service answer (or the "" string when this answer is not required)
Throws:
ServicingEventException -  
java.rmi.RemoteException - Description of the Exception

getHandlerName

private java.lang.String getHandlerName(java.lang.String eventName)
                                 throws ServicingEventException
get in context the name of handler class for the event
Parameters:
eventName - name of event corresponding to user request
Returns:
The handlerName value
Throws:
ServicingEventException -  

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
register a attribute of the user session
Parameters:
key - The new attribute key
value - The new attribute value

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
get value of user session attribute
Parameters:
key - attribute key
Returns:
The attribute value

getServicingControllerEJB

public ServicingControllerEJB getServicingControllerEJB()
get reference to controller ejb
Returns:
The ServicingControllerEJB value

getSessionContext

public javax.ejb.SessionContext getSessionContext()
get SessionContext
Returns:
The sessionContext value