Package org.opennms.netmgt.config
Class PollerConfigFactory
- java.lang.Object
-
- org.opennms.netmgt.config.PollerConfigManager
-
- org.opennms.netmgt.config.PollerConfigFactory
-
- All Implemented Interfaces:
PathOutageConfig
,PollerConfig
public final class PollerConfigFactory extends PollerConfigManager
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.- Author:
- James Zuo , Mike Davidson , Sowmya Nataraj , OpenNMS
-
-
Field Summary
-
Fields inherited from class org.opennms.netmgt.config.PollerConfigManager
m_config
-
-
Constructor Summary
Constructors Constructor Description PollerConfigFactory(long currentVersion, java.io.InputStream stream)
Constructor for PollerConfigFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PollerConfig
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.static void
reload()
Reload the config from the default config fileprotected void
saveXml(java.lang.String xml)
saveXmlstatic void
setInstance(PollerConfig instance)
setInstancestatic void
setPollerConfigFile(java.io.File pollerConfigFile)
void
update()
update-
Methods inherited from class org.opennms.netmgt.config.PollerConfigManager
addMonitor, addPackage, enumeratePackage, getAllPackageMatches, getConfiguration, getCriticalService, getDefaultCriticalPathIp, getDefaultCriticalPathRetries, getDefaultCriticalPathTimeout, getFirstLocalPackageMatch, getIpList, getNextOutageIdSql, getPackage, getPackages, getReadLock, getRRAList, getServiceInPackage, getServiceMonitor, getServiceMonitorLocators, getServiceMonitorNames, getServiceMonitorRegistry, getServiceMonitors, getServiceSelectorForPackage, getStep, getThreads, getWriteLock, isInterfaceInPackage, isNodeOutageProcessingEnabled, isPathOutageEnabled, isPolled, isPolled, isPolled, isPolledLocally, isPolledLocally, isServiceInPackageAndEnabled, isServiceMonitored, isServiceUnresponsiveEnabled, parameters, rebuildPackageIpListMap, save, setUpInternalData, shouldPollAllIfNoCriticalServiceDefined
-
-
-
-
Method Detail
-
setPollerConfigFile
public static void setPollerConfigFile(java.io.File pollerConfigFile) throws java.io.IOException
- Throws:
java.io.IOException
-
init
public static void init() throws java.io.IOException
Load the config from the default config file and create the singleton instance of this factory.- Throws:
java.io.IOException
- Thrown if the specified config file cannot be readjava.io.IOException
- if any.
-
reload
public static void reload() throws java.io.IOException
Reload the config from the default config file- Throws:
java.io.IOException
- Thrown if the specified config file cannot be read/loadedjava.io.IOException
- if any.
-
getInstance
public static PollerConfig getInstance()
Return the singleton instance of this factory.- Returns:
- The current factory instance.
- Throws:
java.lang.IllegalStateException
- Thrown if the factory has not yet been initialized.
-
setInstance
public static void setInstance(PollerConfig instance)
setInstance
- Parameters:
instance
- aPollerConfig
object.
-
saveXml
protected void saveXml(java.lang.String xml) throws java.io.IOException
saveXml
- Specified by:
saveXml
in classPollerConfigManager
- Parameters:
xml
- aString
object.- Throws:
java.io.IOException
- if any.
-
update
public void update() throws java.io.IOException
update
- Specified by:
update
in interfacePollerConfig
- Overrides:
update
in classPollerConfigManager
- Throws:
java.io.IOException
- if any.
-
-