| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectatg.scenario.action.ActionImpl
public abstract class ActionImpl
An abstract base class which can be used by most action implementations.
To implement a subclass of ActionImpl:
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); }
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 ... }
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.
 
ActionImpl| Field Summary | |
|---|---|
| static java.lang.String | CLASS_VERSIONDeprecated. 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 | 
|---|
public static java.lang.String CLASS_VERSION
| Constructor Detail | 
|---|
public ActionImpl()
| Method Detail | 
|---|
protected void storeRequiredParameter(java.util.Map pParameters,
                                      java.lang.String pParameterName,
                                      java.lang.Class pParameterValueType)
                               throws ScenarioException
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
protected void storeOptionalParameter(java.util.Map pParameters,
                                      java.lang.String pParameterName,
                                      java.lang.Class pParameterValueType)
                               throws ScenarioException
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
protected void storeRequiredMutableParameter(java.util.Map pParameters,
                                             java.lang.String pParameterName)
                                      throws ScenarioException
ScenarioException - if no parameter by this name is
 found in the map, or if the parameter value is not a
 MutableExpressionprotected Expression getParameterExpression(java.lang.String pParameterName)
protected java.lang.Object getParameterValue(java.lang.String pParameterName,
                                             ScenarioExecutionContext pContext)
                                      throws ScenarioException
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.
ScenarioException - if the evaluated Expression has a
 value which does not match this parameter's value type
protected abstract void executeAction(ScenarioExecutionContext pContext)
                               throws ScenarioException
execute methods.
ScenarioException - if the action can not be executed
public void initialize(java.util.Map pParameters)
                throws ScenarioException
This default implementation does nothing.
initialize in interface ActionScenarioException - if the action could not be properly
 initialized - for example, if not all of the required parameters
 are present in the MapExpression
public void execute(ScenarioExecutionContext pContext)
             throws ActionException
This default implementation calls executeAction.
 If that throws a ScenarioException, this method throws a
 corresponding ActionException.
execute in interface ActionActionException - 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
public void execute(ScenarioExecutionContext[] pContexts)
             throws ActionException
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.
execute in interface ActionActionException - 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 contextpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getActionName()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||