edu.ucsb.adl.middleware.rmi
Class QueryDriver

java.lang.Object
  |
  +--edu.ucsb.adl.middleware.rmi.QueryDriver
All Implemented Interfaces:
QueryDriver

public final class QueryDriver
extends java.lang.Object
implements QueryDriver

Proxy driver for the ADL query service. This driver establishes an RMI connection to a remote middleware server and thereby provides access to a (single) remote collection.

Before submitting a query to the remote server, the list of collection names in the query is replaced with a single collection name: that of the remote collection. If an UnsupportedException is received due to an unrecognized ranking method, the query is resubmitted with no ranking. The remote collection name is renamed to the local collection name in returned metadata reports.

This class reads the following properties from the RMI proxy driver configuration file rmi-proxy-driver.conf. Property values may be indirectly specified using the notation @P where P is the name of another property (see ExtendedProperties for more information).

remote_collection_name
The name of the remote collection, e.g., "adl_catalog".
registry
The URL of the RMI registry to use, e.g., "rmi://piru.alexandria.ucsb.edu".
query.name
The RMI name of the remote query service, e.g., "/edu/ucsb/adl/middleware/rmi/QueryService".
cancel.name
The RMI name of the remote cancel service, e.g., "/edu/ucsb/adl/middleware/rmi/CancelService".
results.name
The RMI name of the remote results service, e.g., "/edu/ucsb/adl/middleware/rmi/ResultsService".
query.polling_cycle_time
The duration of the driver's results polling loop in milliseconds, e.g., "1000" is 1 second.
In the above, property values that are time durations in milliseconds may have a single-character suffix added to specify a different unit of measure. Recognized suffixes are "s" (seconds), "m" (minutes), "h" (hours), and "d" (days).

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/rmi/RCS/QueryDriver.java,v 1.6 2004/09/23 18:15:51 gjanee Exp $

$Log: QueryDriver.java,v $ Revision 1.6 2004/09/23 18:15:51 gjanee
Rewrite to use classes edu.ucsb.adl.middleware.ExtendedProperties and edu.ucsb.adl.middleware.XmlUtils.

Revision 1.5 2004/03/11 19:26:35 gjanee
Added support for different units of measure in time duration properties.

Revision 1.4 2004/03/05 23:39:38 gjanee
Added support for multiple middleware instances. A middleware instance is represented by a Global object that is tied to a main middleware configuration file. All service objects now maintain a reference to the appropriate Global object. Instance-wide variables formerly coded as class variables are now held by the Global object; various methods that return instance-wide variables now accept a Global object as an argument. The Global object is now passed to all service drivers.

Revision 1.3 2002/09/28 20:48:57 gjanee
Configuration file renames. Renamed the RMI proxy driver configuration file to rmi-proxy-driver.conf.

Revision 1.2 2001/08/20 18:04:14 gjanee
Switched to the new configuration file structure. In the new structure, an entirely collection-independent "main" configuration file refers to a directory of subdirectories, one subdirectory per collection; each subdirectory holds a collection-specific middleware configuration file in addition to any configuration files required by the collection driver.

Revision 1.1 2001/03/16 23:59:19 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library

Method Summary
static edu.ucsb.adl.middleware.rmi.QueryDriver createDriver(edu.ucsb.adl.middleware.Global global, java.io.File directory, java.lang.String collection)
          Creates a QueryDriver for a collection.
 edu.ucsb.adl.middleware.QueryThread createQueryThread(java.lang.String collection, edu.ucsb.adl.middleware.Query query, edu.ucsb.adl.middleware.ResultAccumulator accumulator)
          Creates a thread that processes a query on behalf of the collection.
 void destroy()
          Frees all resources held by the driver.
 java.rmi.Remote[] reloadRemoteServices()
          For use by QueryThread only.
 void threadStarting(edu.ucsb.adl.middleware.rmi.QueryThread thread)
          For use by QueryThread only.
 void threadTerminated(edu.ucsb.adl.middleware.rmi.QueryThread thread)
          For use by QueryThread only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDriver

public static edu.ucsb.adl.middleware.rmi.QueryDriver createDriver(edu.ucsb.adl.middleware.Global global,
                                                                   java.io.File directory,
                                                                   java.lang.String collection)
                                                            throws InternalErrorException
Creates a QueryDriver for a collection.

Parameters:
global - Unused.
directory - The pathname of the directory containing the RMI proxy driver configuration file.
collection - The name of the collection, e.g., "adl_catalog".
Returns:
A QueryDriver.
Throws:
InternalErrorException - If any error is encountered.

reloadRemoteServices

public java.rmi.Remote[] reloadRemoteServices()
                                       throws InternalErrorException
For use by QueryThread only.

InternalErrorException

createQueryThread

public edu.ucsb.adl.middleware.QueryThread createQueryThread(java.lang.String collection,
                                                             edu.ucsb.adl.middleware.Query query,
                                                             edu.ucsb.adl.middleware.ResultAccumulator accumulator)
                                                      throws InternalErrorException
Creates a thread that processes a query on behalf of the collection.

Specified by:
createQueryThread in interface QueryDriver
Parameters:
collection - The collection name, e.g., "adl_catalog".
query - The query.
accumulator - The result accumulator to which query results are to be sent.
Returns:
A query thread.
Throws:
InternalErrorException - If the thread cannot be created.
See Also:
QueryService

threadStarting

public void threadStarting(edu.ucsb.adl.middleware.rmi.QueryThread thread)
For use by QueryThread only.


threadTerminated

public void threadTerminated(edu.ucsb.adl.middleware.rmi.QueryThread thread)
For use by QueryThread only.


destroy

public void destroy()
Frees all resources held by the driver.

Specified by:
destroy in interface QueryDriver