com.livinglogic.struts.workflow
Class WorkflowRequestProcessorLogic

java.lang.Object
  extended bycom.livinglogic.struts.workflow.WorkflowRequestProcessorLogic

public class WorkflowRequestProcessorLogic
extends Object

This class implements the workflow request processor logic. The logic is implemented separately in this class, because we want to be able to reuse it in multiple classes that are not derived from each other. See WorkflowRequestProcessor for an example how this class can be used.

Since:
$Name: $
Version:
$Revision: 1.3 $, $Date: 2004/04/08 14:58:24 $
Author:
M. Bauer, $Author: jason_pratt $

Field Summary
protected  Hashtable authClasses
          The set of Authentication instances that have been created and initialized, keyed by the fully qualified Java class name of the Authentication class.
static String AUTHENTICATION_VIOLATION_FORWARD
          The name used to find an ActionForward instance if an authentication violation occurs
protected static org.apache.commons.logging.Log log
          Commons logging instance
static String WORKFLOW_VIOLATION_FORWARD_PREFIX
          The prefix used to find an ActionForward instance if a workflow violation occurs
 
Method Summary
protected  void logStates(WorkflowContainer workflowContainer)
          Method that logs the current state information
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process an HttpServletRequest and create the corresponding HttpServletResponse.
protected  Authentication processAuthClassCreate(javax.servlet.http.HttpServletResponse response, String className)
          Return an Authentication instance that will be used to check whether the requested action is allowed to be executed with the current request.
protected  boolean processCheckAuthClass(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping, Authentication authClass)
          If this action is protected by an authClass, do the necessary checks.
protected  boolean processCheckWorkflows(WorkflowMapping workflowMapping, WorkflowContainer workflowContainer, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           Checks whether the current action is allowed to be executed: If the previously executed action was part of a primary workflow and has defined one ore more nextState conditions,the current action must be part of the same workflow and must lead to one of the defined next states.
protected  void updateWorkflows(javax.servlet.http.HttpServletRequest request, WorkflowMapping workflowMapping, WorkflowContainer workflowContainer)
          Updates the workflow data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

authClasses

protected Hashtable authClasses
The set of Authentication instances that have been created and initialized, keyed by the fully qualified Java class name of the Authentication class.


WORKFLOW_VIOLATION_FORWARD_PREFIX

public static String WORKFLOW_VIOLATION_FORWARD_PREFIX
The prefix used to find an ActionForward instance if a workflow violation occurs


AUTHENTICATION_VIOLATION_FORWARD

public static String AUTHENTICATION_VIOLATION_FORWARD
The name used to find an ActionForward instance if an authentication violation occurs


log

protected static org.apache.commons.logging.Log log
Commons logging instance

Method Detail

logStates

protected void logStates(WorkflowContainer workflowContainer)
Method that logs the current state information

Parameters:
workflowContainer - the WorkflowContainer associated with the user's session

processCheckWorkflows

protected boolean processCheckWorkflows(WorkflowMapping workflowMapping,
                                        WorkflowContainer workflowContainer,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws IOException,
                                        javax.servlet.ServletException

Checks whether the current action is allowed to be executed:

  1. If the previously executed action was part of a primary workflow and has defined one ore more nextState conditions,the current action must be part of the same workflow and must lead to one of the defined next states.
  2. Each prevState condition, defined in the action's mapping, is checked for correctness. These checks are performed in the order they are listed in the configuration.

Parameters:
workflowMapping - the WorkflowMapping used to select this instance
workflowContainer - the WorkflowContainer associated with the user's session
request - The servlet request we are processing
response - The servlet response we are creating
Returns:
true, if the check succeeded and processing should continue normally
Throws:
IOException
javax.servlet.ServletException

updateWorkflows

protected void updateWorkflows(javax.servlet.http.HttpServletRequest request,
                               WorkflowMapping workflowMapping,
                               WorkflowContainer workflowContainer)
Updates the workflow data.

Parameters:
request - The servlet request we are processing
workflowMapping - the WorkflowMapping used to select this instance
workflowContainer - the WorkflowContainer associated with the user's session

processAuthClassCreate

protected Authentication processAuthClassCreate(javax.servlet.http.HttpServletResponse response,
                                                String className)
                                         throws IOException
Return an Authentication instance that will be used to check whether the requested action is allowed to be executed with the current request.

Parameters:
response - The servlet response we are creating
Throws:
IOException - if an input/output error occurs

processCheckAuthClass

protected boolean processCheckAuthClass(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        org.apache.struts.action.ActionMapping mapping,
                                        Authentication authClass)
                                 throws IOException,
                                        javax.servlet.ServletException
If this action is protected by an authClass, do the necessary checks. Return true to continue normal processing, or false if the check failed.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
mapping - The mapping we are using
authClass - The Authentication instance to use for the checks
Throws:
IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet exception occurs

process

public void process(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws IOException,
                    javax.servlet.ServletException

Process an HttpServletRequest and create the corresponding HttpServletResponse.

Parameters:
request - The servlet request we are processing
response - The servlet response we are creating
Throws:
IOException - if an input/output error occurs
javax.servlet.ServletException - if a processing exception occurs


Copyright © 2004 Struts Workflow Extension Team. All Rights Reserved.