com.ibm.websphere.management.cmdframework.provider

Class 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.
    • Method Detail

      • 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)
      • 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
      • listAllStepParamsData

        public void listAllStepParamsData()
IBM WebSphere Application ServerTM
Release 8.5