IBM WebSphere Application ServerTM
Release 7

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
 com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata createParameterMetadata(java.lang.String pmName, java.util.Hashtable featureList)
          Create a ParameterMetadata object.
 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.
 com.ibm.websphere.management.cmdframework.commandmetadata.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 getOrigParameterValue(java.lang.String parameterName)
          Gets the original parameter value for the UploadFile or DownloadFile parameter.
 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.
 boolean isAsyncCommand()
          Check if it is an async command, which is specified by command provider.
 boolean isDynamicStepCommand()
          Check if it is a dynamic step command, which is specified by command provider.
 boolean isPrivateParameter(java.lang.String paramName)
          Check if it is a private parameter, which is specified by command provider.
 java.util.List listAllParameterName()
          Returns all the parameter names including private one on the ParameterMetadata objects.
 java.util.List listParameterName()
          Returns parameter names that are not private on the ParameterMetadata objects.
 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 setCmdHandler(com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler handler)
          Set the handler to handle command notifications
 void setConfigSession(Session session)
          Sets the user's config session.
 void setLocale(java.util.Locale locale)
          Sets the caller's locale.
 void setOrigParameterValue(java.lang.String paramName, java.lang.Object value)
          Sets the original value for the UploadFile or DownloadFile parameter.
 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

com.ibm.websphere.management.cmdframework.commandmetadata.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

getOrigParameterValue

java.lang.Object getOrigParameterValue(java.lang.String parameterName)
                                       throws InvalidParameterNameException
Gets the original parameter value for the UploadFile or DownloadFile parameter.

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

setOrigParameterValue

void setOrigParameterValue(java.lang.String paramName,
                           java.lang.Object value)
                           throws InvalidParameterValueException,
                                  InvalidParameterNameException
Sets the original value for the UploadFile or DownloadFile 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.

setCmdHandler

void setCmdHandler(com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler handler)
Set the handler to handle command notifications

Parameters:
handler - handler for command notification

isAsyncCommand

boolean isAsyncCommand()
Check if it is an async command, which is specified by command provider.

Returns:
true if this command is async; false otherwise.

isDynamicStepCommand

boolean isDynamicStepCommand()
Check if it is a dynamic step command, which is specified by command provider.

Returns:
true if this command has dynamic step; false otherwise.

isPrivateParameter

boolean isPrivateParameter(java.lang.String paramName)
                           throws InvalidParameterNameException
Check if it is a private parameter, which is specified by command provider.

Parameters:
paramName - is the name of parameter.
Returns:
true if this parameter is private; false otherwise.
Throws:
InvalidParameterNameException - if user specified an invalid parameter name.

listAllParameterName

java.util.List listAllParameterName()
Returns all the parameter names including private one on the ParameterMetadata objects.

Returns:
a list of parameter name in String type.

listParameterName

java.util.List listParameterName()
Returns parameter names that are not private on the ParameterMetadata objects.

Returns:
a list of parameter name in String type.

createParameterMetadata

com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata createParameterMetadata(java.lang.String pmName,
                                                                                                    java.util.Hashtable featureList)
                                                                                                    throws InvalidParameterValueException,
                                                                                                           InvalidParameterNameException
Create a ParameterMetadata object.

Parameters:
pmName - is the name of ParameterMetadata.
featureList - is a Hashtable of ParameterMetadata features (attributes) in feature id - value pair.

See CommandMetadataPackage.PARAMETER_METADATA for list of available features for PARAMETER_METADATA.
Returns:
a new object of class ParameterMetadata.
Throws:
InvalidParameterNameException - if the feature (attribute) id is invalid.
InvalidParameterValueException - if the feature (attribute) value type is incorrect.
See Also:
BaseMetadata, ParameterMetadata

IBM WebSphere Application ServerTM
Release 7