Purpose: Stream class which is used to deal with large collections returned from TOPLink queries more efficiently.
Responsibilities: Wraps a database result set cursor to provide a stream on the resulting selected objects.
| Modifier and Type | Field and Description |
|---|---|
| protected int | marker
Marker for backing up. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CursoredStream(DatabaseCall call, CursoredStreamPolicy policy)
INTERNAL: Initialize the state of the stream |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public int | |
| public Expression | buildCountDistinctExpression(List<E> includeFields, ExpressionBuilder builder)
INTERNAL: Must build the count on the primary key fields, not * as * is not allowed if there was a distinct. |
| public void | clear()
Overrides org. |
| protected List | copy(int startIndex, int endIndex)
INTERNAL: Answer a list of the elements of the receiver's collection from startIndex to endIndex. |
| protected int | getCursorSize()
Implements abstract org. |
| protected int | |
| protected int | |
| public int | getPageSize()
Overrides org. |
| public int | getPosition()
Implements abstract org. |
| public boolean | hasMoreElements()
Implements java. |
| public boolean | hasNext()
Implements java. |
| public void | mark(int
Limit on the number of characters that may be
read while still preserving the mark. Because
the stream's input comes from the database, there
is no actual limit, so this argument is ignored. readAheadLimit)PUBLIC: Mark the present position in the stream. |
| public boolean | |
| public Object | Returns: the next object in streamImplements java. |
| public List | Returns: the next objects in streamPUBLIC: Return a Vector of at most numberOfElements of the next objects from the collection. |
| public Object | Returns: the next object in streamImplements java. |
| public Vector | Returns: the next objects in streamPUBLIC: Return a Vector of at most numberOfElements of the next objects from the collection. |
| public Object | |
| public Object | Returns: - next object in streamPUBLIC: This method differs slightly from conventional read() operation on a Java stream. |
| public List | Returns: - vector containing next number of objects- number of objects to be returned number)PUBLIC: This method differs slightly from conventional read() operation on a Java stream. |
| public void | |
| public void | reset()
PUBLIC: Repositions this stream to the position at the time the mark method was last called on this stream. |
| protected Object | retrieveNextObject()
Implements abstract org. |
| protected Object | |
| protected void | |
| protected void |
| marker | back to summary |
|---|---|
| protected int marker Marker for backing up. | |
| CursoredStream | back to summary |
|---|---|
| public CursoredStream() INTERNAL: Initialize the state of the stream | |
| CursoredStream | back to summary |
|---|---|
| public CursoredStream(DatabaseCall call, CursoredStreamPolicy policy) INTERNAL: Initialize the state of the stream | |
| atEnd | back to summary |
|---|---|
| public boolean atEnd() throws DatabaseException PUBLIC: Return whether the cursored stream is at its end. | |
| available | back to summary |
|---|---|
| public int available() throws DatabaseException PUBLIC: Returns the number of objects that can be read from this input without blocking. | |
| buildCountDistinctExpression | back to summary |
|---|---|
| public Expression buildCountDistinctExpression(List<E> includeFields, ExpressionBuilder builder) INTERNAL: Must build the count on the primary key fields, not * as * is not allowed if there was a distinct. This require a manually defined operator. added for CR 2900 | |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. PUBLIC: Release all objects read in so far. This should be performed when reading in a large collection of objects in order to preserve memory.
| |
| copy | back to summary |
|---|---|
| protected List INTERNAL: Answer a list of the elements of the receiver's collection from startIndex to endIndex. | |
| getCursorSize | back to summary |
|---|---|
| protected int getCursorSize() throws DatabaseException, QueryException Implements abstract org. INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.
| |
| getInitialReadSize | back to summary |
|---|---|
| protected int getInitialReadSize() INTERNAL: Return the threshold for the stream. | |
| getMarker | back to summary |
|---|---|
| protected int getMarker() INTERNAL: Return the marker used for mark() & reset() operations. | |
| getPageSize | back to summary |
|---|---|
| public int getPageSize() Overrides org. INTERNAL: Return the page size for the stream.
| |
| getPosition | back to summary |
|---|---|
| public int getPosition() Implements abstract org. INTERNAL: Return the position of the stream inside the object collection
| |
| hasMoreElements | back to summary |
|---|---|
| public boolean hasMoreElements() Implements java. PUBLIC: Return whether the cursored stream has any more elements.
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. PUBLIC: Return whether the cursored stream has any more elements.
| |
| mark | back to summary |
|---|---|
| public void mark(int readAheadLimit) PUBLIC: Mark the present position in the stream. Subsequent calls to reset() will attempt to reposition the stream to this point.
| |
| markSupported | back to summary |
|---|---|
| public boolean markSupported() PUBLIC:
Tests if this input stream supports the | |
| next | back to summary |
|---|---|
| public Object next() Implements java. PUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor. | |
| next | back to summary |
|---|---|
| public List PUBLIC: Return a Vector of at most numberOfElements of the next objects from the collection. If there aren't that many objects left to read, just return what is available. | |
| nextElement | back to summary |
|---|---|
| public Object nextElement() Implements java. PUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor. | |
| nextElements | back to summary |
|---|---|
| public Vector PUBLIC: Return a Vector of at most numberOfElements of the next objects from the collection. If there aren't that many objects left to read, just return what is available.
| |
| peek | back to summary |
|---|---|
| public Object peek() throws DatabaseException PUBLIC: Return the next object in the stream, without incrementing the stream's position. | |
| read | back to summary |
|---|---|
| public Object read() throws DatabaseException, QueryException PUBLIC: This method differs slightly from conventional read() operation on a Java stream. This method return the next object in the collection rather than specifying the number of bytes to be read in. Return the next object from the collection, if beyond the read limit read from the cursor
| |
| read | back to summary |
|---|---|
| public List PUBLIC: This method differs slightly from conventional read() operation on a Java stream. This method returns the next number of objects in the collection in a vector. Return the next object from the collection, if beyond the read limit read from the cursor
| |
| releasePrevious | back to summary |
|---|---|
| public void releasePrevious() PUBLIC: Release all objects read in so far. This should be performed when reading in a large collection of objects in order to preserve memory. | |
| reset | back to summary |
|---|---|
| public void reset() PUBLIC: Repositions this stream to the position at the time the mark method was last called on this stream. | |
| retrieveNextObject | back to summary |
|---|---|
| protected Object retrieveNextObject() throws DatabaseException Implements abstract org. Doc from org. INTERNAL: Read the next row from the result set.
| |
| retrieveNextPage | back to summary |
|---|---|
| protected Object retrieveNextPage() throws DatabaseException INTERNAL: Retrieve and add the next page size of rows to the vector. Return the last object, or null if at end. | |
| setLimits | back to summary |
|---|---|
| protected void setLimits() INTERNAL: Initialize the stream size and position | |
| setMarker | back to summary |
|---|---|
| protected void setMarker(int value) INTERNAL: Set the marker used for mark() & reset() operations | |