com.ibm.websphere.management.cmdframework.provider

Class SimpleCommandProvider

  1. java.lang.Object
  2. extended bycom.ibm.websphere.management.cmdframework.provider.CommandProvider
  3. extended bycom.ibm.websphere.management.cmdframework.provider.SimpleCommandProvider

  1. public abstract class SimpleCommandProvider
  2. extends CommandProvider
The class provides a mechanism for command providers to implement multiple admin commands easily.

This command provider always creates SimpleAdminCommand instance for any commands. The execute method always delegates the execution logic to a method with the same name of the command defined on this class. For instance, if the command name is "mySimpleCmd", then the SimpleAdminCommand delegates the execution logic of the command to a method Object mySimpleCmd(AdminCommand cmd); This method may return any object type and throw some exceptions. Therefore, command providers only needs to implement a method on this class for each admin command it provides.

The limitation of this approach is that command provider can not override the validate and getChoices methods.


Field Summary

Modifier and Type Field and Description
  1. protected
  2. java.util.HashMap
methodTable

Constructor Summary

Modifier Constructor and Description
  1. protected
SimpleCommandProvider()

Method Summary

Modifier and Type Method and Description
  1. AbstractAdminCommand
createCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
  1. protected
  2. void
execute(SimpleAdminCommand cmd)
Delegates the execution logic to the method with the same name as the command name.
  1. protected
  2. void
executeReal(SimpleAdminCommand cmd)
  1. AbstractAdminCommand
loadCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Methods inherited from class com.ibm.websphere.management.cmdframework.provider.CommandProvider
commandStepPosition, createCommandStep, getCommandProviderHelper, getStepMetadata, initCommandMetadata, loadCommandStep
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

methodTable

  1. protected java.util.HashMap methodTable

Constructor Detail

SimpleCommandProvider

  1. protected SimpleCommandProvider( )

Method Detail

createCommand

  1. public AbstractAdminCommand createCommand( com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
  2. throws CommandNotFoundException
Description copied from class: CommandProvider
Create an instance of an admin command based on the specified metadata. This method also works for task command.
Overrides:
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
Description copied from class: CommandProvider
Create an instance of an admin command based on the specified command data.
Overrides:
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.

execute

  1. protected void execute(SimpleAdminCommand cmd)
Delegates the execution logic to the method with the same name as the command name.
Parameters:
cmd - the command object.

executeReal

  1. protected void executeReal(SimpleAdminCommand cmd)