OpenNMS API 1.2.3

org.opennms.netmgt.rtc.datablock
Class RTCNode

java.lang.Object
  extended byorg.opennms.netmgt.rtc.datablock.RTCNode

public class RTCNode
extends java.lang.Object

The main unit for the RTCManager.

RTCNode is the main data unit for the RTCManager - these datablocks are created initially as data is read from the database and later if a 'nodeGainedService' is received - each node maintains its node id, ip address, service name and a list of 'RTCNodeSvcTime's

Also, each node knows and maintains a list of categories that this tuple belongs to

Author:
Sowmya Kumaraswamy , OpenNMS.org
See Also:
RTCNodeSvcTime, RTCNodeSvcTimesList

Field Summary
private  java.util.List m_categories
          List of the categories this node belongs to
private  java.lang.String m_ip
          The ip address of the interface of the node.
private  long m_nodeID
          The node ID.
private  java.lang.String m_svcName
          The service name.
private  RTCNodeSvcTimesList m_svcTimesList
          List of the lost/regained service times for this node.
 
Constructor Summary
RTCNode()
          Default constructor.
RTCNode(long nodeid, java.lang.String ip, java.lang.String svcName)
          Constructor.
 
Method Summary
 void addCategory(java.lang.String catLabel)
          Add to the category list for this node.
 void addSvcTime(long losttime)
          Add a new 'RTCNodeSvcTime' entry for this node.
 void addSvcTime(long losttime, long regainedtime)
          Add a new 'RTCNodeSvcTime' entry for this node.
 boolean belongsTo(java.lang.String catLabel)
          Check if this node belongs to the category.
 boolean equals(java.lang.Object o)
          Compare RTCNodes.
 java.util.List getCategories()
          Return the list of categories this node belongs to.
 long getDownTime(java.lang.String cat, long curTime, long rollingWindow)
          Get the down time.
 java.lang.String getIP()
          Return the IP address.
 long getNodeID()
          Return the node ID.
 java.util.List getServiceTimes()
          Return the list of service times for this node.
 java.lang.String getSvcName()
          Return the service name.
 double getValue(java.lang.String cat, long curTime, long rollingWindow)
          Get the avaialability.
 boolean isServiceCurrentlyDown()
          Return if the service is currently up/down.
 void nodeLostService(long t)
          Add a node lost service time.
 void nodeRegainedService(long t)
          Add a node regained service time.
 void removeCategory(java.lang.String catLabel)
          Remove a category from the node's context.
 void setIP(java.lang.String ipStr)
          Set the IP address.
 void setNodeID(long id)
          Set the node ID.
 void setSvcName(java.lang.String svcName)
          Set the service name.
 java.lang.String toString()
          String represenatation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_nodeID

private long m_nodeID
The node ID.


m_ip

private java.lang.String m_ip
The ip address of the interface of the node.


m_svcName

private java.lang.String m_svcName
The service name.


m_svcTimesList

private RTCNodeSvcTimesList m_svcTimesList
List of the lost/regained service times for this node.


m_categories

private java.util.List m_categories
List of the categories this node belongs to

Constructor Detail

RTCNode

public RTCNode()
Default constructor. Initializes all values


RTCNode

public RTCNode(long nodeid,
               java.lang.String ip,
               java.lang.String svcName)
Constructor.

Parameters:
nodeid - the node id
ip - the IP address
svcName - the service
Method Detail

setNodeID

public void setNodeID(long id)
Set the node ID.

Parameters:
id - the node ID

setSvcName

public void setSvcName(java.lang.String svcName)
Set the service name.

Parameters:
svcName - the service name

setIP

public void setIP(java.lang.String ipStr)
Set the IP address.

Parameters:
ipStr - the ip address

addSvcTime

public void addSvcTime(long losttime,
                       long regainedtime)
Add a new 'RTCNodeSvcTime' entry for this node.

Parameters:
losttime - time at which service was lost
regainedtime - time at which service was regained

addSvcTime

public void addSvcTime(long losttime)
Add a new 'RTCNodeSvcTime' entry for this node.

Parameters:
losttime - time at which service was lost

addCategory

public void addCategory(java.lang.String catLabel)
Add to the category list for this node.

Parameters:
catLabel - category label of the category this node has been added to

removeCategory

public void removeCategory(java.lang.String catLabel)
Remove a category from the node's context.

Parameters:
catLabel - category label of the category this node has been added to

nodeLostService

public void nodeLostService(long t)
Add a node lost service time. Add a losttime entry to the service times list - create a new service time entry in the list

Parameters:
t - the time at which service was lost

nodeRegainedService

public void nodeRegainedService(long t)
Add a node regained service time. Add a regained time entry to the service times list - set the regained time in the last serice time entry in the list

Parameters:
t - the time at which node regained service

getNodeID

public long getNodeID()
Return the node ID.

Returns:
the node ID

getSvcName

public java.lang.String getSvcName()
Return the service name.

Returns:
the service name

getIP

public java.lang.String getIP()
Return the IP address.

Returns:
the IP address

getServiceTimes

public java.util.List getServiceTimes()
Return the list of service times for this node.

Returns:
the list of service times for this node

belongsTo

public boolean belongsTo(java.lang.String catLabel)
Check if this node belongs to the category.

Parameters:
catLabel - category label
Returns:
true if the node belongs to this category, false otherwise

getCategories

public java.util.List getCategories()
Return the list of categories this node belongs to.

Returns:
list of categories for the node.

getDownTime

public long getDownTime(java.lang.String cat,
                        long curTime,
                        long rollingWindow)
Get the down time. Return the total outage time for this node in the 'rollingWindow' milliseconds since 'curTime' for the category

Parameters:
cat - the category in the context which of which downtime is needed
curTime - the start time (or current time) from which we go back rollinWindow interval
rollingWindow - the window for which downtime is required
Returns:
the total outage time for this node

getValue

public double getValue(java.lang.String cat,
                       long curTime,
                       long rollingWindow)
Get the avaialability. Return the total availability for this node in the last 'rollingWindow' milliseconds since 'curTime' for the category

Parameters:
cat - the category in the context which of which availability is needed
curTime - the start time (or current time) from which we go back rollinWindow interval
rollingWindow - the window for which availability is required
Returns:
the value for this node

isServiceCurrentlyDown

public boolean isServiceCurrentlyDown()
Return if the service is currently up/down.

Returns:
if the service is currently up/down

equals

public boolean equals(java.lang.Object o)
Compare RTCNodes. Overrides the 'equals()' method in the superclass

Returns:
true if all the attributes are equal

toString

public java.lang.String toString()
String represenatation. Returns a string representation of this object that has the nodeid/ip/servicename details

Returns:
the string representation of this object

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.