xsmeral.pipe.context
Class PipeContext

java.lang.Object
  extended by xsmeral.pipe.context.PipeContext
All Implemented Interfaces:
FSContext, ProcessingContext

public class PipeContext
extends Object
implements ProcessingContext, FSContext

A processing context with additional possibility of accessing the underlying Pipe and the file system.


Constructor Summary
PipeContext(Pipe pipe)
          Creates empty parameter map and associates with a Pipe
 
Method Summary
 File getFile(String path)
          Returns a file with the specified path.
 Set<String> getParameterNames()
          Returns set of all parameter names currently present in the map (also those mapped to null).
 Object getParameterValue(String name)
          Returns the parameter value for supplied name.
 Pipe getPipe()
          Returns the underlying Pipe
 String getWorkingDir()
          Returns the working directory
 void removeParameter(String name)
          Removes the parameter for the supplied name.
 Object setParameter(String name, Object value)
          Sets the context parameter, overwriting any previous value (with a warning).
 void setParameterValue(String name, Object value)
          Sets parameter value without warning
 void setWorkingDir(String path)
          Sets the working directory to the given path (relative or absolute)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PipeContext

public PipeContext(Pipe pipe)
Creates empty parameter map and associates with a Pipe

Parameters:
pipe - The underlying Pipe
Method Detail

getParameterNames

public Set<String> getParameterNames()
Description copied from interface: ProcessingContext
Returns set of all parameter names currently present in the map (also those mapped to null).

Specified by:
getParameterNames in interface ProcessingContext

getParameterValue

public Object getParameterValue(String name)
Returns the parameter value for supplied name.

Specified by:
getParameterValue in interface ProcessingContext
Throws:
IllegalArgumentException - If name is null

setParameterValue

public void setParameterValue(String name,
                              Object value)
Sets parameter value without warning

Specified by:
setParameterValue in interface ProcessingContext
Parameters:
name - Parameter name
value - Parameter value
Throws:
IllegalArgumentException - If name is null

setParameter

public Object setParameter(String name,
                           Object value)
Sets the context parameter, overwriting any previous value (with a warning).

Specified by:
setParameter in interface ProcessingContext
Parameters:
name - Parameter name
value - Parameter value
Returns:
The previous value associated with this name, or null if none existed
Throws:
IllegalArgumentException - If name is null

removeParameter

public void removeParameter(String name)
Description copied from interface: ProcessingContext
Removes the parameter for the supplied name. Does nothing if parameter for the name does not exist.

Specified by:
removeParameter in interface ProcessingContext

getPipe

public Pipe getPipe()
Returns the underlying Pipe


setWorkingDir

public void setWorkingDir(String path)
Description copied from interface: FSContext
Sets the working directory to the given path (relative or absolute)

Specified by:
setWorkingDir in interface FSContext

getWorkingDir

public String getWorkingDir()
Description copied from interface: FSContext
Returns the working directory

Specified by:
getWorkingDir in interface FSContext

getFile

public File getFile(String path)
Description copied from interface: FSContext
Returns a file with the specified path. If the path is relative, it is resolved against the working directory.

Specified by:
getFile in interface FSContext