com.ibm.websphere.command
Interface Command

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
CompensableCommand, TargetableCommand

public interface Command
extends java.io.Serializable

The Command interface defines the client side for fundamental command functionality. A command encapsulates the set of operations that makes up a business task. Commands provide the following advantages over conventional client-server interaction:

The Command interface is extended by both the TargetableCommand and CompensableCommand interfaces, which offer additional features. The TargetableCommandImpl abstract class, which implements many of the features of the TargetableCommand interface, provides a runtime for command execution.


Field Summary
static long serialVersionUID
           
 
Method Summary
 void execute()
          Executes the task encapsulated by this command.
 boolean isReadyToCallExecute()
          Indicates if all required input properties have been set.
 void reset()
          Sets the output properties to the values they had before the the execute() method was run.
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Method Detail

execute

public void execute()
             throws CommandException
Executes the task encapsulated by this command. This method calls the isReadyToCallExecute() method and throws UnsetInputPropertiesException if the isReadyToCallExecute() method returns false.

This method is implemented in the TargetableCommandImpl class.

Throws:
CommandException - The superclass for all command exceptions. Specifically, UnsetInputPropertiesException is thrown if the isReadyToCallExecute() method returns false.

isReadyToCallExecute

public boolean isReadyToCallExecute()
Indicates if all required input properties have been set. The isReadyToCall() method is called in the client-side JVM by the execute() before the command is given to the target server to run, but an application programmer can also call this method.

The programmer must determine the conditions under which a command is considered ready to run and implement this abstract method appropriately.

Returns:
The value true if the command is ready to execute.

reset

public void reset()
Sets the output properties to the values they had before the the execute() method was run. After calling the reset() method, the methods to get output properties no longer work, but the isReadyToCallExecute() method returns true. The reset() method provides a convenient and efficient way to reuse a command instance after changing some input properties or the target.

The programmer must determine how to reset the input properties and implement this abstract method accordingly.