org.openanzo.commands
Interface Command

All Known Implementing Classes:
CommandChain, CommandImpl

public interface Command

An Command is basic unit of work that can be execute within a transaction. Command's can be nested arbitrarily deep in a tree structure. When executed, it is the responsibility of each command to, in turn, execute its children (if any).

Author:
Matthew Roy ( mroy@cambridgesemantics.com ), Lee Feigenbaum ( feigenbl@us.ibm.com)

Method Summary
 void addPrecondition(IPrecondition precondition)
          Add a precondition to this command that will get evaluated on the server to decide if the command can get commited.
 java.lang.Object execute()
          Method that is executed by local transaction manager when this command is processed.
 java.lang.String getCommandType()
          Returns a string representing the command type encompassed by this command.
 IDataset getDataset()
          Get the Dataset used by this command.
 java.util.Set<IPrecondition> getPreconditions()
          Return the set of preconditions for this command.
 void setDataset(IDataset dataset)
          Set the Dataset used by this command, for example to create new resources.
 void setInputProperty(java.lang.String name, java.lang.Object value)
          An input property is a name/value pair that can be used by the command during its execution.
 void setPreconditions(java.util.Set<IPrecondition> preconditions)
          Set this commands preconditions to the given set.
 

Method Detail

getCommandType

java.lang.String getCommandType()
Returns a string representing the command type encompassed by this command.

Returns:
CommandType for this Command

setDataset

void setDataset(IDataset dataset)
Set the Dataset used by this command, for example to create new resources.

Parameters:
dataset - the dataset where statements are added or removed

getDataset

IDataset getDataset()
Get the Dataset used by this command.

Returns:
the Dataset used by this command

setInputProperty

void setInputProperty(java.lang.String name,
                      java.lang.Object value)
An input property is a name/value pair that can be used by the command during its execution.

Parameters:
name - Name of input property
value - Value of input property

addPrecondition

void addPrecondition(IPrecondition precondition)
Add a precondition to this command that will get evaluated on the server to decide if the command can get commited.

Parameters:
precondition - Precondition that is evaluated on the server

setPreconditions

void setPreconditions(java.util.Set<IPrecondition> preconditions)
Set this commands preconditions to the given set.

Parameters:
preconditions - Set of preconditions that are evaluated on the server

getPreconditions

java.util.Set<IPrecondition> getPreconditions()
Return the set of preconditions for this command.

Returns:
Set of preconditions

execute

java.lang.Object execute()
Method that is executed by local transaction manager when this command is processed. Commands can return whatever object they choose, including null.

Returns:
results of running command


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.