IBM WebSphere Application ServerTM
Release 8

com.ibm.websphere.management.cmdframework.provider
Class AbstractCommandStep

java.lang.Object
  extended by org.eclipse.emf.common.command.AbstractCommand
      extended by com.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
          extended by com.ibm.websphere.management.cmdframework.provider.AbstractCommandStep
All Implemented Interfaces:
AdminCommand, CommandStep, org.eclipse.emf.common.command.Command

public class AbstractCommandStep
extends AbstractAdminCommand
implements CommandStep

The class is the base class for any command step implementation. Any specific command step implementation should derive from this class and only override the methods that javadoc recommends to override.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
AbstractAdminCommand.CmdNotificationListener
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
org.eclipse.emf.common.command.AbstractCommand.NonDirtying
 
Field Summary
protected  AbstractTaskCommand taskCmd
           
 
Fields inherited from class com.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
ASYNC_CUSTOM_TAG, asyncCmdSession, cmdMgrType, cnh, DYNAMIC_CUSTOM_TAG, listSetParamsTable, PRIVATE_CUSTOM_TAG
 
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label
 
Constructor Summary
AbstractCommandStep(AbstractTaskCommand parent, com.ibm.websphere.management.cmdframework.commanddata.CommandData commandData)
           
AbstractCommandStep(AbstractTaskCommand parent, com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
           
 
Method Summary
 void addRow(javax.management.AttributeList rowData, int rowIndex)
          Add a row to the table at the specified position.
 void commandParamModified()
          This method is called whenever the parameter data in the parent task command are changed.
protected  org.eclipse.emf.ecore.EObject createParamEObject()
          Create an EObject to store the command's parameter values.
 void deleteRow(int rowIndex)
          Remove a row at the specified position from the table.
 boolean equals(java.lang.Object obj)
          If two instance of command step have same name, we consider them eaqual.
 void execute()
          Step can not be executed independently, therefore this method is not supported.
 void execute(CommandHistory cmdHistory)
          Step can not be executed independently, therefore this method is not supported.
protected  void executeStep()
          Execute the current step.
 java.lang.Object[] getChoices(java.lang.String paramName, int rowIndex)
          Returns valid values for the specified parameter.
static com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata(java.lang.String cmdName)
           
 com.ibm.websphere.management.cmdframework.commanddata.CommandStepData getCommandStepData()
          A convienent method that returns more type specific value than the generic CommandData.
 Session getConfigSession()
          Returns user's config session.
 int getNumberOfRows()
          Gets the number of rows in the table.
 java.lang.Object getParameter(java.lang.String parameterName, int rowIndex)
          Gets the parameter value for a specified parameter and row index.
 int hashcode()
          Hash the command step according to the command name.
protected  com.ibm.websphere.management.cmdframework.commanddata.CommandData initCommandData()
          Construct proper type of command data instance.
protected  void initializeRow(javax.management.AttributeList rowData, int rowIndex)
           
protected  void initializeStep()
          Initialize the current step.
 boolean isEnabled()
          Tests if this command step is enabled or not.
protected  boolean isLocalMode()
           
 boolean isRequired()
          Check if step has required data missing
 boolean isRequired(int rowIndex)
          Check if row at the specified position has required data missing
protected  boolean isTable()
           
 java.util.Collection listSetParams(int rowIndex)
          Lists all the parameters are set.
 void resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData stepData)
          Reset the command data for the step.
 void setParameter(java.lang.String paramName, java.lang.Object value, int rowIndex)
          Sets a parameter value.
 void stepModified(java.lang.String stepName)
          This method is called whenever the parameter data in another task step are changed.
protected  void taskCommandExecuted(boolean success, boolean executed)
          This method is called when the task command completes the execution.
 void validate()
          Providers a default implmentation for the method.
 
Methods inherited from class com.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
cleanupUploadedFiles, createParameterMetadata, generateScript, getChoices, getCmdHandler, getCmdMgrType, getCommandData, getCommandMetadata, getCommandResult, getCommandSession, getConfigService, getLocale, getName, getOrigParameterValue, getParameter, getParameterMetadata, getResult, getTargetObject, getTargetObjectChoices, getUserData, initializeParameter, initializeParameter, isAsyncCommand, isDynamicStepCommand, isParamReadonly, isPrivateParameter, listAllParameterName, listParameterName, listSetParams, redo, resetCommandMetadata, save, sendNotification, setCmdHandler, setCmdMgrType, setCommandMetadata, setCommandResult, setCommandSession, setConfigSession, setListSetParamsTable, setLocale, setOrigParameterValue, setParameter, setTargetObject, setupListener
 
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
canExecute, canUndo, chain, dispose, getAffectedObjects, getDescription, getLabel, prepare, setDescription, setLabel, toString, undo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.websphere.management.cmdframework.AdminCommand
createParameterMetadata, generateScript, getChoices, getCmdHandler, getCommandMetadata, getCommandResult, getLocale, getName, getOrigParameterValue, getParameter, getTargetObject, getTargetObjectChoices, isAsyncCommand, isDynamicStepCommand, isPrivateParameter, listAllParameterName, listParameterName, listSetParams, save, setCmdHandler, setConfigSession, setLocale, setOrigParameterValue, setParameter, setTargetObject
 
Methods inherited from interface org.eclipse.emf.common.command.Command
canExecute, canUndo, chain, dispose, getAffectedObjects, getDescription, getLabel, getResult, redo, undo
 

Field Detail

taskCmd

protected AbstractTaskCommand taskCmd
Constructor Detail

AbstractCommandStep

public AbstractCommandStep(AbstractTaskCommand parent,
                           com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)

AbstractCommandStep

public AbstractCommandStep(AbstractTaskCommand parent,
                           com.ibm.websphere.management.cmdframework.commanddata.CommandData commandData)
                    throws CommandNotFoundException
Throws:
CommandNotFoundException
Method Detail

getCommandMetadata

public static com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata(java.lang.String cmdName)
                                                                                                    throws CommandNotFoundException
Throws:
CommandNotFoundException

isEnabled

public boolean isEnabled()
Description copied from interface: CommandStep
Tests if this command step is enabled or not.

Specified by:
isEnabled in interface CommandStep
Returns:
true if this command step is enabled; false otherwise.

isLocalMode

protected boolean isLocalMode()
Overrides:
isLocalMode in class AbstractAdminCommand

hashcode

public final int hashcode()
Hash the command step according to the command name.


equals

public final boolean equals(java.lang.Object obj)
If two instance of command step have same name, we consider them eaqual. The reason is that each command step should have a unique name.

Overrides:
equals in class java.lang.Object

initCommandData

protected com.ibm.websphere.management.cmdframework.commanddata.CommandData initCommandData()
Description copied from class: AbstractAdminCommand
Construct proper type of command data instance.

Overrides:
initCommandData in class AbstractAdminCommand
Returns:
newly created command data instance.

getCommandStepData

public final com.ibm.websphere.management.cmdframework.commanddata.CommandStepData getCommandStepData()
A convienent method that returns more type specific value than the generic CommandData.


resetCommandData

public final void resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData stepData)
Reset the command data for the step.

Overrides:
resetCommandData in class AbstractAdminCommand
Parameters:
stepData - the new command data for the step.

execute

public final void execute(CommandHistory cmdHistory)
Step can not be executed independently, therefore this method is not supported.

Specified by:
execute in interface AdminCommand
Overrides:
execute in class AbstractAdminCommand
Parameters:
cmdHistory - an implementation of command history

execute

public final void execute()
Step can not be executed independently, therefore this method is not supported.

Specified by:
execute in interface org.eclipse.emf.common.command.Command
Specified by:
execute in class AbstractAdminCommand

listSetParams

public java.util.Collection listSetParams(int rowIndex)
                                   throws java.lang.IndexOutOfBoundsException
Description copied from interface: CommandStep
Lists all the parameters are set.

Specified by:
listSetParams in interface CommandStep
Overrides:
listSetParams in class AbstractAdminCommand
Parameters:
rowIndex - the row index in the table. Ignored if the command step parameter data is not a table.
Returns:
a collection of parameter names whose value are set.
Throws:
java.lang.IndexOutOfBoundsException

getParameter

public java.lang.Object getParameter(java.lang.String parameterName,
                                     int rowIndex)
                              throws InvalidParameterNameException,
                                     java.lang.IndexOutOfBoundsException
Description copied from interface: CommandStep
Gets the parameter value for a specified parameter and row index.

Specified by:
getParameter in interface CommandStep
Overrides:
getParameter in class AbstractAdminCommand
Parameters:
parameterName - the name of a paramter
rowIndex - the row index in the table. Ignored if the command step parameter data is not a table.
Returns:
the parameter value for the specified parameter at the specified row index.
Throws:
InvalidParameterNameException
java.lang.IndexOutOfBoundsException

setParameter

public void setParameter(java.lang.String paramName,
                         java.lang.Object value,
                         int rowIndex)
                  throws InvalidParameterValueException,
                         InvalidParameterNameException,
                         java.lang.IndexOutOfBoundsException
Description copied from interface: CommandStep
Sets a parameter value.

Specified by:
setParameter in interface CommandStep
Overrides:
setParameter in class AbstractAdminCommand
Parameters:
paramName - the name of a parameter.
value - the value of a parameter.
rowIndex - the row index in the table. Ignored if the command step parameter data is not a table.
Throws:
InvalidParameterValueException
InvalidParameterNameException
java.lang.IndexOutOfBoundsException

getNumberOfRows

public int getNumberOfRows()
Description copied from interface: CommandStep
Gets the number of rows in the table.

Specified by:
getNumberOfRows in interface CommandStep

initializeRow

protected void initializeRow(javax.management.AttributeList rowData,
                             int rowIndex)
                      throws InvalidParameterValueException,
                             java.lang.IndexOutOfBoundsException
Throws:
InvalidParameterValueException
java.lang.IndexOutOfBoundsException

addRow

public void addRow(javax.management.AttributeList rowData,
                   int rowIndex)
            throws InvalidParameterValueException,
                   java.lang.IndexOutOfBoundsException
Description copied from interface: CommandStep
Add a row to the table at the specified position.

Specified by:
addRow in interface CommandStep
Parameters:
rowData - the parameter data in a row. The attribute name is a parameter name and the attribute value is the value for the parameter.
rowIndex - the row index in the table. Ignored if the command step parameter data is not a table.
Throws:
InvalidParameterValueException
java.lang.IndexOutOfBoundsException

deleteRow

public void deleteRow(int rowIndex)
               throws java.lang.UnsupportedOperationException
Description copied from interface: CommandStep
Remove a row at the specified position from the table.

Specified by:
deleteRow in interface CommandStep
Parameters:
rowIndex - the row index in the table.
Throws:
java.lang.UnsupportedOperationException - if the command step parameter data is not a table.

isTable

protected final boolean isTable()
Overrides:
isTable in class AbstractAdminCommand

createParamEObject

protected final org.eclipse.emf.ecore.EObject createParamEObject()
                                                          throws CommandNotFoundException
Description copied from class: AbstractAdminCommand
Create an EObject to store the command's parameter values.

Overrides:
createParamEObject in class AbstractAdminCommand
Returns:
an EObject instance to store the command's parameter values.
Throws:
CommandNotFoundException

stepModified

public void stepModified(java.lang.String stepName)
                  throws CommandException
This method is called whenever the parameter data in another task step are changed. The default implementation of this methods is a no-op. Subclass may optionally implement additional logic to respond to the changes in other steps. Command provider may use this mechanism to implement the dependencies among steps.

Parameters:
stepName - the step name.
Throws:
CommandException - if not able to change task step by subclass.

commandParamModified

public void commandParamModified()
This method is called whenever the parameter data in the parent task command are changed. The default implementation of this method is a no-op. Subclass may optionally implement additional logic to respond to the changes in parent task command. Command provider may use this mechanism to implement the dependencies between task command and this command step.


validate

public void validate()
              throws CommandValidationException
Description copied from class: AbstractAdminCommand
Providers a default implmentation for the method. The default implementation checks if all the required parameters are specified, also it checks if the types of specified parameter values matches up the type of the parameter data defined in metadata. Extended class may override this method to validate the command parameter further.

Specified by:
validate in interface AdminCommand
Overrides:
validate in class AbstractAdminCommand
Throws:
CommandValidationException - if there is any invalid command parameter.

taskCommandExecuted

protected void taskCommandExecuted(boolean success,
                                   boolean executed)
This method is called when the task command completes the execution. The default implementation of this method is a no-op. Subclass may optionally override this method to clean up the data structure or resources. This method can also used to undo some of the side effect this step caused in case the task command execution failed.

Parameters:
success - true if the task command executed successfully, false otherwise.
executed - true if this step is ever executed, false otherwise.

executeStep

protected void executeStep()
Execute the current step. The default implementation of this method is a no-op. Subclass may optionally override this method to implement the execution logic for the step.


initializeStep

protected void initializeStep()
                       throws CommandException
Initialize the current step.

This method is called when this step is returned to command user first time.

Throws:
CommandException

isRequired

public boolean isRequired()
Description copied from interface: CommandStep
Check if step has required data missing

Specified by:
isRequired in interface CommandStep
Returns:
true if this command step has required data missing; otherwise false.

getConfigSession

public Session getConfigSession()
Description copied from interface: AdminCommand
Returns user's config session. It returns null if the config session is never set.

Specified by:
getConfigSession in interface AdminCommand
Overrides:
getConfigSession in class AbstractAdminCommand
Returns:
user's config session.

isRequired

public boolean isRequired(int rowIndex)
Description copied from interface: CommandStep
Check if row at the specified position has required data missing

Specified by:
isRequired in interface CommandStep
Parameters:
rowIndex - the row index in the table.
Returns:
true if this row has required data missing; otherwise false.

getChoices

public java.lang.Object[] getChoices(java.lang.String paramName,
                                     int rowIndex)
Description copied from interface: CommandStep
Returns valid values for the specified parameter. Implementation of this method is optional. If command provider does not implement this method, then this method returns null.

Specified by:
getChoices in interface CommandStep
Parameters:
paramName - the parameter name.
rowIndex - the row index in the table.
Returns:
an array of valid values for the specified parameter.

IBM WebSphere Application ServerTM
Release 8