org.progeeks.cmd
Interface Command

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
ViewCommand
All Known Implementing Classes:
AbstractViewCommand, WorkerCommand

public interface Command
extends java.io.Serializable

A command is a single unit of execution where the calling code is decoupled from the work being performed. In a way, it can be thought of as encapsulating a method into its own object. Instead of passing method parameters, the object is constructed with the appropriate attributes to peform its work. This command is similar to the Command Pattern discussed in the book "Design Patterns", Gamma, et al..

A few modifications have been made to the standard command patterns including the addition of an encapsulated return type and the passing of a CommandEnvironment object on the execute method.

The CommandEnvironment is a way to further decouple a command from its surroundings and makes it easier to transport the command to another location before execution. For example, a client could create a command and send it to a server. The server could then supply a local environment.

One of the primary functions of the CommandEnvironment object is to give the command a means of running its own commands as sub-tasks. By doing this through the environment object, the command doesn't have to have any specific knowledge or reference to a specific command processor. Plus, depending on the command processor architecture, the environment may be specially tailored to the thread or process in which the command has been executed.

Version:
$Revision: 1.1 $
Author:
Paul Speed

Method Summary
 Result execute(Environment env)
          Called by a command processor to invoke this command's implemented functionality.
 

Method Detail

execute

Result execute(Environment env)
Called by a command processor to invoke this command's implemented functionality.

Parameters:
env - The environment within which the command is running.
Returns:
A result container or null if the command does not return a result.


Copyright © 2002-2003 Paul Speed. All Rights Reserved.