Class RemoteScrollableCursor
- java.lang.Object
-
- org.eclipse.persistence.queries.Cursor
-
- org.eclipse.persistence.queries.ScrollableCursor
-
- org.eclipse.persistence.internal.sessions.remote.RemoteScrollableCursor
-
- All Implemented Interfaces:
Serializable
,Enumeration
,Iterator
,ListIterator
public class RemoteScrollableCursor extends ScrollableCursor
Purpose: The object is used as a wrapper to the ScrollableCursor object in the remote transaction (via RMI, CORBA, etc.)
Responsibilities: Wraps a database result set cursor to provide a stream to the remote client side on the resulting selected objects.
Note: Most of the APIs only work with JDBC 2.0
- Since:
- TOPLink/Java 3.0
- Author:
- King (Yaoping) Wang
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ObjID
id
This is a unique id for remote cursored streamprotected boolean
isClosed
Return if the stream is closed-
Fields inherited from class org.eclipse.persistence.queries.ScrollableCursor
atEndOfCursor, nextObject, previousObject, previousRow
-
Fields inherited from class org.eclipse.persistence.queries.Cursor
executionSession, fields, initiallyConformingIndex, nextRow, objectCollection, policy, position, query, resultSet, selectionCriteriaClone, session, size, statement, translationRow
-
-
Constructor Summary
Constructors Constructor Description RemoteScrollableCursor(ScrollableCursor serverScrollableCursor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
absolute(int rows)
Moves the cursor to the given row number in the result setvoid
afterLast()
Moves the cursor to the end of the result set, just after the last row.void
beforeFirst()
Moves the cursor to the front of the result set, just before the first rowvoid
close()
Close the wrapped cursored stream This should be performed whenever the user has finished with the stream.int
currentIndex()
Retrieves the current row index numberboolean
first()
Moves the cursor to the first row in the result setprotected int
getCursorSize()
INTERNAL: Retreive the size of the wrapped cursored stream.ObjID
getID()
INTERNAL: Retreive the OID of the wrapped cursored stream.boolean
isAfterLast()
Indicates whether the cursor is after the last row in the result set.boolean
isBeforeFirst()
Indicates whether the cursor is before the first row in the result set.boolean
isClosed()
INTERNAL: Return if the stream is closed.boolean
isFirst()
Indicates whether the cursor is on the first row of the result set.boolean
isLast()
Indicates whether the cursor is on the last row of the result set.boolean
last()
Moves the cursor to the last row in the result setboolean
relative(int rows)
Moves the cursor a relative number of rows, either positive or negative.protected Object
retrieveNextObject()
INTERNAL: This method differs slightly from conventional read() operation on a Java stream.protected Object
retrievePreviousObject()
INTERNAL: CR#4139 Read the previous row from the result set.-
Methods inherited from class org.eclipse.persistence.queries.ScrollableCursor
add, clearNextAndPrevious, clearNextAndPreviousObject, getKnownCursorSize, getNextObject, getPosition, getPreviousObject, hasMoreElements, hasNext, hasNextElement, hasPrevious, loadNext, loadPrevious, next, next, nextElement, nextIndex, previous, previousIndex, set, setNextObject, setPreviousObject
-
Methods inherited from class org.eclipse.persistence.queries.Cursor
buildAndRegisterObject, clear, finalize, getAccessor, getExecutionSession, getFields, getInitiallyConformingIndex, getObjectCollection, getPageSize, getPolicy, getQuery, getResultSet, getSelectionCriteriaClone, getSession, getStatement, getTranslationRow, remove, setExecutionSession, setFields, setInitiallyConformingIndex, setObjectCollection, setPolicy, setPosition, setResultSet, setSelectionCriteriaClone, setSession, setSize, setTranslationRow, size
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Methods inherited from interface java.util.ListIterator
remove
-
-
-
-
Field Detail
-
id
protected ObjID id
This is a unique id for remote cursored stream
-
isClosed
protected boolean isClosed
Return if the stream is closed
-
-
Constructor Detail
-
RemoteScrollableCursor
public RemoteScrollableCursor(ScrollableCursor serverScrollableCursor)
-
-
Method Detail
-
absolute
public boolean absolute(int rows) throws DatabaseException
Moves the cursor to the given row number in the result set- Overrides:
absolute
in classScrollableCursor
- Throws:
DatabaseException
-
afterLast
public void afterLast() throws DatabaseException
Moves the cursor to the end of the result set, just after the last row.- Overrides:
afterLast
in classScrollableCursor
- Throws:
DatabaseException
-
beforeFirst
public void beforeFirst() throws DatabaseException
Moves the cursor to the front of the result set, just before the first row- Overrides:
beforeFirst
in classScrollableCursor
- Throws:
DatabaseException
-
close
public void close() throws DatabaseException
Close the wrapped cursored stream This should be performed whenever the user has finished with the stream.- Overrides:
close
in classCursor
- Throws:
DatabaseException
-
currentIndex
public int currentIndex() throws DatabaseException
Retrieves the current row index number- Overrides:
currentIndex
in classScrollableCursor
- Throws:
DatabaseException
-
first
public boolean first() throws DatabaseException
Moves the cursor to the first row in the result set- Overrides:
first
in classScrollableCursor
- Throws:
DatabaseException
-
getCursorSize
protected int getCursorSize()
INTERNAL: Retreive the size of the wrapped cursored stream.- Overrides:
getCursorSize
in classScrollableCursor
-
getID
public ObjID getID()
INTERNAL: Retreive the OID of the wrapped cursored stream.
-
isAfterLast
public boolean isAfterLast() throws DatabaseException
Indicates whether the cursor is after the last row in the result set.- Overrides:
isAfterLast
in classScrollableCursor
- Throws:
DatabaseException
-
isBeforeFirst
public boolean isBeforeFirst() throws DatabaseException
Indicates whether the cursor is before the first row in the result set.- Overrides:
isBeforeFirst
in classScrollableCursor
- Throws:
DatabaseException
-
isClosed
public boolean isClosed()
INTERNAL: Return if the stream is closed.
-
isFirst
public boolean isFirst() throws DatabaseException
Indicates whether the cursor is on the first row of the result set.- Overrides:
isFirst
in classScrollableCursor
- Throws:
DatabaseException
-
isLast
public boolean isLast() throws DatabaseException
Indicates whether the cursor is on the last row of the result set.- Overrides:
isLast
in classScrollableCursor
- Throws:
DatabaseException
-
last
public boolean last() throws DatabaseException
Moves the cursor to the last row in the result set- Overrides:
last
in classScrollableCursor
- Throws:
DatabaseException
-
relative
public boolean relative(int rows) throws DatabaseException
Moves the cursor a relative number of rows, either positive or negative. Attempting to move beyond the first/last row in the result set positions the cursor before/after the the first/last row- Overrides:
relative
in classScrollableCursor
- Throws:
DatabaseException
-
retrieveNextObject
protected Object retrieveNextObject() throws DatabaseException, QueryException
INTERNAL: 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- Overrides:
retrieveNextObject
in classScrollableCursor
- Returns:
- next object in stream
- Throws:
DatabaseException
- if read pass end of streamQueryException
-
retrievePreviousObject
protected Object retrievePreviousObject() throws DatabaseException
INTERNAL: CR#4139 Read the previous row from the result set. It is used solely for scrollable cursor support.- Overrides:
retrievePreviousObject
in classScrollableCursor
- Throws:
DatabaseException
-
-