org.opennms.netmgt.notifd
Class BroadcastEventProcessor

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

public final class BroadcastEventProcessor
extends Object
implements EventListener

BroadcastEventProcessor class.

Author:
Brian Weaver , OpenNMS

Constructor Summary
BroadcastEventProcessor()
          Constructor for BroadcastEventProcessor.
 
Method Summary
 void close()
          Unsubscribe from eventd
 boolean computeNullSafeStatus()
          computeNullSafeStatus
static String expandNotifParms(String input, Map<String,String> paramMap)
          A parameter expansion algorithm, designed to replace strings delimited by percent signs '%' with a value supplied by a Map object.
 DestinationPathManager getDestinationPathManager()
          getDestinationPathManager
 EventIpcManager getEventManager()
          getEventManager
 GroupManager getGroupManager()
          getGroupManager
 String getName()
          Return an id for this event listener
 Map<String,NoticeQueue> getNoticeQueues()
          getNoticeQueues
 NotifdConfigManager getNotifdConfigManager()
          getNotifdConfigManager
 NotificationCommandManager getNotificationCommandManager()
          getNotificationCommandManager
 NotificationManager getNotificationManager()
          getNotificationManager
 PollOutagesConfigManager getPollOutagesConfigManager()
          getPollOutagesConfigManager
 UserManager getUserManager()
          getUserManager
protected  void init()
          An event listener is created and this instance is setup as the endpoint for broadcast events.
protected  void initExpandRe()
          Initializes the expansion regular expression.
 void onEvent(Event event)
          Process a sent event.
 Map<String,String> rebuildParameterMap(int notifId, String resolutionPrefix, boolean skipNumericPrefix)
          rebuildParameterMap
 String scheduledOutage(long nodeId, String theInterface)
          Checks the package information for the pollable service and determines if any of the calendar outages associated with the package apply to the current time and the service's interface.
protected  void sendResolvedNotificationsToUser(String queueID, String targetName, String[] commands, Map<String,String> params)
          sendResolvedNotificationsToUser
 void setDestinationPathManager(DestinationPathManager destinationPathManager)
          setDestinationPathManager
 void setEventManager(EventIpcManager eventManager)
          setEventManager
 void setGroupManager(GroupManager groupManager)
          setGroupManager
 void setNoticeQueues(Map<String,NoticeQueue> noticeQueues)
          setNoticeQueues
 void setNotifdConfigManager(NotifdConfigManager notifdConfigManager)
          setNotifdConfigManager
 void setNotificationCommandManager(NotificationCommandManager notificationCommandManager)
          setNotificationCommandManager
 void setNotificationManager(NotificationManager notificationManager)
          setNotificationManager
 void setPollOutagesConfigManager(PollOutagesConfigManager pollOutagesConfigManager)
          setPollOutagesConfigManager
 void setUserManager(UserManager userManager)
          setUserManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BroadcastEventProcessor

public BroadcastEventProcessor()

Constructor for BroadcastEventProcessor.

Method Detail

init

protected void init()
An event listener is created 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.


initExpandRe

protected void initExpandRe()
Initializes the expansion regular expression. The exception is going to be thrown away if the RE can't be compiled, thus the compilation should be tested prior to runtime.


close

public void close()
Unsubscribe from eventd


onEvent

public void onEvent(Event event)
Process a sent event. This method is invoked by the EventIpcManager when a new event is available for processing.

Specified by:
onEvent in interface EventListener
Parameters:
event - a Event object.

computeNullSafeStatus

public boolean computeNullSafeStatus()

computeNullSafeStatus

Returns:
false if status is not defined in configuration as "on".

sendResolvedNotificationsToUser

protected void sendResolvedNotificationsToUser(String queueID,
                                               String targetName,
                                               String[] commands,
                                               Map<String,String> params)
                                        throws Exception

sendResolvedNotificationsToUser

Parameters:
queueID - a String object.
targetName - a String object.
commands - an array of String objects.
params - a Map object.
Throws:
Exception - if any.

expandNotifParms

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

NOTE: This function only replaces one particular parameter, the %noticeid% parameter.

Parameters:
input - the input string
paramMap - a map that will supply the substitution values
Returns:
a String object.

getName

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

Specified by:
getName in interface EventListener
Returns:
a String object.

rebuildParameterMap

public Map<String,String> rebuildParameterMap(int notifId,
                                              String resolutionPrefix,
                                              boolean skipNumericPrefix)
                                       throws Exception

rebuildParameterMap

Parameters:
notifId - a int.
resolutionPrefix - a String object.
skipNumericPrefix - a boolean.
Returns:
a Map object.
Throws:
Exception - if any.

scheduledOutage

public String scheduledOutage(long nodeId,
                              String theInterface)
Checks the package information for the pollable service and determines if any of the calendar outages associated with the package apply to the current time and the service's interface. If an outage applies it's name is returned...otherwise null is returned.

Parameters:
nodeId - a long.
theInterface - a String object.
Returns:
null if no outage found (indicating a notification may be sent) or the outage name, if an applicable outage is found (indicating notification should not be sent).
Throws:
IOException - if any.
org.exolab.castor.xml.ValidationException - if any.
org.exolab.castor.xml.MarshalException - if any.

getDestinationPathManager

public DestinationPathManager getDestinationPathManager()

getDestinationPathManager

Returns:
a DestinationPathManager object.

setDestinationPathManager

public void setDestinationPathManager(DestinationPathManager destinationPathManager)

setDestinationPathManager

Parameters:
destinationPathManager - a DestinationPathManager object.

getEventManager

public EventIpcManager getEventManager()

getEventManager

Returns:
a EventIpcManager object.

setEventManager

public void setEventManager(EventIpcManager eventManager)

setEventManager

Parameters:
eventManager - a EventIpcManager object.

getGroupManager

public GroupManager getGroupManager()

getGroupManager

Returns:
a GroupManager object.

setGroupManager

public void setGroupManager(GroupManager groupManager)

setGroupManager

Parameters:
groupManager - a GroupManager object.

getNotifdConfigManager

public NotifdConfigManager getNotifdConfigManager()

getNotifdConfigManager

Returns:
a NotifdConfigManager object.

setNotifdConfigManager

public void setNotifdConfigManager(NotifdConfigManager notifdConfigManager)

setNotifdConfigManager

Parameters:
notifdConfigManager - a NotifdConfigManager object.

getNotificationCommandManager

public NotificationCommandManager getNotificationCommandManager()

getNotificationCommandManager

Returns:
a NotificationCommandManager object.

setNotificationCommandManager

public void setNotificationCommandManager(NotificationCommandManager notificationCommandManager)

setNotificationCommandManager

Parameters:
notificationCommandManager - a NotificationCommandManager object.

getNotificationManager

public NotificationManager getNotificationManager()

getNotificationManager

Returns:
a NotificationManager object.

setNotificationManager

public void setNotificationManager(NotificationManager notificationManager)

setNotificationManager

Parameters:
notificationManager - a NotificationManager object.

getPollOutagesConfigManager

public PollOutagesConfigManager getPollOutagesConfigManager()

getPollOutagesConfigManager

Returns:
a PollOutagesConfigManager object.

setPollOutagesConfigManager

public void setPollOutagesConfigManager(PollOutagesConfigManager pollOutagesConfigManager)

setPollOutagesConfigManager

Parameters:
pollOutagesConfigManager - a PollOutagesConfigManager object.

getUserManager

public UserManager getUserManager()

getUserManager

Returns:
a UserManager object.

setUserManager

public void setUserManager(UserManager userManager)

setUserManager

Parameters:
userManager - a UserManager object.

getNoticeQueues

public Map<String,NoticeQueue> getNoticeQueues()

getNoticeQueues

Returns:
a Map object.

setNoticeQueues

public void setNoticeQueues(Map<String,NoticeQueue> noticeQueues)

setNoticeQueues

Parameters:
noticeQueues - a Map object.


Copyright © 2011. All Rights Reserved.