edu.ucsb.adl.middleware.rmi
Class ResultSetImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--edu.ucsb.adl.middleware.rmi.ResultSetImpl
All Implemented Interfaces:
java.rmi.Remote, ResultSet, java.io.Serializable

public final class ResultSetImpl
extends java.rmi.server.UnicastRemoteObject
implements ResultSet

Bridge between the RMI interface to a result set and the result set itself.

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/rmi/RCS/ResultSetImpl.java,v 1.3 2004/03/15 20:40:26 gjanee Exp $

$Log: ResultSetImpl.java,v $ Revision 1.3 2004/03/15 20:40:26 gjanee
Added method getQuery.

Revision 1.2 2003/06/10 16:03:58 gjanee
Query results are now Result objects, i.e., triplets of standard metadata views.

Revision 1.1 2001/03/15 22:41:35 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ResultSetImpl(edu.ucsb.adl.middleware.ResultSet set)
          Creates a ResultSetImpl.
 
Method Summary
 long getCompletionTime()
          Returns the result set's completion time.
 long getCreationTime()
          Returns the result set's creation time.
 java.lang.Exception getException()
          Returns the exception that terminated the associated query.
 int getID()
          Returns the result set's ID.
 int getNumResults()
          Returns the current number of results in the result set.
 java.lang.String getQuery()
          Returns the XML query associated with the result set.
 edu.ucsb.adl.middleware.Result getResult(int index)
          Returns a result from the result set.
 edu.ucsb.adl.middleware.Result[] getResults(int from, int to)
          Returns a range of results from the result set.
 int getTotalResultCount()
          Returns the total result count.
 boolean isComplete()
          Tests if the result set is complete.
 void release()
          Removes the result set from the system-wide registry.
 void waitForCompletion()
          Returns when the result set is complete.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResultSetImpl

public ResultSetImpl(edu.ucsb.adl.middleware.ResultSet set)
              throws java.rmi.RemoteException
Creates a ResultSetImpl.

Parameters:
set - The real result set.
Throws:
java.rmi.RemoteException - If an RMI error occurs.
Method Detail

getID

public int getID()
Returns the result set's ID.

Specified by:
getID in interface ResultSet
Returns:
The ID.

getCreationTime

public long getCreationTime()
Returns the result set's creation time.

Specified by:
getCreationTime in interface ResultSet
Returns:
The time in the semantics of System.currentTimeMillis.

getQuery

public java.lang.String getQuery()
Returns the XML query associated with the result set.

Specified by:
getQuery in interface ResultSet
Returns:
The query.

getNumResults

public int getNumResults()
Returns the current number of results in the result set.

Specified by:
getNumResults in interface ResultSet
Returns:
The current number of results.

getResult

public edu.ucsb.adl.middleware.Result getResult(int index)
Returns a result from the result set.

Specified by:
getResult in interface ResultSet
Parameters:
index - The index of the result to return.
Returns:
The query result.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If index is out of bounds.

getResults

public edu.ucsb.adl.middleware.Result[] getResults(int from,
                                                   int to)
Returns a range of results from the result set.

Specified by:
getResults in interface ResultSet
Parameters:
from - The starting index, inclusive.
to - The ending index, exclusive.
Returns:
The query results.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If from or to are out of bounds or if from is greater than to.

isComplete

public boolean isComplete()
Tests if the result set is complete.

Specified by:
isComplete in interface ResultSet
Returns:
true if the result set is complete.

getCompletionTime

public long getCompletionTime()
Returns the result set's completion time.

Specified by:
getCompletionTime in interface ResultSet
Returns:
The time in the semantics of System.currentTimeMillis or a negative value if the result set is incomplete.

getTotalResultCount

public int getTotalResultCount()
Returns the total result count.

Specified by:
getTotalResultCount in interface ResultSet
Returns:
The total result count, or a negative value if the total result count is unknown or the result set is incomplete.

getException

public java.lang.Exception getException()
Returns the exception that terminated the associated query.

Specified by:
getException in interface ResultSet
Returns:
The exception, or null if the query completed successfully or the result set is incomplete.

waitForCompletion

public void waitForCompletion()
Returns when the result set is complete.

Specified by:
waitForCompletion in interface ResultSet

release

public void release()
Removes the result set from the system-wide registry. The result set is otherwise unchanged so that threads that are already referencing the result set may continue to do so without problem.

Specified by:
release in interface ResultSet