edu.ucsb.adl.bucket99
Class MetadataDriver

java.lang.Object
  |
  +--edu.ucsb.adl.bucket99.MetadataDriver
All Implemented Interfaces:
MetadataDriver

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

Driver for the ADL metadata service. This driver is actually just a configurable shell that relegates all of the work of generating reports to subdrivers, one subdriver per metadata view. The driver itself maintains a (single) database connection for use by subdrivers, and logs requests to a log file.

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

metadata.database_driver_class
The fully-qualified name of the database driver class, e.g., "com.informix.jdbc.IfxDriver".
metadata.database_url
The database's connection URL.
metadata.database_properties
The name of a Java properties file containing database connection properties, or the string "none". If the filename is not absolute, it is interpreted relative to the directory containing the Bucket99 configuration file.
metadata.views
The views supported by the collection expressed as a list of three or more property name prefixes V separated by commas, e.g., "ACCESS,BROWSE,BUCKET". The three standard ADL views (whose names are adl:access, adl:browse, and adl:bucket) must be supported.
V.name
For view V, the name of the view, e.g., "adl:access".
V.class
For view V, the fully-qualified name of the subdriver class, e.g., "edu.ucsb.adl.bucket99.DatabaseURLMetadataSubdriver".
metadata.validation
Must be either "on" or "off". If "on", all standard ADL metadata views returned by the metadata driver are validated for correctness.
metadata.log_file
The name of the file to log invocation records to; or, if the value is of the form "j2se-logger:L", the name L of the Java Logger to log invocation records to (at logging level INFO); or the string "none" if logging is not desired. If the filename is not absolute, it is interpreted relative to the directory containing the Bucket99 configuration file.

Records logged by this driver contain seven fields:

For example:
!957375987400|metadata|edu.ucsb.adl.bucket99.MetadataDriver|adl_catalog|adl:access|1001652|

Version:
$Header: /export/home/gjanee/bucket99/edu/ucsb/adl/bucket99/RCS/MetadataDriver.java,v 1.10 2006/06/23 03:28:36 gjanee Exp $

$Log: MetadataDriver.java,v $ Revision 1.10 2006/06/23 03:28:36 gjanee
Various changes to support the new version of the createDriverInternal method.

Revision 1.9 2004/09/23 16:52:35 gjanee
Rewrite to use class edu.ucsb.adl.middleware.ExtendedProperties.

Revision 1.8 2004/03/05 23:59:25 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.7 2003/06/13 04:03:38 gjanee
Added support for logging to Java loggers. Modified the interpretation of the metadata.log_file property.

Revision 1.6 2003/06/12 03:21:45 gjanee
Added support for arbitrary, per-collection and per-holding metadata views. Specifically, changed the view argument data type from an enumeration to a string. Reworked the Bucket99 configuration parameters. Parameter metadata.views is now a list of arbitrarily many parameter name prefixes. For prefix P, parameter P.name is the view name and P.class is the subdriver class. The three standard ADL views are now required to be supported. Added method performViewsService. Added validation of returned metadata. Added the metadata.validation parameter.

Revision 1.5 2002/09/28 21:05:51 gjanee
Configuration file renames. Renamed the Bucket99 configuration file to bucket99.conf.

Revision 1.4 2002/09/26 13:28:18 gjanee
Added support for a separate Java properties file containing database connection properties. Added property metadata.database_properties.

Revision 1.3 2001/10/09 18:13:57 gjanee
Added support for relative filenames.

Revision 1.2 2001/08/20 19:43:08 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 2000/05/16 19:22:42 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library

Method Summary
static edu.ucsb.adl.bucket99.MetadataDriver createDriver(edu.ucsb.adl.middleware.Global global, java.io.File directory, java.lang.String collection)
          Creates a MetadataDriver for a collection.
static edu.ucsb.adl.bucket99.MetadataDriver createDriverInternal(edu.ucsb.adl.middleware.Global global, java.io.File directory, java.lang.String collection)
          Creates a MetadataDriver for a collection.
 void destroy()
          Frees all resources held by the driver.
static void main(java.lang.String[] args)
          Test driver.
 java.lang.String performMetadataService(java.lang.String view, java.lang.String collection, java.lang.String holding)
          Performs the ADL metadata service, i.e., returns a view of the metadata for a holding within the collection.
 java.lang.String[] performViewsService(java.lang.String collection, java.lang.String holding)
          Returns a list of the views supported by a holding within the collection.
 
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.bucket99.MetadataDriver createDriver(edu.ucsb.adl.middleware.Global global,
                                                                java.io.File directory,
                                                                java.lang.String collection)
                                                         throws InternalErrorException
Creates a MetadataDriver for a collection.

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

createDriverInternal

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

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

performMetadataService

public java.lang.String performMetadataService(java.lang.String view,
                                               java.lang.String collection,
                                               java.lang.String holding)
                                        throws MiddlewareException
Performs the ADL metadata service, i.e., returns a view of the metadata for a holding within the collection. This method is multithread-safe.

Specified by:
performMetadataService in interface MetadataDriver
Parameters:
view - The metadata view, e.g., "adl:access".
collection - The collection name, e.g., "adl_catalog".
holding - The holding identifier.
Returns:
An XML document that is well-formed and valid according to the appropriate DTD.
Throws:
BadRequestException - If holding is not a valid holding identifier.
UnsupportedException - If the request is valid but not supported.
InternalErrorException - If the request is valid but cannot otherwise be completed.
MiddlewareException
See Also:
MetadataService

performViewsService

public java.lang.String[] performViewsService(java.lang.String collection,
                                              java.lang.String holding)
Returns a list of the views supported by a holding within the collection. This method is multithread-safe.

Specified by:
performViewsService in interface MetadataDriver
Parameters:
collection - Unused.
holding - Unused.
Returns:
The views supported by the holding (i.e., the collection in the case of the Bucket99 driver).
See Also:
MetadataService

destroy

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

Specified by:
destroy in interface MetadataDriver

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        MiddlewareException
Test driver.

java.io.IOException
MiddlewareException