uk.org.ogsadai.activity.xmldb.commands
Class CommandContextImpl

java.lang.Object
  |
  +--uk.org.ogsadai.activity.xmldb.commands.CommandContextImpl
All Implemented Interfaces:
CommandContext

public class CommandContextImpl
extends java.lang.Object
implements CommandContext

A simple CommandContext for use from the CommandActivity.

Author:
The OGSA-DAI Project Team

Constructor Summary
CommandContextImpl(org.xmldb.api.base.Collection collection, ActivityContext context, BlockWriter output)
          Constructs an instance using the specified parameters.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandContextImpl

public CommandContextImpl(org.xmldb.api.base.Collection collection,
                          ActivityContext context,
                          BlockWriter output)
Constructs an instance using the specified parameters.

Parameters:
collection - The Collection that will be accessible from this instance.
context - The activity Context from which the inputs that are accessible from this instance will be retrieved.
output - The BlockWriter that will be accessible from this instance.
Method Detail

getCollection

public org.xmldb.api.base.Collection getCollection()
                                            throws CommonSystemException,
                                                   CommonUserException
Description copied from interface: CommandContext
Gets the open Collection that the command will be interact with.

Specified by:
getCollection in interface CommandContext
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
Description copied from interface: CommandContext
Get the named input for the Command to interact with.

Specified by:
getInput in interface CommandContext
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
Description copied from interface: CommandContext
Gets the output for the command to write any results to.

Specified by:
getOutput in interface CommandContext
Returns:
A BlockWriter to which the output can be written.
Throws:
CommonSystemException - If there is a system problem.