public class GenericCommand extends AbstractCommand
Of course, a custom command is worthless unless there is a command service on the server side that can process the command. That is to say, the command type and parameter definitions must be acceptable to the command service where the command is issued.
It is generally not a good thing to allow users of commands to be able to modify command types and parameter definitions as this could make the command inoperable (which is why this capability does not exist in the base superclass}. However, this capability may be needed for specialized clients.
Note that modifications to a custom command have no effect on previous executions of the command. While this may
seem obvious, a less obvious effect is that a command whose AbstractCommand.isCommandInResponse() was
true at the time of execution will be stored in the resulting CommandResponse - changing that flag to
false after the fact will not alter that previous command response.
| Constructor and Description |
|---|
GenericCommand() |
GenericCommand(Command commandToTransform) |
GenericCommand(CommandType commandType,
ParameterDefinition[] paramDefs)
Specialized constructor for
GenericCommand that allows the instantiator to dynamically define this
generic commands metadata at runtime. |
GenericCommand(Map<String,Object> commandParameters) |
| Modifier and Type | Method and Description |
|---|---|
protected CommandType |
buildCommandType()
Builds the command type of this command.
|
protected ParameterDefinition[] |
buildParameterDefinitions()
Builds the set of parameter definitions that this command will use.
|
void |
setCommandType(CommandType newCommandType)
Allows the caller to modify this custom command's
type. |
void |
setParameterDefinitions(ParameterDefinition[] newParameterDefinitions)
Allows the caller to modify this custom command's
parameter definitions. |
allowAnyParameter, checkParameterValidity, convertParameters, getCommandType, getConfiguration, getParameterDefinition, getParameterDefinitions, getParameterValue, getParameterValues, getParameterValuesInternalMap, hasParameterValue, initializeMetadata, isCommandInResponse, removeParameterValue, removeParameterValues, setCommandInResponse, setParameterValue, setParameterValuesInternalMap, toString, toStringpublic GenericCommand()
throws IllegalArgumentException,
InvalidParameterDefinitionException
public GenericCommand(Map<String,Object> commandParameters) throws IllegalArgumentException, InvalidParameterDefinitionException
public GenericCommand(Command commandToTransform)
public GenericCommand(CommandType commandType, ParameterDefinition[] paramDefs)
GenericCommand that allows the instantiator to dynamically define this
generic commands metadata at runtime.commandType - this command typeparamDefs - the definitions for this command's parameterspublic void setCommandType(CommandType newCommandType)
type. Note that calling this method with
a command type that is not understood by a server-side command service will render this command inoperable.newCommandType - this command's new command typepublic void setParameterDefinitions(ParameterDefinition[] newParameterDefinitions)
parameter definitions. Note that
calling this method with definitions that are not understood by a server-side command service will render this
command inoperable.
The given set of parameter definitions completely override the currently existing definitions (i.e. they are not merged; the new definitions replace the old definitions).
Changing the parameter definitions may invalidate the current set of parameter values. Calling
AbstractCommand.checkParameterValidity(boolean) will determine if the current parameter values are still
valid for the new parameter definitions.
newParameterDefinitions - this command's new parameter definitionsprotected CommandType buildCommandType()
AbstractCommandnull.
This method is called by the command's constructors.
buildCommandType in class AbstractCommandnullAbstractCommand.buildCommandType()protected ParameterDefinition[] buildParameterDefinitions()
AbstractCommandnull if the command accepts any and all parameters, regardless of name or typeThis method is called by the command's constructors.
buildParameterDefinitions in class AbstractCommandnullAbstractCommand.buildParameterDefinitions()Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.