com.sun.mdm.index.configurator
Class ConfigurationService

java.lang.Object
  extended bycom.sun.mdm.index.configurator.ConfigurationService
All Implemented Interfaces:
ConfigurationMBean

public class ConfigurationService
extends java.lang.Object
implements ConfigurationMBean

ConfigurationMBean implementation


Nested Class Summary
protected static class ConfigurationService.ConfigurationServiceObservable
          Inner class to notify of configuration changes after the initial load.
 
Field Summary
static java.lang.String ATR_MODULE_NAME
          XML node attribute for the module name
static java.lang.String ATR_PARSER_CLASS
          XML node attribute for parser class
(package private) static java.lang.String FILTER_FILE_NAME
           
(package private) static java.lang.String HOME_SYS_PROP
          JVM property name for BBE home directory
(package private) static java.lang.String MASTER_FILE_NAME
           
(package private) static java.lang.String MATCH_DIR
           
(package private) static java.lang.String MEFA_FILE_NAME
           
(package private) static java.lang.String QUERY_FILE_NAME
           
(package private) static java.lang.String SECURITY_FILE_NAME
           
(package private) static java.lang.String STAND_DIR
           
(package private) static java.lang.String UPDATE_FILE_NAME
           
(package private) static java.lang.String VALIDATION_FILE_NAME
           
 
Fields inherited from interface com.sun.mdm.index.configurator.ConfigurationMBean
MBEAN_NAME
 
Constructor Summary
ConfigurationService()
          Creates new ConfigurationService instance
 
Method Summary
static void addConfigChangeObserver(java.util.Observer anObserver)
          Add an Observer to be notified it the configuration changes from what was originally loaded.
static void deleteConfigChangeObserver(java.util.Observer anObserver)
          Remove the Observer from being notified of configuration changes from what was originally loaded.
 java.io.InputStream getConfigFileStream(java.lang.String fileName)
          Returns an inputstream to the configuration file.
 ConfigurationInfo getConfiguration(java.lang.String name)
          Returns the configuration instance given the name.
static ConfigurationService getInstance()
          Returns a reference to the singleton instance.
 void load(java.io.InputStream fileStream)
          Load the configuration file.
static void resetInstance()
          Ensures the singleton instance will be reloaded with the latest configuration with the next call to getInstance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATR_MODULE_NAME

public static final java.lang.String ATR_MODULE_NAME
XML node attribute for the module name

See Also:
Constant Field Values

ATR_PARSER_CLASS

public static final java.lang.String ATR_PARSER_CLASS
XML node attribute for parser class

See Also:
Constant Field Values

FILTER_FILE_NAME

static final java.lang.String FILTER_FILE_NAME
See Also:
Constant Field Values

HOME_SYS_PROP

static final java.lang.String HOME_SYS_PROP
JVM property name for BBE home directory

See Also:
Constant Field Values

MASTER_FILE_NAME

static final java.lang.String MASTER_FILE_NAME
See Also:
Constant Field Values

MATCH_DIR

static final java.lang.String MATCH_DIR
See Also:
Constant Field Values

MEFA_FILE_NAME

static final java.lang.String MEFA_FILE_NAME
See Also:
Constant Field Values

QUERY_FILE_NAME

static final java.lang.String QUERY_FILE_NAME
See Also:
Constant Field Values

SECURITY_FILE_NAME

static final java.lang.String SECURITY_FILE_NAME
See Also:
Constant Field Values

STAND_DIR

static final java.lang.String STAND_DIR
See Also:
Constant Field Values

UPDATE_FILE_NAME

static final java.lang.String UPDATE_FILE_NAME
See Also:
Constant Field Values

VALIDATION_FILE_NAME

static final java.lang.String VALIDATION_FILE_NAME
See Also:
Constant Field Values
Constructor Detail

ConfigurationService

public ConfigurationService()
Creates new ConfigurationService instance

Method Detail

addConfigChangeObserver

public static void addConfigChangeObserver(java.util.Observer anObserver)
Add an Observer to be notified it the configuration changes from what was originally loaded.

Parameters:
anObserver - the observer to notify.

deleteConfigChangeObserver

public static void deleteConfigChangeObserver(java.util.Observer anObserver)
Remove the Observer from being notified of configuration changes from what was originally loaded.

Parameters:
anObserver - the observer to remove.

getConfigFileStream

public java.io.InputStream getConfigFileStream(java.lang.String fileName)
                                        throws java.io.IOException
Returns an inputstream to the configuration file.

Returns:
an inputstream to the configuration file.
Throws:
java.io.IOException - error constructing the URL.

getConfiguration

public ConfigurationInfo getConfiguration(java.lang.String name)
Returns the configuration instance given the name.

Specified by:
getConfiguration in interface ConfigurationMBean
Parameters:
name - Name of the configuration section.
Returns:
configuration information.

getInstance

public static ConfigurationService getInstance()
                                        throws java.lang.InstantiationException
Returns a reference to the singleton instance. This is syncronized to prevent multiple initial loading by different threads.

Returns:
reference to singleton instance
Throws:
java.lang.InstantiationException - throws error if unable to create instance

load

public void load(java.io.InputStream fileStream)
          throws java.io.IOException,
                 org.xml.sax.SAXException,
                 javax.xml.parsers.ParserConfigurationException,
                 org.w3c.dom.DOMException,
                 java.lang.ClassNotFoundException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException,
                 ConfigurationException
Load the configuration file.

Specified by:
load in interface ConfigurationMBean
Parameters:
fileStream - input stream to the file.
Throws:
java.io.IOException - if there is an error accessing the file.
org.xml.sax.SAXException - if there is an error parsing the file.
javax.xml.parsers.ParserConfigurationException - if there is an invalid parser configuration.
org.w3c.dom.DOMException - if there is an error accessing the DOM tree.
java.lang.ClassNotFoundException - if the parser class not found.
java.lang.InstantiationException - if the parser can not be instantiated.
java.lang.IllegalAccessException - if it is unable to access parser default constructor.
ConfigurationException - if it encounters unexpected values.

resetInstance

public static void resetInstance()
Ensures the singleton instance will be reloaded with the latest configuration with the next call to getInstance. CAUTION! This should currently ONLY be used for unit testing, because this does NOT ensure that clients using the configuration service instances re-load cached configuration information. To ensure that happens, the configuration service clients should register an Observer and re-load the cached values if appropriate. A call to this method triggers a ConfigChangeObserver update notification.



Sun Microsystems, Inc.