net.sf.farrago.runtime
Class FennelTransformTupleIter

java.lang.Object
  extended by org.eigenbase.runtime.AbstractTupleIter
      extended by net.sf.farrago.runtime.FennelAbstractTupleIter
          extended by net.sf.farrago.runtime.FennelTransformTupleIter
All Implemented Interfaces:
TupleIter, ClosableAllocation

public class FennelTransformTupleIter
extends FennelAbstractTupleIter

FennelTransformTupleIter implements the TupleIter interfaces by reading tuples from a Fennel JavaTransformExecStream.

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

FennelTransformTupleIter's implementation of populateBuffer() does not block.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/runtime/FennelTransformTupleIter.java#7 $
Author:
Stephan Zuercher

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eigenbase.runtime.TupleIter
TupleIter.NoDataReason, TupleIter.TimeoutException
 
Field Summary
private  int execStreamInputOrdinal
           
private  FennelStreamHandle inputStreamHandle
           
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
FennelTransformTupleIter(FennelTupleReader tupleReader, FennelStreamGraph streamGraph, FennelStreamHandle streamHandle, FennelStreamHandle inputStreamHandle, int inputOrdinal, int bufferSize)
          Creates a new FennelTransformTupleIter object.
 
Method Summary
 void closeAllocation()
          Closes this object.
protected  int populateBuffer()
          Non-blocking implementation of FennelTupleIter.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

execStreamInputOrdinal

private final int execStreamInputOrdinal

streamGraph

private final FennelStreamGraph streamGraph

streamHandle

private final FennelStreamHandle streamHandle

inputStreamHandle

private final FennelStreamHandle inputStreamHandle
Constructor Detail

FennelTransformTupleIter

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

Parameters:
tupleReader - FennelTupleReader to use to interpret Fennel data
streamGraph - underlying FennelStreamGraph
streamHandle - handle to underlying Fennel JavaTransformExecStream
inputStreamHandle - handle to the Fennel ExecStream that this TupleIter reads from -- used only for reset
inputOrdinal - the input stream's ordinal in the underlying JavaTransformExecStream
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()
Non-blocking implementation of FennelTupleIter.populateBuffer().

Specified by:
populateBuffer in class FennelAbstractTupleIter
Returns:
number of bytes read into FennelAbstractTupleIter.byteBuffer, 0 for end of stream, less than 0 for no data available