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

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  org.xmldb.api.base.Collection mCollection
          The collection that will be returned.
private  ActivityContext mContext
          Context from which the inputs will be retrieved.
private  BlockWriter mOutput
          Output that will be returned.
 
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
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mCollection

private final org.xmldb.api.base.Collection mCollection
The collection that will be returned.


mContext

private final ActivityContext mContext
Context from which the inputs will be retrieved.


mOutput

private final BlockWriter mOutput
Output that will be returned.

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()
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 command's responsibility to close this.

getInput

public BlockReader getInput(java.lang.String inputName)
                     throws XMLDBStreamNotFoundException
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:
XMLDBStreamNotFoundException - If there is no such input stream.

getOutput

public BlockWriter getOutput()
                      throws XMLDBStreamNotFoundException
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:
XMLDBStreamNotFoundException - If there is no output stream.