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 PollerConfiggetInstance()Return the singleton instance of this factory.static voidinit()Load the config from the default config file and create the singleton instance of this factory.static voidreload()Reload the config from the default config fileprotected voidsaveXml(java.lang.String xml)saveXmlstatic voidsetInstance(PollerConfig instance)setInstancestatic voidsetPollerConfigFile(java.io.File pollerConfigFile)voidupdate()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.IOExceptionLoad 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.IOExceptionReload 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- aPollerConfigobject.
-
saveXml
protected void saveXml(java.lang.String xml) throws java.io.IOExceptionsaveXml
- Specified by:
saveXmlin classPollerConfigManager- Parameters:
xml- aStringobject.- Throws:
java.io.IOException- if any.
-
update
public void update() throws java.io.IOExceptionupdate
- Specified by:
updatein interfacePollerConfig- Overrides:
updatein classPollerConfigManager- Throws:
java.io.IOException- if any.
-
-