com.cinecolombia.cinecolombia.control.ejb
Class StateMachine

java.lang.Object
  |
  +--com.cinecolombia.cinecolombia.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:
CincoSOFT
See Also:
Serialized Form
Created:
Junio 2003

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

Field Detail

sccejb

private CinecolombiaControllerEJB 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(CinecolombiaControllerEJB sccejb,
                    javax.ejb.SessionContext sc)
constructor: instances attributes

Parameters:
sccejb - controller ejb
sc - context
Method Detail

handleEvent

public java.util.Collection handleEvent(CinecolombiaEvent ese)
                                 throws java.rmi.RemoteException,
                                        CinecolombiaEventException
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:
CinecolombiaEventException
java.rmi.RemoteException - Description of the Exception

getHandlerName

private java.lang.String getHandlerName(java.lang.String eventName)
                                 throws CinecolombiaEventException
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:
CinecolombiaEventException

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
register an 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

getCinecolombiaControllerEJB

public CinecolombiaControllerEJB getCinecolombiaControllerEJB()
get reference to controller ejb

Returns:
The CinecolombiaControllerEJB value

getSessionContext

public javax.ejb.SessionContext getSessionContext()
get SessionContext

Returns:
The sessionContext value