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()
          afterPropertiesSet
 void clearKnownIpsMap()
          clearKnownIpsMap
 void dataSourceSync()
          dataSourceSync
 IpInterfaceDao getIpInterfaceDao()
          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)
          setIpInterfaceDao
 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()

dataSourceSync

Specified by:
dataSourceSync in interface TrapdIpMgr

getNodeId

public long getNodeId(String addr)
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)
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)
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()

clearKnownIpsMap

Specified by:
clearKnownIpsMap in interface TrapdIpMgr

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

afterPropertiesSet

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception - if any.

getIpInterfaceDao

public IpInterfaceDao getIpInterfaceDao()

getIpInterfaceDao

Returns:
a IpInterfaceDao object.

setIpInterfaceDao

public void setIpInterfaceDao(IpInterfaceDao ipInterfaceDao)

setIpInterfaceDao

Parameters:
ipInterfaceDao - a IpInterfaceDao object.


Copyright © 2011. All Rights Reserved.