OpenNMS API 1.2.3

org.opennms.netmgt.discovery
Class DiscoveredIPMgr

java.lang.Object
  extended byorg.opennms.netmgt.discovery.DiscoveredIPMgr

final class DiscoveredIPMgr
extends java.lang.Object

This class represents a singular instance that is used to check address to determine their pollablility. If the address has already been discovered or is part of the exclude list then the manager can be used to check.

Author:
Brian Weaver , OpenNMS

Nested Class Summary
(package private) static class DiscoveredIPMgr.AddrComparator
          This class implements the Comparator interface and provides the infomation required for a Tree to be sorted.
 
Field Summary
private static java.lang.String IP_LOAD_SQL
          The SQL statement used to extract the list of currently known IP addresses from the IP Interface table.
private static java.util.Set m_discovered
          The set of all discovered addresses
private static ExcludeRange[] m_excluded
          The list of all excluded ranges.
private static java.util.List m_specifics
          The list of specific addresses.
 
Constructor Summary
private DiscoveredIPMgr()
          Default construct for the instance.
 
Method Summary
(package private) static boolean addDiscovered(java.net.InetAddress addr)
          Adds a new address to the list of discovered address.
(package private) static boolean addDiscovered(java.lang.String addr)
          Adds a new address to the list of discovered address.
(package private) static void dataSourceSync()
          Clears and synchronizes the internal known IP address cache with the current information contained in the database.
(package private) static boolean isDiscovered(java.net.InetAddress addr)
          Returns true if the node has been discovered and added to the discovered IP manager.
(package private) static boolean isDiscovered(java.lang.String ipAddr)
          Returns true if the node has been discovered and added to the discovered IP manager.
(package private) static boolean isDiscoveredOrExcluded(java.net.InetAddress addr)
          Returns true if the passed address is either excluded or has already been discovered.
(package private) static boolean isDiscoveredOrExcluded(java.lang.String addr)
          Returns true if the passed address is either excluded or has already been discovered.
(package private) static boolean isExcluded(java.net.InetAddress addr)
          Returns true if the passed address is included in the range of addresses to be skipped and is not contained within the specifcs address list (which takes precedence over the exclude ranges.
(package private) static boolean isExcluded(java.lang.String ipAddr)
          Returns true if the passed address is included in the range of addresses to be skipped.
(package private) static boolean removeDiscovered(java.net.InetAddress addr)
          Removes an address from the list of discovered address.
(package private) static boolean removeDiscovered(java.lang.String addr)
          Removes an address from the list of discovered address.
(package private) static void setExclusionList(ExcludeRange[] ranges)
          Set the exclusion list used to determine if an IP Address has been excluded.
(package private) static void setSpecificsList(java.util.List specifics)
          Set the specifics list used to determine if an IP Address has been excluded (& not specifically included).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IP_LOAD_SQL

private static final java.lang.String IP_LOAD_SQL
The SQL statement used to extract the list of currently known IP addresses from the IP Interface table.

See Also:
Constant Field Values

m_discovered

private static java.util.Set m_discovered
The set of all discovered addresses


m_excluded

private static ExcludeRange[] m_excluded
The list of all excluded ranges.


m_specifics

private static java.util.List m_specifics
The list of specific addresses. Specific addresses take precedence over the exclude ranges.

Constructor Detail

DiscoveredIPMgr

private DiscoveredIPMgr()
Default construct for the instance. This constructor always throws an exception to the caller.

Throws:
java.lang.UnsupportedOperationException - Always thrown.
Method Detail

dataSourceSync

static void dataSourceSync()
                    throws java.sql.SQLException
Clears and synchronizes the internal known IP address cache with the current information contained in the database. To synchronize the cache the method opens a new connection to the database, loads the address, and then closes it's connection.

Throws:
java.sql.SQLException - Thrown if the connection cannot be created or a database error occurs.

setExclusionList

static void setExclusionList(ExcludeRange[] ranges)
Set the exclusion list used to determine if an IP Address has been excluded.

Parameters:
ranges - The list of excluded ranges

setSpecificsList

static void setSpecificsList(java.util.List specifics)
Set the specifics list used to determine if an IP Address has been excluded (& not specifically included).

Parameters:
specifics - The list of specific addresses

isDiscovered

static boolean isDiscovered(java.net.InetAddress addr)
Returns true if the node has been discovered and added to the discovered IP manager.

Parameters:
addr - The IP Address to query.
Returns:
True if the address is known to the manager.

isDiscovered

static boolean isDiscovered(java.lang.String ipAddr)
                     throws java.net.UnknownHostException
Returns true if the node has been discovered and added to the discovered IP manager. If the address cannot be converted to an java.net.InetAddressInetAddress instance then an exception is generated.

Parameters:
ipAddr - The IP Address to query.
Returns:
True if the address is known to the manager.
Throws:
java.io.UnknownHostException - Thrown if the address name could not be converted.
java.net.UnknownHostException

isExcluded

static boolean isExcluded(java.net.InetAddress addr)
Returns true if the passed address is included in the range of addresses to be skipped and is not contained within the specifcs address list (which takes precedence over the exclude ranges.

Parameters:
addr - The address to check for exclusion
Returns:
True if the address is excluded.

isExcluded

static boolean isExcluded(java.lang.String ipAddr)
                   throws java.net.UnknownHostException
Returns true if the passed address is included in the range of addresses to be skipped.

Parameters:
ipAddr - The address to check for exclusion
Returns:
True if the address is excluded.
Throws:
java.net.UnknownHostException - Thrown if the string address could not be converted to an InetAddress.

isDiscoveredOrExcluded

static boolean isDiscoveredOrExcluded(java.net.InetAddress addr)
Returns true if the passed address is either excluded or has already been discovered.

Parameters:
addr - The address to check
Returns:
True if the address has been discovered or is excluded.
Throws:
java.net.UnknownHostException - Thrown if the address cannot be converted to an InetAddress.

isDiscoveredOrExcluded

static boolean isDiscoveredOrExcluded(java.lang.String addr)
                               throws java.net.UnknownHostException
Returns true if the passed address is either excluded or has already been discovered.

Parameters:
addr - The address to check
Returns:
True if the address has been discovered or is excluded.
Throws:
java.net.UnknownHostException - Thrown if the address cannot be converted to an InetAddress.

addDiscovered

static boolean addDiscovered(java.net.InetAddress addr)
Adds a new address to the list of discovered address.

Parameters:
addr - The address to add to the discovered set.
Returns:
True if the address was not already discovered.

addDiscovered

static boolean addDiscovered(java.lang.String addr)
                      throws java.net.UnknownHostException
Adds a new address to the list of discovered address.

Parameters:
addr - The address to add to the discovered set.
Returns:
True if the address was not already discovered.
Throws:
java.net.UnknownHost - Thrown if the address cannot be converted.
java.net.UnknownHostException

removeDiscovered

static boolean removeDiscovered(java.net.InetAddress addr)
Removes an address from the list of discovered address.

Parameters:
addr - The address to remove from the discovered set.
Returns:
True if the address was already discovered.

removeDiscovered

static boolean removeDiscovered(java.lang.String addr)
                         throws java.net.UnknownHostException
Removes an address from the list of discovered address.

Parameters:
addr - The address to remove from the discovered set.
Returns:
True if the address was already discovered.
Throws:
java.net.UnknownHost - Thrown if the address cannot be converted.
java.net.UnknownHostException

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.