Module org.tentackle.persistence
Package org.tentackle.persist.rmi
Class RemoteResultSetCursorImpl<T extends PersistentDomainObject<T>>
java.lang.Object
org.tentackle.dbms.rmi.RemoteDelegateImpl<T>
org.tentackle.persist.rmi.RemoteResultSetCursorImpl<T>
- Type Parameters:
T- the object type
- All Implemented Interfaces:
Remote,RemoteDelegate,RemoteResultSetCursor<T>
public class RemoteResultSetCursorImpl<T extends PersistentDomainObject<T>>
extends RemoteDelegateImpl<T>
implements RemoteResultSetCursor<T>
Remote delegate implementation for
ResultSetCursor.- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteResultSetCursorImpl(RemoteDbSessionImpl session, Class<T> clazz) Creates a remote cursor delegate. -
Method Summary
Modifier and TypeMethodDescriptionintPositions the cursor after the last row.
Works even for empty cursors.voidPositions the cursor before the first row.
Works even for empty cursors.voidclose()Closes the scrollable resource.
The scrollable resource is opened in its constructor.voidconfigureDelegate(Object... args) Configures the delegate.fetch()Fetches the next objects up to the fetchsize.
This method is provided to minimize the number of roundtrips especially for remote cursors.booleanfirst()Rewinds the cursor to the first row.get()Gets the data object of the current row.Gets the local cursor.intGets the fetch direction.intGets the fetchsize.booleanChecks whether the cursor is after the last row.intlast()Positions the cursor on the last row.booleannext()Moves the cursor to the next row.booleanprevious()Moves the cursor to the previous row.intscroll(int rows) Moves the cursor a given number of rows.voidsetCursor(ResultSetCursor<T> cursor) Sets the local cursor.voidsetFetchDirection(int direction) Sets the fetch direction.voidsetFetchSize(int rows) Sets the fetchsize.
This is the number of rows the cursor will fetch from the server in one batch.intsetRow(int row) Sets the cursor to a given row.
Row numbers start at 1.toList()Returns the objects of this cursor as a list.toString()Methods inherited from class org.tentackle.dbms.rmi.RemoteDelegateImpl
getServerSession, getServicedClass, getSession, initialize
-
Constructor Details
-
RemoteResultSetCursorImpl
Creates a remote cursor delegate.- Parameters:
session- the RMI sessionclazz- the PDO interface class
-
-
Method Details
-
toString
- Overrides:
toStringin classRemoteDelegateImpl<T extends PersistentDomainObject<T>>
-
configureDelegate
Configures the delegate.Invoked from
RemoteDbSessionImpl.createRemoteDelegateInstance(java.lang.Class<T>, java.lang.Class<I>, java.lang.Class<?>, java.lang.Class<?>, java.lang.Object...)by reflection.- Parameters:
args- the configuration parameters
-
setCursor
Sets the local cursor.- Parameters:
cursor- the cursor
-
getCursor
Gets the local cursor.- Returns:
- the local cursor
-
afterLast
Description copied from interface:RemoteResultSetCursorPositions the cursor after the last row.
Works even for empty cursors.- Specified by:
afterLastin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the current row
- Throws:
RemoteException- if failed
-
beforeFirst
Description copied from interface:RemoteResultSetCursorPositions the cursor before the first row.
Works even for empty cursors.- Specified by:
beforeFirstin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Throws:
RemoteException- if failed
-
close
Description copied from interface:RemoteResultSetCursorCloses the scrollable resource.
The scrollable resource is opened in its constructor. Closing an already closed scrollable resource is allowed.- Specified by:
closein interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Throws:
RemoteException- if failed
-
first
Description copied from interface:RemoteResultSetCursorRewinds the cursor to the first row.- Specified by:
firstin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if rewound, false if cursor is empty
- Throws:
RemoteException- if failed
-
get
Description copied from interface:RemoteResultSetCursorGets the data object of the current row.- Specified by:
getin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the object, null if invalid row or no such object
- Throws:
RemoteException- if failed
-
isAfterLast
Description copied from interface:RemoteResultSetCursorChecks whether the cursor is after the last row.- Specified by:
isAfterLastin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if after last
- Throws:
RemoteException- if failed
-
last
Description copied from interface:RemoteResultSetCursorPositions the cursor on the last row.- Specified by:
lastin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the current row
- Throws:
RemoteException- if failed
-
next
Description copied from interface:RemoteResultSetCursorMoves the cursor to the next row. If there are no more rows the current row remains unchanged.- Specified by:
nextin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if moved, false if no more rows
- Throws:
RemoteException- if failed
-
previous
Description copied from interface:RemoteResultSetCursorMoves the cursor to the previous row. If we are already at the beginning, the cursor remains unchanged.- Specified by:
previousin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if advanced, false if already at the beginning
- Throws:
RemoteException- if failed
-
setRow
Description copied from interface:RemoteResultSetCursorSets the cursor to a given row.
Row numbers start at 1.- Specified by:
setRowin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
row- the row number (must be ≥ 0)- Returns:
- the new row number
- Throws:
RemoteException- if failed
-
scroll
Description copied from interface:RemoteResultSetCursorMoves the cursor a given number of rows.- Specified by:
scrollin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
rows- the number of rows to move, negative to move backwards- Returns:
- the current row
- Throws:
RemoteException- if failed
-
toList
Description copied from interface:RemoteResultSetCursorReturns the objects of this cursor as a list.- Specified by:
toListin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the list
- Throws:
RemoteException- if failed
-
setFetchSize
Description copied from interface:RemoteResultSetCursorSets the fetchsize.
This is the number of rows the cursor will fetch from the server in one batch. A fetchsize of 0 means server default.- Specified by:
setFetchSizein interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
rows- the fetchsize- Throws:
RemoteException- if failed
-
getFetchSize
Description copied from interface:RemoteResultSetCursorGets the fetchsize.- Specified by:
getFetchSizein interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the fetchsize
- Throws:
RemoteException- if failed
-
setFetchDirection
Description copied from interface:RemoteResultSetCursorSets the fetch direction.- Specified by:
setFetchDirectionin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
direction- the direction, seeResultSet.setFetchDirection(int)- Throws:
RemoteException- if failed
-
getFetchDirection
Description copied from interface:RemoteResultSetCursorGets the fetch direction.- Specified by:
getFetchDirectionin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the direction
- Throws:
RemoteException- if failed
-
fetch
Description copied from interface:RemoteResultSetCursorFetches the next objects up to the fetchsize.
This method is provided to minimize the number of roundtrips especially for remote cursors. The cursor is closed at the end of the cursor.- Specified by:
fetchin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the list of objects, null if no more objects found
- Throws:
RemoteException- if failed
-
createException
- Overrides:
createExceptionin classRemoteDelegateImpl<T extends PersistentDomainObject<T>>
-