com.ibm.websphere.management.cmdframework.provider
Class AbstractAdminCommand
- java.lang.Object
org.eclipse.emf.common.command.AbstractCommand
com.ibm.websphere.management.cmdframework.provider.AbstractAdminCommand
All implemented interfaces:
AdminCommand, org.eclipse.emf.common.command.Command
Direct known subclasses:
- public abstract class AbstractAdminCommand
- extends org.eclipse.emf.common.command.AbstractCommand
- implements AdminCommand
Nested Class Summary
Modifier and Type | Class and Description |
---|---|
|
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 |
---|---|
|
ASYNC_CUSTOM_TAG
|
|
asyncCmdSession
|
|
cmdMgrType
|
|
cnh
|
|
DYNAMIC_CUSTOM_TAG
|
|
listSetParamsTable
|
|
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 |
---|---|
|
cleanupUploadedFiles()
|
|
createParamEObject()
Create an EObject to store the command's parameter values.
|
|
createParameterMetadata(java.lang.String pmName,java.util.Hashtable featureList)
|
|
execute()
Defines the execution logic of command.
|
|
execute(CommandHistory cmdHistory)
|
|
generateScript(java.lang.String lang)
|
|
getChoices(java.lang.String paramName)
Provides a default implement for the method which always returns null.
|
|
getCmdHandler()
|
|
getCmdMgrType()
|
|
getCommandData()
|
|
getCommandMetadata()
|
|
getCommandMetadata(java.lang.String cmdName)
|
getCommandResult()
|
|
|
getCommandSession()
Creates and returns the unique identifier for this command instance.
|
|
getConfigService()
Convenient method to access ConfigService component.
|
getConfigSession()
|
|
|
getLocale()
|
|
getName()
|
|
getOrigParameterValue(java.lang.String paramName)
|
|
getParameter(java.lang.String parameterName)
|
|
getParameter(java.lang.String parameterName,int rowIndex)
|
|
getParameterMetadata(java.lang.String paramName)
returns the metadata for the specified parameter.
|
|
getResult()
Provides a default implementation for this method.
|
|
getTargetObject()
|
|
getTargetObjectChoices()
Provides a default implement for the method which always returns null.
|
|
getUserData()
Gets the user data for the command data.
|
|
initCommandData()
Construct proper type of command data instance.
|
|
initializeParameter(java.lang.String paramName,java.lang.Object value)
|
|
initializeParameter(java.lang.String paramName,java.lang.Object value,int rowIndex)
|
|
isAsyncCommand()
|
|
isDynamicStepCommand()
|
|
isLocalMode()
|
|
isParamReadonly(java.lang.String paramName)
|
|
isPrivateParameter(java.lang.String paramName)
|
|
isTable()
|
|
listAllParameterName()
|
|
listParameterName()
|
|
listSetParams()
|
|
listSetParams(int rowIndex)
|
|
redo()
|
|
resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Resets the command data for the command.
|
|
resetCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata newMetadata)
|
|
save(java.io.OutputStream outputStream)
|
|
sendNotification(CommandNotification cmdNotification)
|
|
setCmdHandler(com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler handler)
|
|
setCmdMgrType(java.lang.Integer cmdMgrType)
|
|
setCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata cmdmetadata)
|
|
setCommandResult(CommandResult thisResult)
|
|
setCommandSession(com.ibm.ws.management.cmdframework.impl.TaskCommandSession session)
|
|
setConfigSession(Session session)
|
|
setListSetParamsTable(int rowIndex,java.lang.String paramName)
|
|
setLocale(java.util.Locale locale)
|
|
setOrigParameterValue(java.lang.String paramName,java.lang.Object value)
|
|
setParameter(java.lang.String paramName,java.lang.Object value)
|
|
setParameter(java.lang.String paramName,java.lang.Object value,int rowIndex)
|
|
setTargetObject(java.lang.Object obj)
|
|
setupListener(java.lang.Object obj)
|
|
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
- public static final java.lang.String ASYNC_CUSTOM_TAG
See Also:
DYNAMIC_CUSTOM_TAG
- public static final java.lang.String DYNAMIC_CUSTOM_TAG
See Also:
PRIVATE_CUSTOM_TAG
- public static final java.lang.String PRIVATE_CUSTOM_TAG
See Also:
cnh
- protected com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler cnh
asyncCmdSession
- protected com.ibm.ws.management.cmdframework.impl.TaskCommandSession asyncCmdSession
cmdMgrType
- protected java.lang.Integer cmdMgrType
listSetParamsTable
- protected java.util.HashMap<java.lang.Integer,java.util.Collection<java.lang.String>> listSetParamsTable
Constructor Detail
AbstractAdminCommand
- public AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
AbstractAdminCommand
- public AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData inCommandData)
- 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
- public static com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata( java.lang.String cmdName)
- throws CommandNotFoundException
Throws:
initCommandData
- protected com.ibm.websphere.management.cmdframework.commanddata.CommandData initCommandData( )
Construct proper type of command data instance.
Returns:
newly created command data instance.
getLocale
- 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
- 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
- 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
- public com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata( )
Description copied from interface:
AdminCommand
Returns the meta data for the command.
Specified by:
getCommandMetadata
in interface AdminCommand
Returns:
the meta data for the command.
getCommandData
- protected com.ibm.websphere.management.cmdframework.commanddata.CommandData getCommandData( )
setCommandMetadata
- protected void setCommandMetadata( com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata cmdmetadata)
getTargetObject
- 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:
getTargetObject
in interface AdminCommand
Returns:
the target object of the command.
setTargetObject
- public void setTargetObject(java.lang.Object obj)
- throws InvalidParameterValueException
Description copied from interface:
AdminCommand
Sets the target object for the command.
Specified by:
setTargetObject
in interface AdminCommand
listSetParams
- public java.util.Collection listSetParams( )
Description copied from interface:
AdminCommand
Gets all the command parameters whose value are set.
Specified by:
listSetParams
in interface AdminCommand
Returns:
the command parameter names whose value are set.
listSetParams
- protected java.util.Collection listSetParams( int rowIndex)
getParameter
- public java.lang.Object getParameter( java.lang.String parameterName)
- 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
- public boolean isAsyncCommand()
Description copied from interface:
AdminCommand
Check if it is an async command, which is specified by command provider.
Specified by:
isAsyncCommand
in interface AdminCommand
Returns:
true if this command is async; false otherwise.
isDynamicStepCommand
- public boolean isDynamicStepCommand( )
Description copied from interface:
AdminCommand
Check if it is a dynamic step command, which is specified by command provider.
Specified by:
isDynamicStepCommand
in interface AdminCommand
Returns:
true if this command has dynamic step; false otherwise.
isPrivateParameter
- public boolean isPrivateParameter( java.lang.String paramName)
- throws InvalidParameterNameException
Description copied from interface:
AdminCommand
Check if it is a private parameter, which is specified by command provider.
Specified by:
isPrivateParameter
in interface AdminCommand
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
- public java.util.List listAllParameterName( )
Description copied from interface:
AdminCommand
Returns all the parameter names including private one on the
ParameterMetadata
objects.
Specified by:
listAllParameterName
in interface AdminCommand
Returns:
a list of parameter name in String type.
listParameterName
- public java.util.List listParameterName( )
Description copied from interface:
AdminCommand
Returns parameter names that are not private on the
ParameterMetadata
objects.
Specified by:
listParameterName
in interface AdminCommand
Returns:
a list of parameter name in String type.
getParameter
- protected java.lang.Object getParameter( java.lang.String parameterName,
- int rowIndex)
- throws InvalidParameterNameException
Throws:
setParameter
- public void setParameter(java.lang.String paramName,
- java.lang.Object value)
- throws InvalidParameterValueException
- 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
- public void setOrigParameterValue( java.lang.String paramName,
- java.lang.Object value)
- throws InvalidParameterValueException
- InvalidParameterNameException
Description copied from interface:
AdminCommand
Sets the original value for the
UploadFile
or DownloadFile
parameter.
Specified by:
setOrigParameterValue
in interface AdminCommand
Parameters:
paramName
- the parameter name. value
- the parameter value. Throws:
InvalidParameterValueException
- if the parameter value is not valid. getOrigParameterValue
- public java.lang.Object getOrigParameterValue( java.lang.String paramName)
- throws InvalidParameterNameException
Description copied from interface:
AdminCommand
Gets the original parameter value for the
UploadFile
or DownloadFile
parameter.
Specified by:
getOrigParameterValue
in interface AdminCommand
Parameters:
paramName
- the parameter name. Returns:
the parameter value.
Throws:
initializeParameter
- protected void initializeParameter( java.lang.String paramName,
- java.lang.Object value)
- throws InvalidParameterValueException
- InvalidParameterNameException
setParameter
- protected void setParameter(java.lang.String paramName,
- java.lang.Object value,
- int rowIndex)
- throws InvalidParameterValueException
- InvalidParameterNameException
initializeParameter
- protected void initializeParameter( java.lang.String paramName,
- java.lang.Object value,
- int rowIndex)
- throws InvalidParameterValueException
- InvalidParameterNameException
setListSetParamsTable
- protected void setListSetParamsTable( int rowIndex,
- java.lang.String paramName)
isTable
- protected boolean isTable()
getChoices
- 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
- public java.lang.Object[] getTargetObjectChoices( )
Provides a default implement for the method which always returns null.
Specified by:
getTargetObjectChoices
in interface AdminCommand
Returns:
an array of valid values for the specified parameter.
validate
- public void validate()
- 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
- 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:
setConfigSession
in interface AdminCommand
Parameters:
session
- the user's admin session. getConfigSession
- 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:
getConfigSession
in interface AdminCommand
Returns:
user's config session.
getCommandResult
- public CommandResult getCommandResult( )
Description copied from interface:
AdminCommand
Return a more user friendly version of command result.
Specified by:
getCommandResult
in interface AdminCommand
Returns:
the result generated from last execution.
setCommandResult
- protected void setCommandResult( CommandResult thisResult)
save
- 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
- 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
- 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
- public void setCommandSession(com.ibm.ws.management.cmdframework.impl.TaskCommandSession session)
getCommandSession
- 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
- 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:
setCmdHandler
in interface AdminCommand
Parameters:
handler
- handler for command notification getCmdHandler
- 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:
getCmdHandler
in interface AdminCommand
Returns:
Handler for command notifications. Null if no handler was set.
setupListener
- protected void setupListener(java.lang.Object obj)
getResult
- 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
- public void sendNotification(CommandNotification cmdNotification)
redo
- public void redo()
Specified by:
redo
in interface org.eclipse.emf.common.command.Command
cleanupUploadedFiles
- public void cleanupUploadedFiles( )
createParamEObject
- protected org.eclipse.emf.ecore.EObject createParamEObject( )
- 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
- 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
- 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
- protected void resetCommandMetadata( com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata newMetadata)
generateScript
- public java.lang.String generateScript( java.lang.String lang)
- throws CommandException
Description copied from interface:
AdminCommand
Generates the corresponding wsadmin script for the specified scripting language.
Specified by:
generateScript
in interface AdminCommand
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
- protected com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata getParameterMetadata( java.lang.String paramName)
- throws InvalidParameterNameException
returns the metadata for the specified parameter.
Parameters:
paramName
- name of parameter Returns:
ParameterMetadata
Throws:
isLocalMode
- protected boolean isLocalMode()
setCmdMgrType
- public void setCmdMgrType(java.lang.Integer cmdMgrType)
getCmdMgrType
- public java.lang.Integer getCmdMgrType( )
isParamReadonly
- protected boolean isParamReadonly( java.lang.String paramName)
- throws InvalidParameterNameException
Throws:
getConfigService
- protected ConfigService getConfigService( )
Convenient method to access ConfigService component.
createParameterMetadata
- public com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata createParameterMetadata( java.lang.String pmName,
- java.util.Hashtable featureList)
- throws InvalidParameterValueException
- InvalidParameterNameException
Description copied from interface:
AdminCommand
Create a ParameterMetadata object.
Specified by:
createParameterMetadata
in interface AdminCommand
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