org.opennms.netmgt.trapd
Class HibernateTrapdIpMgr

java.lang.Object
  extended by org.opennms.netmgt.trapd.HibernateTrapdIpMgr
All Implemented Interfaces:
TrapdIpMgr, org.springframework.beans.factory.InitializingBean

public class HibernateTrapdIpMgr
extends Object
implements TrapdIpMgr, org.springframework.beans.factory.InitializingBean

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

Author:
Brian Weaver , Tarus Balog , OpenNMS

Constructor Summary
HibernateTrapdIpMgr()
          Default construct for the instance.
 
Method Summary
 void afterPropertiesSet()
           
 void clearKnownIpsMap()
           
 void dataSourceSync()
          Clears and synchronizes the internal known IP address cache with the current information contained in the database.
 IpInterfaceDao getIpInterfaceDao()
           
 long getNodeId(String addr)
          Returns the nodeid for the IP Address
 long removeNodeId(String addr)
          Removes an address from the node ID map.
 void setIpInterfaceDao(IpInterfaceDao ipInterfaceDao)
           
 long setNodeId(String addr, long 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
 

Constructor Detail

HibernateTrapdIpMgr

public HibernateTrapdIpMgr()
Default construct for the instance.

Method Detail

dataSourceSync

@Transactional(readOnly=true)
public void dataSourceSync()
Description copied from interface: TrapdIpMgr
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.

Specified by:
dataSourceSync in interface TrapdIpMgr

getNodeId

public long getNodeId(String addr)
Description copied from interface: TrapdIpMgr
Returns the nodeid for the IP Address

Specified by:
getNodeId in interface TrapdIpMgr
Parameters:
addr - The IP Address to query.
Returns:
The node ID of the IP Address if known.

setNodeId

public long setNodeId(String addr,
                      long nodeid)
Description copied from interface: TrapdIpMgr
Sets the IP Address and Node ID in the Map.

Specified by:
setNodeId in interface TrapdIpMgr
Parameters:
addr - The IP Address to add.
nodeid - The Node ID to add.
Returns:
The nodeid if it existed in the map.

removeNodeId

public long removeNodeId(String addr)
Description copied from interface: TrapdIpMgr
Removes an address from the node ID map.

Specified by:
removeNodeId in interface TrapdIpMgr
Parameters:
addr - The address to remove from the node ID map.
Returns:
The nodeid that was in the map.

clearKnownIpsMap

public void clearKnownIpsMap()
Specified by:
clearKnownIpsMap in interface TrapdIpMgr

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

getIpInterfaceDao

public IpInterfaceDao getIpInterfaceDao()

setIpInterfaceDao

public void setIpInterfaceDao(IpInterfaceDao ipInterfaceDao)


Copyright © 2009. All Rights Reserved.