OpenNMS API 1.2.3

org.opennms.netmgt.capsd
Class KnownIPMgr

java.lang.Object
  extended byorg.opennms.netmgt.capsd.KnownIPMgr

final class KnownIPMgr
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 KnownIPMgr.AddrComparator
          This class implements the Comparator interface and provides the infomation required for a Tree to be sorted.
(package private) static class KnownIPMgr.IPInterface
          This class is used to encapsulate the elements of importants from the IP interface table in the OpenNMS database.
 
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.lang.String IP_UPDATE_TIME_SQL
          The SQL statment used to update the last capabilities check time.
private static java.util.Map m_known
          The set of all discovered addresses
 
Constructor Summary
private KnownIPMgr()
          Default construct for the instance.
 
Method Summary
(package private) static boolean addKnown(java.net.InetAddress addr)
          Adds a new address to the list of discovered address.
(package private) static boolean addKnown(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 isKnown(java.net.InetAddress addr)
          Returns true if the node has been discovered and added to the discovered IP manager.
(package private) static boolean isKnown(java.lang.String ipAddr)
          Returns true if the node has been discovered and added to the discovered IP manager.
(package private) static java.net.InetAddress[] knownSet()
          Returns the current snapshot set of all the known internet addresses in the set of known nodes.
 
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

IP_UPDATE_TIME_SQL

private static final java.lang.String IP_UPDATE_TIME_SQL
The SQL statment used to update the last capabilities check time.

See Also:
Constant Field Values

m_known

private static java.util.Map m_known
The set of all discovered addresses

Constructor Detail

KnownIPMgr

private KnownIPMgr()
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.util.MissingResourceException - Thrown if the method cannot find the database configuration file.
java.sql.SQLException - Thrown if the connection cannot be created or a database error occurs.

isKnown

static boolean isKnown(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.

isKnown

static boolean isKnown(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

addKnown

static boolean addKnown(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.

addKnown

static boolean addKnown(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

knownSet

static java.net.InetAddress[] knownSet()
Returns the current snapshot set of all the known internet addresses in the set of known nodes.

Returns:
The arrry of all currently known InetAddress objects.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.