public abstract class AbstractAdminCommand extends org.eclipse.emf.common.command.AbstractCommand implements AdminCommand
| Modifier and Type | Class and Description |
|---|---|
class |
AbstractAdminCommand.CmdNotificationListener |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ASYNC_CUSTOM_TAG |
protected com.ibm.ws.management.cmdframework.impl.TaskCommandSession |
asyncCmdSession |
protected java.lang.Integer |
cmdMgrType |
protected com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler |
cnh |
static java.lang.String |
DYNAMIC_CUSTOM_TAG |
protected java.util.HashMap<java.lang.Integer,java.util.Collection<java.lang.String>> |
listSetParamsTable |
static java.lang.String |
PRIVATE_CUSTOM_TAG |
| 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) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupUploadedFiles() |
protected org.eclipse.emf.ecore.EObject |
createParamEObject()
Create an EObject to store the command's parameter values.
|
com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata |
createParameterMetadata(java.lang.String pmName,
java.util.Hashtable featureList)
Create a ParameterMetadata object.
|
abstract void |
execute()
Defines the execution logic of command.
|
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)
Provides a default implement for the method which always returns null.
|
com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler |
getCmdHandler()
Get the handler which was set to handle command notifications
|
java.lang.Integer |
getCmdMgrType() |
protected com.ibm.websphere.management.cmdframework.commanddata.CommandData |
getCommandData() |
com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata |
getCommandMetadata()
Returns the meta data for the command.
|
static com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata |
getCommandMetadata(java.lang.String cmdName) |
CommandResult |
getCommandResult()
Return a more user friendly version of command result.
|
com.ibm.ws.management.cmdframework.impl.TaskCommandSession |
getCommandSession()
Creates and returns the unique identifier for this command instance.
|
protected ConfigService |
getConfigService()
Convenient method to access ConfigService component.
|
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 paramName)
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.
|
protected java.lang.Object |
getParameter(java.lang.String parameterName,
int rowIndex) |
protected com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata |
getParameterMetadata(java.lang.String paramName)
returns the metadata for the specified parameter.
|
java.util.Collection |
getResult()
Provides a default implementation for this method.
|
java.lang.Object |
getTargetObject()
Returns the target object of the command.
|
java.lang.Object[] |
getTargetObjectChoices()
Provides a default implement for the method which always returns null.
|
protected com.ibm.websphere.management.cmdframework.commanddata.UserData |
getUserData()
Gets the user data for the command data.
|
protected com.ibm.websphere.management.cmdframework.commanddata.CommandData |
initCommandData()
Construct proper type of command data instance.
|
protected void |
initializeParameter(java.lang.String paramName,
java.lang.Object value) |
protected void |
initializeParameter(java.lang.String paramName,
java.lang.Object value,
int rowIndex) |
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.
|
protected boolean |
isLocalMode() |
protected boolean |
isParamReadonly(java.lang.String paramName) |
boolean |
isPrivateParameter(java.lang.String paramName)
Check if it is a private parameter, which is specified by command provider.
|
protected boolean |
isTable() |
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.
|
protected java.util.Collection |
listSetParams(int rowIndex) |
void |
redo() |
void |
resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
Resets the command data for the command.
|
protected void |
resetCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata newMetadata) |
void |
save(java.io.OutputStream outputStream)
Serializes the command into the specified output stream.
|
void |
sendNotification(CommandNotification cmdNotification) |
void |
setCmdHandler(com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler handler)
Set the handler to handle command notifications
|
void |
setCmdMgrType(java.lang.Integer cmdMgrType) |
protected void |
setCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata cmdmetadata) |
protected void |
setCommandResult(CommandResult thisResult) |
void |
setCommandSession(com.ibm.ws.management.cmdframework.impl.TaskCommandSession session) |
void |
setConfigSession(Session session)
Sets the user's config session.
|
protected void |
setListSetParamsTable(int rowIndex,
java.lang.String paramName) |
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.
|
protected void |
setParameter(java.lang.String paramName,
java.lang.Object value,
int rowIndex) |
void |
setTargetObject(java.lang.Object obj)
Sets the target object for the command.
|
protected void |
setupListener(java.lang.Object obj) |
void |
validate()
Providers a default implmentation for the method.
|
canExecute, canUndo, chain, dispose, getAffectedObjects, getDescription, getLabel, prepare, setDescription, setLabel, toString, undopublic static final java.lang.String ASYNC_CUSTOM_TAG
public static final java.lang.String DYNAMIC_CUSTOM_TAG
public static final java.lang.String PRIVATE_CUSTOM_TAG
protected com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler cnh
protected com.ibm.ws.management.cmdframework.impl.TaskCommandSession asyncCmdSession
protected java.lang.Integer cmdMgrType
protected java.util.HashMap<java.lang.Integer,java.util.Collection<java.lang.String>> listSetParamsTable
public AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata metadata)
public AbstractAdminCommand(com.ibm.websphere.management.cmdframework.commanddata.CommandData inCommandData)
throws CommandNotFoundException
inCommandData - the command data for the commandCommandNotFoundException - if the command is not found.public static com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata(java.lang.String cmdName)
throws CommandNotFoundException
CommandNotFoundExceptionprotected com.ibm.websphere.management.cmdframework.commanddata.CommandData initCommandData()
public java.util.Locale getLocale()
AdminCommandgetLocale in interface AdminCommandpublic void setLocale(java.util.Locale locale)
AdminCommandsetLocale in interface AdminCommandlocale - the caller's Locale.public java.lang.String getName()
AdminCommandgetName in interface AdminCommandpublic com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata getCommandMetadata()
AdminCommandgetCommandMetadata in interface AdminCommandprotected com.ibm.websphere.management.cmdframework.commanddata.CommandData getCommandData()
protected void setCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata cmdmetadata)
public java.lang.Object getTargetObject()
AdminCommandgetTargetObject in interface AdminCommandpublic void setTargetObject(java.lang.Object obj)
throws InvalidParameterValueException
AdminCommandsetTargetObject in interface AdminCommandobj - the target object valueInvalidParameterValueExceptionpublic java.util.Collection listSetParams()
AdminCommandlistSetParams in interface AdminCommandprotected java.util.Collection listSetParams(int rowIndex)
public java.lang.Object getParameter(java.lang.String parameterName)
throws InvalidParameterNameException
AdminCommandgetParameter in interface AdminCommandparameterName - the parameter name.InvalidParameterNameExceptionpublic boolean isAsyncCommand()
AdminCommandisAsyncCommand in interface AdminCommandpublic boolean isDynamicStepCommand()
AdminCommandisDynamicStepCommand in interface AdminCommandpublic boolean isPrivateParameter(java.lang.String paramName)
throws InvalidParameterNameException
AdminCommandisPrivateParameter in interface AdminCommandparamName - is the name of parameter.InvalidParameterNameException - if user specified an invalid parameter name.public java.util.List listAllParameterName()
AdminCommandParameterMetadata objects.listAllParameterName in interface AdminCommandpublic java.util.List listParameterName()
AdminCommandParameterMetadata objects.listParameterName in interface AdminCommandprotected java.lang.Object getParameter(java.lang.String parameterName,
int rowIndex)
throws InvalidParameterNameException
InvalidParameterNameExceptionpublic void setParameter(java.lang.String paramName,
java.lang.Object value)
throws InvalidParameterValueException,
InvalidParameterNameException
AdminCommandsetParameter in interface AdminCommandparamName - the parameter name.value - the parameter value.InvalidParameterValueException - if the parameter value is not valid.InvalidParameterNameExceptionpublic void setOrigParameterValue(java.lang.String paramName,
java.lang.Object value)
throws InvalidParameterValueException,
InvalidParameterNameException
AdminCommandUploadFile or DownloadFile parameter.setOrigParameterValue in interface AdminCommandparamName - the parameter name.value - the parameter value.InvalidParameterValueException - if the parameter value is not valid.InvalidParameterNameExceptionpublic java.lang.Object getOrigParameterValue(java.lang.String paramName)
throws InvalidParameterNameException
AdminCommandUploadFile or DownloadFile parameter.getOrigParameterValue in interface AdminCommandparamName - the parameter name.InvalidParameterNameExceptionprotected void initializeParameter(java.lang.String paramName,
java.lang.Object value)
throws InvalidParameterValueException,
InvalidParameterNameException
protected void setParameter(java.lang.String paramName,
java.lang.Object value,
int rowIndex)
throws InvalidParameterValueException,
InvalidParameterNameException
protected void initializeParameter(java.lang.String paramName,
java.lang.Object value,
int rowIndex)
throws InvalidParameterValueException,
InvalidParameterNameException
protected void setListSetParamsTable(int rowIndex,
java.lang.String paramName)
protected boolean isTable()
public java.lang.Object[] getChoices(java.lang.String paramName)
getChoices in interface AdminCommandparamName - the parameter name.public java.lang.Object[] getTargetObjectChoices()
getTargetObjectChoices in interface AdminCommandpublic void validate()
throws CommandValidationException
validate in interface AdminCommandCommandValidationExceptionpublic void setConfigSession(Session session)
AdminCommandsetConfigSession in interface AdminCommandsession - the user's admin session.public Session getConfigSession()
AdminCommandgetConfigSession in interface AdminCommandpublic CommandResult getCommandResult()
AdminCommandgetCommandResult in interface AdminCommandprotected void setCommandResult(CommandResult thisResult)
public void save(java.io.OutputStream outputStream)
AdminCommandsave in interface AdminCommandoutputStream - the output stream that is used to serialize the command
datapublic abstract void execute()
execute in interface org.eclipse.emf.common.command.Commandpublic void execute(CommandHistory cmdHistory)
AdminCommandexecute in interface AdminCommandcmdHistory - an implementation of command historypublic void setCommandSession(com.ibm.ws.management.cmdframework.impl.TaskCommandSession session)
public com.ibm.ws.management.cmdframework.impl.TaskCommandSession getCommandSession()
public void setCmdHandler(com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler handler)
AdminCommandsetCmdHandler in interface AdminCommandhandler - handler for command notificationpublic com.ibm.websphere.management.cmdframework.provider.CmdNotificationHandler getCmdHandler()
AdminCommandgetCmdHandler in interface AdminCommandprotected void setupListener(java.lang.Object obj)
public java.util.Collection getResult()
getResult in interface org.eclipse.emf.common.command.CommandgetResult in class org.eclipse.emf.common.command.AbstractCommandpublic void sendNotification(CommandNotification cmdNotification)
public void redo()
redo in interface org.eclipse.emf.common.command.Commandpublic void cleanupUploadedFiles()
protected org.eclipse.emf.ecore.EObject createParamEObject()
throws CommandNotFoundException
CommandNotFoundExceptionprotected com.ibm.websphere.management.cmdframework.commanddata.UserData getUserData()
public void resetCommandData(com.ibm.websphere.management.cmdframework.commanddata.CommandData cmdData)
cmdData - the new command data.protected void resetCommandMetadata(com.ibm.websphere.management.cmdframework.commandmetadata.CommandMetadata newMetadata)
public java.lang.String generateScript(java.lang.String lang)
throws CommandException
AdminCommandgenerateScript in interface AdminCommandlang - the name of the scripting language.CommandException - if user specified scripting language is not supported.
XXX todo: more specific exception.protected com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata getParameterMetadata(java.lang.String paramName)
throws InvalidParameterNameException
paramName - name of parameterInvalidParameterNameExceptionprotected boolean isLocalMode()
public void setCmdMgrType(java.lang.Integer cmdMgrType)
public java.lang.Integer getCmdMgrType()
protected boolean isParamReadonly(java.lang.String paramName)
throws InvalidParameterNameException
InvalidParameterNameExceptionprotected ConfigService getConfigService()
public com.ibm.websphere.management.cmdframework.commandmetadata.ParameterMetadata createParameterMetadata(java.lang.String pmName,
java.util.Hashtable featureList)
throws InvalidParameterValueException,
InvalidParameterNameException
AdminCommandcreateParameterMetadata in interface AdminCommandpmName - is the name of ParameterMetadata.featureList - is a Hashtable of ParameterMetadata features (attributes) in feature id - value pair.
CommandMetadataPackage.PARAMETER_METADATA
for list of available features for PARAMETER_METADATA.InvalidParameterValueException - if the feature (attribute) value type is incorrect.InvalidParameterNameException - if the feature (attribute) id is invalid.BaseMetadata,
ParameterMetadata