com.ibm.websphere.management.cmdframework.provider

Class AbstractCommandStep

  • All Implemented Interfaces:
    AdminCommand, CommandStep, org.eclipse.emf.common.command.Command


    public class AbstractCommandStep
    extends AbstractAdminCommand
    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.
    • Method Detail

      • isEnabled

        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.
      • 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.
        Specified by:
        execute in interface AdminCommand
        Overrides:
        execute in class AbstractAdminCommand
        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:
        InvalidParameterNameException
        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
      • 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:
        InvalidParameterValueException
        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.
      • 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.
        Specified by:
        validate in interface AdminCommand
        Overrides:
        validate in class AbstractAdminCommand
        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:
        CommandException
      • 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.
      • 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.
IBM WebSphere Application ServerTM
Release 8.5