org.openanzo.commands
Class CommandImpl

java.lang.Object
  extended by org.openanzo.commands.CommandImpl
All Implemented Interfaces:
Command

public abstract class CommandImpl
extends java.lang.Object
implements Command

CommandImpl handles the general bookkeeping of the Command interface, including maintaining the dataset, the parent command, and the list of child commands. It also implements execute() with the help of the abstract method executeThisCommand() which derived classes must implement. It also assembles all command types together for this command and descendant commands, based on derived classes' implementations of getCommandType()

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

Constructor Summary
CommandImpl()
           
 
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.String getCommandType()
          By default the command type is given by the Constants.COMMAND_PREFIX plus the class name.
 IDataset getDataset()
          Get the Dataset used by this command.
 java.lang.Object getInputProperty(java.lang.String name)
          Retrieve the value of the given input property
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openanzo.commands.Command
execute
 

Constructor Detail

CommandImpl

public CommandImpl()
Method Detail

setInputProperty

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

Specified by:
setInputProperty in interface Command
Parameters:
name - Name of input property
value - Value of input property

getInputProperty

public java.lang.Object getInputProperty(java.lang.String name)
Retrieve the value of the given input property

Parameters:
name - Name of value to retreive
Returns:
Value for given name, or null if not stored

setDataset

public void setDataset(IDataset dataset)
Description copied from interface: Command
Set the Dataset used by this command, for example to create new resources.

Specified by:
setDataset in interface Command
Parameters:
dataset - the dataset where statements are added or removed

getDataset

public IDataset getDataset()
Description copied from interface: Command
Get the Dataset used by this command.

Specified by:
getDataset in interface Command
Returns:
the Dataset used by this command

getCommandType

public java.lang.String getCommandType()
By default the command type is given by the Constants.COMMAND_PREFIX plus the class name.

Specified by:
getCommandType in interface Command
Returns:
Constants.COMMAND_PREFIX#classname

addPrecondition

public void addPrecondition(IPrecondition precondition)
Description copied from interface: Command
Add a precondition to this command that will get evaluated on the server to decide if the command can get commited.

Specified by:
addPrecondition in interface Command
Parameters:
precondition - Precondition that is evaluated on the server

getPreconditions

public java.util.Set<IPrecondition> getPreconditions()
Description copied from interface: Command
Return the set of preconditions for this command.

Specified by:
getPreconditions in interface Command
Returns:
Set of preconditions

setPreconditions

public void setPreconditions(java.util.Set<IPrecondition> preconditions)
Description copied from interface: Command
Set this commands preconditions to the given set.

Specified by:
setPreconditions in interface Command
Parameters:
preconditions - Set of preconditions that are evaluated on the server


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