org.specrunner.core.pipes
Class PipeSource

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

public class PipeSource
extends Object
implements IPipe

Creates the source and add to the channel.

Author:
Thiago Santos

Field Summary
static String SOURCE
          Source.
 
Constructor Summary
PipeSource()
           
 
Method Summary
protected  void addResources(ISource source)
          Add resources to a source.
static void bind(IChannel channel, ISource source)
          Bind a source to the channel.
 boolean check(IChannel channel)
          Check if a pipe must perform something on channel.
protected  ISource createSource(String input)
          Creates a source from input.
static ISource lookup(IChannel channel)
          Recover the source 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

SOURCE

public static final String SOURCE
Source.

See Also:
Constant Field Values
Constructor Detail

PipeSource

public PipeSource()
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.

createSource

protected ISource createSource(String input)
                        throws SourceException
Creates a source from input.

Parameters:
input - The input name.
Returns:
The source instance.
Throws:
SourceException - On source creation errors.

addResources

protected void addResources(ISource source)
                     throws ResourceException
Add resources to a source.

Parameters:
source - The source.
Throws:
ResourceException - On resource errors.

bind

public static void bind(IChannel channel,
                        ISource source)
Bind a source to the channel.

Parameters:
channel - The channel.
source - The source.

lookup

public static ISource lookup(IChannel channel)
                      throws NotFoundException,
                             InvalidTypeException
Recover the source from channel.

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


Copyright © 2014. All rights reserved.