org.opennms.netmgt.linkd
Class DbEventWriter

java.lang.Object
  extended by org.opennms.netmgt.linkd.AbstractQueryManager
      extended by org.opennms.netmgt.linkd.DbEventWriter
All Implemented Interfaces:
QueryManager

public class DbEventWriter
extends AbstractQueryManager

This class is used to store informations owned by SnmpCollection and DiscoveryLink Classes in DB. When saving SNMP Collection it populate Bean LinkableNode with information for DiscoveryLink. It performs data test for DiscoveryLink. Also take correct action on DB tables in case node is deleted service SNMP is discovered, service SNMP is Lost and Regained Also this class holds

Version:
$Id: $
Author:
antonio

Field Summary
 
Fields inherited from class org.opennms.netmgt.linkd.AbstractQueryManager
m_linkd
 
Fields inherited from interface org.opennms.netmgt.linkd.QueryManager
ACTION_DELETE, ACTION_UPTODATE, CDP_ADDRESS_TYPE_IP_ADDRESS, SNMP_DOT1D_FDB_STATUS_INVALID, SNMP_DOT1D_FDB_STATUS_LEARNED, SNMP_DOT1D_FDB_STATUS_MGMT, SNMP_DOT1D_FDB_STATUS_OTHER, SNMP_DOT1D_FDB_STATUS_SELF
 
Constructor Summary
DbEventWriter()
          Constructor for DbEventWriter.
 
Method Summary
 AtInterfaceDao getAtInterfaceDao()
           
protected  int getIfIndexByName(Connection dbConn, int nodeid, String ifName)
           
 IpInterfaceDao getIpInterfaceDao()
           
 NodeDao getNodeDao()
           
protected  RouterInterface getNodeFromIp(Connection dbConn, InetAddress ipaddr)
           
protected  int getNodeidFromIp(Connection dbConn, InetAddress ipaddr)
           
protected  RouterInterface getNodeidMaskFromIp(Connection dbConn, InetAddress ipaddr)
           
protected  List<String> getPhysAddrs(int nodeId, DBUtils d, Connection dbConn)
           
protected  int getSnmpIfType(Connection dbConn, int nodeid, Integer ifindex)
           
 LinkableNode getSnmpNode(int nodeid)
          getSnmpNode
 List<LinkableNode> getSnmpNodeList()
          getSnmpNodeList
protected  void markOldDataInactive(Connection dbConn, Timestamp now, int nodeid)
           
protected  void saveIpRouteInterface(Connection dbConn, OnmsIpRouteInterface ipRouteInterface)
           
protected  void saveStpInterface(Connection dbConn, OnmsStpInterface stpInterface)
           
protected  void saveStpNode(Connection dbConn, OnmsStpNode stpNode)
           
protected  void saveVlan(Connection dbConn, OnmsVlan vlan)
           
 void setAtInterfaceDao(AtInterfaceDao dao)
           
 void setIpInterfaceDao(IpInterfaceDao dao)
           
 void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
          
 void setNodeDao(NodeDao nodeDao)
           
 void storeDiscoveryLink(DiscoveryLink discovery)
          storeDiscoveryLink
 LinkableNode storeSnmpCollection(LinkableNode node, SnmpCollection snmpcoll)
          storeSnmpCollection
 void update(int nodeid, char status)
          update
 void updateDeletedNodes()
          updateDeletedNodes
 void updateForInterface(int nodeId, String ipAddr, int ifIndex, char status)
          updateForInterface
 
Methods inherited from class org.opennms.netmgt.linkd.AbstractQueryManager
getLinkd, getNode, processCdpCacheTable, processDot1DBase, processDot1DBasePortTable, processDot1DTpFdbTable, processDot1StpPortTable, processIpNetToMediaTable, processQBridgeDot1dTpFdbTable, processRouteTable, processStpNode, processVlanTable, sendNewSuspectEvent, setLinkd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbEventWriter

public DbEventWriter()

Constructor for DbEventWriter.

Method Detail

storeDiscoveryLink

public void storeDiscoveryLink(DiscoveryLink discovery)
                        throws SQLException

storeDiscoveryLink

Parameters:
discovery - a DiscoveryLink object.
Throws:
SQLException - if any.

storeSnmpCollection

public LinkableNode storeSnmpCollection(LinkableNode node,
                                        SnmpCollection snmpcoll)
                                 throws SQLException

storeSnmpCollection

Parameters:
node - a LinkableNode object.
snmpcoll - a SnmpCollection object.
Returns:
a LinkableNode object.
Throws:
SQLException - if any.

markOldDataInactive

protected void markOldDataInactive(Connection dbConn,
                                   Timestamp now,
                                   int nodeid)
                            throws SQLException
Specified by:
markOldDataInactive in class AbstractQueryManager
Throws:
SQLException

update

public void update(int nodeid,
                   char status)
            throws SQLException

update

Parameters:
nodeid - a int.
status - a char.
Throws:
SQLException - if any.

getNodeidFromIp

protected int getNodeidFromIp(Connection dbConn,
                              InetAddress ipaddr)
                       throws SQLException
Specified by:
getNodeidFromIp in class AbstractQueryManager
Throws:
SQLException

getNodeidMaskFromIp

protected RouterInterface getNodeidMaskFromIp(Connection dbConn,
                                              InetAddress ipaddr)
                                       throws SQLException
Specified by:
getNodeidMaskFromIp in class AbstractQueryManager
Throws:
SQLException

getNodeFromIp

protected RouterInterface getNodeFromIp(Connection dbConn,
                                        InetAddress ipaddr)
                                 throws SQLException
Specified by:
getNodeFromIp in class AbstractQueryManager
Throws:
SQLException

getSnmpIfType

protected int getSnmpIfType(Connection dbConn,
                            int nodeid,
                            Integer ifindex)
                     throws SQLException
Specified by:
getSnmpIfType in class AbstractQueryManager
Throws:
SQLException

getIfIndexByName

protected int getIfIndexByName(Connection dbConn,
                               int nodeid,
                               String ifName)
                        throws SQLException
Specified by:
getIfIndexByName in class AbstractQueryManager
Throws:
SQLException

getSnmpNode

public LinkableNode getSnmpNode(int nodeid)
                         throws SQLException

getSnmpNode

Parameters:
nodeid - a int.
Returns:
a LinkableNode object.
Throws:
SQLException - if any.

getSnmpNodeList

public List<LinkableNode> getSnmpNodeList()
                                   throws SQLException

getSnmpNodeList

Returns:
a List object.
Throws:
SQLException - if any.

updateDeletedNodes

public void updateDeletedNodes()
                        throws SQLException

updateDeletedNodes

Throws:
SQLException - if any.

updateForInterface

public void updateForInterface(int nodeId,
                               String ipAddr,
                               int ifIndex,
                               char status)
                        throws SQLException

updateForInterface

Parameters:
nodeId - a int.
ipAddr - a String object.
ifIndex - a int.
status - a char.
Throws:
SQLException - if any.

getNodeDao

public NodeDao getNodeDao()
Specified by:
getNodeDao in class AbstractQueryManager

setNodeDao

public void setNodeDao(NodeDao nodeDao)

getIpInterfaceDao

public IpInterfaceDao getIpInterfaceDao()
Specified by:
getIpInterfaceDao in class AbstractQueryManager

setIpInterfaceDao

public void setIpInterfaceDao(IpInterfaceDao dao)

getAtInterfaceDao

public AtInterfaceDao getAtInterfaceDao()
Specified by:
getAtInterfaceDao in class AbstractQueryManager

setAtInterfaceDao

public void setAtInterfaceDao(AtInterfaceDao dao)

setJdbcTemplate

public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)


saveIpRouteInterface

protected void saveIpRouteInterface(Connection dbConn,
                                    OnmsIpRouteInterface ipRouteInterface)
                             throws SQLException
Specified by:
saveIpRouteInterface in class AbstractQueryManager
Throws:
SQLException

saveVlan

protected void saveVlan(Connection dbConn,
                        OnmsVlan vlan)
                 throws SQLException
Specified by:
saveVlan in class AbstractQueryManager
Throws:
SQLException

saveStpNode

protected void saveStpNode(Connection dbConn,
                           OnmsStpNode stpNode)
                    throws SQLException
Specified by:
saveStpNode in class AbstractQueryManager
Throws:
SQLException

saveStpInterface

protected void saveStpInterface(Connection dbConn,
                                OnmsStpInterface stpInterface)
                         throws SQLException
Specified by:
saveStpInterface in class AbstractQueryManager
Throws:
SQLException

getPhysAddrs

protected List<String> getPhysAddrs(int nodeId,
                                    DBUtils d,
                                    Connection dbConn)
                             throws SQLException
Specified by:
getPhysAddrs in class AbstractQueryManager
Throws:
SQLException


Copyright © 2011. All Rights Reserved.