uk.org.ogsadai.activity.xmldb.commands
Interface CommandContext

All Known Implementing Classes:
CommandContextImpl

public interface CommandContext

A CommandContext allows a command to access the objects that it can interact with. For example, an command to add a new resource might get a collection, using the getCollection method, then get the new resource from an input, using the getInput method, before writing some results to the output, retrieved with the getOutput method.

Author:
The OGSA-DAI Project

Method Summary
 org.xmldb.api.base.Collection getCollection()
          Gets the open Collection that the command will be interact with.
 BlockReader getInput(java.lang.String inputName)
          Get the named input for the Command to interact with.
 BlockWriter getOutput()
          Gets the output for the command to write any results to.
 

Method Detail

getCollection

public org.xmldb.api.base.Collection getCollection()
                                            throws CommonSystemException,
                                                   CommonUserException
Gets the open Collection that the command will be interact with.

Returns:
An open Collection object. It is not the commands responsibility to close the Collection.
Throws:
CommonUserException - If there is a user problem.
CommonSystemException - If there is a system problem.

getInput

public BlockReader getInput(java.lang.String inputName)
                     throws CommonSystemException,
                            CommonUserException
Get the named input for the Command to interact with.

Parameters:
inputName - The name of the input.
Returns:
A BlockReader from which the input can be read.
Throws:
CommonSystemException - If there is a system problem.
CommonUserException - If there is a user problem.

getOutput

public BlockWriter getOutput()
                      throws CommonSystemException,
                             CommonUserException
Gets the output for the command to write any results to.

Returns:
A BlockWriter to which the output can be written.
Throws:
CommonSystemException - If there is a system problem.
CommonUserException - If there is a user problem.