jet.servlet
Class JetAction

java.lang.Object
  extended by jet.servlet.JetAction
All Implemented Interfaces:
java.lang.Cloneable, Identifiable, Poolable, Resetable
Direct Known Subclasses:
AjaxValidationAction, ClientMessagesAction, ElementAction, ExtJSTypesAction, FFAction, FormDisplayAction, FTLAction, ReportJavascriptErrorAction

public abstract class JetAction
extends java.lang.Object
implements Poolable

This class is the base class for every action in jet. Defines how the actions will be executed.

Author:
Markus.Meisters@web.de

Field Summary
private  ActionValueHolder actionDef
          the actiondef for the action
private  JetContext context
          holds the context
private static org.apache.log4j.Logger log
          log object
 
Constructor Summary
JetAction()
           
 
Method Summary
 java.lang.Object clone()
          Implementation of the clone method for Object pooling
static void delegateTo(JetAction action)
          Method to delegate to a specific action (used also by the JetServlet)
private static void delegateTo(JetAction action, JetForm form)
          Method to delegate toa specific action (used also by the JetServlet
static void delegateTo(java.lang.String url, JetContext context)
          Method to delegate to a specific action
static void delegateTo(java.lang.String url, JetContext context, JetForm form)
          Method to delegate toa specific action (used also by the JetServlet
 void dispatch(java.lang.String url)
          Same as redirect method
 boolean doFormValidation()
          Method to indicate if the action should do form based validation
protected static void doFormValidation(JetMessages messages, JetForm form, JetContext context)
           
abstract  void execute(JetMessages messages, JetData data, JetForm form, JetContext context)
          Abstract method which is called on the action
protected  ActionValueHolder getActionDef()
          Returns the action definition object
 JetContext getContext()
          Returns the context used by this action
protected static JetData getDataStructure(JetForm form, JetContext context, JetAction action)
           
 java.lang.String getIdentifier()
          Returns the identifier
protected  Poolable getInstanceFor(java.lang.String id)
           
 JetContext getJetContext()
           
 void redirect(java.lang.String url)
          Method to redirect to a jsp or other resource through RequestDispatcher
 void render(JetData data, java.lang.String templatename)
          Method to render a template to response
 void reset()
          Implementation of the reset method for object cloning
 void setActionDef(ActionValueHolder actionDef)
          Set the action definition
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actionDef

private ActionValueHolder actionDef
the actiondef for the action


context

private JetContext context
holds the context


log

private static org.apache.log4j.Logger log
log object

Constructor Detail

JetAction

public JetAction()
Method Detail

getJetContext

public JetContext getJetContext()

execute

public abstract void execute(JetMessages messages,
                             JetData data,
                             JetForm form,
                             JetContext context)
                      throws JetActionException,
                             java.io.IOException
Abstract method which is called on the action

Parameters:
messages - the messages
data - the data structure
form - the form to use - could be null!
context - teh context object
Throws:
JetActionException,IOException - r
JetActionException
java.io.IOException

getIdentifier

public java.lang.String getIdentifier()
Returns the identifier

Specified by:
getIdentifier in interface Identifiable
Returns:
the identifier for the action

render

public final void render(JetData data,
                         java.lang.String templatename)
                  throws JetActionException,
                         java.io.IOException
Method to render a template to response

Parameters:
data - the TreeMap with data structure to use
templatename - the name of the template to render
Throws:
JetActionException,IOException
JetActionException
java.io.IOException

dispatch

public final void dispatch(java.lang.String url)
                    throws JetActionException,
                           java.io.IOException,
                           javax.servlet.ServletException
Same as redirect method

Parameters:
url - to redirect
Throws:
JetActionException,IOException,ServletException
JetActionException
java.io.IOException
javax.servlet.ServletException

redirect

public final void redirect(java.lang.String url)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Method to redirect to a jsp or other resource through RequestDispatcher

Parameters:
url -
Throws:
javax.servlet.ServletException
java.io.IOException

delegateTo

public static void delegateTo(java.lang.String url,
                              JetContext context)
                       throws JetActionException,
                              java.io.IOException
Method to delegate to a specific action

Parameters:
url - the url to delegate
context - the context to use for this delegation
Throws:
JetActionException,IOException
JetActionException
java.io.IOException

delegateTo

public static void delegateTo(JetAction action)
                       throws JetActionException,
                              java.io.IOException
Method to delegate to a specific action (used also by the JetServlet)

Parameters:
action - the action to delegate to
Throws:
JetActionException,IOException
JetActionException
java.io.IOException

delegateTo

public static void delegateTo(java.lang.String url,
                              JetContext context,
                              JetForm form)
                       throws JetActionException,
                              java.io.IOException
Method to delegate toa specific action (used also by the JetServlet

Parameters:
url - the url to delegate
context - the context to urse for this delegation
form - the form to useme
Throws:
JetActionException,IOException
JetActionException
java.io.IOException

delegateTo

private static void delegateTo(JetAction action,
                               JetForm form)
                        throws JetActionException,
                               java.io.IOException
Method to delegate toa specific action (used also by the JetServlet

Parameters:
action - the action to delegate to
form - the form to useme
Throws:
JetActionException,IOException
JetActionException
java.io.IOException

getDataStructure

protected static JetData getDataStructure(JetForm form,
                                          JetContext context,
                                          JetAction action)

doFormValidation

protected static void doFormValidation(JetMessages messages,
                                       JetForm form,
                                       JetContext context)

getContext

public final JetContext getContext()
Returns the context used by this action

Returns:
context object

getActionDef

protected ActionValueHolder getActionDef()
Returns the action definition object

Returns:
action definition

setActionDef

public void setActionDef(ActionValueHolder actionDef)
                  throws JetActionException
Set the action definition

Throws:
JetActionException

clone

public java.lang.Object clone()
Implementation of the clone method for Object pooling

Overrides:
clone in class java.lang.Object
Returns:
the clone object

doFormValidation

public boolean doFormValidation()
Method to indicate if the action should do form based validation


reset

public void reset()
Implementation of the reset method for object cloning

Specified by:
reset in interface Resetable

getInstanceFor

protected Poolable getInstanceFor(java.lang.String id)