OpenNMS API 1.1.4

org.opennms.netmgt.config
Class NotificationFactory

java.lang.Object
  extended byorg.opennms.netmgt.config.NotificationFactory

public class NotificationFactory
extends java.lang.Object


Field Summary
protected static java.io.InputStream configIn
          Input stream for the general Notifd configuration xml
private static boolean initialized
          Boolean indicating if the init() method has been called
private static NotificationFactory instance
          Singleton instance
private static long m_lastModified
           
private static java.io.File m_noticeConfFile
           
protected static java.io.File m_notifConfFile
          Configuration file handle
protected static Notifications m_notifications
          Object containing all Notification objects parsed from the xml file
private static 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
           
 
Constructor Summary
private NotificationFactory()
           
 
Method Summary
 void acknowledgeNotice(Event event, java.lang.String uei, java.lang.String[] matchList)
           
 void addNotification(Notification notice)
          Handles adding a new Notification.
 java.util.List getActiveNodes()
           
static NotificationFactory getInstance()
           
static 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()
           
private static 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()
           
static java.lang.String getServiceNoticeStatus(java.lang.String nodeID, java.lang.String ipaddr, java.lang.String service)
           
 boolean hasUei(java.lang.String uei)
           
static void init()
           
static void insertNotice(int notifyId, java.util.Map params)
          This method inserts a row into the notifications table in the database.
private  boolean nodeInterfaceServiceValid(Notification notif, Event event)
           
static 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.
private  Header rebuildHeader()
           
static void reload()
           
 void removeNotification(java.lang.String name)
           
 void replaceNotification(java.lang.String oldName, Notification notice)
           
 void saveCurrent()
           
private static void updateFromFile()
           
static 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

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_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

instance

private static NotificationFactory instance
Singleton instance


m_notifConfFile

protected static java.io.File m_notifConfFile
Configuration file handle


m_notifications

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


configIn

protected static java.io.InputStream configIn
Input stream for the general Notifd configuration xml


initialized

private static boolean initialized
Boolean indicating if the init() method has been called


oldHeader

private static Header oldHeader

m_noticeConfFile

private static java.io.File m_noticeConfFile

m_lastModified

private static long m_lastModified
Constructor Detail

NotificationFactory

private NotificationFactory()
Method Detail

getInstance

public static NotificationFactory getInstance()

init

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

reload

public static void reload()
                   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

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

nodeInterfaceServiceValid

private boolean nodeInterfaceServiceValid(Notification notif,
                                          Event event)

getNoticeId

public static 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 static 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 void 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 static 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 static 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 static void insertNotice(int notifyId,
                                java.util.Map params)
                         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.

Throws:
java.sql.SQLException

getServiceId

private static 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

rebuildHeader

private Header rebuildHeader()

updateFromFile

private static void updateFromFile()
                            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

OpenNMS API 1.1.4

Generated by eevans on November 12 2004 1715.