OpenNMS API 1.2.3

org.opennms.netmgt.outage
Class OutageManager

java.lang.Object
  extended byorg.opennms.netmgt.outage.OutageManager
All Implemented Interfaces:
Fiber, PausableFiber

public final class OutageManager
extends java.lang.Object
implements PausableFiber

The OutageManager receives events selectively and maintains a historical archive of each outage for all devices in the database

Author:
Sowmya Nataraj , Mike Davidson , OpenNMS.org

Field Summary
private static java.lang.String LOG4J_CATEGORY
          The log4j category used to log debug messsages and statements.
private  DbConnectionFactory m_dbConnFactory
           
private  EventIpcManager m_eventMgr
          The EventIpcManager to use for sending and receiving events
private  OutageMgrEventProcessor m_eventReceiver
          The events receiver
private  BasicNetwork m_network
          The Network where nodes, interfaces and services live
private  OutageManagerConfig m_outageMgrConfig
           
private  java.util.Map m_serviceTableMap
          The service table map
private static OutageManager m_singleton
          The singleton instance of this class
private  int m_status
          Current status of this fiber
private  RunnableConsumerThreadPool m_writerPool
          The RunnableConsumerThreadPool that runs writers that update the database
private static int NUM_THREADS
          The number of threads that must be started.
 
Fields inherited from interface org.opennms.core.fiber.PausableFiber
PAUSE_PENDING, PAUSED, RESUME_PENDING
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
OutageManager()
          The constructor for the OutageManager
 
Method Summary
 void addServiceMapping(java.lang.String svcname, long serviceid)
          Add the svcname/svcid mapping to the servicetable map
private  void buildServiceTableMap(java.sql.Connection dbConn)
          Build the servicename to serviceid map - this map is used so as to avoid a database lookup for each incoming event
private  void closeOutages(java.sql.Connection dbConn)
          Close the currently open outages for services and interfaces that are currently unmanaged
(package private)  java.sql.Connection getConnection()
           
 EventIpcManager getEventMgr()
           
 java.lang.String getGetNextOutageID()
           
static OutageManager getInstance()
          Return a handle to the OutageManager
 java.lang.String getName()
          Returns a name/id for this process
 BasicNetwork getNetwork()
           
private  int getNumWriters()
           
 OutageManagerConfig getOutageMgrConfig()
           
 long getServiceID(java.lang.String svcname)
          Return the service id for the name passed
 int getStatus()
          Returns the current status
 void init()
           
 void pause()
          Pauses all the threads
 void resume()
          Resumes all the threads
 void setDbConnectionFactory(DbConnectionFactory dbConnFactory)
           
 void setEventMgr(EventIpcManager eventMgr)
           
 void setOutageMgrConfig(OutageManagerConfig config)
           
 void start()
          Read the configuration xml, create and start all the subthreads.
 void stop()
          Stops all the threads
 
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_singleton

private static final OutageManager m_singleton
The singleton instance of this class


NUM_THREADS

private static final int NUM_THREADS
The number of threads that must be started.

See Also:
Constant Field Values

m_serviceTableMap

private java.util.Map m_serviceTableMap
The service table map


m_network

private BasicNetwork m_network
The Network where nodes, interfaces and services live


m_eventReceiver

private OutageMgrEventProcessor m_eventReceiver
The events receiver


m_writerPool

private RunnableConsumerThreadPool m_writerPool
The RunnableConsumerThreadPool that runs writers that update the database


m_eventMgr

private EventIpcManager m_eventMgr
The EventIpcManager to use for sending and receiving events


m_status

private int m_status
Current status of this fiber


m_outageMgrConfig

private OutageManagerConfig m_outageMgrConfig

m_dbConnFactory

private DbConnectionFactory m_dbConnFactory
Constructor Detail

OutageManager

public OutageManager()
The constructor for the OutageManager

Method Detail

buildServiceTableMap

private void buildServiceTableMap(java.sql.Connection dbConn)
                           throws java.sql.SQLException
Build the servicename to serviceid map - this map is used so as to avoid a database lookup for each incoming event

Throws:
java.sql.SQLException

closeOutages

private void closeOutages(java.sql.Connection dbConn)
                   throws java.sql.SQLException
Close the currently open outages for services and interfaces that are currently unmanaged

Throws:
java.sql.SQLException

getName

public java.lang.String getName()
Returns a name/id for this process

Specified by:
getName in interface Fiber
Returns:
The name of the Fiber.

getStatus

public int getStatus()
Returns the current status

Specified by:
getStatus in interface Fiber
Returns:
The current status of the Fiber.

getEventMgr

public EventIpcManager getEventMgr()

setEventMgr

public void setEventMgr(EventIpcManager eventMgr)

init

public void init()

getConnection

java.sql.Connection getConnection()
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

setDbConnectionFactory

public void setDbConnectionFactory(DbConnectionFactory dbConnFactory)

setOutageMgrConfig

public void setOutageMgrConfig(OutageManagerConfig config)

getOutageMgrConfig

public OutageManagerConfig getOutageMgrConfig()

getNumWriters

private int getNumWriters()
Returns:

start

public void start()
Read the configuration xml, create and start all the subthreads.

Specified by:
start in interface Fiber

pause

public void pause()
Pauses all the threads

Specified by:
pause in interface PausableFiber

resume

public void resume()
Resumes all the threads

Specified by:
resume in interface PausableFiber

stop

public void stop()
Stops all the threads

Specified by:
stop in interface Fiber

getServiceID

public long getServiceID(java.lang.String svcname)
Return the service id for the name passed

Parameters:
svcname - the service name whose service id is required
Returns:
the service id for the name passed, -1 if not found

addServiceMapping

public void addServiceMapping(java.lang.String svcname,
                              long serviceid)
Add the svcname/svcid mapping to the servicetable map


getInstance

public static OutageManager getInstance()
Return a handle to the OutageManager


getGetNextOutageID

public java.lang.String getGetNextOutageID()

getNetwork

public BasicNetwork getNetwork()

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.