org.teiid.query.processor
Class BatchIterator

java.lang.Object
  extended by org.teiid.common.buffer.AbstractTupleSource
      extended by org.teiid.query.processor.BatchIterator
All Implemented Interfaces:
IndexedTupleSource, TupleSource

public class BatchIterator
extends AbstractTupleSource

A BatchIterator provides an iterator interface to a BatchCollector.BatchProducer. By setting #setBuffer(TupleBuffer), the iterator can copy on read into a TupleBuffer for repeated reading. Note that the saveOnMark buffering only lasts until the next mark is set.


Field Summary
 
Fields inherited from class org.teiid.common.buffer.AbstractTupleSource
batch
 
Constructor Summary
BatchIterator(BatchCollector.BatchProducer source)
           
 
Method Summary
 int available()
           
 void closeSource()
          Closes the Tuple Source.
protected  java.util.List<?> finalRow()
           
protected  TupleBatch getBatch(int row)
           
protected  java.util.List<?> getCurrentTuple()
           
 void mark()
          Save the current position that can be restored with a call to IndexedTupleSource.reset()
 void reset()
          Restore the previous mark and set the mark back to the first position.
 void setBuffer(TupleBuffer buffer, boolean saveOnMark)
           
 void setPosition(int position)
          Set the tuple source position
 
Methods inherited from class org.teiid.common.buffer.AbstractTupleSource
getCurrentIndex, hasNext, nextTuple
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchIterator

public BatchIterator(BatchCollector.BatchProducer source)
Method Detail

getBatch

protected TupleBatch getBatch(int row)
                       throws TeiidComponentException,
                              TeiidProcessingException
Specified by:
getBatch in class AbstractTupleSource
Throws:
TeiidComponentException
TeiidProcessingException

finalRow

protected java.util.List<?> finalRow()
                              throws TeiidComponentException,
                                     TeiidProcessingException
Specified by:
finalRow in class AbstractTupleSource
Throws:
TeiidComponentException
TeiidProcessingException

getCurrentTuple

protected java.util.List<?> getCurrentTuple()
                                     throws TeiidComponentException,
                                            BlockedException,
                                            TeiidProcessingException
Overrides:
getCurrentTuple in class AbstractTupleSource
Throws:
TeiidComponentException
BlockedException
TeiidProcessingException

available

public int available()
Specified by:
available in class AbstractTupleSource

setBuffer

public void setBuffer(TupleBuffer buffer,
                      boolean saveOnMark)

closeSource

public void closeSource()
Description copied from interface: TupleSource
Closes the Tuple Source.

Specified by:
closeSource in interface TupleSource
Overrides:
closeSource in class AbstractTupleSource

reset

public void reset()
Description copied from interface: IndexedTupleSource
Restore the previous mark and set the mark back to the first position.

Specified by:
reset in interface IndexedTupleSource
Overrides:
reset in class AbstractTupleSource

mark

public void mark()
Description copied from interface: IndexedTupleSource
Save the current position that can be restored with a call to IndexedTupleSource.reset()

Specified by:
mark in interface IndexedTupleSource
Overrides:
mark in class AbstractTupleSource

setPosition

public void setPosition(int position)
Description copied from interface: IndexedTupleSource
Set the tuple source position

Specified by:
setPosition in interface IndexedTupleSource
Overrides:
setPosition in class AbstractTupleSource


Copyright © 2010. All Rights Reserved.