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
static String DEFAULT_IP_ROUTE_CLASS_NAME
           
protected static LinkdConfiguration m_config
          Object containing all Linkd-configuration objects parsed from the XML file
 
Constructor Summary
LinkdConfigManager(InputStream stream)
          Constructor for LinkdConfigManager.
 
Method Summary
 boolean enableDiscoveryDownload()
          enableDiscoveryDownload
 Enumeration<Package> enumeratePackage()
          enumeratePackage
 boolean forceIpRouteDiscoveryOnEthernet()
           
 List<String> getAllPackageMatches(InetAddress ipaddr)
          Returns true if the IP is part of at least one package.
 LinkdConfiguration getConfiguration()
          Return the linkd configuration object.
 String getDefaultIpRouteClassName()
          
 long getDiscoveryLinkInterval()
          getDiscoveryLinkInterval
 Package getFirstPackageMatch(InetAddress ipaddr)
          Returns the first package that the ip belongs to, null if none.
 long getInitialSleepTime()
          getInitialSleepTime
 List<InetAddress> getIpList(Package pkg)
          Determine the list of IPs the filter rule for this package allows
 String getIpRouteClassName(String sysoid)
          
 Package getPackage(String name)
          getPackage
 Lock getReadLock()
           
 long getSnmpPollInterval()
          getSnmpPollInterval
 int getThreads()
          getThreads
 String getVlanClassName(String sysoid)
          getVlanClassName
 Lock getWriteLock()
           
 boolean hasClassName(String sysoid)
          hasClassName
 boolean hasIpRouteClassName(String sysoid)
          
 boolean isAutoDiscoveryEnabled()
          Whether autodiscovery is enabled in linkd-config (default: false)
 boolean isInterfaceInPackage(InetAddress iface, Package pkg)
          This method is used to determine if the named interface is included in the passed package definition.
 boolean isInterfaceInPackageRange(InetAddress iface, Package pkg)
          This method is used to determine if the named interface is included in the passed package definition.
 boolean isVlanDiscoveryEnabled()
          Whether vlan discovery is enabled in linkd-config (default: true)
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
 void updatePackageIpListMap()
          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 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

DEFAULT_IP_ROUTE_CLASS_NAME

public static final String DEFAULT_IP_ROUTE_CLASS_NAME
See Also:
Constant Field Values

m_config

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

Constructor Detail

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

getReadLock

public Lock getReadLock()
Specified by:
getReadLock in interface LinkdConfig

getWriteLock

public Lock getWriteLock()
Specified by:
getWriteLock in interface LinkdConfig

isAutoDiscoveryEnabled

public boolean isAutoDiscoveryEnabled()
Whether autodiscovery is enabled in linkd-config (default: false)

Specified by:
isAutoDiscoveryEnabled in interface LinkdConfig

isVlanDiscoveryEnabled

public boolean isVlanDiscoveryEnabled()
Whether vlan discovery is enabled in linkd-config (default: true)

Specified by:
isVlanDiscoveryEnabled in interface LinkdConfig

isInterfaceInPackage

public boolean isInterfaceInPackage(InetAddress 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:
isInterfaceInPackage 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.

isInterfaceInPackageRange

public boolean isInterfaceInPackageRange(InetAddress 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:
isInterfaceInPackageRange 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.

enumeratePackage

public Enumeration<Package> enumeratePackage()

enumeratePackage

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

getConfiguration

public LinkdConfiguration getConfiguration()
Return the linkd configuration object.

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

getPackage

public Package getPackage(String name)

getPackage

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

getIpList

public List<InetAddress> 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.

getIpRouteClassName

public String getIpRouteClassName(String sysoid)

Specified by:
getIpRouteClassName 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.

getFirstPackageMatch

public Package getFirstPackageMatch(InetAddress 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(InetAddress ipaddr)
Returns true if the IP is part of at least one package. Note: Evaluation of the interface against a package filter will only work if the IP is already 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 at least one package, false otherwise

hasClassName

public boolean hasClassName(String sysoid)

hasClassName

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

getDefaultIpRouteClassName

public String getDefaultIpRouteClassName()

Specified by:
getDefaultIpRouteClassName in interface LinkdConfig

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.

updatePackageIpListMap

public void updatePackageIpListMap()
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:
updatePackageIpListMap in interface LinkdConfig

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.

hasIpRouteClassName

public boolean hasIpRouteClassName(String sysoid)

Specified by:
hasIpRouteClassName in interface LinkdConfig

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.

saveXml

protected abstract void saveXml(String xml)
                         throws IOException

saveXml

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

forceIpRouteDiscoveryOnEthernet

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


Copyright © 2011. All Rights Reserved.