com.ibm.websphere.management.cmdframework
Interface AdminCommand

All Superinterfaces:
org.eclipse.emf.common.command.Command
All Known Subinterfaces:
CommandStep, TaskCommand
All Known Implementing Classes:
AbstractAdminCommand, AbstractCommandStep, AbstractTaskCommand, SimpleAdminCommand

public interface AdminCommand
extends org.eclipse.emf.common.command.Command

Defines the base interface for all the admin commands.

This class defines methods in following functionalities:


Method Summary
 void execute(CommandHistory cmdHistory)
          Executes the command and puts the command data into the command history.
 java.lang.String generateScript(java.lang.String lang)
          Generates the corresponding wsadmin script for the specified scripting language.
 java.lang.Object[] getChoices(java.lang.String paramName)
          Returns valid values for the specified parameter.
 CommandMetadata getCommandMetadata()
          Returns the meta data for the command.
 CommandResult getCommandResult()
          Return a more user friendly version of command result.
 Session getConfigSession()
          Returns user's config session.
 java.util.Locale getLocale()
          return the user's locale.
 java.lang.String getName()
          Returns a non-localized admin command name.
 java.lang.Object getParameter(java.lang.String parameterName)
          Gets the parameter value for the specified parameter.
 java.lang.Object getTargetObject()
          Returns the target object of the command.
 java.lang.Object[] getTargetObjectChoices()
          Returns valid values for the target object.
 java.util.Collection listSetParams()
          Gets all the command parameters whose value are set.
 void save(java.io.OutputStream outputStream)
          Serializes the command into the specified output stream.
 void setConfigSession(Session session)
          Sets the user's config session.
 void setLocale(java.util.Locale locale)
          Sets the caller's locale.
 void setParameter(java.lang.String paramName, java.lang.Object value)
          Sets the value for the specified parameter.
 void setTargetObject(java.lang.Object targetObj)
          Sets the target object for the command.
 void validate()
          Validates the command parameters.
 
Methods inherited from interface org.eclipse.emf.common.command.Command
canExecute, canUndo, chain, dispose, execute, getAffectedObjects, getDescription, getLabel, getResult, redo, undo
 

Method Detail

getName

java.lang.String getName()
Returns a non-localized admin command name.

Returns:
the name of this admin command.

getCommandMetadata

CommandMetadata getCommandMetadata()
Returns the meta data for the command.

Returns:
the meta data for the command.

getTargetObject

java.lang.Object getTargetObject()
Returns the target object of the command. If the admin command does not contains any target object, this method returns null.

Returns:
the target object of the command.

setTargetObject

void setTargetObject(java.lang.Object targetObj)
                     throws InvalidParameterValueException
Sets the target object for the command.

Parameters:
targetObj - the target object value
Throws:
InvalidParameterValueException

setConfigSession

void setConfigSession(Session session)
Sets the user's config session. This is only needed for configuration related commands.

Parameters:
session - the user's admin session.

getConfigSession

Session getConfigSession()
Returns user's config session. It returns null if the config session is never set.

Returns:
user's config session.

setLocale

void setLocale(java.util.Locale locale)
Sets the caller's locale. If this method is not called, the system default locale will be used.

Parameters:
locale - the caller's Locale.

getLocale

java.util.Locale getLocale()
return the user's locale. It may be null if the locale is never set.


listSetParams

java.util.Collection listSetParams()
Gets all the command parameters whose value are set.

Returns:
the command parameter names whose value are set.

getParameter

java.lang.Object getParameter(java.lang.String parameterName)
                              throws InvalidParameterNameException
Gets the parameter value for the specified parameter.

Parameters:
parameterName - the parameter name.
Returns:
the parameter value.
Throws:
InvalidParameterNameException

setParameter

void setParameter(java.lang.String paramName,
                  java.lang.Object value)
                  throws InvalidParameterValueException,
                         InvalidParameterNameException
Sets the value for the specified parameter.

Parameters:
paramName - the parameter name.
value - the parameter value.
Throws:
InvalidParameterValueException - if the parameter value is not valid.
InvalidParameterNameException

getChoices

java.lang.Object[] getChoices(java.lang.String paramName)
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.

Parameters:
paramName - the parameter name.
Returns:
an array of valid values for the specified parameter.

getTargetObjectChoices

java.lang.Object[] getTargetObjectChoices()
Returns valid values for the target object. Implementation of this method is optional. If command provider does not implement this method, then this method returns null.

Returns:
an array of valid values for the specified parameter.

validate

void validate()
              throws CommandValidationException
Validates the command parameters.

Throws:
CommandValidationException - if there is any invalid command parameter.

execute

void execute(CommandHistory cmdHistory)
Executes the command and puts the command data into the command history.

Parameters:
cmdHistory - an implementation of command history

getCommandResult

CommandResult getCommandResult()
Return a more user friendly version of command result.

Returns:
the result generated from last execution.

save

void save(java.io.OutputStream outputStream)
          throws CommandException
Serializes the command into the specified output stream.

Parameters:
outputStream - the output stream that is used to serialize the command data
Throws:
CommandException - if the save operation fails.

generateScript

java.lang.String generateScript(java.lang.String lang)
                                throws CommandException
Generates the corresponding wsadmin script for the specified scripting language.

Parameters:
lang - the name of the scripting language.
Returns:
wsadmin script for the command.
Throws:
CommandException - if user specified scripting language is not supported. XXX todo: more specific exception.