org.figure8.join.control
Class JoinAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by org.figure8.join.control.JoinAction
Direct Known Subclasses:
AssemblyActions, BrowseLogsActions, BuildActions, ComponentActions, ComponentTypeActions, ConfigurationActions, ConsumerActions, DeliverableActions, DeliverableTypeActions, DeploymentActions, DeploymentsActions, EISMappingActions, EnvironmentMappingActions, LogicalEnvironmentActions, LoginAction, LogoutAction, MachineActions, MailingListActions, MessageActions, ParameterActions, ParameterValueActions, PermissionActions, PhysicalEnvironmentActions, QuartzCronActions, ReleaseActions, ResourceActions, ResourceMappingActions, ResourceTypeActions, ResourceUpdateActions, ResourceVersionActions, ScriptLogActions, SetupActions, StatusActions, StepActions, TargetActions, UserActions

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

An abstract Action class that all Join action classes must extend. This class implements Struts execute() method as a wrapper to a new doExecute() abstract method. This wrapper is intended to perform some pre-processing (such as retrieving the specified operation to invoke) and some post-processing (such as performing different rendering based on given informations).

As a consequence, the doExecute() method of the subclasses should only return ActionForward those path are a page fragment : this fragment (or tile) will be inserted into a specific page layout by this super class.

Version:
$Revision: 1.6 $
Author:
Laurent Broudoux

Field Summary
static java.lang.String BODY_ATTRIBUTE
          The request attribute which will contain the path of the page body.
static java.lang.String BODY_PARAMETER
          The request parameter which will contain the pathc of the page body.
static java.lang.String EXCEPTION_KEY
          The request attribute which will contain exception thrown by action processing.
static java.lang.String GUI_KEY
          The key of the ResourceBundle for GUI related resources.
static java.lang.String OP_PARAMETER
          The request parameter which contains the operation name.
static java.lang.String REND_MAIN
          Rendering value for main page rendering
static java.lang.String REND_NONE
          Rendering value for no page rendering (inclusion necessary)
static java.lang.String REND_PARAMETER
          The request parameter which contains graphical rendering operation.
static java.lang.String REND_POPUP
          Rendering value for popup page rendering
static java.lang.String XHR_PARAMETER
          The request parameter which tells that request has been made using XmlHttpRequest (Ajax)
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
JoinAction()
           
 
Method Summary
abstract  org.apache.struts.action.ActionForward doExecute(java.lang.String operation, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Abstract method that subclasses must implement.
 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)
          This method acts as a wrapper around doExecute() abstract method.
static UserContainer getUserContainer(javax.servlet.http.HttpServletRequest request)
          Retrieve the user container for the user tied to the HttpServletRequest.
static boolean isLoggedIn(javax.servlet.http.HttpServletRequest request)
          Check if user tied to the HttpServletRequest is logged in Join application (ie : has a non empty UserContainer).
protected  boolean isXhrRequest(javax.servlet.http.HttpServletRequest request)
          Tells wether a request has been submitted using XmlHttpRequest
protected  void removeObsoleteForm(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
          Remove the obsolete form associated to action ; wether the form is request or session scoped.
 
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, 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

GUI_KEY

public static final java.lang.String GUI_KEY
The key of the ResourceBundle for GUI related resources.

See Also:
Constant Field Values

OP_PARAMETER

public static final java.lang.String OP_PARAMETER
The request parameter which contains the operation name.

See Also:
Constant Field Values

REND_PARAMETER

public static final java.lang.String REND_PARAMETER
The request parameter which contains graphical rendering operation.

See Also:
Constant Field Values

XHR_PARAMETER

public static final java.lang.String XHR_PARAMETER
The request parameter which tells that request has been made using XmlHttpRequest (Ajax)

See Also:
Constant Field Values

BODY_ATTRIBUTE

public static final java.lang.String BODY_ATTRIBUTE
The request attribute which will contain the path of the page body.

See Also:
Constant Field Values

BODY_PARAMETER

public static final java.lang.String BODY_PARAMETER
The request parameter which will contain the pathc of the page body.

See Also:
Constant Field Values

EXCEPTION_KEY

public static final java.lang.String EXCEPTION_KEY
The request attribute which will contain exception thrown by action processing.

See Also:
Constant Field Values

REND_MAIN

public static final java.lang.String REND_MAIN
Rendering value for main page rendering

See Also:
Constant Field Values

REND_POPUP

public static final java.lang.String REND_POPUP
Rendering value for popup page rendering

See Also:
Constant Field Values

REND_NONE

public static final java.lang.String REND_NONE
Rendering value for no page rendering (inclusion necessary)

See Also:
Constant Field Values
Constructor Detail

JoinAction

public JoinAction()
Method Detail

doExecute

public abstract org.apache.struts.action.ActionForward doExecute(java.lang.String operation,
                                                                 org.apache.struts.action.ActionMapping mapping,
                                                                 org.apache.struts.action.ActionForm form,
                                                                 javax.servlet.http.HttpServletRequest request,
                                                                 javax.servlet.http.HttpServletResponse response)
                                                          throws java.lang.Exception
Abstract method that subclasses must implement. The real execution must be done here according to the specified operation. ActionForward returned by execution should only point on page fragment : this superclass is responsible of including them within a whole page.

Parameters:
operation - String representing the operation to invoke on Action
mapping - Mapping between forwards name and path for this action
form - The form object containing request parameters
request - The servlet container request wrapper
response - The servlet container response wrapper
Returns:
A forward to the next view to render and display
Throws:
java.lang.Exception - such as InfraStructureExceptions ...

isLoggedIn

public static boolean isLoggedIn(javax.servlet.http.HttpServletRequest request)
Check if user tied to the HttpServletRequest is logged in Join application (ie : has a non empty UserContainer).

Parameters:
request - The servlet container request wrapper
Returns:
true if current user is logged in, false otherwise

getUserContainer

public static UserContainer getUserContainer(javax.servlet.http.HttpServletRequest request)
Retrieve the user container for the user tied to the HttpServletRequest. Creates an empty container if one doesn't exist already.

Parameters:
request - The servlet container request wrapper
Returns:
A UserContainer for current request' user (this container may have no UserView associated if it's not logged in)

removeObsoleteForm

protected void removeObsoleteForm(org.apache.struts.action.ActionMapping mapping,
                                  javax.servlet.http.HttpServletRequest request)
Remove the obsolete form associated to action ; wether the form is request or session scoped.

Parameters:
mapping - Mapping between forwards name and path for this action
request - The servlet container request wrapper

isXhrRequest

protected boolean isXhrRequest(javax.servlet.http.HttpServletRequest request)
Tells wether a request has been submitted using XmlHttpRequest

Parameters:
request - The servlet container request wrapper
Returns:
Wether request has been submitted using XmlHttpRequest

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.lang.Exception
This method acts as a wrapper around doExecute() abstract method. First, it retrieves operation to invoke onto Action (if any). Then, it calls doExecute() passing around this operation. Lastly, it uses provided rendering information to forward the doExecute() result to the correct page layout (full page, popup, etc ...)

Overrides:
execute in class org.apache.struts.action.Action
Parameters:
mapping - Mapping between forwards name and path for this action
form - The form object containing request parameters
request - The servlet container request wrapper
response - The servlet container response wrapper
Returns:
A forward to the next view to render and display
Throws:
java.lang.Exception - ... this should not happen ...


Copyright © 2005-2008 Join. All Rights Reserved.