|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.rtc.DataManager
Contains and maintains all the data for the RTC. The basic datablock is a 'RTCNode' that gets added to relevant 'RTCCategory's. it also gets added to a map with different keys for easy lookup The map('RTCHashMap') is keyed with 'RTCNodeKey's(a nodeid/ip/svc combination), nodeid/ip combinations and nodeid and these keys either lookup a single RTCNode or lists of 'RTCNode's Incoming events have a method in the DataManager to alter data - for e.g., a 'nodeGainedService' event would result in the 'nodeGainedService()' method being called by the DataUpdater(s).
Field Summary | |
private java.util.Map |
m_categories
The RTC categories |
private RTCHashMap |
m_map
map keyed using the RTCNodeKey or nodeid or nodeid/ip |
private java.util.HashMap |
m_serviceTableMap
The service table map - this is built at startup and updated if a servicename that is not found in the map is found so as to avoid a database lookup for each servicename to serviceid mapping |
Constructor Summary | |
DataManager()
Constructor. |
Method Summary | |
private void |
addIpToCategory(java.util.List ipRTCs,
RTCCategory cat)
Add the RTCNodes known for an IP to the category. |
private void |
addNodeIpSvcToCategory(long nodeid,
java.lang.String ip,
java.lang.String svcname,
RTCCategory cat,
java.util.HashMap knownIPs,
java.sql.PreparedStatement outagesGetStmt)
Add a node/ip/service to the specified category. |
void |
addServiceMapping(java.lang.String svcname,
long serviceid)
Add the svcname/svcid mapping to the servicetable map |
private void |
createCategoriesMap()
Creates the categories map. |
private void |
delNodeIpSvcToCategory(long nodeid,
java.lang.String ip,
java.lang.String svcname,
RTCCategory cat)
Delete a node/ip/service to the specified category. |
RTCNode |
get(long nodeid,
java.lang.String ip,
java.lang.String svcName)
Get the rtcnode with this nodeid/ip/svcname. |
RTCNode |
get(RTCNodeKey key)
Get the node from it's key. |
java.util.Map |
getCategories()
|
int |
getServiceCount(long nodeid,
java.lang.String catLabel)
Get the service count for the nodeid in the context of the passed category |
int |
getServiceDownCount(long nodeid,
java.lang.String catLabel)
Get the service down count for the nodeid in the context of the passed category |
long |
getServiceID(java.lang.String svcname)
Return the service id for the name passed |
private char |
getServiceStatus(long nodeid,
java.lang.String ip,
java.lang.String svc)
Get the 'ismanaged' status for the nodeid, ipaddr combination |
double |
getValue(long nodeid,
java.lang.String catLabel,
long curTime,
long rollingWindow)
Get the value(uptime) for the nodeid in the last 'rollingWindow' starting at current time in the context of the passed category |
double |
getValue(java.lang.String catLabel,
long curTime,
long rollingWindow)
Get the value(uptime) for the category in the last 'rollingWindow' starting at current time |
void |
interfaceDown(long nodeid,
java.lang.String ip,
long t)
Add a lost service entry to the right nodes. |
void |
interfaceReparented(java.lang.String ip,
long oldNodeId,
long newNodeId)
Reparent an interface. |
void |
interfaceUp(long nodeid,
java.lang.String ip,
long t)
Add a regained service entry to the right nodes. |
void |
nodeDown(long nodeid,
long t)
Add a lost service entry to the right nodes. |
void |
nodeGainedService(long nodeid,
java.lang.String ip,
java.lang.String svcName)
Handles a node gained service event. |
void |
nodeLostService(long nodeid,
java.lang.String ip,
java.lang.String svcName,
long t)
Handles a node lost service event. |
void |
nodeRegainedService(long nodeid,
java.lang.String ip,
java.lang.String svcName,
long t)
Add a regained service entry to the right node. |
void |
nodeUp(long nodeid,
long t)
Add a regained service entry to the right nodes. |
private void |
populateNodesFromDB(java.sql.Connection dbConn)
Poplulates nodes from the database. |
void |
rtcNodeIpRescan(long nodeid,
java.lang.String ip)
Update the categories for a node. |
void |
rtcNodeRescan(long nodeid)
Update the categories for a node. |
void |
serviceDeleted(long nodeid,
java.lang.String ip,
java.lang.String svcName)
Remove node from the map and the categories on a 'serviceDeleted' event. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.Map m_categories
private RTCHashMap m_map
private java.util.HashMap m_serviceTableMap
Constructor Detail |
public DataManager() throws org.xml.sax.SAXException, java.io.IOException, java.sql.SQLException, FilterParseException, RTCException
java.sql.SQLException
- if there is an error reading initial data from the
database
FilterParseException
- if a rule in the categories.xml was incorrect
RTCException
- if the initialization/data reading does not go through
org.xml.sax.SAXException
java.io.IOException
Method Detail |
private char getServiceStatus(long nodeid, java.lang.String ip, java.lang.String svc)
nodeid
- the nodeid of the interfaceip
- the interface for which the status is requiredsvc
- the service for which status is required
private void addNodeIpSvcToCategory(long nodeid, java.lang.String ip, java.lang.String svcname, RTCCategory cat, java.util.HashMap knownIPs, java.sql.PreparedStatement outagesGetStmt)
nodeid
- the nodeid to be addedip
- the interface to be addedsvcname
- the service to be addedcat
- the category to which this node is to be added toknownIPs
- the hashtable of IP->list of RTCNodes (used only at startup)outagesGetStmt
- the prepared statement to read outagesprivate void delNodeIpSvcToCategory(long nodeid, java.lang.String ip, java.lang.String svcname, RTCCategory cat)
nodeid
- the nodeid to be addedip
- the interface to be addedsvcname
- the service to be addedcat
- the category to which this node is to be added toprivate void addIpToCategory(java.util.List ipRTCs, RTCCategory cat)
ipRTCs
- the list of RTCNodes related to a particular IPcat
- the category to which the list is to be addedprivate void createCategoriesMap()
private void populateNodesFromDB(java.sql.Connection dbConn) throws java.sql.SQLException, FilterParseException, RTCException
dbConn
- the database connection.
java.sql.SQLException
- if the database read fails due to an SQL error
FilterParseException
- if filtering the data against the category rule fails due to
the rule being incorrect
RTCException
- if the database read or filtering the data against the
category rule fails for some reasonpublic void nodeGainedService(long nodeid, java.lang.String ip, java.lang.String svcName)
nodeid
- the node idip
- the IP addresssvcName
- the service namepublic void nodeLostService(long nodeid, java.lang.String ip, java.lang.String svcName, long t)
nodeid
- the node idip
- the IP addresssvcName
- the service namet
- the time at which service was lostpublic void interfaceDown(long nodeid, java.lang.String ip, long t)
nodeid
- the node idip
- the IP addresst
- the time at which service was lostpublic void nodeDown(long nodeid, long t)
nodeid
- the node idt
- the time at which service was lostpublic void nodeUp(long nodeid, long t)
nodeid
- the node idt
- the time at which service was regainedpublic void interfaceUp(long nodeid, java.lang.String ip, long t)
nodeid
- the node idip
- the IP addresst
- the time at which service was regainedpublic void nodeRegainedService(long nodeid, java.lang.String ip, java.lang.String svcName, long t)
nodeid
- the node idip
- the IP addresssvcName
- the service namet
- the time at which service was regainedpublic void serviceDeleted(long nodeid, java.lang.String ip, java.lang.String svcName)
nodeid
- the nodeid on which service was deletedip
- the ip on which service was deletedsvcName
- the service that was deletedpublic void rtcNodeRescan(long nodeid) throws java.sql.SQLException, FilterParseException, RTCException
nodeid
- the nodeid on which SNMP service was added
java.sql.SQLException
- if the database read fails due to an SQL error
FilterParseException
- if filtering the data against the category rule fails due to
the rule being incorrect
RTCException
- if the database read or filtering the data against the
category rule fails for some reasonpublic void rtcNodeIpRescan(long nodeid, java.lang.String ip) throws java.sql.SQLException, FilterParseException, RTCException
nodeid
- the nodeid on which SNMP service was addedip
- the ip on which SNMP service was added
java.sql.SQLException
- if the database read fails due to an SQL error
FilterParseException
- if filtering the data against the category rule fails due to
the rule being incorrect
RTCException
- if the database read or filtering the data against the
category rule fails for some reasonpublic void interfaceReparented(java.lang.String ip, long oldNodeId, long newNodeId)
ip
- the interface to reparentoldNodeId
- the node that the ip belonged to earliernewNodeId
- the node that the ip now belongs topublic RTCNode get(long nodeid, java.lang.String ip, java.lang.String svcName)
nodeid
- the node idip
- the interfacesvcName
- the servicepublic RTCNode get(RTCNodeKey key)
key
- the RTCNodeKey
public double getValue(java.lang.String catLabel, long curTime, long rollingWindow)
catLabel
- the category to which the node should belong tocurTime
- the current timerollingWindow
- the window for which value is to be calculated
public double getValue(long nodeid, java.lang.String catLabel, long curTime, long rollingWindow)
nodeid
- the node for which value is to be calculatedcatLabel
- the category to which the node should belong tocurTime
- the current timerollingWindow
- the window for which value is to be calculated
public int getServiceCount(long nodeid, java.lang.String catLabel)
nodeid
- the node for which service count is to be calculatedcatLabel
- the category to which the node should belong to
public int getServiceDownCount(long nodeid, java.lang.String catLabel)
nodeid
- the node for which service down count is to be calculatedcatLabel
- the category to which the node should belong to
public java.util.Map getCategories()
public long getServiceID(java.lang.String svcname) throws java.sql.SQLException
svcname
- the service name whose service id is required
java.sql.SQLException
public void addServiceMapping(java.lang.String svcname, long serviceid)
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |