Package org.opennms.netmgt.config
Class SnmpInterfacePollerConfigFactory
- java.lang.Object
-
- org.opennms.netmgt.config.SnmpInterfacePollerConfigManager
-
- org.opennms.netmgt.config.SnmpInterfacePollerConfigFactory
-
- All Implemented Interfaces:
SnmpInterfacePollerConfig
public final class SnmpInterfacePollerConfigFactory extends SnmpInterfacePollerConfigManager
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 IP list 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 SnmpInterfacePollerConfigFactory(long currentVersion, InputStream stream)
Constructor for SnmpInterfacePollerConfigFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SnmpInterfacePollerConfig
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(SnmpInterfacePollerConfig instance)
setInstancevoid
update()
update-
Methods inherited from class org.opennms.netmgt.config.SnmpInterfacePollerConfigManager
addPackage, enumeratePackage, getAllPackageMatches, getConfiguration, getCriteria, getCriticalServiceIds, getDownValues, getDownValues, getInterfaceOnPackage, getInterval, getInterval, getIpList, getMaxVarsPerPdu, getPackage, getPackageForAddress, getPackageName, getPort, getRetries, getService, getStatus, getThreads, getTimeout, getUpValues, getUpValues, hasMaxVarsPerPdu, hasPort, hasRetries, hasTimeout, includeURLs, interfaceInPackage, packages, rebuildPackageIpListMap, reloadXML, save, useCriteriaFilters
-
-
-
-
Constructor Detail
-
SnmpInterfacePollerConfigFactory
public SnmpInterfacePollerConfigFactory(long currentVersion, InputStream stream) throws IOException
Constructor for SnmpInterfacePollerConfigFactory.
- 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.
-
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.
-
saveXml
protected void saveXml(String xml) throws IOException
saveXml
- Specified by:
saveXml
in classSnmpInterfacePollerConfigManager
- Parameters:
xml
- aString
object.- Throws:
IOException
- if any.
-
getInstance
public static SnmpInterfacePollerConfig 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(SnmpInterfacePollerConfig instance)
setInstance
- Parameters:
instance
- aSnmpInterfacePollerConfig
object.
-
update
public void update() throws IOException
update
- Specified by:
update
in interfaceSnmpInterfacePollerConfig
- Specified by:
update
in classSnmpInterfacePollerConfigManager
- Throws:
IOException
- if any.
-
-