org.norther.tammi.spray.loader.task
Class ActionEvent

java.lang.Object
  extended by org.norther.tammi.spray.loader.task.Action
      extended by org.norther.tammi.spray.loader.task.ActionEvent
All Implemented Interfaces:
Serializable, Task
Direct Known Subclasses:
FlowStepAction, TemplateAction

public abstract class ActionEvent
extends Action

ActionEvent is an alternative to Action that allows you to do event based actions. Essentially, you label all your submit buttons and methods with the prefix of "submit". For example, "submitDelete". Then any class that subclasses this class will get its submitDelete method executed.

If the named submit method was not implemented, it executes the generic submit method, named "submit", that must always be implemented.

Based on ActionEvent in the Apache Jakarta Turbine project.

Author:
Jon S. Stevens, Ilkka Priha
See Also:
Serialized Form

Constructor Summary
ActionEvent()
          Constructs a new action event.
 
Method Summary
 void execute(ServletRequest request, ServletResponse response, FilterChain chain, Object context)
          Executes the submitted event.
protected  Method getAction(Map params)
          Gets the submit method present in a parameter map.
protected  Method getAction(Map params, String className)
          Gets the qualified submit method present in a parameter map.
protected  Method getAction(String action)
          Gets the named submit method.
protected  Class[] getSignature()
          Gets the action class specific signature.
 void initialize(ServletRequest request, ServletResponse response, FilterChain chain, Object context)
          Initializes customized functionality after construction but before the first execution.
protected  void invoke(Method method, Object[] args)
          Invokes a method.
 void submit(ServletRequest request, ServletResponse response, FilterChain chain, Object context)
          Implements the default submit method if the specific one is not implemented.
 
Methods inherited from class org.norther.tammi.spray.loader.task.Action
find, getFilter, getMBeanServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionEvent

public ActionEvent()
Constructs a new action event.

Method Detail

initialize

public void initialize(ServletRequest request,
                       ServletResponse response,
                       FilterChain chain,
                       Object context)
Description copied from interface: Task
Initializes customized functionality after construction but before the first execution. The initialization parameters are the same as given to the first execution.

Specified by:
initialize in interface Task
Overrides:
initialize in class Action
Parameters:
request - the request.
response - the response.
chain - the filter chain.
context - a task specific context.

execute

public void execute(ServletRequest request,
                    ServletResponse response,
                    FilterChain chain,
                    Object context)
             throws Exception
Executes the submitted event.

Specified by:
execute in interface Task
Specified by:
execute in class Action
Parameters:
request - the request.
response - the response.
chain - the filter chain.
context - the context.
Throws:
Exception - on errors.

submit

public void submit(ServletRequest request,
                   ServletResponse response,
                   FilterChain chain,
                   Object context)
            throws Exception
Implements the default submit method if the specific one is not implemented. The default implementation does nothing.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
context - the template context.
Throws:
Exception - on errors.

getAction

protected Method getAction(String action)
Gets the named submit method.

Parameters:
action - the action name.
Returns:
the submit method or null.

getAction

protected Method getAction(Map params)
Gets the submit method present in a parameter map. If an exactly named method is not available, but some submit parameter was present, the generic submit method is returned.

Parameters:
params - the parameter map.
Returns:
the submit method or null.

getAction

protected Method getAction(Map params,
                           String className)
Gets the qualified submit method present in a parameter map. If an exactly named method is not available, but some submit parameter was present, the generic submit method is returned.

An optional class name is appended to the action parameter name to get a qualified submit method. If a qualified method is not available, the class name is removed and a non-qualified method returned.

Parameters:
params - the parameter map.
className - an optional class name.
Returns:
the action method or null.

invoke

protected void invoke(Method method,
                      Object[] args)
               throws Exception
Invokes a method.

Parameters:
method - the method.
args - the arguments.
Throws:
Exception - on errors.

getSignature

protected Class[] getSignature()
Gets the action class specific signature.

Returns:
the action signature.


Copyright © 2004 The Norther Organization. All rights reserved.