OpenNMS API 1.2.9

## org.opennms.netmgt.trapd
Class TrapdIPMgr

    java.lang.Object
      org.opennms.netmgt.trapd.TrapdIPMgr

final class TrapdIPMgr
extends java.lang.Object

This class represents a singular instance that is used to map trap IP addresses to known nodes.

Author:
  Brian Weaver , Tarus Balog , OpenNMS

Field Summary
`private static java.lang.String` `IP_LOAD_SQL` The SQL statement used to extract the list of currently known IP addresses and their node IDs from the IP Interface table.
`private static java.util.Map` `m_knownips` A Map of IP addresses and node IDs

Constructor Summary
`private` `TrapdIPMgr()` Default construct for the instance.

Method Summary
`(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 java.lang.String` `getNodeId(java.lang.String addr)` Returns the nodeid for the IP Address
`(package private) static java.lang.String` `removeNodeId(java.lang.String addr)` Removes an address from the node ID map.
`(package private) static java.lang.String` `setNodeId(java.lang.String addr, java.lang.String nodeid)` Sets the IP Address and Node ID in the Map.

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 and their node IDs from the IP Interface table.

  See Also:
    Constant Field Values

### m_knownips

    private static java.util.Map m_knownips

  A Map of IP addresses and node IDs

Constructor Detail

### TrapdIPMgr

    private TrapdIPMgr()

  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.

### getNodeId

    static java.lang.String getNodeId(java.lang.String addr)

  Returns the nodeid for the IP Address

  Parameters:
    `addr` - The IP Address to query.
  Returns:
    The node ID of the IP Address if known.

### setNodeId

    static java.lang.String setNodeId(java.lang.String addr,
                                      java.lang.String nodeid)

  Sets the IP Address and Node ID in the Map.

  Parameters:
    `addr` - The IP Address to add.
    `nodeid` - The Node ID to add.
  Returns:
    The nodeid if it existed in the map.

### removeNodeId

    static java.lang.String removeNodeId(java.lang.String addr)

  Removes an address from the node ID map.

  Parameters:
    `addr` - The address to remove from the node ID map.
  Returns:
    The nodeid that was in the map.

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.