com.ibm.websphere.management.cmdframework.provider
Class AbstractTaskCommand
- java.lang.Object
org.eclipse.emf.common.command.AbstractCommand
com.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
com.ibm.websphere.management.cmdframework.provider.AbstractTaskCommand
All implemented interfaces:
AdminCommand, TaskCommand, org.eclipse.emf.common.command.Command
- public abstract class AbstractTaskCommand
- extends AbstractAdminCommand
- implements TaskCommand
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
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 |
---|
AbstractTaskCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData commandData)
|
AbstractTaskCommand(com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata inMetadata)
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
addNewStep(com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata metadata,com.ibm.websphere.management.cmdframework.commanddata.CommandStepData stepData,int i)
|
|
addStep(AbstractCommandStep step,int index)
add an additional step for the task.
|
|
afterStepsExecuted()
This method is called after the steps are executed.
|
|
beforeStepsExecuted()
This method is called before the steps are executed.
|
|
commandParamsModified()
This method is called before the user starts to navigate through steps.
|
|
contructSteps()
|
|
execute()
Implements the execution flow for a task command.
|
getCommandStep(java.lang.String stepName)
|
|
getCurrentStep(int operation)
|
|
getCurrentStep(int operation,java.lang.String stepName)
|
|
|
getCurrentStepIndex()
|
|
getTaskCommandData()
|
|
getTaskCommandMetadata()
|
getTaskCommandResult()
|
|
gotoStep(java.lang.String stepName)
|
|
|
hasNextStep()
|
|
hasPreviousStep()
|
|
initCommandData()
|
|
listAllStepParamsData()
|
|
listCommandSteps()
|
nextStep()
|
|
previousStep()
|
|
|
processTaskParameters()
This method is called to process task parameters.
|
|
resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Reset the command data.
|
|
setCurrentStep(AbstractCommandStep newCurrentStep)
|
|
setCurrentStepIndex(int index)
|
|
showArrayContents(java.lang.Object[] array)
|
|
showListContents(java.util.List list)
|
|
stepModified(java.lang.String stepName)
This method is called whenever the user navigates away from the specified step.
|
|
taskCommandExecuted(boolean success)
This method is called after the task command is executed.
|
|
validate()
This provides a basic implementation for command parameter validation.
|
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.ibm.websphere.management.cmdframework.AdminCommand |
---|
createParameterMetadata, execute, generateScript, getChoices, getCmdHandler, getCommandMetadata, getCommandResult, getConfigSession, 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 |
Constructor Detail
AbstractTaskCommand
- public AbstractTaskCommand(com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata inMetadata)
- throws CommandNotFoundException
Throws:
AbstractTaskCommand
- public AbstractTaskCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData commandData)
- throws CommandNotFoundException
- CommandLoadException
Method Detail
contructSteps
- protected void contructSteps()
- throws CommandNotFoundException
Throws:
initCommandData
- protected com.ibm.websphere.management.cmdframework.commanddata.CommandData initCommandData( )
Construct proper type of command data instance.
Overrides:
initCommandData
in class AbstractAdminCommand
Returns:
newly created command data instance.
getCurrentStep
- public CommandStep getCurrentStep( int operation)
getCurrentStep
- public CommandStep getCurrentStep( int operation,
- java.lang.String stepName)
setCurrentStep
- public void setCurrentStep(AbstractCommandStep newCurrentStep)
getCurrentStepIndex
- public int getCurrentStepIndex( )
setCurrentStepIndex
- public void setCurrentStepIndex( int index)
listCommandSteps
- public java.lang.String[] listCommandSteps( )
Description copied from interface:
TaskCommand
Lists the command step names contained in this task command including
the disabled command steps.
Specified by:
listCommandSteps
in interface TaskCommand
Returns:
the names of command steps defined in this command.
nextStep
- public final CommandStep nextStep( )
- throws java.util.NoSuchElementException
Description copied from interface:
TaskCommand
Gets the next enabled command step.
Returns the first enabled step if this method is called first time.
Specified by:
nextStep
in interface TaskCommand
Returns:
the next enabled command step.
Throws:
java.util.NoSuchElementException
- if there is no enabled step after the cursor. previousStep
- public final CommandStep previousStep( )
- throws java.util.NoSuchElementException
Description copied from interface:
TaskCommand
Gets the previous enabled step in the task command.
Specified by:
previousStep
in interface TaskCommand
Returns:
the previous enabled step in the task command.
Throws:
java.util.NoSuchElementException
- if there is no enabled step before the cursor. hasNextStep
- public final boolean hasNextStep( )
Description copied from interface:
TaskCommand
Tests if there is an enabled step after the cursor.
Specified by:
hasNextStep
in interface TaskCommand
Returns:
true if there is an enabled step after the cursor.
hasPreviousStep
- public final boolean hasPreviousStep( )
Description copied from interface:
TaskCommand
Tests if there is an enabled step before the cursor.
Specified by:
hasPreviousStep
in interface TaskCommand
Returns:
true if there is an enabled step before the cursor.
gotoStep
- public final CommandStep gotoStep( java.lang.String stepName)
- throws java.util.NoSuchElementException
Description copied from interface:
TaskCommand
Goes to the specified step.
This method puts the cursor after the step if the call succeeds; the cusor
is not moved if the call fails.
Specified by:
gotoStep
in interface TaskCommand
Parameters:
stepName
- the step name Returns:
the specified step if the step is found and enabled.
Throws:
java.util.NoSuchElementException
- if the step is not found or not enabled. getCommandStep
- public CommandStep getCommandStep( java.lang.String stepName)
- throws CommandNotFoundException
Description copied from interface:
TaskCommand
Gets the command step of the specified command step name.
Unlike the
gotoStep
method, this method does not change
the cursor position. Typically this method is called when the task command
is executed in batch mode.
Specified by:
getCommandStep
in interface TaskCommand
Parameters:
stepName
- the command step name Returns:
the command step of the specified command step name.
Throws:
getTaskCommandData
- public final com.ibm.websphere.management.cmdframework.commanddata.TaskCommandData getTaskCommandData( )
getTaskCommandMetadata
- public final com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata getTaskCommandMetadata( )
addStep
- public void addStep(AbstractCommandStep step,
- int index)
add an additional step for the task.
Parameters:
step
- - the step instance. index
- - the position of added step in the step list. If index is
out of range, then the step will be added at the end. resetCommandData
- public void resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Reset the command data.
Subclass may override this method to put more logic in,
but the overriding implementation must call the base implementation first.
Overrides:
resetCommandData
in class AbstractAdminCommand
Parameters:
cmdData
- the new command data. addNewStep
- protected void addNewStep(com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata metadata,
- com.ibm.websphere.management.cmdframework.commanddata.CommandStepData stepData,
- int i)
validate
- public void validate()
- throws CommandValidationException
This provides a basic implementation for command parameter validation.
Basically it validates that the parameter values match up the paramter type
and all the required parameters are specified. Subclass may override this
method to provide more validation, but it is strongly recommended that
the overriding implementation calls the base implementation first.
Throws:
CommandValidationException
- if there is any invalid command parameter. processTaskParameters
- public void processTaskParameters( )
This method is called to process task parameters.
Command providers which override this processTaskParameters must invoke
super.processTaskParameters first and check the command result for
any error. The subclass would simply return in the event that the
command result indicates that an error occurred. This gives
AbstractTaskCommand the chance to perform any preprocessing that might
be necessary.
Specified by:
processTaskParameters
in interface TaskCommand
beforeStepsExecuted
- protected void beforeStepsExecuted( )
This method is called before the steps are executed.
The default implementation is a no-op. Subclass may optionally
override this method to do something before steps are executed.
afterStepsExecuted
- protected void afterStepsExecuted( )
This method is called after the steps are executed.
The default implementation is a no-op. Subclass may optionally
override this method to do something after steps are executed.
taskCommandExecuted
- protected void taskCommandExecuted( boolean success)
This method is called after the task command is executed.
The default implementation is a no-op. Subclass may optionally
override this method to clean up data structure or release resources after
the task command is executed.
Parameters:
success
- true if the command is executed successfully; false otherwise. showArrayContents
- protected java.lang.String showArrayContents( java.lang.Object[] array)
showListContents
- protected java.lang.String showListContents( java.util.List list)
stepModified
- protected void stepModified(java.lang.String stepName)
This method is called whenever the user navigates away from the specified step.
The default implementation notifies all the steps except the specified step
that the specified step is modified. Subclass may optionally
override this method to response to the modification further, however it
is strongly recommended that the subclass implementation calls the base implementation first.
Parameters:
stepName
- the name of the step. commandParamsModified
- public void commandParamsModified( )
This method is called before the user starts to navigate through steps.
The default implementation notifies all the steps dified. Subclass may optionally
override this method to response to the modification further, however it
is strongly recommended that the subclass implementation calls the base implementation first.
execute
- public void execute()
Implements the execution flow for a task command.
This method is final. In other words, subclass should not override this method.
The reason is that command framework controls the general control flow.
Subclasses may override more specific methods to implement the task command
specific semantics and behavior.
Specified by:
execute
in interface org.eclipse.emf.common.command.Command
Specified by:
execute
in class AbstractAdminCommand
getTaskCommandResult
- public TaskCommandResult getTaskCommandResult( )
Description copied from interface:
TaskCommand
Gets the task command result.
Specified by:
getTaskCommandResult
in interface TaskCommand
listAllStepParamsData
- public void listAllStepParamsData( )
AbstractAdminCommand