edu.ucsb.adl.middleware
Class ConfigurationFile

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--edu.ucsb.adl.middleware.ExtendedProperties
                          |
                          +--edu.ucsb.adl.middleware.ConfigurationFile
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public final class ConfigurationFile
extends ExtendedProperties

Holds the contents of a middleware configuration file. A middleware configuration file is a Java properties file with the added feature that property values may be indirectly specified using the notation @P where P is the name of another property (see ExtendedProperties for more information).

There are actually several middleware configuration files per installation: a main configuration file and collection-specific configuration files, one per collection. An instance of this class holds the contents of any one configuration file. Note, however, that the main configuration file serves as a properties default for the collection-specific configuration files.

The main configuration file and the collection-specific configuration files are related as follows. If the value of the collection_directory property in the main configuration file is D, then the collection-specific configuration file for collection C is located at D/C/drivers.conf. If D is not an absolute pathname, it is interpreted relative to the directory containing the main middleware configuration file.

An additional property, middleware_configuration_file, is added by this class to record the filename of the main configuration file.

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/RCS/ConfigurationFile.java,v 1.5 2004/09/21 17:48:27 gjanee Exp $

$Log: ConfigurationFile.java,v $ Revision 1.5 2004/09/21 17:48:27 gjanee
Rewrite to use class ExtendedProperties.

Revision 1.4 2002/09/28 20:23:43 gjanee
Configuration file renames. Renamed the collection-specific configuration file to drivers.conf.

Revision 1.3 2002/09/25 23:09:03 gjanee
Added support for disabled collections. A subdirectory of the master collection directory is interpreted as a collection if and only if it does *not* contain a file named "OFFLINE".

Revision 1.2 2001/10/06 14:39:43 gjanee
Added the middleware_configuration_file property.

Revision 1.1 2001/08/11 13:44:07 gjanee
Initial revision

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

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ConfigurationFile(java.lang.String filename)
          Creates a configuration file holding the contents of the main middleware configuration file.
ConfigurationFile(java.lang.String mainFilename, java.lang.String collection)
          Creates a configuration file holding the contents of a collection-specific middleware configuration file.
 
Method Summary
 java.io.File getCollectionDirectory()
          Returns a File representing the value of the collection_directory property.
 
Methods inherited from class edu.ucsb.adl.middleware.ExtendedProperties
getProperty, getPropertySafe
 
Methods inherited from class java.util.Properties
getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigurationFile

public ConfigurationFile(java.lang.String filename)
                  throws InternalErrorException
Creates a configuration file holding the contents of the main middleware configuration file.

Parameters:
filename - The filename of the configuration file.
Throws:
InternalErrorException - If any error occurs.

ConfigurationFile

public ConfigurationFile(java.lang.String mainFilename,
                         java.lang.String collection)
                  throws BadRequestException,
                         InternalErrorException
Creates a configuration file holding the contents of a collection-specific middleware configuration file.

Parameters:
mainFilename - The filename of the main middleware configuration file.
collection - The name of the collection, e.g., "adl_catalog".
Throws:
BadRequestException - If collection is invalid or if there is no such collection.
InternalErrorException - If any other error occurs.
Method Detail

getCollectionDirectory

public java.io.File getCollectionDirectory()
                                    throws InternalErrorException
Returns a File representing the value of the collection_directory property. It is checked that the directory exists.

Returns:
The File.
Throws:
InternalErrorException - If any error occurs.