org.opennms.netmgt.config
Class SnmpInterfacePollerConfigManager

java.lang.Object
  extended by org.opennms.netmgt.config.SnmpInterfacePollerConfigManager
All Implemented Interfaces:
SnmpInterfacePollerConfig
Direct Known Subclasses:
SnmpInterfacePollerConfigFactory

public abstract class SnmpInterfacePollerConfigManager
extends Object
implements SnmpInterfacePollerConfig

Author:
Mathew Brozowski, David Hustace

Constructor Summary
SnmpInterfacePollerConfigManager(Reader reader, String localServer, boolean verifyServer)
           
 
Method Summary
 void addPackage(Package pkg)
           
 Enumeration<Package> enumeratePackage()
           
 List<String> getAllPackageMatches(String ipaddr)
          Returns a list of package names that the ip belongs to, null if none.
 SnmpInterfacePollerConfiguration getConfiguration()
          Return the poller configuration object.
 String[] getCriticalServiceIds()
          This method returns the configured critical service name.
 List<String> getIpList(Package pkg)
           
 Package getPackage(String name)
           
 Package getPackageForAddress(String ipaddr)
          Returns the first package that the ip belongs to, null if none.
 String getService()
           
 int getThreads()
           
 Iterable<String> includeURLs(Package pkg)
           
 boolean interfaceInPackage(String iface, Package pkg)
          This method is used to determine if the named interface is included in the passed package definition.
 Iterable<Package> packages()
           
 void rebuildPackageIpListMap()
          This method is used to rebuild the package agaist iplist mapping when needed.
protected  void reloadXML(Reader reader)
           
 void save()
          Saves the current in-memory configuration to disk and reloads
protected abstract  void saveXml(String xml)
           
 boolean suppressAdminDownEvent()
           
abstract  void update()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpInterfacePollerConfigManager

public SnmpInterfacePollerConfigManager(Reader reader,
                                        String localServer,
                                        boolean verifyServer)
                                 throws org.exolab.castor.xml.MarshalException,
                                        org.exolab.castor.xml.ValidationException,
                                        IOException
Parameters:
reader -
localServer -
verifyServer -
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
Method Detail

update

public abstract void update()
                     throws IOException,
                            org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException
Specified by:
update in interface SnmpInterfacePollerConfig
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

saveXml

protected abstract void saveXml(String xml)
                         throws IOException
Throws:
IOException

reloadXML

protected void reloadXML(Reader reader)
                  throws org.exolab.castor.xml.MarshalException,
                         org.exolab.castor.xml.ValidationException,
                         IOException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException

save

public void save()
          throws org.exolab.castor.xml.MarshalException,
                 IOException,
                 org.exolab.castor.xml.ValidationException
Saves the current in-memory configuration to disk and reloads

Throws:
org.exolab.castor.xml.MarshalException
IOException
org.exolab.castor.xml.ValidationException

getConfiguration

public SnmpInterfacePollerConfiguration getConfiguration()
Return the poller configuration object.


getPackage

public Package getPackage(String name)
Specified by:
getPackage in interface SnmpInterfacePollerConfig

addPackage

public void addPackage(Package pkg)

getCriticalServiceIds

public String[] getCriticalServiceIds()
This method returns the configured critical service name.

Specified by:
getCriticalServiceIds in interface SnmpInterfacePollerConfig
Returns:
the name of the configured critical service, or null if none is present

getIpList

public List<String> getIpList(Package pkg)

rebuildPackageIpListMap

public void rebuildPackageIpListMap()
This method is used to rebuild the package agaist iplist mapping when needed. When a node gained service event occurs, poller has to determine which package the ip/service combination is in, but if the interface is a newly added one, the package iplist should be rebuilt so that poller could know which package this ip/service pair is in.

Specified by:
rebuildPackageIpListMap in interface SnmpInterfacePollerConfig

interfaceInPackage

public boolean interfaceInPackage(String iface,
                                  Package pkg)
This method is used to determine if the named interface is included in the passed package definition. If the interface belongs to the package then a value of true is returned. If the interface does not belong to the package a false value is returned. Note: Evaluation of the interface against a package filter will only work if the IP is already in the database.

Specified by:
interfaceInPackage in interface SnmpInterfacePollerConfig
Parameters:
iface - The interface to test against the package.
pkg - The package to check for the inclusion of the interface.
Returns:
True if the interface is included in the package, false otherwise.

getPackageForAddress

public Package getPackageForAddress(String ipaddr)
Returns the first package that the ip belongs to, null if none. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.

Specified by:
getPackageForAddress in interface SnmpInterfacePollerConfig
Parameters:
ipaddr - the interface to check
Returns:
the first package that the ip belongs to, null if none

getAllPackageMatches

public List<String> getAllPackageMatches(String ipaddr)
Returns a list of package names that the ip belongs to, null if none. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database.

Specified by:
getAllPackageMatches in interface SnmpInterfacePollerConfig
Parameters:
ipaddr - the interface to check
Returns:
a list of package names that the ip belongs to, null if none

enumeratePackage

public Enumeration<Package> enumeratePackage()
Specified by:
enumeratePackage in interface SnmpInterfacePollerConfig

packages

public Iterable<Package> packages()
Specified by:
packages in interface SnmpInterfacePollerConfig

includeURLs

public Iterable<String> includeURLs(Package pkg)

suppressAdminDownEvent

public boolean suppressAdminDownEvent()
Specified by:
suppressAdminDownEvent in interface SnmpInterfacePollerConfig

getThreads

public int getThreads()
Specified by:
getThreads in interface SnmpInterfacePollerConfig

getService

public String getService()
Specified by:
getService in interface SnmpInterfacePollerConfig


Copyright © 2009. All Rights Reserved.