com.bankframe.fe.statemachine.base
Class RequestManager

java.lang.Object
  extended bycom.bankframe.fe.statemachine.base.RequestManager

public class RequestManager
extends java.lang.Object


Field Summary
static java.lang.String VIEW_OVERRIDE_KEY
          If this key is present in the properties the RequestManager will interpret its value as the name of a View class to use instead of the Views specified in the statechart.
 
Constructor Summary
RequestManager()
           
 
Method Summary
static RequestContext buildDefaultRequestContext(IRequest request, IResponse response, java.util.Properties properties)
          This method creates a new RequestContext based on the values given.
static IView manageRequest(IRequest request, IResponse response)
          Deprecated. use manageRequest(IRequest, IResponse, Properties)
static IView manageRequest(IRequest request, IResponse response, java.util.Properties properties)
          This method calls buildDefaultRequestContext then manageRequest(RequestContext).
static IView manageRequest(RequestContext requestContext)
          This method is the core of the statemachine.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEW_OVERRIDE_KEY

public static java.lang.String VIEW_OVERRIDE_KEY
If this key is present in the properties the RequestManager will interpret its value as the name of a View class to use instead of the Views specified in the statechart.

The value of this constant is "com.bankframe.fe.statemachine.base.ViewOverride".

Constructor Detail

RequestManager

public RequestManager()
Method Detail

manageRequest

public static IView manageRequest(IRequest request,
                                  IResponse response,
                                  java.util.Properties properties)
                           throws StateMachineException
This method calls buildDefaultRequestContext then manageRequest(RequestContext).

Parameters:
request - The IRequest containing the details of the request.
response - The IResponse to be given to the Views.
properties - The properties for the request. Determines the ApplicationManager and UserSession manager used, among other things.
Returns:
The IView implementor for the result state.
Throws:
StateMachineException - If the request cannot be processed.

manageRequest

public static IView manageRequest(IRequest request,
                                  IResponse response)
                           throws StateMachineException
Deprecated. use manageRequest(IRequest, IResponse, Properties)

This method processes a request based on the given request and response, and the contents of the System.properties.

Parameters:
request - The IRequest containing the details of the request.
response - The IResponse to be given to the Views.
Returns:
The IView implementor for the result state.
Throws:
StateMachineException - If the request cannot be processed.

buildDefaultRequestContext

public static RequestContext buildDefaultRequestContext(IRequest request,
                                                        IResponse response,
                                                        java.util.Properties properties)
                                                 throws StateMachineException
This method creates a new RequestContext based on the values given. This method is called by manageRequest(IRequest, IResponse, Properties) and passed in to manageRequest(RequestContext). If a connector is happy with the default behaviour it can call the three-parameter manageRequest method. If it wants to change the default RequestContext it can call this method and the one-parameter manageRequest method. I use this method in the Servlet connector to wrap the ApplicationManager in an ApplicationManager that stores the applications in the ServletContext. This provides the freedom to change the ApplicationManager and know it will still be stored correctly.

Parameters:
request - The IRequest containing the details of the request.
response - The IResponse to be given to the Views.
properties - The properties for the request. Determines the ApplicationManager and UserSession manager used, among other things.
Returns:
requestContext containing a default ApplicationManager, UserSessionManager, logger, request and response.
Throws:
StateMachineException - Thrown if the RequestContext cannot be built. (typically because the ApplicationManager or UserSessionManager cannot be loaded).

manageRequest

public static IView manageRequest(RequestContext requestContext)
                           throws StateMachineException
This method is the core of the statemachine. All events arrive at this method for processing. This method locates the Event to be processed and loads the appropriate Controller to determine the result state. It then follows the HISTORY or HISTORY_STAR from the UserSession, if required, and any default Events on the result state. It calls the doSideEffects method on the controller. Finally, it builds the appropriate View. This method also does some exception handling (passing control to an exception state if appropriate) and some logging.

Parameters:
requestContext - The full context for the request to be processed.
Returns:
The IView implementor for the result state.
Throws:
StateMachineException - If the request cannot be processed.


Copyright © 2005, 2007, Oracle. All rights reserved.