Class FennelTupleIter

  extended by org.eigenbase.runtime.AbstractTupleIter
      extended by net.sf.farrago.runtime.FennelAbstractTupleIter
          extended by net.sf.farrago.runtime.FennelTupleIter
All Implemented Interfaces:
TupleIter, ClosableAllocation

public class FennelTupleIter
extends FennelAbstractTupleIter

FennelTupleIter implements the TupleIter interfaces by reading tuples from a Fennel ExecStream.

FennelTupleIter only deals with raw byte buffers; it delegates to a FennelTupleReader object the responsibility to unmarshal individual fields.

FennelTupleIter's implementation of populateBuffer() blocks.

$Id: //open/dev/farrago/src/net/sf/farrago/runtime/ $
John V. Sichi, Stephan Zuercher

Nested Class Summary
Nested classes/interfaces inherited from interface org.eigenbase.runtime.TupleIter
TupleIter.NoDataReason, TupleIter.TimeoutException
Field Summary
private  FennelStreamGraph streamGraph
private  FennelStreamHandle streamHandle
Fields inherited from class net.sf.farrago.runtime.FennelAbstractTupleIter
bufferAsArray, byteBuffer, tupleReader
Fields inherited from interface org.eigenbase.runtime.TupleIter
Constructor Summary
FennelTupleIter(FennelTupleReader tupleReader, FennelStreamGraph streamGraph, FennelStreamHandle streamHandle, int bufferSize)
          Creates a new FennelTupleIter object.
Method Summary
 void closeAllocation()
          Closes this object.
protected  int populateBuffer()
          Blocking implementation of populateBuffer().
 void restart()
          Restarts this iterator, so that a subsequent call to TupleIter.fetchNext() returns the first element in the collection being iterated.
Methods inherited from class net.sf.farrago.runtime.FennelAbstractTupleIter
fetchNext, getStatus, requestData, traceNext
Methods inherited from class org.eigenbase.runtime.AbstractTupleIter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


private final FennelStreamGraph streamGraph


private final FennelStreamHandle streamHandle
Constructor Detail


public FennelTupleIter(FennelTupleReader tupleReader,
                       FennelStreamGraph streamGraph,
                       FennelStreamHandle streamHandle,
                       int bufferSize)
Creates a new FennelTupleIter object.

tupleReader - FennelTupleReader to use to interpret Fennel data
streamGraph - underlying FennelStreamGraph
streamHandle - handle to underlying Fennel ExecStream that this TupleIter reads from
bufferSize - number of bytes in buffer used for fetching from Fennel
Method Detail


public void restart()
Description copied from interface: TupleIter
Restarts this iterator, so that a subsequent call to TupleIter.fetchNext() returns the first element in the collection being iterated.

Specified by:
restart in interface TupleIter
restart in class FennelAbstractTupleIter


public void closeAllocation()
Description copied from interface: ClosableAllocation
Closes this object.


protected int populateBuffer()
Blocking implementation of populateBuffer().

Specified by:
populateBuffer in class FennelAbstractTupleIter
number of bytes read into FennelAbstractTupleIter.byteBuffer or 0 for end of stream.