org.opennms.web.outage
Class OutageModel

java.lang.Object
  extended by org.opennms.web.outage.OutageModel

public class OutageModel
extends Object

As the nonvisual logic for the Services Down (Outage) servlet and JSPs, this class queries the database for current outages and provides utility methods for manipulating that list of outages.

Author:
Lawrence Karnowski , OpenNMS

Constructor Summary
OutageModel()
          Create a new OutageModel.
 
Method Summary
 Node[] filterNodesWithCurrentOutages(Node[] nodes)
           
 OutageSummary[] getAllOutageSummaries(Date date)
          Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address.
 int getCurrentOutageCount()
           
 Outage[] getCurrentOutages()
          Query the database to retrieve the current outages.
 Outage[] getCurrentOutagesForNode(int nodeId)
           
 Collection<Integer> getCurrentOutagesIdsForNode(int nodeId)
           
 OutageSummary[] getCurrentOutageSummaries()
          Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address.
 OutageSummary[] getCurrentSDSOutageSummaries()
          Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address.
 Outage[] getNonCurrentOutagesForNode(int nodeId)
           
 Outage[] getOutagesForInterface(int nodeId, String ipInterface)
           
 Outage[] getOutagesForInterface(int nodeId, String ipAddr, Date time)
          Get all current outages and any resolved outages since the given time for the given interface.
 Outage[] getOutagesForNode(int nodeId)
          Get all outages for a given node.
 Outage[] getOutagesForNode(int nodeId, Date time)
          Get all current outages and any resolved outages since the given time for the given node.
 Outage[] getOutagesForService(int nodeId, String ipInterface, int serviceId)
           
 Outage[] getOutagesForService(int nodeId, String ipAddr, int serviceId, Date time)
          Get all current outages and any resolved outages since the given time for the given service.
 int getSuppressedOutageCount()
           
 Outage[] getSuppressedOutages()
           
protected static Outage[] rs2Outages(ResultSet rs)
           
protected static Outage[] rs2Outages(ResultSet rs, boolean includesRegainedTime)
           
protected static Outage[] rs2Outages(ResultSet rs, boolean includesRegainedTime, boolean includesNotifications)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutageModel

public OutageModel()
Create a new OutageModel.

Method Detail

getCurrentOutages

public Outage[] getCurrentOutages()
                           throws SQLException
Query the database to retrieve the current outages.

Returns:
An array of Outageobjects, or if there are none, an empty array.
Throws:
SQLException - If there is a problem getting a database connection or making a query.

getSuppressedOutages

public Outage[] getSuppressedOutages()
                              throws SQLException
Throws:
SQLException

getCurrentOutageCount

public int getCurrentOutageCount()
                          throws SQLException
Throws:
SQLException

getSuppressedOutageCount

public int getSuppressedOutageCount()
                             throws SQLException
Throws:
SQLException

getCurrentOutagesForNode

public Outage[] getCurrentOutagesForNode(int nodeId)
                                  throws SQLException
Throws:
SQLException

getCurrentOutagesIdsForNode

public Collection<Integer> getCurrentOutagesIdsForNode(int nodeId)
                                                throws SQLException
Throws:
SQLException

filterNodesWithCurrentOutages

public Node[] filterNodesWithCurrentOutages(Node[] nodes)
                                     throws SQLException
Throws:
SQLException

getNonCurrentOutagesForNode

public Outage[] getNonCurrentOutagesForNode(int nodeId)
                                     throws SQLException
Throws:
SQLException

getOutagesForNode

public Outage[] getOutagesForNode(int nodeId)
                           throws SQLException
Get all outages for a given node.

Throws:
SQLException

getOutagesForNode

public Outage[] getOutagesForNode(int nodeId,
                                  Date time)
                           throws SQLException
Get all current outages and any resolved outages since the given time for the given node.

Parameters:
nodeId - this is the node to query
time - no resolved outages older than this time will be returned
Returns:
All current outages and resolved outages no older than time.
Throws:
SQLException

getOutagesForInterface

public Outage[] getOutagesForInterface(int nodeId,
                                       String ipInterface)
                                throws SQLException
Throws:
SQLException

getOutagesForInterface

public Outage[] getOutagesForInterface(int nodeId,
                                       String ipAddr,
                                       Date time)
                                throws SQLException
Get all current outages and any resolved outages since the given time for the given interface.

Parameters:
nodeId - this is the node to query
ipAddr - this is the interface to query
time - no resolved outages older than this time will be returned
Returns:
All current outages and resolved outages no older than time.
Throws:
SQLException

getOutagesForService

public Outage[] getOutagesForService(int nodeId,
                                     String ipInterface,
                                     int serviceId)
                              throws SQLException
Throws:
SQLException

getOutagesForService

public Outage[] getOutagesForService(int nodeId,
                                     String ipAddr,
                                     int serviceId,
                                     Date time)
                              throws SQLException
Get all current outages and any resolved outages since the given time for the given service.

Parameters:
nodeId - this is the node to query
ipAddr - this is the interface to query
serviceId - this is the service to query
time - no resolved outages older than this time will be returned
Returns:
All current outages and resolved outages no older than time.
Throws:
SQLException

getCurrentOutageSummaries

public OutageSummary[] getCurrentOutageSummaries()
                                          throws SQLException
Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address. The list will be sorted in ascending order from the service down longest to the service down shortest.

Throws:
SQLException

getAllOutageSummaries

public OutageSummary[] getAllOutageSummaries(Date date)
                                      throws SQLException
Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address. The list will be sorted by the amount of time it has been down.

Parameters:
date - the starting date for the query
Throws:
SQLException

getCurrentSDSOutageSummaries

public OutageSummary[] getCurrentSDSOutageSummaries()
                                             throws SQLException
Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address. The list will be sorted in ascending order from the service down longest to the service down shortest. This is a clone of getCurrentOutageSummaries for Harrah's (special consideration).

Throws:
SQLException

rs2Outages

protected static Outage[] rs2Outages(ResultSet rs)
                              throws SQLException
Throws:
SQLException

rs2Outages

protected static Outage[] rs2Outages(ResultSet rs,
                                     boolean includesRegainedTime)
                              throws SQLException
Throws:
SQLException

rs2Outages

protected static Outage[] rs2Outages(ResultSet rs,
                                     boolean includesRegainedTime,
                                     boolean includesNotifications)
                              throws SQLException
Throws:
SQLException


Copyright © 2009. All Rights Reserved.