Interface TargetableCommand
- 
- All Superinterfaces:
- Command,- java.io.Serializable
 - All Known Subinterfaces:
- CacheableCommand
 - All Known Implementing Classes:
- CacheableCommandImpl,- CacheableCommandImpl,- TargetableCommandImpl
 
 public interface TargetableCommand extends Command The TargetableCommand interface describes a command that can be run in a remote JVM. It extends the Command interface and declares methods that support remote execution of commands. Some of the methods are implemented in the TargetableCommandImpl class, and some must be implemented by the application programmer.A targetable command must have a target, which represents the server that will actually run the command. The target object is an instance of the CommandTarget interface, and it is responsible for ensuring that the command runs in the desired server environment. For each server, there is at least one class that implements the CommandTarget interface. The TargetableCommand interface provides two ways for a client to specify the target of a command: - The target object can be set directly on the command by using the setCommandTarget() method.
- The name of the target object can be set on the command by using the setCommandTargetName() method.
 
- 
- 
Field Summary- 
Fields inherited from interface com.ibm.websphere.command.CommandserialVersionUID
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description CommandTargetgetCommandTarget()Returns the target object for the command.java.lang.StringgetCommandTargetName()Returns the name of the target object for the command.booleanhasOutputProperties()Indicates if the command has any output properties that must be returned to the client.voidperformExecute()Runs the business logic that makes up the command.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.voidsetOutputProperties(TargetableCommand fromCommand)Sets the return values on the command.- 
Methods inherited from interface com.ibm.websphere.command.Commandexecute, isReadyToCallExecute, reset
 
- 
 
- 
- 
- 
Method Detail- 
getCommandTargetCommandTarget getCommandTarget() Returns the target object for the command. The target object locates the server in which the command will run.This method is implemented in the TargetableCommandImpl class. - Returns:
- The target object for the command.
 
 - 
getCommandTargetNamejava.lang.String getCommandTargetName() Returns the name of the target object for the command. The target object locates the server in which the command will run.This abstract is implemented in the TargetableCommandImpl class. - Returns:
- The name of the target object for the command. The name is a fully qualified name for a Java class, for example, mypkg.bp.MyBusinessCmdTarget.
 
 - 
hasOutputPropertiesboolean hasOutputProperties() Indicates if the command has any output properties that must be returned to the client. If there is nothing to return to the client, this method can returnfalseto eliminate unecessary copying and remote invocations.This method is implemented in the TargetableCommandImpl class. - Returns:
- The value trueif the command has output properties.
 
 - 
performExecutevoid performExecute() throws java.lang.ExceptionRuns the business logic that makes up the command. The application programmer implements the performExecute() method for a command. The executeCommand() method in the target server invokes the performExecute() method.This method must be implemented by the application programmer. - Throws:
- java.lang.Exception- Any exception that occurs in the method will be thrown as an Exception.
 
 - 
setCommandTargetvoid setCommandTarget(CommandTarget commandTarget) Sets the target object on the command. The target object locates the server in which the command will run.This method is implemented in the TargetableCommandImpl class. - Parameters:
- commandTarget- The target object for the command.
 
 - 
setCommandTargetNamevoid setCommandTargetName(java.lang.String commandTargetName) Sets the name of the target object on the command. The target object locates the server in which the command will run.This method is implemented in the TargetableCommandImpl class. - Parameters:
- commandTargetName- The name of the target object for the command. The name is a fully qualified name for a Java class, for example, mypkg.bp.MyBusinessCmdTarget.
 
 - 
setOutputPropertiesvoid setOutputProperties(TargetableCommand fromCommand) Sets the return values on the command. If the command is executed in a remote JVM, the returned command is a different instance than the client's command. In this case, the execute() method in the TargetableCommand interface calls the setOutputProperties() method to copy properties from the returned instance of the command to the client's instance. If the hasOutputProperties() method returnsfalse, there is no need to invoke this method.This method is implemented in the TargetableCommandImpl class. - Parameters:
- fromCommand- The command from which the output properties are copied.
 
 
- 
 
-