Klasse ActionEvent

java.lang.Object
org.apache.turbine.modules.ActionEvent
Alle implementierten Schnittstellen:
Action, Assembler
Bekannte direkte Unterklassen:
VelocityActionEvent

public abstract class ActionEvent extends Object implements Action

This is an alternative to the Action class that allows you to do event based actions. Essentially, you label all your submit buttons with the prefix of "eventSubmit_" and the suffix of "methodName". For example, "eventSubmit_doDelete". Then any class that subclasses this class will get its "doDelete(PipelineData data)" method executed. If for any reason, it was not able to execute the method, it will fall back to executing the doPerform() method which is required to be implemented.

Limitations:

Because ParameterParser makes all the key values lowercase, we have to do some work to format the string into a method name. For example, a button name eventSubmit_doDelete gets converted into eventsubmit_dodelete. Thus, we need to form some sort of naming convention so that dodelete can be turned into doDelete.

Thus, the convention is this:

  • The variable name MUST have the prefix "eventSubmit_".
  • The variable name after the prefix MUST begin with the letters "do".
  • The first letter after the "do" will be capitalized and the rest will be lowercase
If you follow these conventions, then you should be ok with your method naming in your Action class.
Version:
$Id$
Autor:
Jon S. Stevens , Henning P. Schmiedehausen, Quinton McCombs, Peter Courcoux
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected boolean
    If true, then exceptions raised in eventSubmit_do<xxx> methods as well as in doPerform methods are bubbled up to the Turbine servlet's handleException method.
    protected static final String
    The name of the button to look for.
    protected static final int
    The length of the button to look for.
    protected static final String
    The default method.
    protected static final int
    The length of the button to look for.
    protected org.apache.logging.log4j.Logger
    Logging
    protected static final int
    The length of the method name.
    protected static final String
    The prefix of the method name.

    Von Schnittstelle geerbte Felder org.apache.turbine.modules.Action

    CACHE_SIZE_DEFAULT, CACHE_SIZE_KEY, NAME, PREFIX
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    protected boolean
    considerKey(String key, org.apache.fulcrum.parser.ParameterParser pp)
    Checks whether the selected key really is a valid event.
    void
    doPerform(PipelineData pipelineData)
    This overrides the default Action.doPerform() to execute the doEvent() method.
    protected void
    executeEvents(org.apache.fulcrum.parser.ParameterParser pp, Class<?>[] signature, Object[] parameters)
    This method should be called to execute the event based system.
    protected String
    formatString(String input, org.apache.fulcrum.parser.ParameterParser pp)
    This method does the conversion of the lowercase method name into the proper case.
    protected Method
    getMethod(String name, Class<?>[] signature, org.apache.fulcrum.parser.ParameterParser pp)
    Retrieve a method of the given name and signature.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Von Schnittstelle geerbte Methoden org.apache.turbine.modules.Action

    perform
  • Felddetails

    • log

      protected org.apache.logging.log4j.Logger log
      Logging
    • BUTTON

      protected static final String BUTTON
      The name of the button to look for.
      Siehe auch:
    • BUTTON_LENGTH

      protected static final int BUTTON_LENGTH
      The length of the button to look for.
    • DEFAULT_METHOD

      protected static final String DEFAULT_METHOD
      The default method.
      Siehe auch:
    • METHOD_NAME_PREFIX

      protected static final String METHOD_NAME_PREFIX
      The prefix of the method name.
      Siehe auch:
    • METHOD_NAME_LENGTH

      protected static final int METHOD_NAME_LENGTH
      The length of the method name.
    • LENGTH

      protected static final int LENGTH
      The length of the button to look for.
    • bubbleUpException

      protected boolean bubbleUpException
      If true, then exceptions raised in eventSubmit_do<xxx> methods as well as in doPerform methods are bubbled up to the Turbine servlet's handleException method.
  • Konstruktordetails

  • Methodendetails

    • getMethod

      protected Method getMethod(String name, Class<?>[] signature, org.apache.fulcrum.parser.ParameterParser pp) throws NoSuchMethodException
      Retrieve a method of the given name and signature. The value is cached.
      Parameter:
      name - the name of the method
      signature - an array of classes forming the signature of the method
      pp - ParameterParser for correct folding
      Gibt zurück:
      the method object
      Löst aus:
      NoSuchMethodException - if the method does not exist
    • doPerform

      public void doPerform(PipelineData pipelineData) throws Exception
      This overrides the default Action.doPerform() to execute the doEvent() method. If that fails, then it will execute the doPerform() method instead.
      Angegeben von:
      doPerform in Schnittstelle Action
      Parameter:
      pipelineData - Turbine information.
      Löst aus:
      Exception - a generic exception.
    • executeEvents

      protected void executeEvents(org.apache.fulcrum.parser.ParameterParser pp, Class<?>[] signature, Object[] parameters) throws Exception
      This method should be called to execute the event based system.
      Parameter:
      pp - the parameter parser
      signature - the signature of the method to call
      parameters - the parameters for the method to call
      Löst aus:
      Exception - a generic exception.
    • formatString

      protected String formatString(String input, org.apache.fulcrum.parser.ParameterParser pp)
      This method does the conversion of the lowercase method name into the proper case.
      Parameter:
      input - The unconverted method name.
      pp - The parameter parser (for correct folding)
      Gibt zurück:
      A string with the method name in the proper case.
    • considerKey

      protected boolean considerKey(String key, org.apache.fulcrum.parser.ParameterParser pp)
      Checks whether the selected key really is a valid event.
      Parameter:
      key - The selected key
      pp - The parameter parser to look for the key value
      Gibt zurück:
      true if this key is really an ActionEvent Key