OpenNMS API 1.2.3

org.opennms.web.category
Class Category

java.lang.Object
  extended byorg.opennms.web.category.Category

public class Category
extends java.lang.Object

Adapts the functionality of the category definition and RTC category updates into one simple interface. Also adds many convenience methods.

The category definition is read from the categories.xml file by the CategoryFactory. The RTC category updates are periodically sent from the RTC to the WebUI.

Author:
Lawrence Karnowski , OpenNMS

Field Summary
protected  Category m_categoryDef
          The category definition (from the categories.xml file).
protected  java.util.Date m_lastUpdated
          The last time this category was updated.
protected  Category m_rtcCategory
          An update from the RTC about the service level availability for this category.
protected  java.lang.Long m_serviceCount
          A cached value of the total number of services on nodes belonging to this category.
protected  java.lang.Long m_serviceDownCount
          A cached value of the total number of services on nodes belonging to this category that are currently down.
protected  java.lang.Double m_servicePercentage
          A cached value of the ratio of services that are up on notes beloging to this category to all nodes belonging in this category.
 
Constructor Summary
protected Category(Category categoryDef, Category rtcCategory, java.util.Date lastUpdated)
          Create a new instance to wrapper information from the categories.xml file (that defines a category) and information from the RTC (that gives current service level availability).
protected Category(java.lang.String categoryName)
          Create an empty category with nothing other than a name.
 
Method Summary
 java.util.Enumeration enumerateNode()
          Returns an enumeration of the Castor-generated Node objects tied to this category.
 java.lang.String getAvailColor()
          Returns the availability background color for this category.
 java.lang.String getAvailText()
          Returns the availability text for this category ("XXX.XX%").
 java.lang.String getComment()
          Return a description explaining this category.
 java.util.Date getLastUpdated()
          Return the date and time this category was last updated by the RTC.
 java.lang.String getName()
          Return the unique name for this category.
 double getNormalThreshold()
          Return the value considered to be the minimum "normal" value.
 java.lang.String getOutageColor()
          Returns the outage background color for this category.
 java.lang.String getOutageText()
          Returns the outage text for this category ("X of Y" nodes down).
(package private)  Category getRtcCategory()
          Package protected implementation method that exposes the internal representation (a Castor-generated object) of the data from the RTC, strictly for use in marshalling the data back to XML (via Castor).
 long getServiceCount()
          Return the number of services contained within this category.
protected static long[] getServiceCounts(Category category)
          Convenience method to count the number of services under a category and the number of those services that are currently down.
 long getServiceDownCount()
          Return the number of services that are currently down with this category.
 double getServicePercentage()
          Return a percentage of the ratio of services that are up to all services in this category.
 java.lang.String getTitle()
          Returns the category comment if there is one, otherwise, its name.
 double getValue()
          Return the current service level availability for this category.
 double getWarningThreshold()
          Return the value considered to be the minimum value below the "normal" value where only a warning is necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_categoryDef

protected Category m_categoryDef
The category definition (from the categories.xml file).


m_rtcCategory

protected Category m_rtcCategory
An update from the RTC about the service level availability for this category.


m_lastUpdated

protected java.util.Date m_lastUpdated
The last time this category was updated. Note that with the current way this class and the CategoryModel are implemented, this value does not change because a new instance of this class is created for each RTC update.


m_serviceCount

protected java.lang.Long m_serviceCount
A cached value of the total number of services on nodes belonging to this category.


m_serviceDownCount

protected java.lang.Long m_serviceDownCount
A cached value of the total number of services on nodes belonging to this category that are currently down.


m_servicePercentage

protected java.lang.Double m_servicePercentage
A cached value of the ratio of services that are up on notes beloging to this category to all nodes belonging in this category.

Constructor Detail

Category

protected Category(java.lang.String categoryName)
Create an empty category with nothing other than a name. This represents a category with no RTC data.


Category

protected Category(Category categoryDef,
                   Category rtcCategory,
                   java.util.Date lastUpdated)
Create a new instance to wrapper information from the categories.xml file (that defines a category) and information from the RTC (that gives current service level availability).

Method Detail

getName

public java.lang.String getName()
Return the unique name for this category.


getNormalThreshold

public double getNormalThreshold()
Return the value considered to be the minimum "normal" value.


getWarningThreshold

public double getWarningThreshold()
Return the value considered to be the minimum value below the "normal" value where only a warning is necessary. Below this value the category's value will be considered unacceptable.


getComment

public java.lang.String getComment()
Return a description explaining this category.


getLastUpdated

public java.util.Date getLastUpdated()
Return the date and time this category was last updated by the RTC.


getValue

public double getValue()
Return the current service level availability for this category.


getRtcCategory

Category getRtcCategory()
Package protected implementation method that exposes the internal representation (a Castor-generated object) of the data from the RTC, strictly for use in marshalling the data back to XML (via Castor). In other words, this method is only for debugging purposes, please do not use in normal situations. Instead please use the public methods of this class.


getServiceCount

public long getServiceCount()
Return the number of services contained within this category.


getServiceDownCount

public long getServiceDownCount()
Return the number of services that are currently down with this category.


getServicePercentage

public double getServicePercentage()
Return a percentage of the ratio of services that are up to all services in this category.


getOutageColor

public java.lang.String getOutageColor()
                                throws java.io.IOException,
                                       org.exolab.castor.xml.MarshalException,
                                       org.exolab.castor.xml.ValidationException
Returns the outage background color for this category.

Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

getAvailColor

public java.lang.String getAvailColor()
                               throws java.io.IOException,
                                      org.exolab.castor.xml.MarshalException,
                                      org.exolab.castor.xml.ValidationException
Returns the availability background color for this category.

Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

getOutageText

public java.lang.String getOutageText()
Returns the outage text for this category ("X of Y" nodes down).


getAvailText

public java.lang.String getAvailText()
Returns the availability text for this category ("XXX.XX%").


getTitle

public java.lang.String getTitle()
Returns the category comment if there is one, otherwise, its name.


enumerateNode

public java.util.Enumeration enumerateNode()
Returns an enumeration of the Castor-generated Node objects tied to this category.

Note, LJK Dec 5,2001: I'm not really happy about exposing the Castor objects this way. We do it all over the place, but I've already started hiding them in this particular case (the rtceui.xsd objects). I'm not very pleased with this half approach. I'd rather hide them completely or not at all, but I don't want to introduce a new pass-through object.


getServiceCounts

protected static long[] getServiceCounts(Category category)
Convenience method to count the number of services under a category and the number of those services that are currently down.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.