Package org.opennms.netmgt.config
Class RWSConfigFactory
- java.lang.Object
-
- org.opennms.netmgt.config.RWSConfigManager
-
- org.opennms.netmgt.config.RWSConfigFactory
-
- All Implemented Interfaces:
RWSConfig
public final class RWSConfigFactory extends RWSConfigManager
This is the singleton class used to load the configuration for the OpenNMS Poller service from the poller-configuration xml file. A mapping of the configured URLs to the iplist they contain is built at init() time so as to avoid numerous file reads. Note: Users of this class should make sure the init() is called before calling any other method to ensure the config is loaded before accessing other convenience methods.- Version:
- $Id: $
- Author:
- James Zuo , Mike Davidson , Sowmya Nataraj , OpenNMS
-
-
Constructor Summary
Constructors Constructor Description RWSConfigFactory(long currentVersion, InputStream stream)
Constructor for RWSConfigFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RWSConfig
getInstance()
Return the singleton instance of this factory.static void
init()
Load the config from the default config file and create the singleton instance of this factory.protected void
saveXml(String xml)
Reload the config from the default config filestatic void
setInstance(RWSConfig instance)
setInstancevoid
update()
update-
Methods inherited from class org.opennms.netmgt.config.RWSConfigManager
getBase, getBaseUrl, getConfiguration, getNextStandBy, getNextStandbyUrl, getReadLock, getStandBy, getStandbyUrls, getWriteLock, hasStandbyUrl, reloadXML
-
-
-
-
Constructor Detail
-
RWSConfigFactory
public RWSConfigFactory(long currentVersion, InputStream stream) throws IOException
Constructor for RWSConfigFactory.
- Parameters:
currentVersion
- a long.stream
- aInputStream
object.- Throws:
IOException
- if any.
-
-
Method Detail
-
init
public static void init() throws IOException
Load the config from the default config file and create the singleton instance of this factory.- Throws:
IOException
- Thrown if the specified config file cannot be readIOException
- if any.
-
getInstance
public static RWSConfig getInstance()
Return the singleton instance of this factory.- Returns:
- The current factory instance.
- Throws:
IllegalStateException
- Thrown if the factory has not yet been initialized.
-
setInstance
public static void setInstance(RWSConfig instance)
setInstance
- Parameters:
instance
- aRWSConfig
object.
-
saveXml
protected void saveXml(String xml) throws IOException
Reload the config from the default config file- Parameters:
xml
- aString
object.- Throws:
IOException
- Thrown if the specified config file cannot be read/loadedIOException
- if any.
-
update
public void update() throws IOException
update
- Throws:
IOException
- if any.
-
-