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

Abstract LinkdConfigManager class.

Version:
$Id: $
Author:
Antonio Russo

Field Summary
protected static LinkdConfiguration m_config
          Object containing all Linkd-configuration objects parsed from the XML file
 
Constructor Summary
LinkdConfigManager(InputStream stream)
          Constructor for LinkdConfigManager.
LinkdConfigManager(Reader reader)
          Deprecated. 
 
Method Summary
 boolean autoDiscovery()
          autoDiscovery
 void createPackageIpListMap()
          This method is used to establish package against IP list mapping, with which, the IP list is selected per package via the configured filter rules from the database.
 boolean enableDiscoveryDownload()
          enableDiscoveryDownload
 boolean enableVlanDiscovery()
          enableVlanDiscovery
 Enumeration<Package> enumeratePackage()
          enumeratePackage
 boolean forceIpRouteDiscoveryOnEthernet()
           
 List<String> getAllPackageMatches(String ipaddr)
          Returns true if the ip is part of atleast one package.
 LinkdConfiguration getConfiguration()
          Return the linkd configuration object.
 String getDefaultIpRouteClassName()
          
 long getDiscoveryLinkInterval()
          getDiscoveryLinkInterval
 Package getFirstPackageMatch(String ipaddr)
          Returns the first package that the ip belongs to, null if none.
 long getInitialSleepTime()
          getInitialSleepTime
 List<String> getIpList(Package pkg)
          Determine the list of IPs the filter rule for this package allows
 String getIpRouteClassName(String sysoid)
          
 Package getPackage(String name)
          getPackage
 long getSnmpPollInterval()
          getSnmpPollInterval
 int getThreads()
          getThreads
 String getVlanClassName(String sysoid)
          getVlanClassName
 boolean hasClassName(String sysoid)
          hasClassName
 boolean hasIpRouteClassName(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)
          interfaceInPackageRange
protected  void reloadXML(InputStream stream)
          reloadXML
protected  void reloadXML(Reader reader)
          Deprecated. 
 void save()
          Saves the current in-memory configuration to disk and reloads
 boolean saveRouteTable()
          saveRouteTable
 boolean saveStpInterfaceTable()
          saveStpInterfaceTable
 boolean saveStpNodeTable()
          saveStpNodeTable
protected abstract  void saveXml(String xml)
          saveXml
abstract  void update()
          update
 boolean useBridgeDiscovery()
          useBridgeDiscovery
 boolean useCdpDiscovery()
          useCdpDiscovery
 boolean useIpRouteDiscovery()
          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

@Deprecated
public LinkdConfigManager(Reader reader)
                   throws org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException,
                          IOException
Deprecated. 

Constructor for LinkdConfigManager.

Parameters:
reader - a Reader object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.

LinkdConfigManager

public LinkdConfigManager(InputStream stream)
                   throws org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException,
                          IOException

Constructor for LinkdConfigManager.

Parameters:
stream - a InputStream object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.
Method Detail

update

public abstract void update()
                     throws IOException,
                            org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException

update

Specified by:
update in interface LinkdConfig
Throws:
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

saveXml

protected abstract void saveXml(String xml)
                         throws IOException

saveXml

Parameters:
xml - a String object.
Throws:
IOException - if any.

getPackage

public Package getPackage(String name)

getPackage

Specified by:
getPackage in interface LinkdConfig
Parameters:
name - a String object.
Returns:
a Package object.

createPackageIpListMap

public void createPackageIpListMap()
This method is used to establish package against IP list mapping, with which, the IP list 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)
Determine the list of IPs the filter rule for this package allows

Specified by:
getIpList in interface LinkdConfig
Parameters:
pkg - a Package object.
Returns:
a List object.

useIpRouteDiscovery

public boolean useIpRouteDiscovery()

useIpRouteDiscovery

Specified by:
useIpRouteDiscovery in interface LinkdConfig
Returns:
a boolean.

saveRouteTable

public boolean saveRouteTable()

saveRouteTable

Specified by:
saveRouteTable in interface LinkdConfig
Returns:
a boolean.

useCdpDiscovery

public boolean useCdpDiscovery()

useCdpDiscovery

Specified by:
useCdpDiscovery in interface LinkdConfig
Returns:
a boolean.

useBridgeDiscovery

public boolean useBridgeDiscovery()

useBridgeDiscovery

Specified by:
useBridgeDiscovery in interface LinkdConfig
Returns:
a boolean.

saveStpNodeTable

public boolean saveStpNodeTable()

saveStpNodeTable

Specified by:
saveStpNodeTable in interface LinkdConfig
Returns:
a boolean.

enableDiscoveryDownload

public boolean enableDiscoveryDownload()

enableDiscoveryDownload

Specified by:
enableDiscoveryDownload in interface LinkdConfig
Returns:
a boolean.

saveStpInterfaceTable

public boolean saveStpInterfaceTable()

saveStpInterfaceTable

Specified by:
saveStpInterfaceTable in interface LinkdConfig
Returns:
a boolean.

getInitialSleepTime

public long getInitialSleepTime()
Description copied from interface: LinkdConfig

getInitialSleepTime

Specified by:
getInitialSleepTime in interface LinkdConfig
Returns:
a long.

getSnmpPollInterval

public long getSnmpPollInterval()
Description copied from interface: LinkdConfig

getSnmpPollInterval

Specified by:
getSnmpPollInterval in interface LinkdConfig
Returns:
a long.

getDiscoveryLinkInterval

public long getDiscoveryLinkInterval()
Description copied from interface: LinkdConfig

getDiscoveryLinkInterval

Specified by:
getDiscoveryLinkInterval in interface LinkdConfig
Returns:
a long.

getThreads

public int getThreads()

getThreads

Specified by:
getThreads in interface LinkdConfig
Returns:
a int.

getConfiguration

public LinkdConfiguration getConfiguration()
Return the linkd configuration object.

Specified by:
getConfiguration in interface LinkdConfig
Returns:
a LinkdConfiguration object.

autoDiscovery

public boolean autoDiscovery()
Description copied from interface: LinkdConfig

autoDiscovery

Specified by:
autoDiscovery in interface LinkdConfig
Returns:
a boolean.

enableVlanDiscovery

public boolean enableVlanDiscovery()
Description copied from interface: LinkdConfig

enableVlanDiscovery

Specified by:
enableVlanDiscovery in interface LinkdConfig
Returns:
a boolean.

getIpRouteClassName

public String getIpRouteClassName(String sysoid)

Specified by:
getIpRouteClassName in interface LinkdConfig

getDefaultIpRouteClassName

public String getDefaultIpRouteClassName()

Specified by:
getDefaultIpRouteClassName in interface LinkdConfig

getVlanClassName

public String getVlanClassName(String sysoid)

getVlanClassName

Specified by:
getVlanClassName in interface LinkdConfig
Parameters:
sysoid - a String object.
Returns:
a String object.

hasIpRouteClassName

public boolean hasIpRouteClassName(String sysoid)

Specified by:
hasIpRouteClassName in interface LinkdConfig

hasClassName

public boolean hasClassName(String sysoid)

hasClassName

Specified by:
hasClassName in interface LinkdConfig
Parameters:
sysoid - a String object.
Returns:
a boolean.

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)

interfaceInPackageRange

Specified by:
interfaceInPackageRange in interface LinkdConfig
Parameters:
iface - a String object.
pkg - a org$opennms$netmgt$config$linkd$Package object.
Returns:
a boolean.

reloadXML

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

reloadXML

Parameters:
reader - a Reader object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.

reloadXML

protected void reloadXML(InputStream stream)
                  throws org.exolab.castor.xml.MarshalException,
                         org.exolab.castor.xml.ValidationException,
                         IOException

reloadXML

Parameters:
stream - a InputStream object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.

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 - if any.
IOException - if any.
org.exolab.castor.xml.ValidationException - if any.

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. 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 already 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 true if the ip is part of atleast one package. Note: Evaluation of the interface against a package filter will only work if the IP is alrady in the database. 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 already in the database.

Specified by:
getAllPackageMatches in interface LinkdConfig
Parameters:
ipaddr - a String object.
Returns:
true if the ip is part of atleast one package, false otherwise

enumeratePackage

public Enumeration<Package> enumeratePackage()

enumeratePackage

Specified by:
enumeratePackage in interface LinkdConfig
Returns:
a Enumeration object.

forceIpRouteDiscoveryOnEthernet

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


Copyright © 2011. All Rights Reserved.