OpenNMS API 1.1.4

org.opennms.netmgt.notifd
Class BroadcastEventProcessor

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

final class BroadcastEventProcessor
extends java.lang.Object
implements EventListener

Author:
Brian Weaver, OpenNMS

Field Summary
private  java.util.Map m_noticeQueues
           
private static java.lang.String NOTIFD_EXPANSION_PARM
          A regular expression for matching an expansion parameter delimited by percent signs.
private static org.apache.regexp.RE notifdExpandRE
           
 
Constructor Summary
(package private) BroadcastEventProcessor(java.util.Map noticeQueues)
          This constructor is called to initilize the event receiver.
 
Method Summary
private  void automaticAcknowledge(Event event)
           
private  java.util.Map buildParameterMap(Notification notification, Event event, int noticeId)
           
 void close()
          Unsubscribe from eventd
private  boolean continueWithNotice(Event event)
          This method determines if the notice should continue based on the status of the notify
static java.lang.String expandNotifParms(java.lang.String inp, java.util.Map paramMap)
          A parameter expansion algorithm, designed to replace strings delimited by percent signs '%' with a value supplied by a Map object.
 java.lang.String getName()
          Return an id for this event listener
private  int getUserCount(Target[] targets, Escalate[] escalations)
          Detemines the number of users assigned to a list of Target and Escalate lists.
private  int getUsersInTarget(Target target)
           
private  NotificationTask makeEmailTask(long sendTime, java.util.Map parameters, int noticeId, java.lang.String address, java.lang.String[] commandList, java.util.List siblings)
           
private  NotificationTask makeUserTask(long sendTime, java.util.Map parameters, int noticeId, java.lang.String targetName, java.lang.String[] commandList, java.util.List siblings)
           
private  boolean matchNotificationParameters(Event event, Notification notification)
          See if the event parameters match the variables in the notification.
 void onEvent(Event event)
          This method is invoked by the EventIpcManager when a new event is available for processing.
private  void processEscalations(Escalate[] escalations, java.util.List targetSiblings, NoticeQueue noticeQueue, long startTime, java.util.Map params, int noticeId)
           
private  void processTargets(Target[] targets, java.util.List targetSiblings, NoticeQueue noticeQueue, long startTime, java.util.Map params, int noticeId)
           
private  void scheduleNoticesForEvent(Event event)
           
private  void sendNotifEvent(java.lang.String uei, java.lang.String logMessage, java.lang.String description)
          Sends and event related to a notification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_noticeQueues

private java.util.Map m_noticeQueues

NOTIFD_EXPANSION_PARM

private static final java.lang.String NOTIFD_EXPANSION_PARM
A regular expression for matching an expansion parameter delimited by percent signs.

See Also:
Constant Field Values

notifdExpandRE

private static org.apache.regexp.RE notifdExpandRE
Constructor Detail

BroadcastEventProcessor

BroadcastEventProcessor(java.util.Map noticeQueues)
This constructor is called to initilize the 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.

Method Detail

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.

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

automaticAcknowledge

private void automaticAcknowledge(Event event)

continueWithNotice

private boolean continueWithNotice(Event event)
This method determines if the notice should continue based on the status of the notify


scheduleNoticesForEvent

private void scheduleNoticesForEvent(Event event)

getUserCount

private int getUserCount(Target[] targets,
                         Escalate[] escalations)
                  throws java.io.IOException,
                         org.exolab.castor.xml.MarshalException,
                         org.exolab.castor.xml.ValidationException
Detemines the number of users assigned to a list of Target and Escalate lists. Group names may be specified in these objects and the users will have to be extracted from those groups

Parameters:
targets - the list of Target objects
escalations - the list of Escalate objects
Returns:
the total # of users assigned in each Target and Escalate objecst.
Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

getUsersInTarget

private int getUsersInTarget(Target target)
                      throws java.io.IOException,
                             org.exolab.castor.xml.MarshalException,
                             org.exolab.castor.xml.ValidationException
Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

sendNotifEvent

private void sendNotifEvent(java.lang.String uei,
                            java.lang.String logMessage,
                            java.lang.String description)
Sends and event related to a notification

Parameters:
uei - the UEI for the event

buildParameterMap

private java.util.Map buildParameterMap(Notification notification,
                                        Event event,
                                        int noticeId)

expandNotifParms

public static java.lang.String expandNotifParms(java.lang.String inp,
                                                java.util.Map paramMap)
A parameter expansion algorithm, designed to replace strings delimited by percent signs '%' with a value supplied by a Map object.

Parameters:
inp - the input string
paramMap - a map that will supply the substitution values

processTargets

private void processTargets(Target[] targets,
                            java.util.List targetSiblings,
                            NoticeQueue noticeQueue,
                            long startTime,
                            java.util.Map params,
                            int noticeId)
                     throws java.io.IOException,
                            org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException
Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

processEscalations

private void processEscalations(Escalate[] escalations,
                                java.util.List targetSiblings,
                                NoticeQueue noticeQueue,
                                long startTime,
                                java.util.Map params,
                                int noticeId)
                         throws java.io.IOException,
                                org.exolab.castor.xml.MarshalException,
                                org.exolab.castor.xml.ValidationException
Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

makeUserTask

private NotificationTask makeUserTask(long sendTime,
                                      java.util.Map parameters,
                                      int noticeId,
                                      java.lang.String targetName,
                                      java.lang.String[] commandList,
                                      java.util.List siblings)
                               throws java.io.IOException,
                                      org.exolab.castor.xml.MarshalException,
                                      org.exolab.castor.xml.ValidationException
Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

makeEmailTask

private NotificationTask makeEmailTask(long sendTime,
                                       java.util.Map parameters,
                                       int noticeId,
                                       java.lang.String address,
                                       java.lang.String[] commandList,
                                       java.util.List siblings)
                                throws java.io.IOException,
                                       org.exolab.castor.xml.MarshalException,
                                       org.exolab.castor.xml.ValidationException
Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

getName

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

Specified by:
getName in interface EventListener

matchNotificationParameters

private boolean matchNotificationParameters(Event event,
                                            Notification notification)
See if the event parameters match the variables in the notification. The purpose of this method is to match parameters, such as those in a threshold event, with parameters configured for a notification, such as ds-name.

Parameters:
event - The event to process.
notification - The notification to process.

OpenNMS API 1.1.4

Generated by eevans on November 11 2004 1600.