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, 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(String xml)
saveXmlstatic void
setInstance(PollerConfig instance)
setInstancestatic void
setPollerConfigFile(File pollerConfigFile)
void
update()
update-
Methods inherited from class org.opennms.netmgt.config.PollerConfigManager
addMonitor, addPackage, enumeratePackage, getAllPackageMatches, getConfiguration, getConfiguredMonitors, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.netmgt.config.PollerConfig
findPackageForService, findService
-
-
-
-
Constructor Detail
-
PollerConfigFactory
public PollerConfigFactory(long currentVersion, InputStream stream)
Constructor for PollerConfigFactory.
- Parameters:
currentVersion
- a long.stream
- aInputStream
object.
-
-
Method Detail
-
setPollerConfigFile
public static void setPollerConfigFile(File pollerConfigFile) throws IOException
- Throws:
IOException
-
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.
-
reload
public static void reload() throws IOException
Reload the config from the default config file- Throws:
IOException
- Thrown if the specified config file cannot be read/loadedIOException
- if any.
-
getInstance
public static PollerConfig 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(PollerConfig instance)
setInstance
- Parameters:
instance
- aPollerConfig
object.
-
saveXml
protected void saveXml(String xml) throws IOException
saveXml
- Specified by:
saveXml
in classPollerConfigManager
- Parameters:
xml
- aString
object.- Throws:
IOException
- if any.
-
update
public void update() throws IOException
update
- Specified by:
update
in interfacePollerConfig
- Overrides:
update
in classPollerConfigManager
- Throws:
IOException
- if any.
-
-