Package com.ibm.websphere.command
Class TargetableCommandImpl
- java.lang.Object
- 
- com.ibm.websphere.command.TargetableCommandImpl
 
- 
- All Implemented Interfaces:
- Command,- TargetableCommand,- java.io.Serializable
 - Direct Known Subclasses:
- CacheableCommandImpl
 
 public abstract class TargetableCommandImpl extends java.lang.Object implements TargetableCommand 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. - See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringLOCALA target object that executes a command within the client's JVM.- 
Fields inherited from interface com.ibm.websphere.command.CommandserialVersionUID
 
- 
 - 
Constructor SummaryConstructors Constructor Description TargetableCommandImpl()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidexecute()Executes the task encapsulated by the command.CommandTargetgetCommandTarget()Returns the target object for the command.java.lang.StringgetCommandTargetName()Returns the name of the target object for the command.static TargetPolicygetTargetPolicy()Returns the target policy for the command.booleanhasOutputProperties()Indicates if the command has any output properties that will have to be returned to the client.abstract booleanisReadyToCallExecute()Indicates if all required input properties have been set.abstract voidperformExecute()Runs the business logic that makes up the command.abstract voidreset()Sets the output properties to the values they had before the the execute method was run.voidsetCommandTarget(CommandTarget commandTarget)Sets the target object on the command.voidsetCommandTargetName(java.lang.String commandTargetName)Sets the name of the target object on the command.voidsetHasOutputProperties(boolean inProp)Sets the hasOutputProperties class variable to indicate if the command has output properties that must be returned to the client.voidsetOutputProperties(TargetableCommand fromCommand)Sets the return values on the command.static voidsetTargetPolicy(TargetPolicy targetPolicy)Sets the target policy for the command.
 
- 
- 
- 
Method Detail- 
executepublic void execute() throws CommandExceptionExecutes the task encapsulated by the command. This is the default implementation for the execute() method in the Command interface, but it can be overridden by the application programmer.This implementation of the execute() method does the following: - Throws an UnsetInputPropertiesException if the isReadyToCallExecute
     method returns falsefor the command.
- Gets the target for the command according to the target policy.
- Invokes the executeCommand() method on the target, which in turn calls the performExecute() method on the command.
- Copies output values by using the setOutputProperties() method
     if the hasOutputProperties() method returns trueand if the returned command is not the same instance as this command.
 - Specified by:
- executein interface- Command
- Throws:
- CommandException- The superclass for all command exceptions. Specificially, UnsetInputPropertiesException is thrown if this command's isReadyToCallExecute() method returns- false.
 
- Throws an UnsetInputPropertiesException if the isReadyToCallExecute
     method returns 
 - 
getCommandTargetpublic CommandTarget getCommandTarget() Returns the target object for the command. This implements the getCommandTarget() method declared in the TargetableCommand interface.- Specified by:
- getCommandTargetin interface- TargetableCommand
- Returns:
- The target object, which locates the server where the command will run.
 
 - 
getCommandTargetNamepublic java.lang.String getCommandTargetName() Returns the name of the target object for the command. This implements the getCommandTargetName() method declared in the TargetableCommand interface.- Specified by:
- getCommandTargetNamein interface- TargetableCommand
- Returns:
- The fully qualified name of the Java class of the target object.
 
 - 
getTargetPolicypublic static TargetPolicy getTargetPolicy() Returns the target policy for the command.
 - 
hasOutputPropertiespublic final boolean hasOutputProperties() Indicates if the command has any output properties that will have to be returned to the client. This implements the hasOutputProperties() method in the TargetableCommand interface.- Specified by:
- hasOutputPropertiesin interface- TargetableCommand
- Returns:
- The value trueif the command has output properties that must be copied back to the client.
 
 - 
isReadyToCallExecutepublic abstract boolean isReadyToCallExecute() Indicates if all required input properties have been set. This abstract method is declared in the Command interface and must be implemented by the application programmer.A typical implementation simply checks whether the required input properties are set: return (inputProperties != null)- Specified by:
- isReadyToCallExecutein interface- Command
- Returns:
- The value trueif all required input properties are set and the command can be run.
 
 - 
performExecutepublic abstract void performExecute() throws java.lang.ExceptionRuns the business logic that makes up the command. This abstract method is declared in the TargetableCommand interface and must be implemented by the application programmer. It is called by the executeCommand() method on the command target.- Specified by:
- performExecutein interface- TargetableCommand
- Throws:
- java.lang.Exception- Any exception that occurs in this method is thrown as an Exception or CommandException.
 
 - 
resetpublic abstract void reset() Sets the output properties to the values they had before the the execute method was run. This abstract method is declared in the Command interface and must be implemented by the application programmer.A typical implementation just resets the output property variables: outputPropertyP = null; outputPropertyQ = 0;
 - 
setCommandTargetpublic void setCommandTarget(CommandTarget commandTarget) Sets the target object on the command. This implements the setCommandTarget() method declared in the TargetableCommand interface.- Specified by:
- setCommandTargetin interface- TargetableCommand
- Parameters:
- commandTarget- The target object, which locates the server where the command will run.
 
 - 
setCommandTargetNamepublic void setCommandTargetName(java.lang.String commandTargetName) Sets the name of the target object on the command. This implements the setCommandTargetName() method declared in the TargetableCommand interface.- Specified by:
- setCommandTargetNamein interface- TargetableCommand
- Parameters:
- commandTargetName- The fully qualified name of the Java class of the target object.
 
 - 
setHasOutputPropertiespublic final void setHasOutputProperties(boolean inProp) Sets the hasOutputProperties class variable to indicate if the command has output properties that must be returned to the client.- Parameters:
- inProp- A boolean indicating if there are output properties to be returned to the client.
 
 - 
setOutputPropertiespublic void setOutputProperties(TargetableCommand fromCommand) Sets the return values on the command. This is the default implementation for the setOutputProperties() method in the TargetableCommand interface, but it can be overridden by the application programmer.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;- Specified by:
- setOutputPropertiesin interface- TargetableCommand
- Parameters:
- fromCommand- The command from which the output properties are copied.
 
 - 
setTargetPolicypublic static void setTargetPolicy(TargetPolicy targetPolicy) Sets the target policy for the command.- Parameters:
- targetPolicy- The target policy for the command.
 
 
- 
 
-