com.ibm.websphere.management.cmdframework.provider

Class AbstractCommandStep

  1. java.lang.Object
  2. extended byorg.eclipse.emf.common.command.AbstractCommand
  3. extended bycom.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
  4. extended bycom.ibm.websphere.management.cmdframework.provider.AbstractCommandStep
All implemented interfaces:
AdminCommand, CommandStep, org.eclipse.emf.common.command.Command

  1. public class AbstractCommandStep
  2. extends AbstractAdminCommand
  3. 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

Modifier and Type Field and Description
  1. protected
  2. 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

Constructor and Description
AbstractCommandStep(AbstractTaskCommand parent,com.ibm.websphere.management.cmdframework.commanddata.CommandData commandData)
AbstractCommandStep(AbstractTaskCommand parent,com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)

Method Summary

Modifier and Type Method and Description
  1. void
addRow(javax.management.AttributeList rowData,int rowIndex)
  1. void
commandParamModified()
This method is called whenever the parameter data in the parent task command are changed.
  1. protected
  2. org.eclipse.emf.ecore.EObject
createParamEObject()
  1. void
deleteRow(int rowIndex)
  1. boolean
equals(java.lang.Object obj)
If two instance of command step have same name, we consider them eaqual.
  1. void
execute()
Step can not be executed independently, therefore this method is not supported.
  1. void
execute(CommandHistory cmdHistory)
Step can not be executed independently, therefore this method is not supported.
  1. protected
  2. void
executeStep()
Execute the current step.
  1. java.lang.Object[]
getChoices(java.lang.String paramName,int rowIndex)
  1. static
  2. com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata
getCommandMetadata(java.lang.String cmdName)
  1. com.ibm.websphere.management.cmdframework.commanddata.CommandStepData
getCommandStepData()
A convienent method that returns more type specific value than the generic CommandData.
  1. Session
getConfigSession()
  1. int
getNumberOfRows()
  1. java.lang.Object
getParameter(java.lang.String parameterName,int rowIndex)
  1. int
hashcode()
Hash the command step according to the command name.
  1. protected
  2. com.ibm.websphere.management.cmdframework.commanddata.CommandData
initCommandData()
  1. protected
  2. void
initializeRow(javax.management.AttributeList rowData,int rowIndex)
  1. protected
  2. void
initializeStep()
Initialize the current step.
  1. boolean
isEnabled()
  1. protected
  2. boolean
isLocalMode()
  1. boolean
isRequired()
  1. boolean
isRequired(int rowIndex)
  1. protected
  2. boolean
isTable()
  1. java.util.Collection
listSetParams(int rowIndex)
  1. void
resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData stepData)
Reset the command data for the step.
  1. void
setParameter(java.lang.String paramName,java.lang.Object value,int rowIndex)
  1. void
stepModified(java.lang.String stepName)
This method is called whenever the parameter data in another task step are changed.
  1. protected
  2. void
taskCommandExecuted(boolean success,boolean executed)
This method is called when the task command completes the execution.
  1. void
validate()
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

  1. protected AbstractTaskCommand taskCmd

Constructor Detail

AbstractCommandStep

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

AbstractCommandStep

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

Method Detail

getCommandMetadata

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

isEnabled

  1. 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

  1. protected boolean isLocalMode()
Overrides:

hashcode

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

equals

  1. 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

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

getCommandStepData

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

resetCommandData

  1. public final void resetCommandData( com.ibm.websphere.management.cmdframework.commanddata.CommandData stepData)
Reset the command data for the step.
Overrides:
Parameters:
stepData - the new command data for the step.

execute

  1. 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:
Parameters:
cmdHistory - an implementation of command history

execute

  1. 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:

listSetParams

  1. public java.util.Collection listSetParams( int rowIndex)
  2. throws java.lang.IndexOutOfBoundsException
Description copied from interface: CommandStep
Lists all the parameters are set.
Specified by:
listSetParams in interface CommandStep
Overrides:
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

  1. public java.lang.Object getParameter( java.lang.String parameterName,
  2. int rowIndex)
  3. throws InvalidParameterNameException
  4. 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:
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:
java.lang.IndexOutOfBoundsException

setParameter

  1. public void setParameter(java.lang.String paramName,
  2. java.lang.Object value,
  3. int rowIndex)
  4. throws InvalidParameterValueException
  5. InvalidParameterNameException
  6. java.lang.IndexOutOfBoundsException
Description copied from interface: CommandStep
Sets a parameter value.
Specified by:
setParameter in interface CommandStep
Overrides:
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:
java.lang.IndexOutOfBoundsException

getNumberOfRows

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

initializeRow

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

addRow

  1. public void addRow(javax.management.AttributeList rowData,
  2. int rowIndex)
  3. throws InvalidParameterValueException
  4. 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:
java.lang.IndexOutOfBoundsException

deleteRow

  1. public void deleteRow(int rowIndex)
  2. 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

  1. protected final boolean isTable( )
Overrides:

createParamEObject

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

stepModified

  1. public void stepModified(java.lang.String stepName)
  2. 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

  1. 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

  1. public void validate()
  2. 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:
Throws:
CommandValidationException - if there is any invalid command parameter.

taskCommandExecuted

  1. protected void taskCommandExecuted( boolean success,
  2. 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

  1. 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

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

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

Throws:

isRequired

  1. 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

  1. 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:
Overrides:
Returns:
user's config session.

isRequired

  1. 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

  1. public java.lang.Object[] getChoices( java.lang.String paramName,
  2. 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.