Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mentawai.core
Class ActionConfig  view ActionConfig download ActionConfig.java

java.lang.Object
  extended byorg.mentawai.core.ActionConfig
Direct Known Subclasses:
SingleInstanceActionConfig

public class ActionConfig
extends java.lang.Object

An ActionConfig links together an action implementation, an action name or alias, action results and action consequences. It makes it possible for an action implementation to be re-used in different situations with different names and consequences.


Field Summary
private  java.lang.Class actionClass
           
private  java.util.Map consequences
           
private  java.util.List filters
           
private  java.lang.String innerAction
           
private  java.util.Map innerConsequences
           
private  java.lang.String name
           
 
Constructor Summary
ActionConfig(java.lang.Class klass)
          Creates an internal ActionConfig for the given action implementation.
ActionConfig(java.lang.String name, java.lang.Class klass)
          Creates an ActionConfig with the given name for the given action implementation.
ActionConfig(java.lang.String name, java.lang.Class klass, java.lang.String innerAction)
          Creates an ActionConfig with the given name for the given inner action implementation.
 
Method Summary
 ActionConfig addConsequence(java.lang.String result, Consequence c)
          Adds a consequence for the given result.
 ActionConfig addConsequence(java.lang.String result, java.lang.String innerAction, Consequence c)
          Adds a consequence for the given result of the given inner action.
 ActionConfig addFilter(Filter filter)
          Adds a filter for the action.
 ActionConfig addFilter(Filter filter, java.lang.String innerAction)
          Adds a filter for this inner action.
 ActionConfig addFilter(java.util.List filters)
          Adds a list of filter for the action.
 ActionConfig addFilter(java.util.List filters, java.lang.String innerAction)
          Adds a list of filter for the inner action.
private  java.lang.String cutSlash(java.lang.String name)
           
 Action getAction()
          Returns an action instance to be used with this request.
 Consequence getConsequence(java.lang.String result)
          Gets the consequence for the given result.
 Consequence getConsequence(java.lang.String result, java.lang.String innerAction)
          Gets the consequence for the given result of the given inner action.
 java.util.List getFilters()
          Returns the filters for this action.
 java.util.List getFilters(java.lang.String innerAction)
          Returns the filters for this inner action.
 java.lang.String getInnerAction()
          Gets the inner action that this action config represents.
 java.lang.String getName()
          Gets the name or alias of this ActionConfig.
(package private)  void setInnerAction(java.lang.String innerAction)
           
 java.lang.String toString()
          Returns the name of this ActionConfig.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actionClass

private java.lang.Class actionClass

name

private java.lang.String name

consequences

private java.util.Map consequences

innerConsequences

private java.util.Map innerConsequences

filters

private java.util.List filters

innerAction

private java.lang.String innerAction
Constructor Detail

ActionConfig

public ActionConfig(java.lang.Class klass)
Creates an internal ActionConfig for the given action implementation. This action config does not have a name and cannot be called by the outside world. Trying to add an internal action config to the application manager will throw an exception. An internal action config may be useful for action chaining, in other words, you may want to chain an action with another action that is not available to the outside world.


ActionConfig

public ActionConfig(java.lang.String name,
                    java.lang.Class klass)
Creates an ActionConfig with the given name for the given action implementation.


ActionConfig

public ActionConfig(java.lang.String name,
                    java.lang.Class klass,
                    java.lang.String innerAction)
Creates an ActionConfig with the given name for the given inner action implementation. Notice that this action config is specific to an inner action.

Method Detail

addConsequence

public ActionConfig addConsequence(java.lang.String result,
                                   Consequence c)
Adds a consequence for the given result. An action must have a consequence for each of its possible results.


cutSlash

private java.lang.String cutSlash(java.lang.String name)

addConsequence

public ActionConfig addConsequence(java.lang.String result,
                                   java.lang.String innerAction,
                                   Consequence c)
Adds a consequence for the given result of the given inner action. An inner action can have a consequence for each of its possible results. If you don't define consequences for an inner action, the consequences of the main action (execute() method) is used instead.


addFilter

public ActionConfig addFilter(Filter filter)
Adds a filter for the action.


addFilter

public ActionConfig addFilter(Filter filter,
                              java.lang.String innerAction)
Adds a filter for this inner action.

Since:
1.1.1

addFilter

public ActionConfig addFilter(java.util.List filters)
Adds a list of filter for the action.


addFilter

public ActionConfig addFilter(java.util.List filters,
                              java.lang.String innerAction)
Adds a list of filter for the inner action.

Since:
1.1.1

getFilters

public java.util.List getFilters()
Returns the filters for this action.


getFilters

public java.util.List getFilters(java.lang.String innerAction)
Returns the filters for this inner action.

Since:
1.1.1

getName

public java.lang.String getName()
Gets the name or alias of this ActionConfig.


getInnerAction

public java.lang.String getInnerAction()
Gets the inner action that this action config represents.


setInnerAction

void setInnerAction(java.lang.String innerAction)

getConsequence

public Consequence getConsequence(java.lang.String result)
Gets the consequence for the given result.


getConsequence

public Consequence getConsequence(java.lang.String result,
                                  java.lang.String innerAction)
Gets the consequence for the given result of the given inner action.


getAction

public Action getAction()
Returns an action instance to be used with this request. Mentawai creates a new action instance for each request. You can extend ActionConfig and override this class to integrage Mentawai with other IoC containers.


toString

public java.lang.String toString()
Returns the name of this ActionConfig. Ex: /HelloWorld, /customers/add, etc.