atg.scenario.action
Class ActionImpl

java.lang.Object
  extended by atg.scenario.action.ActionImpl
All Implemented Interfaces:
Action

Deprecated. This class has been deprecated in favour of atg.process.action.ActionImpl

public abstract class ActionImpl
extends java.lang.Object
implements Action

An abstract base class which can be used by most action implementations.

To implement a subclass of ActionImpl:

  1. Override the Action.initialize method with action-specific parameter initialization. You can use the methods storeRequiredParameter and storeOptionalParameter in this class to validate and store parameter Expressions for later evaluation or retrieval. For example,
    public void initialize(Map pParameters) throws ScenarioException { storeRequiredParameter(pParameters, PARAM_PATH, String.class); storeOptionalParameter(pParameters, PARAM_COUNT, Integer.class); }
  2. Implement the executeAction method defined in this class to execute the action in a single scenario execution context. You can use the getParameterValue method to evaluate the parameter expressions. For example,
    protected void executeAction(ScenarioExecutionContext pContext) throws ScenarioException { // evaluate parameter expressions (note: count may be null) String path = (String) getParameterValue(PARAM_PATH, pContext); Integer count = (Integer) getParameterValue(PARAM_COUNT, pContext); // execute the action using these parameter values ... }
  3. (Optional) Override the getActionName method defined in this class to return the name of the action. The action name is used in the toString method. By default, the name of the Action class is used as the action name.

See Also:
ActionImpl

Field Summary
static java.lang.String CLASS_VERSION
          Deprecated. Class version string
 
Constructor Summary
ActionImpl()
          Deprecated.  
 
Method Summary
 void execute(ScenarioExecutionContext pContext)
          Deprecated. Executes the action in the given scenario execution context.
 void execute(ScenarioExecutionContext[] pContexts)
          Deprecated. Executes the action in each of the given scenario execution contexts.
protected abstract  void executeAction(ScenarioExecutionContext pContext)
          Deprecated. Executes this action in the given single scenario execution context.
 java.lang.String getActionName()
          Deprecated. Returns the name of the action.
protected  Expression getParameterExpression(java.lang.String pParameterName)
          Deprecated. Returns the given parameter Expression.
protected  java.lang.Object getParameterValue(java.lang.String pParameterName, ScenarioExecutionContext pContext)
          Deprecated. Evaluates the given parameter Expression in the given context, and returns the value.
 void initialize(java.util.Map pParameters)
          Deprecated. Initializes the action with the given parameters.
protected  void storeOptionalParameter(java.util.Map pParameters, java.lang.String pParameterName, java.lang.Class pParameterValueType)
          Deprecated. Extracts an Expression with the given parameter name from the given parameter Map, and stores it for later retrieval.
protected  void storeRequiredMutableParameter(java.util.Map pParameters, java.lang.String pParameterName)
          Deprecated. Extracts a MutableExpression with the given parameter name from the given parameter Map, and stores it for later retrieval.
protected  void storeRequiredParameter(java.util.Map pParameters, java.lang.String pParameterName, java.lang.Class pParameterValueType)
          Deprecated. Extracts an Expression with the given parameter name from the given parameter Map, and stores it for later retrieval.
 java.lang.String toString()
          Deprecated. Returns the String representation of the Action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Deprecated. 
Class version string

Constructor Detail

ActionImpl

public ActionImpl()
Deprecated. 
Method Detail

storeRequiredParameter

protected void storeRequiredParameter(java.util.Map pParameters,
                                      java.lang.String pParameterName,
                                      java.lang.Class pParameterValueType)
                               throws ScenarioException
Deprecated. 
Extracts an Expression with the given parameter name from the given parameter Map, and stores it for later retrieval. If the Expression is constant, evaluates it and caches the constant value as well. The type of the constant value must match the given parameter value type.

Throws:
ScenarioException - if no parameter by this name is found in the map, if the parameter value is not an Expression, or if the constant Expression has a value which does not match the given value type

storeOptionalParameter

protected void storeOptionalParameter(java.util.Map pParameters,
                                      java.lang.String pParameterName,
                                      java.lang.Class pParameterValueType)
                               throws ScenarioException
Deprecated. 
Extracts an Expression with the given parameter name from the given parameter Map, and stores it for later retrieval. If the Expression is constant, evaluates it and caches the constant value as well. The type of the constant value must match the given parameter value type. If the parameter is not found in the map, does nothing.

Throws:
ScenarioException - if the parameter value is not an Expression, or if the constant Expression has a value which does not match the given value type

storeRequiredMutableParameter

protected void storeRequiredMutableParameter(java.util.Map pParameters,
                                             java.lang.String pParameterName)
                                      throws ScenarioException
Deprecated. 
Extracts a MutableExpression with the given parameter name from the given parameter Map, and stores it for later retrieval. No attempt is made to evaluate the expression.

Throws:
ScenarioException - if no parameter by this name is found in the map, or if the parameter value is not a MutableExpression

getParameterExpression

protected Expression getParameterExpression(java.lang.String pParameterName)
Deprecated. 
Returns the given parameter Expression.


getParameterValue

protected java.lang.Object getParameterValue(java.lang.String pParameterName,
                                             ScenarioExecutionContext pContext)
                                      throws ScenarioException
Deprecated. 
Evaluates the given parameter Expression in the given context, and returns the value. The value's type must match the parameter value type passed in to storeRequiredParameter or storeOptionalParameter. If the parameter Expression is constant, returns the cached constant value. If there is no Expression stored for this parameter, or if the Expression evaluates to null, returns null.

Throws:
ScenarioException - if the evaluated Expression has a value which does not match this parameter's value type

executeAction

protected abstract void executeAction(ScenarioExecutionContext pContext)
                               throws ScenarioException
Deprecated. 
Executes this action in the given single scenario execution context. Called by both of the execute methods.

Throws:
ScenarioException - if the action can not be executed

initialize

public void initialize(java.util.Map pParameters)
                throws ScenarioException
Deprecated. 
Initializes the action with the given parameters. keys in the parameter Map are the String parameter names; the values are the Expression objects representing parameter values.

This default implementation does nothing.

Specified by:
initialize in interface Action
Throws:
ScenarioException - if the action could not be properly initialized - for example, if not all of the required parameters are present in the Map
See Also:
Expression

execute

public void execute(ScenarioExecutionContext pContext)
             throws ActionException
Deprecated. 
Executes the action in the given scenario execution context. The context can be used to evaluate any parameter Expressions.

This default implementation calls executeAction. If that throws a ScenarioException, this method throws a corresponding ActionException.

Specified by:
execute in interface Action
Throws:
ActionException - if the action failed when executed in this context; the scenario engine will catch the ActionException and respond based on the value of the action's error response, as specified in the ActionException itself and/or the action registry; for example, the engine may ignore the error and continue, or it may delete the scenario instance pointed to by the context and stop executing the scenario segment in this context

execute

public void execute(ScenarioExecutionContext[] pContexts)
             throws ActionException
Deprecated. 
Executes the action in each of the given scenario execution contexts. Each context can be used to evaluate any parameter Expressions.

If an error occurs when executing the action in one of the given contexts, this method should still try to execute the action in the rest of the contexts before throwing an exception. In the end, an ActionException should be thrown with a FailedActionInfo entry for each failed scenario execution context.

This default implementation calls executeAction on each of the contexts. If any of these calls throw a ScenarioException, all the errors are collected, and a single ActionException is thrown in the end.

Specified by:
execute in interface Action
Throws:
ActionException - if the action failed when executed in any of the given contexts; the scenario engine will catch the ActionException and, for each failed context, respond based on the value of the action's error response, as specified in the ActionException itself and/or the action registry; for example, the engine may ignore the error and continue, or it may delete the scenario instance pointed to by the context and stop executing the scenario segment in that context

toString

public java.lang.String toString()
Deprecated. 
Returns the String representation of the Action.

Overrides:
toString in class java.lang.Object

getActionName

public java.lang.String getActionName()
Deprecated. 
Returns the name of the action.