OpenNMS API 1.1.4

org.opennms.netmgt.poller
Class Poller

java.lang.Object
  extended byorg.opennms.netmgt.poller.Poller
All Implemented Interfaces:
Fiber, PausableFiber

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


Field Summary
private static java.lang.String LOG4J_CATEGORY
           
private  java.util.Map m_pollableNodes
          Map of 'PollableNode' objects keyed by nodeId
private  java.util.List m_pollableServices
          List of all PollableService objects.
private  BroadcastEventProcessor m_receiver
           
private  Scheduler m_scheduler
           
private static java.util.Map m_serviceIds
          Holds map of service names to service identifiers
private static Poller m_singleton
           
private  int m_status
           
private static java.util.Map m_svcMonitors
          Map of all available 'ServiceMonitor' objects indexed by service name
private static java.lang.String SQL_RETRIEVE_INTERFACES
           
private static java.lang.String SQL_RETRIEVE_SERVICE_IDS
           
private static java.lang.String SQL_RETRIEVE_SERVICE_STATUS
           
private static int WAIT_FOREVER
          Integer constant for passing in to PollableNode.getNodeLock() method in order to indicate that the method should block until node lock is available.
 
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
private Poller()
           
 
Method Summary
 void addNode(PollableNode pNode)
           
static Poller getInstance()
           
 java.lang.String getName()
          This method is used to return the name of the Fiber.
 PollableNode getNode(int nodeId)
           
 java.util.List getPollableServiceList()
           
 Scheduler getScheduler()
           
static java.util.Date getServiceLostDate(java.sql.Connection dbConn, int nodeId, java.lang.String ipAddr, java.lang.String svcName)
          Determines the last known status of a ipaddr/service pair based on outage information from the 'outages' table and if the last known status is UNAVAILABLE returns a date object representing when the service was lost.
 ServiceMonitor getServiceMonitor(java.lang.String svcName)
           
 int getStatus()
          This method is used to get the current status of the Fiber.
 void init()
           
 void pause()
          This method is used to suspend a currently running Fiber.
 void removeNode(int nodeId)
           
 void resume()
          This method is used to resume a suspeneded Fiber.
private  void scheduleExistingInterfaces()
           
 void start()
          This method is used to start the initilization process of the Fiber, which should eventually transition to a RUNNING status.
 void stop()
          This method is used to stop a currently running Fiber.
 
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
See Also:
Constant Field Values

SQL_RETRIEVE_INTERFACES

private static final java.lang.String SQL_RETRIEVE_INTERFACES
See Also:
Constant Field Values

SQL_RETRIEVE_SERVICE_IDS

private static final java.lang.String SQL_RETRIEVE_SERVICE_IDS
See Also:
Constant Field Values

SQL_RETRIEVE_SERVICE_STATUS

private static final java.lang.String SQL_RETRIEVE_SERVICE_STATUS
See Also:
Constant Field Values

WAIT_FOREVER

private static int WAIT_FOREVER
Integer constant for passing in to PollableNode.getNodeLock() method in order to indicate that the method should block until node lock is available.


m_singleton

private static final Poller m_singleton

m_serviceIds

private static final java.util.Map m_serviceIds
Holds map of service names to service identifiers


m_pollableServices

private java.util.List m_pollableServices
List of all PollableService objects.


m_scheduler

private Scheduler m_scheduler

m_status

private int m_status

m_receiver

private BroadcastEventProcessor m_receiver

m_pollableNodes

private java.util.Map m_pollableNodes
Map of 'PollableNode' objects keyed by nodeId


m_svcMonitors

private static java.util.Map m_svcMonitors
Map of all available 'ServiceMonitor' objects indexed by service name

Constructor Detail

Poller

private Poller()
Method Detail

init

public void init()

start

public void start()
Description copied from interface: Fiber
This method is used to start the initilization process of the Fiber, which should eventually transition to a RUNNING status.

Specified by:
start in interface Fiber

stop

public void stop()
Description copied from interface: Fiber
This method is used to stop a currently running Fiber. Once invoked the Fiber should begin it's shutdown process. Depending on the implementation, this method may block until the Fiber terminates.

Specified by:
stop in interface Fiber

pause

public void pause()
Description copied from interface: PausableFiber
This method is used to suspend a currently running Fiber. When invoked the Fiber will begin the transition to a PAUSED status after changing its internal state, if applicable.

Specified by:
pause in interface PausableFiber

resume

public void resume()
Description copied from interface: PausableFiber
This method is used to resume a suspeneded Fiber. If the thread is already running then this method should have no effect on the current Fiber.

Specified by:
resume in interface PausableFiber

getStatus

public int getStatus()
Description copied from interface: Fiber
This method is used to get the current status of the Fiber. The status of the fiber should be one of the predefined constants of the Fiber interface, or from one of the derived interfaces.

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

getName

public java.lang.String getName()
Description copied from interface: Fiber
This method is used to return the name of the Fiber. The name of the instance is defined by the implementor, but it should be realitively unique when possible.

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

getInstance

public static Poller getInstance()

getScheduler

public Scheduler getScheduler()

getServiceMonitor

public ServiceMonitor getServiceMonitor(java.lang.String svcName)

getPollableServiceList

public java.util.List getPollableServiceList()

getNode

public PollableNode getNode(int nodeId)

addNode

public void addNode(PollableNode pNode)

removeNode

public void removeNode(int nodeId)

scheduleExistingInterfaces

private void scheduleExistingInterfaces()
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getServiceLostDate

public static final java.util.Date getServiceLostDate(java.sql.Connection dbConn,
                                                      int nodeId,
                                                      java.lang.String ipAddr,
                                                      java.lang.String svcName)
Determines the last known status of a ipaddr/service pair based on outage information from the 'outages' table and if the last known status is UNAVAILABLE returns a date object representing when the service was lost. If last known status is AVAILABLE null is returned.

Parameters:
dbConn - Database connection
nodeId - Node identifier
ipAddr - IP address
svcName - service name
Returns:
Date object representing the time the service was lost if the service is UNAVAILABLE or null if the service is AVAILABLE.

OpenNMS API 1.1.4

Generated by eevans on November 11 2004 1600.