Package org.teiid.common.buffer
Class AbstractTupleSource
- java.lang.Object
-
- org.teiid.common.buffer.AbstractTupleSource
-
- All Implemented Interfaces:
IndexedTupleSource
,TupleSource
- Direct Known Subclasses:
BatchIterator
,TupleBuffer.TupleBufferTupleSource
public abstract class AbstractTupleSource extends Object implements IndexedTupleSource
-
-
Field Summary
Fields Modifier and Type Field Description protected TupleBatch
batch
protected List<?>
currentTuple
-
Constructor Summary
Constructors Constructor Description AbstractTupleSource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract long
available()
void
closeSource()
Closes the Tuple Source.protected abstract List<?>
finalRow()
protected abstract TupleBatch
getBatch(long row)
long
getCurrentIndex()
Get the current position.protected List<?>
getCurrentTuple()
boolean
hasNext()
void
mark()
Save the current position that can be restored with a call toIndexedTupleSource.reset()
List<?>
nextTuple()
Returns the next tuplevoid
reset()
Restore the previous mark and set the mark back to the first position.void
setPosition(long position)
Set the tuple source position
-
-
-
Field Detail
-
currentTuple
protected List<?> currentTuple
-
batch
protected TupleBatch batch
-
-
Method Detail
-
getCurrentIndex
public long getCurrentIndex()
Description copied from interface:IndexedTupleSource
Get the current position. The position is 1 based and reports the position of the tuple that will be retrieved with a call toTupleSource.nextTuple()
- Specified by:
getCurrentIndex
in interfaceIndexedTupleSource
- Returns:
-
nextTuple
public List<?> nextTuple() throws TeiidComponentException, TeiidProcessingException
Description copied from interface:TupleSource
Returns the next tuple- Specified by:
nextTuple
in interfaceTupleSource
- Returns:
- the next tuple (a List object), or
null
if there are no more tuples. - Throws:
TeiidComponentException
- indicating a non-business exception such as a communication exception, or other such nondeterministic exceptionTeiidProcessingException
-
getCurrentTuple
protected List<?> getCurrentTuple() throws TeiidComponentException, BlockedException, TeiidProcessingException
-
finalRow
protected abstract List<?> finalRow() throws BlockedException, TeiidComponentException, TeiidProcessingException
-
getBatch
protected abstract TupleBatch getBatch(long row) throws TeiidComponentException, TeiidProcessingException
-
available
protected abstract long available()
-
closeSource
public void closeSource()
Description copied from interface:TupleSource
Closes the Tuple Source.- Specified by:
closeSource
in interfaceTupleSource
-
hasNext
public boolean hasNext() throws TeiidComponentException, TeiidProcessingException
- Specified by:
hasNext
in interfaceIndexedTupleSource
- Returns:
- true if there are more tuples
- Throws:
TeiidComponentException
TeiidProcessingException
-
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 interfaceIndexedTupleSource
-
mark
public void mark() throws TeiidComponentException
Description copied from interface:IndexedTupleSource
Save the current position that can be restored with a call toIndexedTupleSource.reset()
- Specified by:
mark
in interfaceIndexedTupleSource
- Throws:
TeiidComponentException
-
setPosition
public void setPosition(long position)
Description copied from interface:IndexedTupleSource
Set the tuple source position- Specified by:
setPosition
in interfaceIndexedTupleSource
-
-