Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jcorporate.expresso.core.controller
Class Controller  view Controller download Controller.java

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended bycom.jcorporate.expresso.core.controller.Controller
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DBController

public abstract class Controller
extends org.apache.struts.action.Action
implements java.io.Serializable

A sequence of interaction with a user is defined as a "Controller".

An Expresso controller is best thought of as a finite state machine. The only real difference is that because of the stateless nature of the web, anybody can reach any state with using the "state" parameter in the URL.

Usually for a web deployment environment, you would derive your own controller from DBController, which adds a database-backed Security matrix to the controller's base capabilities. Controllers (and DBControllers) do not necessarily need to be run inside a servlet environment. If they never downcast their ControllerResponse object to ServletControllerResponse, the Controller can also be used in products such as Expresso Webservices, or

See the Expresso Developer's Guide for more information on creating and using a Controller.

A Controller takes a series of parameters (optional) and then provides a series of Blocks, Inputs, Outputs, and Transitions to the client

An Input specifies a piece of information we want FROM the client An Output is a piece of information we supply TO the client A Transition is an action the client can take from this point - e.g. further controllers that are followups to this controller A Block is a collection of Inputs, Outputs, Transitions or other Blocks


Field Summary
static java.lang.String CONTROLLER_PARAM_KEY
          key for putting controller into parameter map
private  Transition controllerChainingTransition
           
private  Transition controllerSecurityTransition
           
static java.lang.String CTL_SUCC_CTL
           
static java.lang.String CTL_SUCC_STATE
           
static java.lang.String CTL_SUCC_TRAN
           
private  State finalState
           
private  java.util.ArrayList handleStates
          handleStates is only updated in the constructor.
private static java.util.Hashtable initialStates
           
private static org.apache.log4j.Logger log
          log for methods in this class alone
protected  org.apache.log4j.Logger mLog
          if subclass calls getLogger(), this will create logger with subclass name
static java.lang.String NEWSTATE_EXCEPTION_KEY
          New state exception key
private static java.lang.Class[] newStateParams
          used to specify the classes of parameters for introspection; since these classes are constant across all controllers, we use a static
static java.lang.String ORIGINAL_URL_KEY
          Controller original URL key
private  java.util.ArrayList promptStates
          promptStates is only updated in the constructor.
static java.lang.String REQUEST_KEY
          Controller request key
static java.lang.String RESPONSE_KEY
          Controller response key
static java.lang.String RETURN_TO_SENDER_TRAN
           
private static java.util.Hashtable schemas
          Static map of classes to schema instances
private static java.lang.Class[] servletStateHandlerParams
          used for reflection into the state handlers
static java.lang.String STATE_ERR_CTL
           
static java.lang.String STATE_ERR_STATE
           
static java.lang.String STATE_ERR_TRAN
           
static java.lang.String STATE_PARAM_KEY
          key for putting state into parameter map
static java.lang.String STATE_SUCC_CTL
           
static java.lang.String STATE_SUCC_STATE
           
static java.lang.String STATE_SUCC_TRAN
           
private static java.lang.Class[] stateHandlerParams
          used for reflection into the state handlers
private static java.util.Hashtable states
          States is a hashtable of hashtables, e.g.
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
Controller()
          Default constructor
 
Method Summary
protected  void addFinalState(State newFinalState)
          The constructor of the child object should call addFinalState to define the last state to be executed for this controller.
protected  void addPromptTransitions(State nextState, ControllerResponse response)
          If nextState is a prompt state (as determined by the addStatePairing method) then add a 'next' and 'previous' transitions as required.
protected  void addRegDomainParamtoSession(javax.servlet.http.HttpServletRequest req, ControllerRequest creq, java.lang.String regDomain)
          ???????????????????????
protected  void addRequestedURLtoSession(javax.servlet.http.HttpServletRequest req, ControllerRequest creq)
           
protected  void addState(State newState)
          The constructor of the child object should call addState to define each of the states available in this method.
protected  void addStatePairing(State promptState, State handleState, java.lang.String stateFormClass)
          The constructor of the child object should call this method with a pairing of State objects.
private  boolean checkSsl(javax.servlet.http.HttpServletRequest aRequest, javax.servlet.http.HttpServletResponse aResponse, boolean isSecure)
          Checks to see if SSL should be toggled for this action
protected  void endTimer(long beginTimer, javax.servlet.http.HttpServletRequest request)
          Used for logging time of requests.
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it).
protected  org.apache.struts.action.ActionForm findControllerForm(ControllerRequest request)
          Return the Struts ActionForm associated with this controller as specified in the Struts config file.
protected  java.lang.String generateToken(ControllerRequest request)
          Generate a new transaction token, to be used for enforcing a single request for a particular transaction.
protected  org.apache.struts.action.ActionForward getActionForward(ServletControllerRequest req, org.apache.struts.config.ActionConfig mapping, ControllerResponse res)
          Determine the forward appropriate for this controller/state, either from parameters or from configuration files, or from remapping based on past extensions like .xsl
protected  Transition getControllerChainingTransition()
          Return the transition that will be executed once this controller completes without errors.
protected  Transition getControllerSecurityTransition()
          Return the transition that will be executed if any state in this controller cannot be run because the user does not have sufficient authorization.
 State getFinalState()
          Return the final state for this controller.
 java.lang.String getInitialState()
          Get the initial state in a controller.
 org.apache.log4j.Logger getLogger()
          Call from subclass to log into Category with subclass name will create logger with subclass name as necessary.
static java.lang.String[] getParamValues(ServletControllerRequest request, java.lang.String paramName)
          Fetches array of parameter values from underlying HTTP request; use this in a web app to access the underlying parameters in the HTTP request which have the same name; parameters with the same name are not reflected in the hashtable maintained by ControllerRequest;
protected  java.lang.String getRequestURL(javax.servlet.http.HttpServletRequest req)
          recreate requested URL; never null, though could be empty string
protected  java.lang.String getSchema()
          Get the name of the schema object that this Controller belongs to
 java.util.Stack getSchemaHierarchy()
          Deprecated. 7/04; v5.5. just name changed. see getSchemaStack
protected  com.jcorporate.expresso.core.dbobj.Schema getSchemaInstance()
          Retrieve a full instance of the Schema object that is associated with this controller
 java.util.Stack getSchemaStack()
          Retrieve a stack of all schemas.
 State getState(java.lang.String stateName)
          Return a specific state
 java.util.Hashtable getStates()
          Return the hashtable of valid states for this controller
protected  java.lang.String getString(java.lang.String stringCode)
          Convenience version, uses default locale of default db context

IMPORTANT: in general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.

protected  java.lang.String getString(java.lang.String stringCode, java.lang.Object[] args)
          Convenience version, uses default locale of default db context

IMPORTANT: In general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.

 java.lang.String getTitle()
          Return the title of this Controller
protected  void handleException(javax.servlet.http.HttpServletRequest req, ControllerRequest creq, java.lang.String dbName, java.lang.String userName, java.lang.Throwable theException)
          Handle an exception error that is not otherwise caught or handled by the Controller instance itself.
static Controller instantiate(java.lang.String className)
          Factory method to create an Controller from it's name Do not call this function directly! Use ConfigManager.getControllerFactory() .getInstance(java.lang.String) instead.
protected  boolean isFinalState(java.lang.String newState)
          Return True if the passed in state was added to this controller as a final state.
protected  boolean isHandleState(State nextState)
          Return True if the passed in state was added to this controller as a handle state.
protected  boolean isPromptState(State nextState)
          Return True if the passed in state was added to this controller as a prompt state.
protected  boolean isTokenValid(ControllerRequest request)
          Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.
protected  StateForm loadStateForm(State nextState, org.apache.struts.action.ActionForm controllerForm)
          Return the state's form with data from the controller's form.
 ControllerResponse newState(java.lang.String newState, ControllerRequest myRequest)
          This is the method where all of the real work of the controller is done.
protected  java.lang.String nextHandleState(State nextState)
          Return the name of the handle state that is associated with the passed in prompt state.
protected  java.lang.String nextPromptState(State nextState)
          Return the name of the prompt state that is 'next' to the passed in prompt state in the sequence for this controller.
protected  void populateStateForm(StateForm stateForm, ControllerRequest request)
          Populate the state form with any matching request parameters.
protected  void postPerform(State nextState, ControllerRequest request, ControllerResponse response)
          Template Method, allowing a subclass to into actions after the invocation of any state in this controller.
protected  void prePerform(State nextState, ControllerRequest request, ControllerResponse response)
          Template Method, allowing a subclass to do an action after any state in this controller is performed.
protected  java.lang.String previousPromptState(State nextState)
          Return the name of the prompt state that is 'previous' to the passed in prompt state in the sequence for this controller.
protected  void processRequestTransitions(State nextState, ControllerRequest request)
          

This method picks up the following routing parameters from the current request and builds transition objects from them before the state is invoked.

protected  Transition processTransitions(ControllerRequest request, ControllerResponse response, State nextState)
          This method is the traffic cop that determines which transition to execute after a state completes.
 void redirectRequest(ControllerRequest request, ControllerResponse response, java.lang.String redirectURL)
          redirect response so that URL changes in client browser
protected  void redirectRequest(javax.servlet.http.HttpServletResponse response, java.lang.String redirectURL)
          redirect response so that URL changes in client browser
protected  org.apache.struts.config.ForwardConfig remapFromExtension(org.apache.struts.config.ForwardConfig fwd, org.apache.struts.config.ActionConfig mapping, ServletControllerRequest req)
          if the extension in the current forward is ".xsl" or ".xslt", remap the forward to "xml", and set a parameter for the xsl style sheet.
protected  void resetToken(ControllerRequest request)
          Reset the saved transaction token in the user's session.
protected  void saveToken(ControllerRequest request)
          Save a new transaction token in the user's current session, creating a new session if necessary.
protected  void setControllerChainingTransition(Transition newControllerChainingTransition)
          Set the transition that will be executed when this controller completes successfully.
protected  void setControllerSecurityTransition(Transition newControllerSecurityTransition)
          Set the transition that will be executed when a user attempts to run a state he doesn't have authorization on.
 ControllerResponse setCurrentState(java.lang.String newState, ControllerRequest params)
          Convenience method to be able to access the state as a property from a JSP.
 void setInitialState(java.lang.String newInitialState)
          Set what state to invoke if no state parameter is set.
protected  void setSchema(java.lang.Class schemaClass)
          Identical to setSchema(String) but provides a typesafe way of passing parameters.
protected  void setSchema(java.lang.String schemaClass)
          Tell this Controller object what Schema it belongs to.
 void setupDefaultValues(java.lang.String dbName)
          Allows for DBCreate to set up proper default values for views, etc.
protected  void setupReturnToSender(State nextState, ControllerRequest request)
          This method is called before a state executes.
protected  void setupSubclassLog()
          setup a subclass logger separately from the base controller logger.
 boolean stateAllowed(java.lang.String newState, ControllerRequest params)
          Is this state allowed for the current user? The generic controller object can't determine this, but the DBController child of this object checks the database to determine which users can access which states.
protected  void transition(java.lang.String newState, java.lang.Class externalController, ControllerRequest req, ControllerResponse res)
          convenience method for transition to other controller
protected  void transition(java.lang.String newState, ControllerRequest req, ControllerResponse res)
           
protected  void transition(java.lang.String newState, ControllerRequest req, ControllerResponse res, boolean clear)
          Transition to an internal state.
protected  void unloadStateForm(StateForm stateForm, org.apache.struts.action.ActionForm controllerForm)
          Move the state's form data back into the controller's form.
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Logger log
log for methods in this class alone


mLog

protected org.apache.log4j.Logger mLog
if subclass calls getLogger(), this will create logger with subclass name


RESPONSE_KEY

public static final java.lang.String RESPONSE_KEY
Controller response key

See Also:
Constant Field Values

ORIGINAL_URL_KEY

public static final java.lang.String ORIGINAL_URL_KEY
Controller original URL key

See Also:
Constant Field Values

REQUEST_KEY

public static final java.lang.String REQUEST_KEY
Controller request key

See Also:
Constant Field Values

NEWSTATE_EXCEPTION_KEY

public static final java.lang.String NEWSTATE_EXCEPTION_KEY
New state exception key

See Also:
Constant Field Values

CTL_SUCC_TRAN

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

CTL_SUCC_CTL

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

CTL_SUCC_STATE

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

STATE_SUCC_TRAN

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

STATE_SUCC_CTL

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

STATE_SUCC_STATE

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

STATE_ERR_TRAN

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

STATE_ERR_CTL

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

STATE_ERR_STATE

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

RETURN_TO_SENDER_TRAN

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

STATE_PARAM_KEY

public static final java.lang.String STATE_PARAM_KEY
key for putting state into parameter map

See Also:
Constant Field Values

CONTROLLER_PARAM_KEY

public static final java.lang.String CONTROLLER_PARAM_KEY
key for putting controller into parameter map

See Also:
Constant Field Values

initialStates

private static java.util.Hashtable initialStates

schemas

private static java.util.Hashtable schemas
Static map of classes to schema instances


states

private static java.util.Hashtable states
States is a hashtable of hashtables, e.g. the states hashtable itself is indexed by controller class name. Each entry against a classname is itself a hashtable with a list of the valid state objects for the given controller


newStateParams

private static final java.lang.Class[] newStateParams
used to specify the classes of parameters for introspection; since these classes are constant across all controllers, we use a static


stateHandlerParams

private static final java.lang.Class[] stateHandlerParams
used for reflection into the state handlers


servletStateHandlerParams

private static final java.lang.Class[] servletStateHandlerParams
used for reflection into the state handlers


promptStates

private java.util.ArrayList promptStates
promptStates is only updated in the constructor. The instantiation of Controller by Struts is synchronized so we don't need to worry about threadsafety while updating this collection even though it is shared by many threads(singleton). However, Controller is also instantiated by Transition and Controller itself and unlike Struts these are not synchronized. Luckily, unlike Struts, these instances are not shared between threads. So we should be OK with no sychronized access and also with using a non-synchronized collection (ArrayList). The main reason this collection was not static like most of the other fields in this class is because of the way this collection is populated. Unlike the 'states' collection, this one appends new items to the collection rather than overwriting (hashing). So if this had been static, every time Transition/Controller instantiated a new instance of this class it would try to append the same states to the collection making the collection inaccurate (and big).


handleStates

private java.util.ArrayList handleStates
handleStates is only updated in the constructor. The instantiation of Controller by Struts is synchronized so we don't need to worry about threadsafety while updating this collection even though it is shared by many threads(singleton). However, Controller is also instantiated by Transition and Controller itself and unlike Struts these are not synchronized. Luckily, unlike Struts, these instances are not shared between threads. So we should be OK with no sychronized access and also with using a non-synchronized collection (ArrayList). The main reason this collection was not static like most of the other fields in this class is because of the way this collection is populated. Unlike the 'states' collection, this one appends new items to the collection rather than overwriting (hashing). So if this had been static, every time Transition/Controller instantiated a new instance of this class it would try to append the same states to the collection making the collection inaccurate (and big).


finalState

private State finalState

controllerChainingTransition

private Transition controllerChainingTransition

controllerSecurityTransition

private Transition controllerSecurityTransition
Constructor Detail

Controller

public Controller()
Default constructor

Method Detail

addFinalState

protected void addFinalState(State newFinalState)
                      throws NonHandleableException
The constructor of the child object should call addFinalState to define the last state to be executed for this controller. Once the final state is added then no other states can be added via the addStatePairing method.


addPromptTransitions

protected void addPromptTransitions(State nextState,
                                    ControllerResponse response)
                             throws ControllerException
If nextState is a prompt state (as determined by the addStatePairing method) then add a 'next' and 'previous' transitions as required. A 'next' transition will refer to a prompt state's associated validate state. A 'previous' transition will refer to the prompt state that precedes the passed in state. The 'previous' state will not be added to the response if if the passed in state is the first one (iniial state) in this controller.


addState

protected void addState(State newState)
The constructor of the child object should call addState to define each of the states available in this method.


addStatePairing

protected void addStatePairing(State promptState,
                               State handleState,
                               java.lang.String stateFormClass)
                        throws NonHandleableException
The constructor of the child object should call this method with a pairing of State objects. The sequence of calls to this method determine the runtime ordering of states.


findControllerForm

protected org.apache.struts.action.ActionForm findControllerForm(ControllerRequest request)
                                                          throws ControllerException
Return the Struts ActionForm associated with this controller as specified in the Struts config file. Struts would have already created and populated this form and put it either in the request or session scope.


getControllerChainingTransition

protected Transition getControllerChainingTransition()
Return the transition that will be executed once this controller completes without errors. The controller 'completes' once the final state (as defined using addFinalState) returns without errors in the error collection.


getControllerSecurityTransition

protected Transition getControllerSecurityTransition()
Return the transition that will be executed if any state in this controller cannot be run because the user does not have sufficient authorization.


getFinalState

public State getFinalState()
Return the final state for this controller. See addFinalState().


getInitialState

public java.lang.String getInitialState()
Get the initial state in a controller. This is the state to use if there is no state parameter specified in the requesting URL or execution container.


getSchema

protected final java.lang.String getSchema()
Get the name of the schema object that this Controller belongs to


getSchemaInstance

protected com.jcorporate.expresso.core.dbobj.Schema getSchemaInstance()
Retrieve a full instance of the Schema object that is associated with this controller


getSchemaHierarchy

public java.util.Stack getSchemaHierarchy()
Deprecated. 7/04; v5.5. just name changed. see getSchemaStack

Retrieve a stack of all schemas in a 'derived sense'


getSchemaStack

public java.util.Stack getSchemaStack()
Retrieve a stack of all schemas. hands out actual object instance; singleton for this controller.


getState

public final State getState(java.lang.String stateName)
Return a specific state


getStates

public final java.util.Hashtable getStates()
Return the hashtable of valid states for this controller


getString

protected java.lang.String getString(java.lang.String stringCode)
Convenience version, uses default locale of default db context

IMPORTANT: in general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.


getString

protected java.lang.String getString(java.lang.String stringCode,
                                     java.lang.Object[] args)
Convenience version, uses default locale of default db context

IMPORTANT: In general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.


getTitle

public java.lang.String getTitle()
Return the title of this Controller


handleException

protected void handleException(javax.servlet.http.HttpServletRequest req,
                               ControllerRequest creq,
                               java.lang.String dbName,
                               java.lang.String userName,
                               java.lang.Throwable theException)
                        throws javax.servlet.ServletException
Handle an exception error that is not otherwise caught or handled by the Controller instance itself. Typically, these will be reserved for "system failure" type of situations, as anything that the user can reasonable be expected to correct should be reported in the ErrorCollection instead.


addRequestedURLtoSession

protected void addRequestedURLtoSession(javax.servlet.http.HttpServletRequest req,
                                        ControllerRequest creq)
                                 throws ControllerException

getRequestURL

protected java.lang.String getRequestURL(javax.servlet.http.HttpServletRequest req)
recreate requested URL; never null, though could be empty string


addRegDomainParamtoSession

protected void addRegDomainParamtoSession(javax.servlet.http.HttpServletRequest req,
                                          ControllerRequest creq,
                                          java.lang.String regDomain)
                                   throws ControllerException
???????????????????????


instantiate

public static Controller instantiate(java.lang.String className)
                              throws ControllerException
Factory method to create an Controller from it's name Do not call this function directly! Use ConfigManager.getControllerFactory() .getInstance(java.lang.String) instead.


isFinalState

protected boolean isFinalState(java.lang.String newState)
Return True if the passed in state was added to this controller as a final state.


isHandleState

protected boolean isHandleState(State nextState)
Return True if the passed in state was added to this controller as a handle state.


isPromptState

protected boolean isPromptState(State nextState)
Return True if the passed in state was added to this controller as a prompt state.


loadStateForm

protected StateForm loadStateForm(State nextState,
                                  org.apache.struts.action.ActionForm controllerForm)
                           throws ControllerException
Return the state's form with data from the controller's form. The controller's form is specified in the struts config file. The state form is specified in the state's stateFormClass attribute.


newState

public ControllerResponse newState(java.lang.String newState,
                                   ControllerRequest myRequest)
                            throws ControllerException,
                                   NonHandleableException
This is the method where all of the real work of the controller is done. The client calls this to indicate what state the controller is transitioning into.

This is normally what is called from the command line when driving a Controller object. If running in a struts environment, this function call is wrapped by execute() method which does the actual running, plus then performs tasks such as finding the next forward etc.


prePerform

protected void prePerform(State nextState,
                          ControllerRequest request,
                          ControllerResponse response)
                   throws ControllerException
Template Method, allowing a subclass to do an action after any state in this controller is performed. For example, a common header for the web pages could be created here, so long as the web pages in question, with the common header, were all in the same controller which overrides this method.


postPerform

protected void postPerform(State nextState,
                           ControllerRequest request,
                           ControllerResponse response)
                    throws ControllerException
Template Method, allowing a subclass to into actions after the invocation of any state in this controller. For example, a common footer for web pages could be created here, so long as the web pages in question, with the common footer, were all in the same controller which overrides this method. (Multiple controllers which need common pre/post actions could share a common superclass.)


nextHandleState

protected java.lang.String nextHandleState(State nextState)
Return the name of the handle state that is associated with the passed in prompt state. Null will be returned if the passed in state is not a prompt state.


nextPromptState

protected java.lang.String nextPromptState(State nextState)
Return the name of the prompt state that is 'next' to the passed in prompt state in the sequence for this controller. If the passed in state is the last prompt state in this controller then null will be returned.


endTimer

protected void endTimer(long beginTimer,
                        javax.servlet.http.HttpServletRequest request)
Used for logging time of requests.


execute

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
                                                      org.apache.struts.action.ActionForm form,
                                                      javax.servlet.http.HttpServletRequest request,
                                                      javax.servlet.http.HttpServletResponse response)
                                               throws java.io.IOException,
                                                      javax.servlet.ServletException
Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed. Note, that if you wish to run a controller within something other than a HTTP session, then call newState directly.


getActionForward

protected org.apache.struts.action.ActionForward getActionForward(ServletControllerRequest req,
                                                                  org.apache.struts.config.ActionConfig mapping,
                                                                  ControllerResponse res)
                                                           throws NonHandleableException,
                                                                  ControllerException
Determine the forward appropriate for this controller/state, either from parameters or from configuration files, or from remapping based on past extensions like .xsl


remapFromExtension

protected org.apache.struts.config.ForwardConfig remapFromExtension(org.apache.struts.config.ForwardConfig fwd,
                                                                    org.apache.struts.config.ActionConfig mapping,
                                                                    ServletControllerRequest req)
                                                             throws ControllerException
if the extension in the current forward is ".xsl" or ".xslt", remap the forward to "xml", and set a parameter for the xsl style sheet. author: Larry Hamel, CodeGuild, Inc.


redirectRequest

protected void redirectRequest(javax.servlet.http.HttpServletResponse response,
                               java.lang.String redirectURL)
                        throws java.io.IOException
redirect response so that URL changes in client browser


populateStateForm

protected void populateStateForm(StateForm stateForm,
                                 ControllerRequest request)
                          throws ControllerException
Populate the state form with any matching request parameters.


previousPromptState

protected java.lang.String previousPromptState(State nextState)
Return the name of the prompt state that is 'previous' to the passed in prompt state in the sequence for this controller. If the passed in state is the first prompt state in this controller then null will be returned.


processRequestTransitions

protected void processRequestTransitions(State nextState,
                                         ControllerRequest request)
                                  throws ControllerException

This method picks up the following routing parameters from the current request and builds transition objects from them before the state is invoked.

1. "Controller Success" These parameters identify the state that should be run once this controller completes successfully (ie the'final' state has completed without errors). Any controller success parameters will cause this method to put a serialized transition object specific to this controller in session scope.

2. "State Success" These parameters identify the state that should be run if this state completes without errors. Any state success parameters will cause this method to assign a transition object to this currently running state.

3. "State Error" These parameters identify the state that should be run if this state completes with errors. Any state error parameters will cause this method to assign a transition object to this currently running state.

Note, the transition specified at this time can be overridden by the state when it executes.


processTransitions

protected Transition processTransitions(ControllerRequest request,
                                        ControllerResponse response,
                                        State nextState)
                                 throws ControllerException,
                                        NonHandleableException
This method is the traffic cop that determines which transition to execute after a state completes.

1. "State Error" The state returned with errors in the error collection. The 'error transition' associated with the state is executed. This transition could have been set either in processRequestTransitions() prior to state execution or in the state itself during execution.

2. "State Success" The state returned without errors in the error collection. The following priority is followed: - If the 'success transition' is not null for this state then it is executed. - If the state that just completed is a final state then: - If the 'chaining transition' is not null for this controller then it is executed. - If the 'controller success transition' is not null for this controller then it is executed.


setControllerChainingTransition

protected void setControllerChainingTransition(Transition newControllerChainingTransition)
                                        throws NonHandleableException
Set the transition that will be executed when this controller completes successfully. This will not likely be used as often as the runtime 'controller success' routing parameters. However when used, it will relay any 'controller success' parameters onto the next controller so that the return path is not lost.


setControllerSecurityTransition

protected void setControllerSecurityTransition(Transition newControllerSecurityTransition)
Set the transition that will be executed when a user attempts to run a state he doesn't have authorization on. As always, this transition can have return-to-sender enabled. This could allow a login screen to be called and then control would automatically return to the state whose authorization failed.


setCurrentState

public ControllerResponse setCurrentState(java.lang.String newState,
                                          ControllerRequest params)
                                   throws ControllerException,
                                          NonHandleableException
Convenience method to be able to access the state as a property from a JSP.


setInitialState

public void setInitialState(java.lang.String newInitialState)
Set what state to invoke if no state parameter is set.


setSchema

protected void setSchema(java.lang.String schemaClass)
Tell this Controller object what Schema it belongs to. This is used when the Controller tries to use it's "getString(String, Object[])" method to prepare internationalized messages - it passes the call along to the appropriate schema which knows how to locate the proper message file.


setSchema

protected void setSchema(java.lang.Class schemaClass)
Identical to setSchema(String) but provides a typesafe way of passing parameters. Example:
setSchema(com.jcorporate.expresso.core.ExpressoSchema .class);


setupDefaultValues

public void setupDefaultValues(java.lang.String dbName)
                        throws com.jcorporate.expresso.core.db.DBException
Allows for DBCreate to set up proper default values for views, etc.


setupReturnToSender

protected void setupReturnToSender(State nextState,
                                   ControllerRequest request)
                            throws ControllerException
This method is called before a state executes. It will assign a return-to-sender transition to the state. This transition will include the parameters that this state is being called with.

If this state causes a transition (with return-to-sender enabled) to be executed, then this state's return-to-sender transition will be serialized and passed to the next controller. This controller will then use this transition (once the controller completes successfull) to return to this state with the same parameters that this state was initally called with.

This method will also check for a request parameter that overrides the return-to-sender transition that would normally be associated with this state. This is useful when the final state reruns all of the controller's handle states. In that case, any transitions should return to the final state and not the handle state that caused the transition.


stateAllowed

public boolean stateAllowed(java.lang.String newState,
                            ControllerRequest params)
                     throws ControllerException
Is this state allowed for the current user? The generic controller object can't determine this, but the DBController child of this object checks the database to determine which users can access which states.


transition

protected void transition(java.lang.String newState,
                          ControllerRequest req,
                          ControllerResponse res)
                   throws ControllerException,
                          NonHandleableException