no.feide.moria.directory
Class DirectoryManagerConfiguration

java.lang.Object
  extended by no.feide.moria.directory.DirectoryManagerConfiguration

public class DirectoryManagerConfiguration
extends java.lang.Object

Configuration handler for the Directory Manager. Parses the configuration file.


Field Summary
private  org.jdom.Element backendConfiguration
          Internal representation of the backend configuration file structure.
private  java.lang.Class backendFactoryClass
          Internal representation of the backend class.
static java.lang.String CONFIGURATION_PROPERTY
          The required configuration file property, for external reference.
private  java.lang.String indexFilename
          The location of the index file.
private  long indexUpdateFrequency
          The index update frequency, in milliseconds.
 
Constructor Summary
DirectoryManagerConfiguration(java.util.Properties config)
          Constructor.
 
Method Summary
 org.jdom.Element getBackendElement()
          Gets the backend configuration element.
 java.lang.Class getBackendFactoryClass()
          Gets the backend factory class implementation.
 java.lang.String getIndexFilename()
          Gets the serialized index file name.
 long getIndexUpdateFrequency()
          Gets the index update frequency.
private  org.jdom.Element parseBackendConfig(org.jdom.Element rootElement)
          Parses the subsection of the configuration file common to all backend implementations and updates the configuration.
private  void parseIndexConfig(org.jdom.Element rootElement)
          Parses the subsection of the configuration file related to the index and updates the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexFilename

private java.lang.String indexFilename
The location of the index file.


indexUpdateFrequency

private long indexUpdateFrequency
The index update frequency, in milliseconds.


backendFactoryClass

private java.lang.Class backendFactoryClass
Internal representation of the backend class.


backendConfiguration

private org.jdom.Element backendConfiguration
Internal representation of the backend configuration file structure.


CONFIGURATION_PROPERTY

public static final java.lang.String CONFIGURATION_PROPERTY
The required configuration file property, for external reference. Currently contains the value no.feide.moria.directory.configuration.

See Also:
Constant Field Values
Constructor Detail

DirectoryManagerConfiguration

public DirectoryManagerConfiguration(java.util.Properties config)
Constructor. Creates a new configuration object and reads the Directory Manager configuration file.

Note that the actual parsing of the configuration file is done by parseIndexConfig(Element) and parseBackendConfig(Element).

Parameters:
config - The Directory Manager configuration passed on from DirectoryManager.setConfig(Properties). Must include the property given by DirectoryManagerConfiguration.CONFIGURATION_PROPERTY.
Throws:
java.lang.NullPointerException - If config is null.
DirectoryManagerConfigurationException - If the property given by DirectoryManagerConfiguration.CONFIGURATION_PROPERTY is not set or is an empty string. Also thrown if unable to read from or parse the configuration file.
See Also:
DirectoryManager.setConfig(Properties), CONFIGURATION_PROPERTY, parseBackendConfig(Element), parseIndexConfig(Element)
Method Detail

getBackendElement

public final org.jdom.Element getBackendElement()
Gets the backend configuration element.

Returns:
A copy of the backend configuration element, as per Element.clone().
See Also:
Element.clone()

parseIndexConfig

private void parseIndexConfig(org.jdom.Element rootElement)
Parses the subsection of the configuration file related to the index and updates the configuration.

If more than one Index element is found, only the first is considered.

Parameters:
rootElement - The root configuration element. Cannot be null.
Throws:
java.lang.NullPointerException - If rootElement is null.
DirectoryManagerConfigurationException - If index file (attribute file in element Index) is not set, or if index update frequency (attribute update in element Index) is not set or is less than zero.

getIndexFilename

public final java.lang.String getIndexFilename()
Gets the serialized index file name.

Returns:
The index file name.

getIndexUpdateFrequency

public final long getIndexUpdateFrequency()
Gets the index update frequency.

Returns:
The index update frequency, in milliseconds.

parseBackendConfig

private org.jdom.Element parseBackendConfig(org.jdom.Element rootElement)
Parses the subsection of the configuration file common to all backend implementations and updates the configuration.

This method will only consider the attribute class in the Backend element; further parsing of the element is left to the backend implementation. If more than one Backend element is found, only the first is considered.

Parameters:
rootElement - The root configuration element. Cannot be null.
Returns:
The backend configuration element, as per Element.clone().
Throws:
java.lang.NullPointerException - If rootElement is null.
DirectoryManagerConfigurationException - If backend factory class (attribute class in element Backend) is not set, or if the given backend factory class cannot be resolved.
See Also:
Element.clone(), DirectoryManagerBackendFactory.setConfig(Element)

getBackendFactoryClass

public final java.lang.Class getBackendFactoryClass()
Gets the backend factory class implementation.

Returns:
The backend factory class.


Copyright © 2001-2006 UNINETT FAS. All Rights Reserved.