|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.websphere.command.TargetableCommandImpl
The TargetableCommandImpl class implements the generic methods in the TargetableCommand interface. Application programmers must implement the application-specific methods. The TargetableCommand interface provides support for the remote execution of commands, and the TargetableCommandImpl class provides a runtime for command execution.
All targetable commands extend the TargetableCommandImpl class.
Field Summary | |
---|---|
protected CommandTarget |
commandTarget
The target object for the command. |
protected java.lang.String |
commandTargetName
The name of the target object for the command. |
protected boolean |
hasOutputProperties
Indicates if the command has output properties. |
static java.lang.String |
LOCAL
A target object that executes a command within the client's JVM. |
protected static TargetPolicy |
targetPolicy
The target policy used by the command to determine the target associated with the command. |
Fields inherited from interface com.ibm.websphere.command.Command |
---|
serialVersionUID |
Constructor Summary | |
---|---|
TargetableCommandImpl()
|
Method Summary | |
---|---|
void |
execute()
Executes the task encapsulated by the command. |
CommandTarget |
getCommandTarget()
Returns the target object for the command. |
java.lang.String |
getCommandTargetName()
Returns the name of the target object for the command. |
static TargetPolicy |
getTargetPolicy()
Returns the target policy for the command. |
boolean |
hasOutputProperties()
Indicates if the command has any output properties that will have to be returned to the client. |
abstract boolean |
isReadyToCallExecute()
Indicates if all required input properties have been set. |
abstract void |
performExecute()
Runs the business logic that makes up the command. |
abstract void |
reset()
Sets the output properties to the values they had before the the execute method was run. |
void |
setCommandTarget(CommandTarget commandTarget)
Sets the target object on the command. |
void |
setCommandTargetName(java.lang.String commandTargetName)
Sets the name of the target object on the command. |
void |
setHasOutputProperties(boolean inProp)
Sets the hasOutputProperties class variable to indicate if the command has output properties that must be returned to the client. |
void |
setOutputProperties(TargetableCommand fromCommand)
Sets the return values on the command. |
static void |
setTargetPolicy(TargetPolicy targetPolicy)
Sets the target policy for the command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String LOCAL
This is static so that it is easy to obtain.
protected static TargetPolicy targetPolicy
This is static so that it is easy to obtain.
protected transient CommandTarget commandTarget
protected java.lang.String commandTargetName
protected boolean hasOutputProperties
false
to eliminate
unecessary copying and remote invocations.Constructor Detail |
public TargetableCommandImpl()
Method Detail |
public void execute() throws CommandException
This implementation of the execute() method does the following:
execute
in interface Command
CommandException
- The superclass for all command exceptions.
Specificially, UnsetInputPropertiesException
is thrown if this command's
isReadyToCallExecute() method returns
false.public CommandTarget getCommandTarget()
getCommandTarget
in interface TargetableCommand
public java.lang.String getCommandTargetName()
getCommandTargetName
in interface TargetableCommand
public static TargetPolicy getTargetPolicy()
public final boolean hasOutputProperties()
hasOutputProperties
in interface TargetableCommand
public abstract boolean isReadyToCallExecute()
A typical implementation simply checks whether the required input properties are set:
return (inputProperties != null)
isReadyToCallExecute
in interface Command
public abstract void performExecute() throws java.lang.Exception
performExecute
in interface TargetableCommand
java.lang.Exception
- Any exception that occurs in this method is
thrown as an Exception or CommandException.public abstract void reset()
A typical implementation just resets the output property variables:
outputPropertyP = null; outputPropertyQ = 0;
reset
in interface Command
public void setCommandTarget(CommandTarget commandTarget)
setCommandTarget
in interface TargetableCommand
commandTarget
- The target object, which locates the server where
the command will run.public void setCommandTargetName(java.lang.String commandTargetName)
setCommandTargetName
in interface TargetableCommand
commandTargetName
- The fully qualified name of the Java class
of the target object.public final void setHasOutputProperties(boolean inProp)
inProp
- A boolean indicating if there are output properties
to be returned to the client.public void setOutputProperties(TargetableCommand fromCommand)
This implementation uses introspection to copy all instance variables, provided that they are non-private and non-package; that is, must be public or protected. This implementation does not copy the final, static or transient fields.
If this implementation is not acceptable, the programmer can override this method. A typical re-implementation does the following:
this.outputPropertyA = fromCommand.outputPropertyA; this.outputPropertyB = fromCommand.outputPropertyB;
setOutputProperties
in interface TargetableCommand
fromCommand
- The command from which the output properties are
copied.public static void setTargetPolicy(TargetPolicy targetPolicy)
targetPolicy
- The target policy for the command.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |