com.novell.ecb
Interface Command

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
SecretBean, SecretStoreBean

public interface Command
extends java.io.Serializable

A command encapsulates a business logic task. This Command interface provides the client interface for the most generic form of command, which is the contract between the command client and the command implementation.

Commands provide the following advantages over conventional client-server interaction:

A Command has the following states during its lifecycle: The only enforcement of these states is that the Command's implementation of the execute method calls the command's isReady method prior to executing the command. In this case, if isReady returns false then an NotReadyException is thrown. Any other enforcement of these states is up to the command writer.


Method Summary
 void execute()
          Performs the task encapsulated by this command.
 boolean isReady()
          Allows the command client and the command runtime to ask the command whether all required input properties have been set.
 void reset()
          Resets the output properties.
 

Method Detail

isReady

public boolean isReady()
Allows the command client and the command runtime to ask the command whether all required input properties have been set. It is called in the client JVM prior to execution being given to the CommandTarget for execution.

Returns:
true, if the command is in the initialized or executed state; false, otherwise.

execute

public void execute()
             throws CommandException
Performs the task encapsulated by this command. This moves the command from the initialized to the executed state. If the isReady method returns false, this throws a NotReadyException.

Throws:
CommandException - The superclass for all command exceptions.

reset

public void reset()
Resets the output properties. After the call, get methods return the default values they had prior to calling the execute method. It provides a convenient and efficient way to reuse the same command instance with changes in some input properties or in the CommandTarget.



Copyright © 2001-2003 Novell, Inc. All Rights Reserved.