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