|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.config.ServiceConfigFactory
This factory class is designed to be the main interface between the service
configuration information and the users of the information. When initialized
the factory loads the configuration from the file system, allowing access to
the information by others. The init
method may be called by more
than one thread, but MUST be called by at least one thread before
the factory can be used.
The factory supports the singleton design pattern, and thus the configuration
is loaded only once. All callers get the same reference unless a call to
reload
is made. After than any saved instances of the factory can still
be referenced. Old references will not reflect any changes in the file if the
factory is reloaded.
Field Summary | |
private ServiceConfiguration |
m_config
The loaded configuration after is has been unmarhsalled by castor. |
private static boolean |
m_loaded
This member is set to true if the configuration file has been loaded. |
private static ServiceConfigFactory |
m_singleton
The singleton instance of this factory |
Constructor Summary | |
private |
ServiceConfigFactory(java.lang.String configFile)
Private constructor. |
Method Summary | |
static ServiceConfigFactory |
getInstance()
Returns the currently defined singleton instance of the factory. |
Service[] |
getServices()
Returns an array of all the defined configuration information for the Services. |
static void |
init()
Load the config from the default config file and create the singleton instance of this factory. |
static void |
reload()
Reload the config from the default config file |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static ServiceConfigFactory m_singleton
private static boolean m_loaded
private ServiceConfiguration m_config
Constructor Detail |
private ServiceConfigFactory(java.lang.String configFile) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
configFile
- The name of the configuration file.
java.io.IOException
- Thrown if the specified config file cannot be read
org.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.Method Detail |
public static void init() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
- Thrown if the specified config file cannot be read
org.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.public static void reload() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
- Thrown if the specified config file cannot be read/loaded
org.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.public static ServiceConfigFactory getInstance()
reload
method is called.
java.lang.IllegalStateException
- Thrown if the factory has not yet been initialized.public Service[] getServices()
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |