com.ibm.websphere.management.cmdframework.provider

Class AbstractAdminCommand

  1. java.lang.Object
  2. extended byorg.eclipse.emf.common.command.AbstractCommand
  3. extended bycom.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
All implemented interfaces:
AdminCommand, org.eclipse.emf.common.command.Command
Direct known subclasses:
AbstractCommandStep, AbstractTaskCommand, SimpleAdminCommand

  1. public abstract class AbstractAdminCommand
  2. extends org.eclipse.emf.common.command.AbstractCommand
  3. implements AdminCommand
The class is the base class for any admin command implementation. Any specific admin command implementation should derive from this class and only override the methods that javadoc recommends to override.

Nested Class Summary

Modifier and Type Class and Description
  1. class
AbstractAdminCommand.CmdNotificationListener
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
org.eclipse.emf.common.command.AbstractCommand.NonDirtying

Field Summary

Modifier and Type Field and Description
  1. static
  2. java.lang.String
ASYNC_CUSTOM_TAG
  1. protected
  2. com.ibm.ws.management.cmdframework.impl.TaskCommandSession
asyncCmdSession
  1. protected
  2. java.lang.Integer
cmdMgrType
  1. protected
  2. com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler
cnh
  1. static
  2. java.lang.String
DYNAMIC_CUSTOM_TAG
  1. protected
  2. java.util.HashMap<java.lang.Integer,java.util.Collection<java.lang.String>>
listSetParamsTable
  1. static
  2. java.lang.String
PRIVATE_CUSTOM_TAG
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label

Constructor Summary

Constructor and Description
AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData inCommandData)
Constructs an instance of admin command based on its command data
AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)

Method Summary

Modifier and Type Method and Description
  1. void
cleanupUploadedFiles()
  1. protected
  2. org.eclipse.emf.ecore.EObject
createParamEObject()
Create an EObject to store the command's parameter values.
  1. com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata
createParameterMetadata(java.lang.String pmName,java.util.Hashtable featureList)
  1. abstract
  2. void
execute()
Defines the execution logic of command.
  1. void
execute(CommandHistory cmdHistory)
  1. java.lang.String
generateScript(java.lang.String lang)
  1. java.lang.Object[]
getChoices(java.lang.String paramName)
Provides a default implement for the method which always returns null.
  1. com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler
getCmdHandler()
  1. java.lang.Integer
getCmdMgrType()
  1. protected
  2. com.ibm.websphere.management.cmdframework.commanddata.CommandData
getCommandData()
  1. com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata
getCommandMetadata()
  1. static
  2. com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata
getCommandMetadata(java.lang.String cmdName)
  1. CommandResult
getCommandResult()
  1. com.ibm.ws.management.cmdframework.impl.TaskCommandSession
getCommandSession()
Creates and returns the unique identifier for this command instance.
  1. protected
  2. ConfigService
getConfigService()
Convenient method to access ConfigService component.
  1. Session
getConfigSession()
  1. java.util.Locale
getLocale()
  1. java.lang.String
getName()
  1. java.lang.Object
getOrigParameterValue(java.lang.String paramName)
  1. java.lang.Object
getParameter(java.lang.String parameterName)
  1. protected
  2. java.lang.Object
getParameter(java.lang.String parameterName,int rowIndex)
  1. protected
  2. com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata
getParameterMetadata(java.lang.String paramName)
returns the metadata for the specified parameter.
  1. java.util.Collection
getResult()
Provides a default implementation for this method.
  1. java.lang.Object
getTargetObject()
  1. java.lang.Object[]
getTargetObjectChoices()
Provides a default implement for the method which always returns null.
  1. protected
  2. com.ibm.websphere.management.cmdframework.commanddata.UserData
getUserData()
Gets the user data for the command data.
  1. protected
  2. com.ibm.websphere.management.cmdframework.commanddata.CommandData
initCommandData()
Construct proper type of command data instance.
  1. protected
  2. void
initializeParameter(java.lang.String paramName,java.lang.Object value)
  1. protected
  2. void
initializeParameter(java.lang.String paramName,java.lang.Object value,int rowIndex)
  1. boolean
isAsyncCommand()
  1. boolean
isDynamicStepCommand()
  1. protected
  2. boolean
isLocalMode()
  1. protected
  2. boolean
isParamReadonly(java.lang.String paramName)
  1. boolean
isPrivateParameter(java.lang.String paramName)
  1. protected
  2. boolean
isTable()
  1. java.util.List
listAllParameterName()
  1. java.util.List
listParameterName()
  1. java.util.Collection
listSetParams()
  1. protected
  2. java.util.Collection
listSetParams(int rowIndex)
  1. void
redo()
  1. void
resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Resets the command data for the command.
  1. protected
  2. void
resetCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata newMetadata)
  1. void
save(java.io.OutputStream outputStream)
  1. void
sendNotification(CommandNotification cmdNotification)
  1. void
setCmdHandler(com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler handler)
  1. void
setCmdMgrType(java.lang.Integer cmdMgrType)
  1. protected
  2. void
setCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata cmdmetadata)
  1. protected
  2. void
setCommandResult(CommandResult thisResult)
  1. void
setCommandSession(com.ibm.ws.management.cmdframework.impl.TaskCommandSession session)
  1. void
setConfigSession(Session session)
  1. protected
  2. void
setListSetParamsTable(int rowIndex,java.lang.String paramName)
  1. void
setLocale(java.util.Locale locale)
  1. void
setOrigParameterValue(java.lang.String paramName,java.lang.Object value)
  1. void
setParameter(java.lang.String paramName,java.lang.Object value)
  1. protected
  2. void
setParameter(java.lang.String paramName,java.lang.Object value,int rowIndex)
  1. void
setTargetObject(java.lang.Object obj)
  1. protected
  2. void
setupListener(java.lang.Object obj)
  1. void
validate()
Providers a default implmentation for the method.
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
canExecute, canUndo, chain, dispose, getAffectedObjects, getDescription, getLabel, prepare, setDescription, setLabel, toString, undo
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.emf.common.command.Command
canExecute, canUndo, chain, dispose, getAffectedObjects, getDescription, getLabel, undo

Field Detail

ASYNC_CUSTOM_TAG

  1. public static final java.lang.String ASYNC_CUSTOM_TAG
See Also:

DYNAMIC_CUSTOM_TAG

  1. public static final java.lang.String DYNAMIC_CUSTOM_TAG
See Also:

PRIVATE_CUSTOM_TAG

  1. public static final java.lang.String PRIVATE_CUSTOM_TAG
See Also:

cnh

  1. protected com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler cnh

asyncCmdSession

  1. protected com.ibm.ws.management.cmdframework.impl.TaskCommandSession asyncCmdSession

cmdMgrType

  1. protected java.lang.Integer cmdMgrType

listSetParamsTable

  1. protected java.util.HashMap<java.lang.Integer,java.util.Collection<java.lang.String>> listSetParamsTable

Constructor Detail

AbstractAdminCommand

  1. public AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)

AbstractAdminCommand

  1. public AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData inCommandData)
  2. throws CommandNotFoundException
Constructs an instance of admin command based on its command data
Parameters:
inCommandData - the command data for the command
Throws:
CommandNotFoundException - if the command is not found.

Method Detail

getCommandMetadata

  1. public static com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata( java.lang.String cmdName)
  2. throws CommandNotFoundException
Throws:

initCommandData

  1. protected com.ibm.websphere.management.cmdframework.commanddata.CommandData initCommandData( )
Construct proper type of command data instance.
Returns:
newly created command data instance.

getLocale

  1. public java.util.Locale getLocale( )
Description copied from interface: AdminCommand
return the user's locale. It may be null if the locale is never set.
Specified by:
getLocale in interface AdminCommand

setLocale

  1. public void setLocale(java.util.Locale locale)
Description copied from interface: AdminCommand
Sets the caller's locale. If this method is not called, the system default locale will be used.
Specified by:
setLocale in interface AdminCommand
Parameters:
locale - the caller's Locale.

getName

  1. public java.lang.String getName( )
Description copied from interface: AdminCommand
Returns a non-localized admin command name.
Specified by:
getName in interface AdminCommand
Returns:
the name of this admin command.

getCommandMetadata

  1. public com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata( )
Description copied from interface: AdminCommand
Returns the meta data for the command.
Specified by:
Returns:
the meta data for the command.

getCommandData

  1. protected com.ibm.websphere.management.cmdframework.commanddata.CommandData getCommandData( )

setCommandMetadata

  1. protected void setCommandMetadata( com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata cmdmetadata)

getTargetObject

  1. public java.lang.Object getTargetObject( )
Description copied from interface: AdminCommand
Returns the target object of the command. If the admin command does not contains any target object, this method returns null.
Specified by:
Returns:
the target object of the command.

setTargetObject

  1. public void setTargetObject(java.lang.Object obj)
  2. throws InvalidParameterValueException
Description copied from interface: AdminCommand
Sets the target object for the command.
Specified by:
Parameters:
obj - the target object value
Throws:

listSetParams

  1. public java.util.Collection listSetParams( )
Description copied from interface: AdminCommand
Gets all the command parameters whose value are set.
Specified by:
Returns:
the command parameter names whose value are set.

listSetParams

  1. protected java.util.Collection listSetParams( int rowIndex)

getParameter

  1. public java.lang.Object getParameter( java.lang.String parameterName)
  2. throws InvalidParameterNameException
Description copied from interface: AdminCommand
Gets the parameter value for the specified parameter.
Specified by:
getParameter in interface AdminCommand
Parameters:
parameterName - the parameter name.
Returns:
the parameter value.
Throws:

isAsyncCommand

  1. public boolean isAsyncCommand()
Description copied from interface: AdminCommand
Check if it is an async command, which is specified by command provider.
Specified by:
Returns:
true if this command is async; false otherwise.

isDynamicStepCommand

  1. public boolean isDynamicStepCommand( )
Description copied from interface: AdminCommand
Check if it is a dynamic step command, which is specified by command provider.
Specified by:
Returns:
true if this command has dynamic step; false otherwise.

isPrivateParameter

  1. public boolean isPrivateParameter( java.lang.String paramName)
  2. throws InvalidParameterNameException
Description copied from interface: AdminCommand
Check if it is a private parameter, which is specified by command provider.
Specified by:
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

  1. public java.util.List listAllParameterName( )
Description copied from interface: AdminCommand
Returns all the parameter names including private one on the ParameterMetadata objects.
Specified by:
Returns:
a list of parameter name in String type.

listParameterName

  1. public java.util.List listParameterName( )
Description copied from interface: AdminCommand
Returns parameter names that are not private on the ParameterMetadata objects.
Specified by:
Returns:
a list of parameter name in String type.

getParameter

  1. protected java.lang.Object getParameter( java.lang.String parameterName,
  2. int rowIndex)
  3. throws InvalidParameterNameException
Throws:

setParameter

  1. public void setParameter(java.lang.String paramName,
  2. java.lang.Object value)
  3. throws InvalidParameterValueException
  4. InvalidParameterNameException
Description copied from interface: AdminCommand
Sets the value for the specified parameter.
Specified by:
setParameter in interface AdminCommand
Parameters:
paramName - the parameter name.
value - the parameter value.
Throws:
InvalidParameterValueException - if the parameter value is not valid.

setOrigParameterValue

  1. public void setOrigParameterValue( java.lang.String paramName,
  2. java.lang.Object value)
  3. throws InvalidParameterValueException
  4. InvalidParameterNameException
Description copied from interface: AdminCommand
Sets the original value for the UploadFile or DownloadFile parameter.
Specified by:
Parameters:
paramName - the parameter name.
value - the parameter value.
Throws:
InvalidParameterValueException - if the parameter value is not valid.

getOrigParameterValue

  1. public java.lang.Object getOrigParameterValue( java.lang.String paramName)
  2. throws InvalidParameterNameException
Description copied from interface: AdminCommand
Gets the original parameter value for the UploadFile or DownloadFile parameter.
Specified by:
Parameters:
paramName - the parameter name.
Returns:
the parameter value.
Throws:

initializeParameter

  1. protected void initializeParameter( java.lang.String paramName,
  2. java.lang.Object value)
  3. throws InvalidParameterValueException
  4. InvalidParameterNameException
Throws:

setParameter

  1. protected void setParameter(java.lang.String paramName,
  2. java.lang.Object value,
  3. int rowIndex)
  4. throws InvalidParameterValueException
  5. InvalidParameterNameException
Throws:

initializeParameter

  1. protected void initializeParameter( java.lang.String paramName,
  2. java.lang.Object value,
  3. int rowIndex)
  4. throws InvalidParameterValueException
  5. InvalidParameterNameException
Throws:

setListSetParamsTable

  1. protected void setListSetParamsTable( int rowIndex,
  2. java.lang.String paramName)

isTable

  1. protected boolean isTable()

getChoices

  1. public java.lang.Object[] getChoices( java.lang.String paramName)
Provides a default implement for the method which always returns null.
Specified by:
getChoices in interface AdminCommand
Parameters:
paramName - the parameter name.
Returns:
an array of valid values for the specified parameter.

getTargetObjectChoices

  1. public java.lang.Object[] getTargetObjectChoices( )
Provides a default implement for the method which always returns null.
Specified by:
Returns:
an array of valid values for the specified parameter.

validate

  1. public void validate()
  2. throws CommandValidationException
Providers a default implmentation for the method. The default implementation checks if all the required parameters are specified, also it checks if the types of specified parameter values matches up the type of the parameter data defined in metadata. Extended class may override this method to validate the command parameter further.
Specified by:
validate in interface AdminCommand
Throws:

setConfigSession

  1. public void setConfigSession(Session session)
Description copied from interface: AdminCommand
Sets the user's config session. This is only needed for configuration related commands.
Specified by:
Parameters:
session - the user's admin session.

getConfigSession

  1. public Session getConfigSession( )
Description copied from interface: AdminCommand
Returns user's config session. It returns null if the config session is never set.
Specified by:
Returns:
user's config session.

getCommandResult

  1. public CommandResult getCommandResult( )
Description copied from interface: AdminCommand
Return a more user friendly version of command result.
Specified by:
Returns:
the result generated from last execution.

setCommandResult

  1. protected void setCommandResult( CommandResult thisResult)

save

  1. public void save(java.io.OutputStream outputStream)
Description copied from interface: AdminCommand
Serializes the command into the specified output stream.
Specified by:
save in interface AdminCommand
Parameters:
outputStream - the output stream that is used to serialize the command data

execute

  1. public abstract void execute()
Defines the execution logic of command. Any admin command must at least implement this method.
Specified by:
execute in interface org.eclipse.emf.common.command.Command

execute

  1. public void execute(CommandHistory cmdHistory)
Description copied from interface: AdminCommand
Executes the command and puts the command data into the command history.
Specified by:
execute in interface AdminCommand
Parameters:
cmdHistory - an implementation of command history

setCommandSession

  1. public void setCommandSession(com.ibm.ws.management.cmdframework.impl.TaskCommandSession session)

getCommandSession

  1. public com.ibm.ws.management.cmdframework.impl.TaskCommandSession getCommandSession( )
Creates and returns the unique identifier for this command instance. Note: getCommandSession is a misnomer because the term "session" really refers to an asynchronous command instance identifier rather than a task command config session. Similarly, TaskComamndSession really is a task command instance ID and has nothing to do with the command's config session.
Returns:
a task command identifier

setCmdHandler

  1. public void setCmdHandler(com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler handler)
Description copied from interface: AdminCommand
Set the handler to handle command notifications
Specified by:
Parameters:
handler - handler for command notification

getCmdHandler

  1. public com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler getCmdHandler( )
Description copied from interface: AdminCommand
Get the handler which was set to handle command notifications
Specified by:
Returns:
Handler for command notifications. Null if no handler was set.

setupListener

  1. protected void setupListener(java.lang.Object obj)

getResult

  1. public java.util.Collection getResult( )
Provides a default implementation for this method. Returns the result objects if the command execution is successful; returns a Throwable otherwise to indicate the error.
Specified by:
getResult in interface org.eclipse.emf.common.command.Command
Overrides:
getResult in class org.eclipse.emf.common.command.AbstractCommand

sendNotification

  1. public void sendNotification(CommandNotification cmdNotification)

redo

  1. public void redo()
Specified by:
redo in interface org.eclipse.emf.common.command.Command

cleanupUploadedFiles

  1. public void cleanupUploadedFiles( )

createParamEObject

  1. protected org.eclipse.emf.ecore.EObject createParamEObject( )
  2. throws CommandNotFoundException
Create an EObject to store the command's parameter values.
Returns:
an EObject instance to store the command's parameter values.
Throws:

getUserData

  1. protected com.ibm.websphere.management.cmdframework.commanddata.UserData getUserData( )
Gets the user data for the command data. This method creates the UserData instance for the command data if it is not created before.
Returns:
a UserData instance.

resetCommandData

  1. public void resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Resets the command data for the command.
Parameters:
cmdData - the new command data.

resetCommandMetadata

  1. protected void resetCommandMetadata( com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata newMetadata)

generateScript

  1. public java.lang.String generateScript( java.lang.String lang)
  2. throws CommandException
Description copied from interface: AdminCommand
Generates the corresponding wsadmin script for the specified scripting language.
Specified by:
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.

getParameterMetadata

  1. protected com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata getParameterMetadata( java.lang.String paramName)
  2. throws InvalidParameterNameException
returns the metadata for the specified parameter.
Parameters:
paramName - name of parameter
Returns:
ParameterMetadata
Throws:

isLocalMode

  1. protected boolean isLocalMode()

setCmdMgrType

  1. public void setCmdMgrType(java.lang.Integer cmdMgrType)

getCmdMgrType

  1. public java.lang.Integer getCmdMgrType( )

isParamReadonly

  1. protected boolean isParamReadonly( java.lang.String paramName)
  2. throws InvalidParameterNameException
Throws:

getConfigService

  1. protected ConfigService getConfigService( )
Convenient method to access ConfigService component.

createParameterMetadata

  1. public com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata createParameterMetadata( java.lang.String pmName,
  2. java.util.Hashtable featureList)
  3. throws InvalidParameterValueException
  4. InvalidParameterNameException
Description copied from interface: AdminCommand
Create a ParameterMetadata object.
Specified by:
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:
InvalidParameterValueException - if the feature (attribute) value type is incorrect.
InvalidParameterNameException - if the feature (attribute) id is invalid.
See Also:
BaseMetadata, ParameterMetadata