OpenNMS API 1.2.3

org.opennms.netmgt.config
Class NotificationManager

java.lang.Object
  extended byorg.opennms.netmgt.config.NotificationManager
Direct Known Subclasses:
MockNotificationManager, NotificationFactory

public abstract class NotificationManager
extends java.lang.Object

Author:
David Hustace This base class was refactored from NotificationFactory to support non-global references during JUnit testing and later to support distributed processes.

Field Summary
(package private)  NotifdConfigManager m_configManager
           
private  DbConnectionFactory m_dbConnectionFactory
           
 Notifications m_notifications
          Object containing all Notification objects parsed from the xml file
private  Header oldHeader
           
static java.lang.String PARAM_DESTINATION
           
static java.lang.String PARAM_EMAIL
           
static java.lang.String PARAM_INTERFACE
           
static java.lang.String PARAM_NODE
           
static java.lang.String PARAM_NUM_MSG
           
static java.lang.String PARAM_NUM_PAGER_PIN
           
static java.lang.String PARAM_PAGER_EMAIL
           
static java.lang.String PARAM_RESPONSE
           
static java.lang.String PARAM_SERVICE
           
static java.lang.String PARAM_SUBJECT
           
static java.lang.String PARAM_TEXT_MSG
           
static java.lang.String PARAM_TEXT_PAGER_PIN
           
static java.lang.String PARAM_TYPE
           
static java.lang.String PARAM_XMPP_ADDRESS
           
 
Constructor Summary
protected NotificationManager(NotifdConfigManager configManager, DbConnectionFactory dcf)
           
 
Method Summary
 java.util.Collection acknowledgeNotice(Event event, java.lang.String uei, java.lang.String[] matchList)
           
 void addNotification(Notification notice)
          Handles adding a new Notification.
 void forEachUserNotification(int notifId, RowProcessor rp)
           
 java.util.List getActiveNodes()
           
protected  NotifdConfigManager getConfigManager()
           
private  java.sql.Connection getConnection()
           
protected  java.lang.String getInterfaceFilter(java.lang.String rule)
           
 int getNoticeId()
          This method wraps the call to the database to get a sequence notice ID from the database.
 Notification[] getNotifForEvent(Event event)
           
 Notification getNotification(java.lang.String name)
           
 java.util.List getNotificationNames()
           
 java.util.Map getNotifications()
           
 java.lang.String getQueueForNotification(int notifId)
           
private  int getServiceId(java.lang.String service)
          This method queries the database in search of a service id for a given serivice name
 java.util.List getServiceNames()
           
 java.lang.String getServiceNoticeStatus(java.lang.String nodeID, java.lang.String ipaddr, java.lang.String service)
           
 boolean hasUei(java.lang.String uei)
           
 void insertNotice(int notifyId, java.util.Map params, java.lang.String queueID)
          This method inserts a row into the notifications table in the database.
private  boolean nodeInterfaceServiceValid(Notification notif, Event event)
           
 boolean noticeOutstanding(int noticeId)
          This method returns a boolean indicating if the page has been responded to by any member of the group the page was sent to.
 void parseXML(java.io.Reader reader)
           
private  Header rebuildHeader()
           
 java.util.Map rebuildParamterMap(int notifId, java.lang.String resolutionPrefix)
           
 void removeNotification(java.lang.String name)
           
 void replaceNotification(java.lang.String oldName, Notification notice)
           
 void saveCurrent()
           
protected abstract  void saveXML(java.lang.String xmlString)
           
protected abstract  void update()
           
 void updateNoticeWithUserInfo(java.lang.String userId, int noticeId, java.lang.String media, java.lang.String contactInfo)
           
 void updateStatus(java.lang.String name, java.lang.String status)
          Sets the status on an individual notification configuration and saves to xml.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_notifications

public Notifications m_notifications
Object containing all Notification objects parsed from the xml file


oldHeader

private Header oldHeader

PARAM_TYPE

public static final java.lang.String PARAM_TYPE
See Also:
Constant Field Values

PARAM_DESTINATION

public static final java.lang.String PARAM_DESTINATION
See Also:
Constant Field Values

PARAM_TEXT_MSG

public static final java.lang.String PARAM_TEXT_MSG
See Also:
Constant Field Values

PARAM_NUM_MSG

public static final java.lang.String PARAM_NUM_MSG
See Also:
Constant Field Values

PARAM_RESPONSE

public static final java.lang.String PARAM_RESPONSE
See Also:
Constant Field Values

PARAM_NODE

public static final java.lang.String PARAM_NODE
See Also:
Constant Field Values

PARAM_INTERFACE

public static final java.lang.String PARAM_INTERFACE
See Also:
Constant Field Values

PARAM_SERVICE

public static final java.lang.String PARAM_SERVICE
See Also:
Constant Field Values

PARAM_SUBJECT

public static final java.lang.String PARAM_SUBJECT
See Also:
Constant Field Values

PARAM_EMAIL

public static final java.lang.String PARAM_EMAIL
See Also:
Constant Field Values

PARAM_PAGER_EMAIL

public static final java.lang.String PARAM_PAGER_EMAIL
See Also:
Constant Field Values

PARAM_XMPP_ADDRESS

public static final java.lang.String PARAM_XMPP_ADDRESS
See Also:
Constant Field Values

PARAM_TEXT_PAGER_PIN

public static final java.lang.String PARAM_TEXT_PAGER_PIN
See Also:
Constant Field Values

PARAM_NUM_PAGER_PIN

public static final java.lang.String PARAM_NUM_PAGER_PIN
See Also:
Constant Field Values

m_configManager

NotifdConfigManager m_configManager

m_dbConnectionFactory

private DbConnectionFactory m_dbConnectionFactory
Constructor Detail

NotificationManager

protected NotificationManager(NotifdConfigManager configManager,
                              DbConnectionFactory dcf)
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
Method Detail

parseXML

public void parseXML(java.io.Reader reader)
              throws org.exolab.castor.xml.MarshalException,
                     org.exolab.castor.xml.ValidationException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

hasUei

public boolean hasUei(java.lang.String uei)
               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

getNotifForEvent

public Notification[] getNotifForEvent(Event event)
                                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

getConfigManager

protected NotifdConfigManager getConfigManager()
Returns:

nodeInterfaceServiceValid

private boolean nodeInterfaceServiceValid(Notification notif,
                                          Event event)

getInterfaceFilter

protected java.lang.String getInterfaceFilter(java.lang.String rule)
Parameters:
rule -
Returns:

getConnection

private java.sql.Connection getConnection()
                                   throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException

getNoticeId

public int getNoticeId()
                throws java.sql.SQLException,
                       java.io.IOException,
                       org.exolab.castor.xml.MarshalException,
                       org.exolab.castor.xml.ValidationException
This method wraps the call to the database to get a sequence notice ID from the database.

Returns:
int, the sequence id from the database, 0 by default if there is database trouble
Throws:
java.sql.SQLException
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

noticeOutstanding

public boolean noticeOutstanding(int noticeId)
                          throws java.io.IOException,
                                 org.exolab.castor.xml.MarshalException,
                                 org.exolab.castor.xml.ValidationException
This method returns a boolean indicating if the page has been responded to by any member of the group the page was sent to.

Throws:
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

acknowledgeNotice

public java.util.Collection acknowledgeNotice(Event event,
                                              java.lang.String uei,
                                              java.lang.String[] matchList)
                                       throws java.sql.SQLException,
                                              java.io.IOException,
                                              org.exolab.castor.xml.MarshalException,
                                              org.exolab.castor.xml.ValidationException
Throws:
java.sql.SQLException
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

getActiveNodes

public java.util.List getActiveNodes()
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getServiceNoticeStatus

public java.lang.String getServiceNoticeStatus(java.lang.String nodeID,
                                               java.lang.String ipaddr,
                                               java.lang.String service)
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

updateNoticeWithUserInfo

public void updateNoticeWithUserInfo(java.lang.String userId,
                                     int noticeId,
                                     java.lang.String media,
                                     java.lang.String contactInfo)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

insertNotice

public void insertNotice(int notifyId,
                         java.util.Map params,
                         java.lang.String queueID)
                  throws java.sql.SQLException
This method inserts a row into the notifications table in the database. This row indicates that the page has been sent out.

Parameters:
queueID -
Throws:
java.sql.SQLException

getServiceId

private int getServiceId(java.lang.String service)
                  throws java.sql.SQLException
This method queries the database in search of a service id for a given serivice name

Parameters:
service - the name of the service
Returns:
the serviceID of the service
Throws:
java.sql.SQLException

getNotifications

public java.util.Map getNotifications()
                               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

getServiceNames

public java.util.List getServiceNames()
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

getNotification

public Notification getNotification(java.lang.String name)
                             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

getNotificationNames

public java.util.List getNotificationNames()
                                    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

removeNotification

public void removeNotification(java.lang.String name)
                        throws org.exolab.castor.xml.MarshalException,
                               org.exolab.castor.xml.ValidationException,
                               java.io.IOException,
                               java.lang.ClassNotFoundException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.io.IOException
java.lang.ClassNotFoundException

addNotification

public void addNotification(Notification notice)
                     throws org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException,
                            java.io.IOException,
                            java.lang.ClassNotFoundException
Handles adding a new Notification.

Parameters:
notice - The Notification to add.
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.io.IOException
java.lang.ClassNotFoundException

replaceNotification

public void replaceNotification(java.lang.String oldName,
                                Notification notice)
                         throws org.exolab.castor.xml.MarshalException,
                                org.exolab.castor.xml.ValidationException,
                                java.io.IOException,
                                java.lang.ClassNotFoundException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.io.IOException
java.lang.ClassNotFoundException

updateStatus

public void updateStatus(java.lang.String name,
                         java.lang.String status)
                  throws org.exolab.castor.xml.MarshalException,
                         org.exolab.castor.xml.ValidationException,
                         java.io.IOException,
                         java.lang.ClassNotFoundException
Sets the status on an individual notification configuration and saves to xml.

Parameters:
name - The name of the notification.
status - The status (either "on" or "off").
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.io.IOException
java.lang.ClassNotFoundException

saveCurrent

public void saveCurrent()
                 throws org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException,
                        java.io.IOException,
                        java.lang.ClassNotFoundException
Throws:
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
java.io.IOException
java.lang.ClassNotFoundException

saveXML

protected abstract void saveXML(java.lang.String xmlString)
                         throws java.io.IOException
Parameters:
xmlString -
Throws:
java.io.IOException

rebuildHeader

private Header rebuildHeader()

update

protected abstract void update()
                        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

rebuildParamterMap

public java.util.Map rebuildParamterMap(int notifId,
                                        java.lang.String resolutionPrefix)
                                 throws java.lang.Exception
Parameters:
notifId -
Throws:
java.lang.Exception

forEachUserNotification

public void forEachUserNotification(int notifId,
                                    RowProcessor rp)
Parameters:
notifId -
Returns:

getQueueForNotification

public java.lang.String getQueueForNotification(int notifId)
Parameters:
notifId -
Returns:

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.