OpenNMS API 1.2.3

org.opennms.netmgt.collectd
Class BroadcastEventProcessor

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

final class BroadcastEventProcessor
extends java.lang.Object
implements EventListener

Author:
Mike Davidson , OpenNMS

Field Summary
private  java.util.List m_collectableServices
          List of CollectableService objects.
private  java.util.Map m_monitors
          The map of service names to service models.
private  Scheduler m_scheduler
          The scheduler assocated with this receiver
 
Constructor Summary
(package private) BroadcastEventProcessor(java.util.List collectableServices)
          This constructor is called to initilize the JMS event receiver.
 
Method Summary
(package private)  void close()
           Closes the current connections to the Java Message Queue if they are still active.
private  void configureSNMPHandler(Event event)
          This method is responsible for handling configureSNMP events.
protected  void finalize()
          This method may be invoked by the garbage collection.
 java.lang.String getName()
          Return the id of the listener
private  void installMessageSelectors()
          Create message selector to set to the subscription
private  void interfaceDeletedHandler(Event event)
          This method is responsible for handling interfaceDeleted events.
private  void interfaceReparentedHandler(Event event)
          This method is responsible for processing 'interfacReparented' events.
private  void nodeDeletedHandler(Event event)
          This method is responsible for handling nodeDeleted events.
private  void nodeGainedServiceHandler(Event event)
          Process the event, construct a new CollectableService object representing the node/interface combination, and schedule the interface for collection.
 void onEvent(Event event)
          This method is invoked by the JMS topic session when a new event is available for processing.
private  void primarySnmpInterfaceChangedHandler(Event event)
          Process the 'primarySnmpInterfaceChanged' event.
private  void reinitializePrimarySnmpInterfaceHandler(Event event)
          Process the event.
private  void scheduleForCollection(Event event)
           
private  void serviceDeletedHandler(Event event)
          This method is responsible for handling serviceDeleted events.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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 receiver


m_collectableServices

private java.util.List m_collectableServices
List of CollectableService objects.

Constructor Detail

BroadcastEventProcessor

BroadcastEventProcessor(java.util.List collectableServices)
This constructor is called to initilize the JMS event receiver. A connection to the message server is opened and this instance is setup as the endpoint for broadcast events. When a new event arrives it is processed and the appropriate action is taken.

Parameters:
collectableServices - List of all the CollectableService objects scheduled for collection.
Throws:
javax.naming.NamingException - Thrown if the JNDI lookups fail.
javax.jms.JMSException - Thrown if an error occurs in the JMS subsystem.
Method Detail

installMessageSelectors

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


close

void close()

Closes the current connections to the Java Message Queue if they are still active. This call may be invoked more than once safely and may be invoked during object finalization.


finalize

protected void finalize()
                 throws java.lang.Throwable
This method may be invoked by the garbage collection. Once invoked it ensures that the close method is called at least once during the cycle of this object.

Throws:
java.lang.Throwable

getName

public java.lang.String getName()
Description copied from interface: EventListener
Return the id of the listener

Specified by:
getName in interface EventListener

onEvent

public void onEvent(Event event)
This method is invoked by the JMS topic session when a new event is available for processing. Currently only text based messages are processed by this callback. 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 message.

reinitializePrimarySnmpInterfaceHandler

private void reinitializePrimarySnmpInterfaceHandler(Event event)
Process the event. This event is generated when a managed node which supports SNMP gains a new interface. In this situation the CollectableService object representing the primary SNMP interface of the node must be reinitialized. The CollectableService object associated with the primary SNMP interface for the node will be marked for reinitialization. Reinitializing the CollectableService object consists of calling the ServiceCollector.release() method followed by the ServiceCollector.initialize() method which will refresh attributes such as the interface key list and number of interfaces (both of which most likely have changed). Reinitialization will take place the next time the CollectableService is popped from an interval queue for collection. If any errors occur scheduling the service no error is returned.

Parameters:
event - The event to process.

nodeGainedServiceHandler

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

Parameters:
event - The event to process.

primarySnmpInterfaceChangedHandler

private void primarySnmpInterfaceChangedHandler(Event event)
Process the 'primarySnmpInterfaceChanged' event. Extract the old and new primary SNMP interface addresses from the event parms. Any CollectableService objects located in the collectable services list which match the IP address of the old primary interface and have a service name of "SNMP" are flagged for deletion. This will ensure that the old primary interface is no longer collected against. Finally the new primary SNMP interface is scheduled. The packages are examined and new CollectableService objects are created, initialized and scheduled for collection.

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. All CollectableService objects in the service updates map which match the event's interface address and the SNMP service have a reparenting update associated with them. When the scheduler next pops one of these services from an interval queue for collection all of the RRDs associated with the old nodeId are moved under the new nodeId and the nodeId of the collectable service is updated to reflect the interface's new parent nodeId.

Parameters:
event - The event to process.

nodeDeletedHandler

private void nodeDeletedHandler(Event event)
This method is responsible for handling nodeDeleted events.

Parameters:
event - The event to process.

interfaceDeletedHandler

private void interfaceDeletedHandler(Event event)
This method is responsible for handling interfaceDeleted events.

Parameters:
event - The event to process.

serviceDeletedHandler

private void serviceDeletedHandler(Event event)
This method is responsible for handling serviceDeleted events.

Parameters:
event - The event to process.

configureSNMPHandler

private void configureSNMPHandler(Event event)
This method is responsible for handling configureSNMP events.

Parameters:
event - The event to process.

scheduleForCollection

private void scheduleForCollection(Event event)

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.