com.ibm.websphere.management.cmdframework.provider

Class CommandProvider

  1. java.lang.Object
  2. extended bycom.ibm.websphere.management.cmdframework.provider.CommandProvider
Direct known subclasses:
SimpleCommandProvider

  1. public abstract class CommandProvider
  2. 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

Constructor and Description
CommandProvider()

Method Summary

Modifier and Type Method and Description
  1. int
commandStepPosition(AbstractTaskCommand taskCmd,java.lang.String stepName)
Returns the index of step in the task command.
  1. AbstractAdminCommand
createCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
Create an instance of an admin command based on the specified metadata.
  1. AbstractCommandStep
createCommandStep(AbstractTaskCommand taskCmd,java.lang.String stepName)
Create an instance of a task command step based on the specified metadata.
  1. protected
  2. CommandProviderHelper
getCommandProviderHelper()
A convenient method for the command provider to get a CommandProviderHelper instance.
  1. protected
  2. com.ibm.websphere.management.cmdframework.commandmetadata.CommandStepMetadata
getStepMetadata(AbstractTaskCommand taskCmd,java.lang.String stepName)
  1. 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.
  1. AbstractAdminCommand
loadCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Create an instance of an admin command based on the specified command data.
  1. 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

  1. public CommandProvider()

Method Detail

createCommand

  1. public AbstractAdminCommand createCommand( com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
  2. 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

  1. public AbstractAdminCommand loadCommand( com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
  2. throws CommandNotFoundException
  3. 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

  1. 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

  1. public AbstractCommandStep createCommandStep( AbstractTaskCommand taskCmd,
  2. java.lang.String stepName)
  3. 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

  1. public AbstractCommandStep loadCommandStep( AbstractTaskCommand taskCmd,
  2. com.ibm.websphere.management.cmdframework.commanddata.CommandStepData stepData)
  3. throws CommandNotFoundException
  4. 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

  1. public int commandStepPosition( AbstractTaskCommand taskCmd,
  2. 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

  1. 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

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