cascading.tap
Class SinkTap<Config,Output>

java.lang.Object
  extended by cascading.tap.Tap<Config,Void,Output>
      extended by cascading.tap.SinkTap<Config,Output>
All Implemented Interfaces:
FlowElement, Traceable, Serializable
Direct Known Subclasses:
BaseTemplateTap, MultiSinkTap

public abstract class SinkTap<Config,Output>
extends Tap<Config,Void,Output>

Class SinkTap is an optional base class for sink only Taps.

Some Tap instances may only be sinks (as opposed to being a source). These types may subclass SinkTap for convenience or set isSource() to false in a custom Tap sub-class.

See Also:
Serialized Form

Constructor Summary
protected SinkTap()
           
protected SinkTap(Scheme<Config,?,Output,?,?> scheme)
           
protected SinkTap(Scheme<Config,?,Output,?,?> scheme, SinkMode sinkMode)
           
 
Method Summary
 Fields getSourceFields()
          Method getSourceFields returns the sourceFields of this Tap object.
 boolean isSource()
          Method isSource returns true if this Tap instance can be used as a source.
 TupleEntryIterator openForRead(FlowProcess<Config> flowProcess, Void input)
          Method openForRead opens the resource represented by this Tap instance for reading.
 boolean prepareResourceForRead(Config conf)
          Method prepareResourceForRead allows the underlying resource to be notified when reading will begin.
 void sourceConfInit(FlowProcess<Config> flowProcess, Config conf)
          Method sourceConfInit initializes this instance as a source.
 
Methods inherited from class cascading.tap.Tap
commitResource, createResource, createResource, deleteResource, deleteResource, equals, flowConfInit, getConfigDef, getFullIdentifier, getFullIdentifier, getIdentifier, getModifiedTime, getModifiedTime, getScheme, getSinkFields, getSinkMode, getStepConfigDef, getTrace, hasConfigDef, hashCode, hasStepConfigDef, id, isEquivalentTo, isKeep, isReplace, isSink, isTemporary, isUpdate, openForRead, openForWrite, openForWrite, outgoingScopeFor, prepareResourceForWrite, presentSinkFields, presentSourceFields, resolveIncomingOperationArgumentFields, resolveIncomingOperationPassThroughFields, resourceExists, resourceExists, retrieveSinkFields, retrieveSourceFields, rollbackResource, setScheme, sinkConfInit, taps, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SinkTap

protected SinkTap()

SinkTap

protected SinkTap(Scheme<Config,?,Output,?,?> scheme)

SinkTap

protected SinkTap(Scheme<Config,?,Output,?,?> scheme,
                  SinkMode sinkMode)
Method Detail

getSourceFields

public Fields getSourceFields()
Description copied from class: Tap
Method getSourceFields returns the sourceFields of this Tap object.

Overrides:
getSourceFields in class Tap<Config,Void,Output>
Returns:
the sourceFields (type Fields) of this Tap object.

prepareResourceForRead

public boolean prepareResourceForRead(Config conf)
                               throws IOException
Description copied from class: Tap
Method prepareResourceForRead allows the underlying resource to be notified when reading will begin.

This method will be called client side so that any remote or external resources can be initialized.

If this method returns false, an exception will be thrown halting the current Flow.

In most cases, resource initialization should happen in the Tap.openForRead(FlowProcess, Object) method.

This allows for initialization of cluster side resources, like a JDBC driver used to read data from a database, that cannot be passed client to cluster.

Overrides:
prepareResourceForRead in class Tap<Config,Void,Output>
Parameters:
conf - of type Config
Returns:
returns true if successful
Throws:
IOException

isSource

public boolean isSource()
Description copied from class: Tap
Method isSource returns true if this Tap instance can be used as a source.

Overrides:
isSource in class Tap<Config,Void,Output>
Returns:
boolean

sourceConfInit

public void sourceConfInit(FlowProcess<Config> flowProcess,
                           Config conf)
Description copied from class: Tap
Method sourceConfInit initializes this instance as a source.

This method maybe called more than once if this Tap instance is used outside the scope of a Flow instance or if it participates in multiple times in a given Flow or across different Flows in a Cascade.

In the context of a Flow, it will be called after FlowListener.onStarting(cascading.flow.Flow)

Note that no resources or services should be modified by this method.

Overrides:
sourceConfInit in class Tap<Config,Void,Output>
Parameters:
flowProcess - of type FlowProcess
conf - of type Config

openForRead

public TupleEntryIterator openForRead(FlowProcess<Config> flowProcess,
                                      Void input)
                               throws IOException
Description copied from class: Tap
Method openForRead opens the resource represented by this Tap instance for reading.

input value may be null, if so, sub-classes must inquire with the underlying Scheme via Scheme.sourceConfInit(cascading.flow.FlowProcess, Tap, Object) to get the proper input type and instantiate it before calling super.openForRead().

Note the returned iterator will return the same instance of TupleEntry on every call, thus a copy must be made of either the TupleEntry or the underlying Tuple instance if they are to be stored in a Collection.

Specified by:
openForRead in class Tap<Config,Void,Output>
Parameters:
flowProcess - of type FlowProcess
input - of type Input
Returns:
TupleEntryIterator
Throws:
IOException - when the resource cannot be opened


Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.