org.opennms.netmgt.config
Class LinkdConfigManager

java.lang.Object
  extended by org.opennms.netmgt.config.LinkdConfigManager
All Implemented Interfaces:
LinkdConfig
Direct Known Subclasses:
LinkdConfigFactory

public abstract class LinkdConfigManager
extends Object
implements LinkdConfig

Author:
Antonio Russo

Field Summary
protected static LinkdConfiguration m_config
          Object containing all Linkd-configuration objects parsed from the xml file
 
Constructor Summary
LinkdConfigManager(Reader reader)
           
 
Method Summary
 boolean autoDiscovery()
           
 void createPackageIpListMap()
          This method is used to establish package agaist iplist mapping, with which, the iplist is selected per package via the configured filter rules from the database.
 boolean enableDiscoveryDownload()
           
 boolean enableVlanDiscovery()
           
 Enumeration enumeratePackage()
           
 List<String> getAllPackageMatches(String ipaddr)
          Returns a list of package names that the ip belongs to, null if none.
 String getClassName(String sysoid)
           
 LinkdConfiguration getConfiguration()
          Return the linkd configuration object.
 DiscoveryLink getDiscoveryLink(String pkgName)
           
 long getDiscoveryLinkInterval()
           
 Package getFirstPackageMatch(String ipaddr)
          Returns the first package that the ip belongs to, null if none.
 long getInitialSleepTime()
           
 List<String> getIpList(Package pkg)
          Determine the list of IPs the filter rule for this package allows
 Package getPackage(String name)
           
 SnmpCollection getSnmpCollection(String ipaddr, String sysoid, String pkgName)
           
 List<SnmpCollection> getSnmpCollections(String ipaddr, String sysoid)
           
 long getSnmpPollInterval()
           
 int getThreads()
           
 boolean hasClassName(String sysoid)
           
 boolean interfaceInPackage(String iface, Package pkg)
          This method is used to determine if the named interface is included in the passed package definition.
 boolean interfaceInPackageRange(String iface, Package pkg)
          This method is used to determine if the named interface is included in the passed package definition.
protected  void reloadXML(Reader reader)
           
 void save()
          Saves the current in-memory configuration to disk and reloads
 boolean saveRouteTable()
           
 boolean saveStpInterfaceTable()
           
 boolean saveStpNodeTable()
           
protected abstract  void saveXml(String xml)
           
abstract  void update()
           
 boolean useBridgeDiscovery()
           
 boolean useCdpDiscovery()
           
 boolean useIpRouteDiscovery()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_config

protected static LinkdConfiguration m_config
Object containing all Linkd-configuration objects parsed from the xml file

Constructor Detail

LinkdConfigManager

public LinkdConfigManager(Reader reader)
                   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 LinkdConfig
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

saveXml

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

getPackage

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

createPackageIpListMap

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

Specified by:
createPackageIpListMap in interface LinkdConfig

getIpList

public List<String> getIpList(Package pkg)
Description copied from interface: LinkdConfig
Determine the list of IPs the filter rule for this package allows

Specified by:
getIpList in interface LinkdConfig
Returns:

useIpRouteDiscovery

public boolean useIpRouteDiscovery()
Specified by:
useIpRouteDiscovery in interface LinkdConfig

saveRouteTable

public boolean saveRouteTable()
Specified by:
saveRouteTable in interface LinkdConfig

useCdpDiscovery

public boolean useCdpDiscovery()
Specified by:
useCdpDiscovery in interface LinkdConfig

useBridgeDiscovery

public boolean useBridgeDiscovery()
Specified by:
useBridgeDiscovery in interface LinkdConfig

saveStpNodeTable

public boolean saveStpNodeTable()
Specified by:
saveStpNodeTable in interface LinkdConfig

enableDiscoveryDownload

public boolean enableDiscoveryDownload()
Specified by:
enableDiscoveryDownload in interface LinkdConfig

saveStpInterfaceTable

public boolean saveStpInterfaceTable()
Specified by:
saveStpInterfaceTable in interface LinkdConfig

getInitialSleepTime

public long getInitialSleepTime()
Specified by:
getInitialSleepTime in interface LinkdConfig

getSnmpPollInterval

public long getSnmpPollInterval()
Specified by:
getSnmpPollInterval in interface LinkdConfig

getDiscoveryLinkInterval

public long getDiscoveryLinkInterval()
Specified by:
getDiscoveryLinkInterval in interface LinkdConfig

getThreads

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

getConfiguration

public LinkdConfiguration getConfiguration()
Return the linkd configuration object.

Specified by:
getConfiguration in interface LinkdConfig

autoDiscovery

public boolean autoDiscovery()
Specified by:
autoDiscovery in interface LinkdConfig
Returns:
boolean auto-discovery

enableVlanDiscovery

public boolean enableVlanDiscovery()
Specified by:
enableVlanDiscovery in interface LinkdConfig
Returns:
boolean enable-vlan-discovery

getClassName

public String getClassName(String sysoid)
Specified by:
getClassName in interface LinkdConfig

hasClassName

public boolean hasClassName(String sysoid)
Specified by:
hasClassName in interface LinkdConfig

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 LinkdConfig
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.

interfaceInPackageRange

public boolean interfaceInPackageRange(String iface,
                                       Package pkg)
Description copied from interface: LinkdConfig
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:
interfaceInPackageRange in interface LinkdConfig
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.

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

Specified by:
save in interface LinkdConfig
Throws:
org.exolab.castor.xml.MarshalException
IOException
org.exolab.castor.xml.ValidationException

getSnmpCollections

public List<SnmpCollection> getSnmpCollections(String ipaddr,
                                               String sysoid)
Specified by:
getSnmpCollections in interface LinkdConfig

getSnmpCollection

public SnmpCollection getSnmpCollection(String ipaddr,
                                        String sysoid,
                                        String pkgName)
Specified by:
getSnmpCollection in interface LinkdConfig

getFirstPackageMatch

public Package getFirstPackageMatch(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:
getFirstPackageMatch in interface LinkdConfig
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 LinkdConfig
Parameters:
ipaddr - the interface to check
Returns:
a list of package names that the ip belongs to, null if none

enumeratePackage

public Enumeration enumeratePackage()
Specified by:
enumeratePackage in interface LinkdConfig

getDiscoveryLink

public DiscoveryLink getDiscoveryLink(String pkgName)
Specified by:
getDiscoveryLink in interface LinkdConfig


Copyright © 2009. All Rights Reserved.