OpenNMS API 1.2.3

org.opennms.report.availability
Class AvailabilityData

java.lang.Object
  extended byorg.opennms.report.availability.AvailabilityData

public class AvailabilityData
extends java.lang.Object

AvailabilityData collects all the outages for all node/ip/service combination and stores it appropriately in the m_nodes structure.

Author:
Jacinta Remedios , Oculan

Field Summary
private static long LAST_YEAR_ROLLING_WINDOW
          Rolling window of the last year.
private static java.lang.String LOG4J_CATEGORY
          The log4j category used to log debug messsages and statements.
private  long m_12MonthsBack
          End Time of the report.
(package private) static java.sql.Connection m_availConn
          Database connection handle.
private  java.lang.String m_catComment
          Category Comments
private  java.lang.String m_categoryName
          Category Name
(package private)  CategoryFactory m_catFactory
          Category Factory
private  java.lang.String m_commonRule
          Common Rule for the category group.
private  int m_daysInLastMonth
          Number of days in the last month
private  long m_endTime
          End Time of the report.
private  long m_lastMonthEndTime
          End Time of the last month.
private  java.util.List m_nodes
          List of Node objects that satisfy the filter rule for the category.
private  int m_sectionIndex
          Section Index
 
Constructor Summary
AvailabilityData(java.lang.String categoryName, Report report, java.lang.String format)
          Constructor
 
Method Summary
 void addNode(java.lang.String nodeName, int nodeid, java.lang.String ipaddr, java.lang.String serviceid, long losttime, long regainedtime)
          This method adds a unique tuple to the list of nodes m_nodes.
 void closeConnection()
          Closes the database connection.
private static int getDays(boolean isLeap, int month)
          Returns the number of days in the month, also considers checks for leap year.
private  int getDaysForMonth(long endTime)
          Returns the number of Days in the month
 java.util.List getNodes()
          Returns the nodes.
private  void getOutagesNodeIpSvc(int nodeid, java.lang.String nodeName, java.lang.String ipaddr, int serviceid, java.lang.String serviceName, OutageSvcTimesList outageSvcTimesList, java.sql.PreparedStatement outagesGetStmt)
          Get all outages for this nodeid/ipaddr/service combination and add it to m_nodes.
 java.util.TreeMap getPercentNode()
          Returns percent/node combinations for the last month.
 void initialiseConnection()
          Initialises the database connection.
private  void initialiseInterval()
          Initialise the endTime, last Months end time and number of days in the last month.
private  void populateDataStructures(Category cat, Report report, java.lang.String format, int catIndex)
          Populates the data structure for this category.
private  void populateNodesFromDB(Category cat, java.util.List monitoredServices)
          For each category in the categories list, this reads the services and outage tables to get the initial data, creates objects that are added to the map and and to the appropriate category
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_CATEGORY

private static final java.lang.String LOG4J_CATEGORY
The log4j category used to log debug messsages and statements.

See Also:
Constant Field Values

m_availConn

static java.sql.Connection m_availConn
Database connection handle.


m_nodes

private java.util.List m_nodes
List of Node objects that satisfy the filter rule for the category.


m_commonRule

private java.lang.String m_commonRule
Common Rule for the category group.


m_categoryName

private java.lang.String m_categoryName
Category Name


m_catComment

private java.lang.String m_catComment
Category Comments


m_endTime

private long m_endTime
End Time of the report.


m_12MonthsBack

private long m_12MonthsBack
End Time of the report.


m_lastMonthEndTime

private long m_lastMonthEndTime
End Time of the last month.


m_daysInLastMonth

private int m_daysInLastMonth
Number of days in the last month


m_catFactory

CategoryFactory m_catFactory
Category Factory


LAST_YEAR_ROLLING_WINDOW

private static long LAST_YEAR_ROLLING_WINDOW
Rolling window of the last year.


m_sectionIndex

private int m_sectionIndex
Section Index

Constructor Detail

AvailabilityData

public AvailabilityData(java.lang.String categoryName,
                        Report report,
                        java.lang.String format)
                 throws java.io.IOException,
                        org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException,
                        java.lang.Exception
Constructor

Method Detail

populateDataStructures

private void populateDataStructures(Category cat,
                                    Report report,
                                    java.lang.String format,
                                    int catIndex)
                             throws java.lang.Exception
Populates the data structure for this category. This method only computes for monitored services in this category.

Parameters:
cat - Category
report - Report Castor class
format - SVG-specific/all reports
Throws:
java.lang.Exception

initialiseInterval

private void initialiseInterval()
Initialise the endTime, last Months end time and number of days in the last month.


getDays

private static int getDays(boolean isLeap,
                           int month)
Returns the number of days in the month, also considers checks for leap year.

Parameters:
isLeap - the leap year flag.
month - The month whose days count is reqd

getDaysForMonth

private int getDaysForMonth(long endTime)
Returns the number of Days in the month

Parameters:
endTime - The end of the month (time in milliseconds)

getNodes

public java.util.List getNodes()
Returns the nodes.


initialiseConnection

public void initialiseConnection()
                          throws java.io.IOException,
                                 org.exolab.castor.xml.MarshalException,
                                 org.exolab.castor.xml.ValidationException,
                                 java.lang.ClassNotFoundException,
                                 java.sql.SQLException
Initialises the database connection.

Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.lang.ClassNotFoundException
java.sql.SQLException

closeConnection

public void closeConnection()
Closes the database connection.


getPercentNode

public java.util.TreeMap getPercentNode()
Returns percent/node combinations for the last month. This is used to get the last months top 20 offenders


populateNodesFromDB

private void populateNodesFromDB(Category cat,
                                 java.util.List monitoredServices)
                          throws java.sql.SQLException,
                                 FilterParseException,
                                 java.lang.Exception
For each category in the categories list, this reads the services and outage tables to get the initial data, creates objects that are added to the map and and to the appropriate category

Throws:
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
java.lang.Exception

getOutagesNodeIpSvc

private void getOutagesNodeIpSvc(int nodeid,
                                 java.lang.String nodeName,
                                 java.lang.String ipaddr,
                                 int serviceid,
                                 java.lang.String serviceName,
                                 OutageSvcTimesList outageSvcTimesList,
                                 java.sql.PreparedStatement outagesGetStmt)
                          throws java.sql.SQLException
Get all outages for this nodeid/ipaddr/service combination and add it to m_nodes.

Throws:
java.sql.SQLException

addNode

public void addNode(java.lang.String nodeName,
                    int nodeid,
                    java.lang.String ipaddr,
                    java.lang.String serviceid,
                    long losttime,
                    long regainedtime)
This method adds a unique tuple to the list of nodes m_nodes.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.