com.ibm.websphere.command
Interface Command
- All Superinterfaces:
- java.io.Serializable
- All Known Subinterfaces:
- CompensableCommand, TargetableCommand
- All Known Implementing Classes:
- TargetableCommandImpl
- 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:
- They provide a simple, uniform way to call business logic, regardless of the programming style used for the business logic (for example, enterprise beans, JDBC, stored procedures, connectors, file access).
- They reduce the number of messages used when a client interacts with a remote server, often replacing several messages that do small pieces of work with a single message that does all of them.
- They provide local-remote transparency; the client-side command code is independent of whether the command is executed in the client's JVM or a remote JVM.
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
- See Also:
- Constant Field Values
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.
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.