net.sf.farrago.runtime
Class FennelTupleIter

java.lang.Object
  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.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/runtime/FennelTupleIter.java#7 $
Author:
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
EMPTY_ITERATOR
 
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
setTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

streamGraph

private final FennelStreamGraph streamGraph

streamHandle

private final FennelStreamHandle streamHandle
Constructor Detail

FennelTupleIter

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

Parameters:
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

restart

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
Overrides:
restart in class FennelAbstractTupleIter

closeAllocation

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


populateBuffer

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

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