IBM WebSphere Application ServerTM
Release 7

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

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.AbstractTaskCommand
All Implemented Interfaces:
AdminCommand, TaskCommand, org.eclipse.emf.common.command.Command

public abstract class AbstractTaskCommand
extends AbstractAdminCommand
implements TaskCommand

The class is the base class for any task command implementation. Any specific task command 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
 
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
AbstractTaskCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData commandData)
           
AbstractTaskCommand(com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata inMetadata)
           
 
Method Summary
protected  void addNewStep(com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata metadata, com.ibm.websphere.management.cmdframework.commanddata.CommandStepData stepData, int i)
           
 void addStep(AbstractCommandStep step, int index)
          add an additional step for the task.
protected  void afterStepsExecuted()
          This method is called after the steps are executed.
protected  void beforeStepsExecuted()
          This method is called before the steps are executed.
 void commandParamsModified()
          This method is called before the user starts to navigate through steps.
protected  void contructSteps()
           
 void execute()
          Implements the execution flow for a task command.
 CommandStep getCommandStep(java.lang.String stepName)
          Gets the command step of the specified command step name.
 CommandStep getCurrentStep(int operation)
           
 CommandStep getCurrentStep(int operation, java.lang.String stepName)
           
 int getCurrentStepIndex()
           
 com.ibm.websphere.management.cmdframework.commanddata.TaskCommandData getTaskCommandData()
           
 com.ibm.websphere.management.cmdframework.commandmetadata.TaskCommandMetadata getTaskCommandMetadata()
           
 TaskCommandResult getTaskCommandResult()
          Gets the task command result.
 CommandStep gotoStep(java.lang.String stepName)
          Goes to the specified step.
 boolean hasNextStep()
          Tests if there is an enabled step after the cursor.
 boolean hasPreviousStep()
          Tests if there is an enabled step before the cursor.
protected  com.ibm.websphere.management.cmdframework.commanddata.CommandData initCommandData()
          Construct proper type of command data instance.
 void listAllStepParamsData()
           
 java.lang.String[] listCommandSteps()
          Lists the command step names contained in this task command including the disabled command steps.
 CommandStep nextStep()
          Gets the next enabled command step.
 CommandStep previousStep()
          Gets the previous enabled step in the task command.
 void processTaskParameters()
          This method is called to process task parameters.
 void resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
          Reset the command data.
 void setCurrentStep(AbstractCommandStep newCurrentStep)
           
 void setCurrentStepIndex(int index)
           
protected  java.lang.String showArrayContents(java.lang.Object[] array)
           
protected  java.lang.String showListContents(java.util.List list)
           
protected  void stepModified(java.lang.String stepName)
          This method is called whenever the user navigates away from the specified step.
protected  void taskCommandExecuted(boolean success)
          This method is called after the task command is executed.
 void validate()
          This provides a basic implementation for command parameter validation.
 
Methods inherited from class com.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
cleanupUploadedFiles, createParamEObject, createParameterMetadata, execute, generateScript, getChoices, getCmdMgrType, getCommandData, getCommandMetadata, getCommandMetadata, getCommandResult, getCommandSession, getConfigService, getConfigSession, getLocale, getName, getOrigParameterValue, getParameter, getParameter, getParameterMetadata, getResult, getTargetObject, getTargetObjectChoices, getUserData, initializeParameter, initializeParameter, isAsyncCommand, isDynamicStepCommand, isLocalMode, isParamReadonly, isPrivateParameter, isTable, listAllParameterName, listParameterName, listSetParams, listSetParams, redo, resetCommandMetadata, save, sendNotification, setCmdHandler, setCmdMgrType, setCommandMetadata, setCommandResult, setCommandSession, setConfigSession, setListSetParamsTable, setLocale, setOrigParameterValue, setParameter, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.websphere.management.cmdframework.AdminCommand
createParameterMetadata, execute, generateScript, getChoices, 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:
CommandNotFoundException

AbstractTaskCommand

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

contructSteps

protected void contructSteps()
                      throws CommandNotFoundException
Throws:
CommandNotFoundException

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.

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:
CommandNotFoundException

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.

Specified by:
validate in interface AdminCommand
Overrides:
validate in class AbstractAdminCommand
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()

IBM WebSphere Application ServerTM
Release 7