cascading.tuple
Class TupleEntrySchemeCollector<Config,Output>

java.lang.Object
  extended by cascading.tuple.TupleEntryCollector
      extended by cascading.tuple.TupleEntrySchemeCollector<Config,Output>

public class TupleEntrySchemeCollector<Config,Output>
extends TupleEntryCollector

Class TupleEntrySchemeCollector is a helper class for wrapping a Scheme instance, calling Scheme.sink(cascading.flow.FlowProcess, cascading.scheme.SinkCall) on every call to add(TupleEntry) or add(Tuple).

Use this class inside a custom Tap when overriding the Tap.openForWrite(cascading.flow.FlowProcess) method.


Field Summary
protected  ConcreteCall<Object,Output> sinkCall
           
 
Fields inherited from class cascading.tuple.TupleEntryCollector
tupleEntry
 
Constructor Summary
TupleEntrySchemeCollector(FlowProcess<Config> flowProcess, Scheme scheme)
           
TupleEntrySchemeCollector(FlowProcess<Config> flowProcess, Scheme scheme, Output output)
           
TupleEntrySchemeCollector(FlowProcess<Config> flowProcess, Scheme scheme, Output output, String identifier)
           
TupleEntrySchemeCollector(FlowProcess<Config> flowProcess, Scheme scheme, String identifier)
           
TupleEntrySchemeCollector(FlowProcess<Config> flowProcess, Tap tap, Output output)
           
 
Method Summary
 void add(Tuple tuple)
          Method add inserts the given Tuple into the outgoing stream.
 void add(TupleEntry tupleEntry)
          Method add inserts the given TupleEntry into the outgoing stream.
 void close()
          Method close closes the underlying resource being written to.
protected  void collect(TupleEntry tupleEntry)
           
protected  FlowProcess<Config> getFlowProcess()
           
protected  Output getOutput()
           
protected  void prepare()
          Need to defer preparing the scheme till after the fields have been resolved
 void setFields(Fields declared)
           
protected  void setOutput(Output output)
           
protected  Output wrapOutput(Output output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sinkCall

protected final ConcreteCall<Object,Output> sinkCall
Constructor Detail

TupleEntrySchemeCollector

public TupleEntrySchemeCollector(FlowProcess<Config> flowProcess,
                                 Scheme scheme)

TupleEntrySchemeCollector

public TupleEntrySchemeCollector(FlowProcess<Config> flowProcess,
                                 Scheme scheme,
                                 String identifier)

TupleEntrySchemeCollector

public TupleEntrySchemeCollector(FlowProcess<Config> flowProcess,
                                 Scheme scheme,
                                 Output output)

TupleEntrySchemeCollector

public TupleEntrySchemeCollector(FlowProcess<Config> flowProcess,
                                 Tap tap,
                                 Output output)

TupleEntrySchemeCollector

public TupleEntrySchemeCollector(FlowProcess<Config> flowProcess,
                                 Scheme scheme,
                                 Output output,
                                 String identifier)
Method Detail

getFlowProcess

protected FlowProcess<Config> getFlowProcess()

setFields

public void setFields(Fields declared)
Overrides:
setFields in class TupleEntryCollector

getOutput

protected Output getOutput()

setOutput

protected void setOutput(Output output)

wrapOutput

protected Output wrapOutput(Output output)

prepare

protected void prepare()
Need to defer preparing the scheme till after the fields have been resolved


add

public void add(TupleEntry tupleEntry)
Description copied from class: TupleEntryCollector
Method add inserts the given TupleEntry into the outgoing stream. Note the method TupleEntryCollector.add(Tuple) is more efficient as it simply calls TupleEntry.getTuple();

See TupleEntryCollector on when and how to re-use a Tuple instance.

Overrides:
add in class TupleEntryCollector
Parameters:
tupleEntry - of type TupleEntry

add

public void add(Tuple tuple)
Description copied from class: TupleEntryCollector
Method add inserts the given Tuple into the outgoing stream.

See TupleEntryCollector on when and how to re-use a Tuple instance.

Overrides:
add in class TupleEntryCollector
Parameters:
tuple - of type Tuple

collect

protected void collect(TupleEntry tupleEntry)
                throws IOException
Specified by:
collect in class TupleEntryCollector
Throws:
IOException

close

public void close()
Description copied from class: TupleEntryCollector
Method close closes the underlying resource being written to.

This method should be called when when an instance is returned via Tap.openForWrite(cascading.flow.FlowProcess) and no more Tuple instances will be written out.

This method must not be called when an instance is returned from getOutputCollector() from any of the relevant OperationCall implementations (inside a Function, Aggregator, or Buffer).

Overrides:
close in class TupleEntryCollector


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