OpenNMS API 1.1.4

org.opennms.netmgt.poller
Class BroadcastEventProcessor

java.lang.Object
  extended byorg.opennms.netmgt.poller.BroadcastEventProcessor
All Implemented Interfaces:
EventListener

final class BroadcastEventProcessor
extends java.lang.Object
implements EventListener

Author:
James Zuo, Brian Weaver, OpenNMS

Field Summary
private  java.util.Map m_monitors
          The map of service names to service models.
private  java.util.List m_pollableServices
          List of PollableService objects.
private  Scheduler m_scheduler
          The scheduler assocated with this reciever
private  boolean m_xmlrpc
          Boolean flag to indicate if need to notify external xmlrpc server with event processing failure.
private static java.lang.String SQL_COUNT_IFSERVICE_STATUS
          SQL statement used to query the 'ifServices' for a nodeid/ipaddr/service combination on the receipt of a 'nodeGainedService' to make sure there is atleast one row where the service status for the tuple is 'A'.
private static java.lang.String SQL_COUNT_IFSERVICES_TO_POLL
          SQL statement used to count the active ifservices on the specified ip address.
private static java.lang.String SQL_DELETE_SNMP_OUTAGE
          SQL statement used to delete oustanding SNMP service outages for the specified nodeid/interface in the event in the event of a primary snmp interface changed event.
private static java.lang.String SQL_FETCH_IFSERVICES_TO_POLL
          SQL statement used to retrieve an active ifservice for the scheduler to poll.
private static java.lang.String SQL_RETRIEVE_NODE_ID
          SQL statement used to retrieve nodeid from the database for a specified ip address.
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.
 
Constructor Summary
(package private) BroadcastEventProcessor(java.util.List pollableServices)
          Constructor
 
Method Summary
 void close()
          Unsubscribe from eventd
private  void createMessageSelectorAndSubscribe()
          Create message selector to set to the subscription
 java.lang.String getName()
          Return an id for this event listener
private  void interfaceDeletedHandler(Event event)
           
private  void interfaceReparentedHandler(Event event)
          This method is responsible for processing 'interfacReparented' events.
private  void nodeDeletedHandler(Event event)
          This method is responsible for removing the node specified in the nodeDeleted event from the Poller's pollable node map.
private  void nodeGainedServiceHandler(Event event)
          Process the event, construct a new PollableService object representing the node/interface/service/pkg combination, and schedule the service for polling.
private  void nodeRemovePollableServiceHandler(Event event)
          This method is responsible for removing a node's pollable service from the pollable services list
 void onEvent(Event event)
          This method is invoked by the EventIpcManager when a new event is available for processing.
private  void restartPollingInterfaceHandler(Event event)
          Process the event, construct new PollableService object representing the node/interface/service/pkg combination, and schedule all services on the specified interface for polling.
private  void serviceDeletedHandler(Event event)
          This method remove a deleted service from the pollable service list of the specified interface, so that it will not be scheduled by the poller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_DELETE_SNMP_OUTAGE

private static java.lang.String SQL_DELETE_SNMP_OUTAGE
SQL statement used to delete oustanding SNMP service outages for the specified nodeid/interface in the event in the event of a primary snmp interface changed event.


SQL_COUNT_IFSERVICE_STATUS

private static java.lang.String SQL_COUNT_IFSERVICE_STATUS
SQL statement used to query the 'ifServices' for a nodeid/ipaddr/service combination on the receipt of a 'nodeGainedService' to make sure there is atleast one row where the service status for the tuple is 'A'.


SQL_COUNT_IFSERVICES_TO_POLL

private static java.lang.String SQL_COUNT_IFSERVICES_TO_POLL
SQL statement used to count the active ifservices on the specified ip address.


SQL_FETCH_IFSERVICES_TO_POLL

private static java.lang.String SQL_FETCH_IFSERVICES_TO_POLL
SQL statement used to retrieve an active ifservice for the scheduler to poll.


SQL_RETRIEVE_NODE_ID

private static java.lang.String SQL_RETRIEVE_NODE_ID
SQL statement used to retrieve nodeid from the database for a specified ip address.


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_monitors

private java.util.Map m_monitors
The map of service names to service models.


m_scheduler

private Scheduler m_scheduler
The scheduler assocated with this reciever


m_pollableServices

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


m_xmlrpc

private boolean m_xmlrpc
Boolean flag to indicate if need to notify external xmlrpc server with event processing failure.

Constructor Detail

BroadcastEventProcessor

BroadcastEventProcessor(java.util.List pollableServices)
Constructor

Parameters:
pollableServices - List of all the PollableService objects scheduled for polling
Method Detail

createMessageSelectorAndSubscribe

private void createMessageSelectorAndSubscribe()
Create message selector to set to the subscription


nodeGainedServiceHandler

private void nodeGainedServiceHandler(Event event)
Process the event, construct a new PollableService object representing the node/interface/service/pkg combination, and schedule the service for polling. If any errors occur scheduling the interface no error is returned.

Parameters:
event - The event to process.

restartPollingInterfaceHandler

private void restartPollingInterfaceHandler(Event event)
Process the event, construct new PollableService object representing the node/interface/service/pkg combination, and schedule all services on the specified interface for polling. If any errors occur scheduling the interface no error is returned, but any SQL Exception will cause the process to stop, and an error will be logged.

Parameters:
event - The event to process.

interfaceReparentedHandler

private void interfaceReparentedHandler(Event event)
This method is responsible for processing 'interfacReparented' events. An 'interfaceReparented' event will have old and new nodeId parms associated with it. Node outage processing hierarchy will be updated to reflect the new associations.

Parameters:
event - The event to process.

nodeRemovePollableServiceHandler

private void nodeRemovePollableServiceHandler(Event event)
This method is responsible for removing a node's pollable service from the pollable services list


nodeDeletedHandler

private void nodeDeletedHandler(Event event)
This method is responsible for removing the node specified in the nodeDeleted event from the Poller's pollable node map.


interfaceDeletedHandler

private void interfaceDeletedHandler(Event event)

serviceDeletedHandler

private void serviceDeletedHandler(Event event)

This method remove a deleted service from the pollable service list of the specified interface, so that it will not be scheduled by the poller.


close

public void close()
Unsubscribe from eventd


onEvent

public void onEvent(Event event)
This method is invoked by the EventIpcManager when a new event is available for processing. Each message is examined for its Universal Event Identifier and the appropriate action is taking based on each UEI.

Specified by:
onEvent in interface EventListener
Parameters:
event - The event

getName

public java.lang.String getName()
Return an id for this event listener

Specified by:
getName in interface EventListener

OpenNMS API 1.1.4

Generated by eevans on November 11 2004 1600.