IBM WebSphere Application ServerTM
Release 7

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

java.lang.Object
  extended by com.ibm.websphere.management.cmdframework.provider.CommandProvider
Direct Known Subclasses:
SimpleCommandProvider

public abstract class CommandProvider
extends java.lang.Object

An abstract class any command provider must extend.

Defines the APIs that get the metadata and an instance of admin commands. Any implementation of this abstract class must provide a constructor that takes no argument.


Constructor Summary
CommandProvider()
           
 
Method Summary
 int commandStepPosition(AbstractTaskCommand taskCmd, java.lang.String stepName)
          Returns the index of step in the task command.
 AbstractAdminCommand createCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
          Create an instance of an admin command based on the specified metadata.
 AbstractCommandStep createCommandStep(AbstractTaskCommand taskCmd, java.lang.String stepName)
          Create an instance of a task command step based on the specified metadata.
protected  CommandProviderHelper getCommandProviderHelper()
          A convenient method for the command provider to get a CommandProviderHelper instance.
protected  com.ibm.websphere.management.cmdframework.commandmetadata.CommandStepMetadata getStepMetadata(AbstractTaskCommand taskCmd, java.lang.String stepName)
           
 java.util.List initCommandMetadata(java.util.List metadata)
          Initialize the command metadata based on the command metadata defined in the admin-command-def.xml file.
 AbstractAdminCommand loadCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
          Create an instance of an admin command based on the specified command data.
 AbstractCommandStep loadCommandStep(AbstractTaskCommand taskCmd, com.ibm.websphere.management.cmdframework.commanddata.CommandStepData stepData)
          Create an instance of a command step based on the specified command data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandProvider

public CommandProvider()
Method Detail

createCommand

public AbstractAdminCommand createCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
                                   throws CommandNotFoundException
Create an instance of an admin command based on the specified metadata. This method also works for task command.

Parameters:
metadata - the metadata of an admin command.
Returns:
an admin command instance.
Throws:
CommandNotFoundException - if the specified command is not found.

loadCommand

public AbstractAdminCommand loadCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
                                 throws CommandNotFoundException,
                                        CommandLoadException
Create an instance of an admin command based on the specified command data.

Parameters:
cmdData - the command data of the admin command.
Returns:
an instance of admin command that contains specified command data.
Throws:
CommandNotFoundException - if the specified command is not found.
CommandLoadException - if the command data is failed to load into an admin command instance.

initCommandMetadata

public java.util.List initCommandMetadata(java.util.List metadata)
Initialize the command metadata based on the command metadata defined in the admin-command-def.xml file. This method provides an opportunity for the command provider to override or add some command metadata information beyond the information defined in xml file. The default behavior of this method returns the input parameter.

Parameters:
metadata - List of command metadata loaded from the admin-command-def.xml file.
Returns:
modified command metadata.

createCommandStep

public AbstractCommandStep createCommandStep(AbstractTaskCommand taskCmd,
                                             java.lang.String stepName)
                                      throws CommandNotFoundException
Create an instance of a task command step based on the specified metadata.

Parameters:
taskCmd - the parent task command of the step.
stepName - the name of the command step.
Returns:
an instance of a command step
Throws:
CommandNotFoundException - if the specified step is not defined in the specified task command.

loadCommandStep

public AbstractCommandStep loadCommandStep(AbstractTaskCommand taskCmd,
                                           com.ibm.websphere.management.cmdframework.commanddata.CommandStepData stepData)
                                    throws CommandNotFoundException,
                                           CommandLoadException
Create an instance of a command step based on the specified command data.

Parameters:
taskCmd - the parent task command of the step.
stepData - the command data of a command step.
Returns:
an instance of a command step
Throws:
CommandNotFoundException - if the specified step is not defined in the specified task command.
CommandLoadException - if failed to load the command data.

commandStepPosition

public int commandStepPosition(AbstractTaskCommand taskCmd,
                               java.lang.String stepName)
Returns the index of step in the task command. Task command constructs its steps in the order that steps are defined in the command metadata file. This method is called after a step is constructed and before the step is inserted into its parent task command.

The default behavior of this method is to add the step at the end. In another word, the order of step instances in the task command will be exactly the same as the order of step metadata defined in the command definition file. In general, the command provider does not need to override. The command provider may choose to override this method to order the steps in a way different from the order of their metadata. One typical usage scenario of overriding this method is that an extended step must be inserted in certain position in the base implementation of the task command.

Parameters:
taskCmd - the parent task command.
stepName - the name of the step
Returns:
the index of the step in the step list of the task command.

getCommandProviderHelper

protected CommandProviderHelper getCommandProviderHelper()
A convenient method for the command provider to get a CommandProviderHelper instance.

Returns:
an instance of CommandProviderHelper implementation for the current command execution environment.

getStepMetadata

protected com.ibm.websphere.management.cmdframework.commandmetadata.CommandStepMetadata getStepMetadata(AbstractTaskCommand taskCmd,
                                                                                                        java.lang.String stepName)

IBM WebSphere Application ServerTM
Release 7