org.specrunner.core.pipes
Class PipeContext

java.lang.Object
  extended by org.specrunner.core.pipes.PipeContext
All Implemented Interfaces:
IPipe

public class PipeContext
extends Object
implements IPipe

Create and bind a context to the channel.

Author:
Thiago Santos

Field Summary
static String CONTEXT
          Source.
 
Constructor Summary
PipeContext()
           
 
Method Summary
static IChannel bind(IChannel channel, IContext obj)
          Bind the object to the channel.
 boolean check(IChannel channel)
          Check if a pipe must perform something on channel.
protected  IContext createContext(ISource source, IRunner runner)
          Creates a context based on a source and runner.
static IContext lookup(IChannel channel)
          Recover a context from channel.
 IChannel process(IChannel channel)
          Perform some transformation over the channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT

public static final String CONTEXT
Source.

See Also:
Constant Field Values
Constructor Detail

PipeContext

public PipeContext()
Method Detail

check

public boolean check(IChannel channel)
              throws AbortException
Description copied from interface: IPipe
Check if a pipe must perform something on channel. If the channel is corrupted the pipe must throw AbortException.

Specified by:
check in interface IPipe
Parameters:
channel - The information channel.
Returns:
true, if pipe must perform something on channel, false, otherwise.
Throws:
AbortException - If the channel is corrupted.

process

public IChannel process(IChannel channel)
                 throws PipelineException
Description copied from interface: IPipe
Perform some transformation over the channel.

Specified by:
process in interface IPipe
Parameters:
channel - The channel.
Returns:
The pipe itself.
Throws:
PipelineException - On processing errors.

createContext

protected IContext createContext(ISource source,
                                 IRunner runner)
                          throws ContextException
Creates a context based on a source and runner.

Parameters:
source - The input.
runner - The runner.
Returns:
Context errors.
Throws:
ContextException - On context creation.

bind

public static IChannel bind(IChannel channel,
                            IContext obj)
Bind the object to the channel.

Parameters:
channel - The channel.
obj - The object.
Returns:
The channel itself.

lookup

public static IContext lookup(IChannel channel)
                       throws NotFoundException,
                              InvalidTypeException
Recover a context from channel.

Parameters:
channel - The channel.
Returns:
The context.
Throws:
NotFoundException - On lookup errors.
InvalidTypeException - On type errors.


Copyright © 2014. All rights reserved.