Arch4J 1.1

org.arch4j.clientcontroller.struts
Class StateMachineAction

java.lang.Object
  |
  +--org.apache.struts.action.Action
        |
        +--org.arch4j.clientcontroller.struts.StateMachineAction

public abstract class StateMachineAction
extends org.apache.struts.action.Action

Manages a single state machine for each user session. This includes passing events and mapping resulting state context data into the servlet sessions scope.

Version:
1.0
Author:
David Colwell

Field Summary
 
Fields inherited from class org.apache.struts.action.Action
DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGES_KEY, MULTIPART_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Constructor Summary
StateMachineAction()
           
 
Method Summary
protected abstract  HashMap getAttributes(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Retrieves the attribute set to be passed to the state machine to handle the event.
protected abstract  String getEvent(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Retrieves the name of the event this action will trigger
protected  org.apache.struts.action.ActionForward getResultingResource(String currentState, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method is called after the state machine has handled the event.
 org.apache.struts.action.ActionForward perform(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  void performEntry(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method is not abstract.
protected  void performExit(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method is not abstract.
 
Methods inherited from class org.apache.struts.action.Action
generateToken, getLocale, getResources, getServlet, isCancelled, isTokenValid, perform, perform, perform, resetToken, saveErrors, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateMachineAction

public StateMachineAction()
Method Detail

perform

public final org.apache.struts.action.ActionForward perform(org.apache.struts.action.ActionMapping mapping,
                                                            org.apache.struts.action.ActionForm form,
                                                            javax.servlet.http.HttpServletRequest request,
                                                            javax.servlet.http.HttpServletResponse response)
                                                     throws 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.

Overrides:
perform in class org.apache.struts.action.Action
Parameters:
mapping - The ActionMapping used to select this instance
request - The HTTP request we are processing
response - The HTTP response we are creating
Throws:
IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

performEntry

protected void performEntry(org.apache.struts.action.ActionMapping mapping,
                            org.apache.struts.action.ActionForm form,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws IOException,
                            javax.servlet.ServletException
This method is not abstract. It may be overridden and will be called before the state machine handling code.

IOException
javax.servlet.ServletException

performExit

protected void performExit(org.apache.struts.action.ActionMapping mapping,
                           org.apache.struts.action.ActionForm form,
                           javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws IOException,
                           javax.servlet.ServletException
This method is not abstract. It may be overridden and will be called after the state machine handling code.

IOException
javax.servlet.ServletException

getEvent

protected abstract String getEvent(org.apache.struts.action.ActionMapping mapping,
                                   org.apache.struts.action.ActionForm form,
                                   javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
                            throws IOException,
                                   javax.servlet.ServletException
Retrieves the name of the event this action will trigger

IOException
javax.servlet.ServletException

getAttributes

protected abstract HashMap getAttributes(org.apache.struts.action.ActionMapping mapping,
                                         org.apache.struts.action.ActionForm form,
                                         javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
                                  throws IOException,
                                         javax.servlet.ServletException
Retrieves the attribute set to be passed to the state machine to handle the event.

IOException
javax.servlet.ServletException

getResultingResource

protected org.apache.struts.action.ActionForward getResultingResource(String currentState,
                                                                      org.apache.struts.action.ActionMapping mapping,
                                                                      org.apache.struts.action.ActionForm form,
                                                                      javax.servlet.http.HttpServletRequest request,
                                                                      javax.servlet.http.HttpServletResponse response)
                                                               throws IOException,
                                                                      javax.servlet.ServletException
This method is called after the state machine has handled the event. It will return an ActionForward instance associated with a JSP page or other resource.

IOException
javax.servlet.ServletException

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.