org.opennms.netmgt.config
Class ThreshdConfigManager

java.lang.Object
  extended by org.opennms.netmgt.config.ThreshdConfigManager
Direct Known Subclasses:
ThreshdConfigFactory

public abstract class ThreshdConfigManager
extends Object

Author:
mhuot

Field Summary
protected  ThreshdConfiguration m_config
          The config class loaded from the config file
protected  String m_localServer
          The name of the local OpenNMS server
protected  boolean m_verifyServer
          A boolean flag to indicate If a filter rule against the local OpenNMS server has to be used.
 
Constructor Summary
ThreshdConfigManager(Reader rdr, String localServer, boolean verifyServer)
           
 
Method Summary
protected  void createPackageIpListMap()
          This method is used to establish package against an iplist iplist mapping, with which, the iplist is selected per package via the configured filter rules from the database.
protected  void createUrlIpMap()
          Go through the configuration and build a mapping of each configured URL to a list of IPs configured in that URL - done at init() time so that repeated file reads can be avoided
 ThreshdConfiguration getConfiguration()
          Return the threshd configuration object.
 Package getPackage(String name)
           
 boolean interfaceInPackage(String iface, Package pkg)
          This method is used to determine if the named interface is included in the passed package definition.
 void rebuildPackageIpListMap()
          This nethod is used to rebuild the package agaist iplist mapping when needed.
abstract  void reloadXML()
           
 void saveCurrent()
          Saves the current in-memory configuration to disk and reloads
protected abstract  void saveXML(String xmlString)
           
 boolean serviceInPackageAndEnabled(String svcName, Package pkg)
          Returns true if the service is part of the package and the status of the service is set to "on".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_config

protected ThreshdConfiguration m_config
The config class loaded from the config file


m_verifyServer

protected boolean m_verifyServer
A boolean flag to indicate If a filter rule against the local OpenNMS server has to be used.


m_localServer

protected String m_localServer
The name of the local OpenNMS server

Constructor Detail

ThreshdConfigManager

public ThreshdConfigManager(Reader rdr,
                            String localServer,
                            boolean verifyServer)
                     throws org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
Method Detail

createUrlIpMap

protected void createUrlIpMap()
Go through the configuration and build a mapping of each configured URL to a list of IPs configured in that URL - done at init() time so that repeated file reads can be avoided


createPackageIpListMap

protected void createPackageIpListMap()
This method is used to establish package against an iplist iplist mapping, with which, the iplist is selected per package via the configured filter rules from the database.


rebuildPackageIpListMap

public void rebuildPackageIpListMap()
This nethod is used to rebuild the package agaist iplist mapping when needed. When a node gained service event occurs, threshd 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 threshd could know which package this ip/service pair is in.


saveCurrent

public void saveCurrent()
                 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

reloadXML

public abstract void reloadXML()
                        throws IOException,
                               org.exolab.castor.xml.MarshalException,
                               org.exolab.castor.xml.ValidationException
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

saveXML

protected abstract void saveXML(String xmlString)
                         throws IOException
Throws:
IOException

getConfiguration

public ThreshdConfiguration getConfiguration()
Return the threshd configuration object.


getPackage

public Package getPackage(String name)

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.

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.

serviceInPackageAndEnabled

public boolean serviceInPackageAndEnabled(String svcName,
                                          Package pkg)
Returns true if the service is part of the package and the status of the service is set to "on". Returns false if the service is not in the package or it is but the status of the service is set to "off".

Parameters:
svcName - The service name to lookup.
pkg - The package to lookup up service.


Copyright © 2009. All Rights Reserved.