public abstract class NotificationManager extends Object
Abstract NotificationManager class.
Modifier and Type | Field and Description |
---|---|
Notifications |
m_notifications
Object containing all Notification objects parsed from the xml file
|
static String |
PARAM_DESTINATION
Constant
PARAM_DESTINATION="-d" |
static String |
PARAM_EMAIL
Constant
PARAM_EMAIL="-email" |
static String |
PARAM_HOME_PHONE
Constant
PARAM_HOME_PHONE="-hphone" |
static String |
PARAM_INTERFACE
Constant
PARAM_INTERFACE="-interface" |
static String |
PARAM_MICROBLOG_USERNAME
Constant
PARAM_MICROBLOG_USERNAME="-ublog" |
static String |
PARAM_MOBILE_PHONE
Constant
PARAM_MOBILE_PHONE="-mphone" |
static String |
PARAM_NODE
Constant
PARAM_NODE="-nodeid" |
static String |
PARAM_NUM_MSG
Constant
PARAM_NUM_MSG="-nm" |
static String |
PARAM_NUM_PAGER_PIN
Constant
PARAM_NUM_PAGER_PIN="-np" |
static String |
PARAM_PAGER_EMAIL
Constant
PARAM_PAGER_EMAIL="-pemail" |
static String |
PARAM_RESPONSE
Constant
PARAM_RESPONSE="-r" |
static String |
PARAM_SERVICE
Constant
PARAM_SERVICE="-service" |
static String |
PARAM_SUBJECT
Constant
PARAM_SUBJECT="-subject" |
static String |
PARAM_TEXT_MSG
Constant
PARAM_TEXT_MSG="-tm" |
static String |
PARAM_TEXT_PAGER_PIN
Constant
PARAM_TEXT_PAGER_PIN="-tp" |
static String |
PARAM_TUI_PIN
Constant
PARAM_TUI_PIN="-tuipin" |
static String |
PARAM_TYPE
Constant
PARAM_TYPE="-t" |
static String |
PARAM_WORK_PHONE
Constant
PARAM_WORK_PHONE="-wphone" |
static String |
PARAM_XMPP_ADDRESS
Constant
PARAM_XMPP_ADDRESS="-xmpp" |
Modifier | Constructor and Description |
---|---|
protected |
NotificationManager(NotifdConfigManager configManager,
DataSource dcf)
Constructor for NotificationManager.
|
Modifier and Type | Method and Description |
---|---|
Collection<Integer> |
acknowledgeNotice(Event event,
String uei,
String[] matchList)
acknowledgeNotice
|
Collection<Integer> |
acknowledgeNoticeBasedOnAlarms(Event event)
acknowledgeNoticeBasedOnAlarms
|
void |
addNotification(Notification notice)
Handles adding a new Notification.
|
static void |
addNotificationParams(Map<String,String> paramMap,
Notification notification)
Adds additional parameters defined by the user in the notification
configuration XML.
|
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.
|
void |
forEachUserNotification(int notifId,
RowProcessor rp)
forEachUserNotification
|
List<Integer> |
getActiveNodes()
getActiveNodes
|
long |
getBinaryNoticesAttempted() |
long |
getBinaryNoticesFailed() |
long |
getBinaryNoticesInterrupted() |
long |
getBinaryNoticesSucceeded() |
protected NotifdConfigManager |
getConfigManager()
getConfigManager
|
Event |
getEvent(int eventid)
In the absence of DAOs and ORMs this creates an Event object from the persisted
record.
|
long |
getJavaNoticesAttempted() |
long |
getJavaNoticesFailed() |
long |
getJavaNoticesInterrupted() |
long |
getJavaNoticesSucceeded() |
int |
getNoticeId()
This method wraps the call to the database to get a sequence notice ID
from the database.
|
Notification[] |
getNotifForEvent(Event event)
getNotifForEvent
|
Notification |
getNotification(String name)
getNotification
|
List<String> |
getNotificationNames()
getNotificationNames
|
Map<String,Notification> |
getNotifications()
getNotifications
|
long |
getNotificationTasksQueued() |
String |
getQueueForNotification(int notifId)
getQueueForNotification
|
List<String> |
getServiceNames()
getServiceNames
|
String |
getServiceNoticeStatus(String nodeID,
String ipaddr,
String service)
getServiceNoticeStatus
|
long |
getUnknownNoticesInterrupted() |
int |
getUserNotifId()
getUserNotifId
|
boolean |
hasUei(String uei)
hasUei
|
void |
incrementAttempted(boolean isBinary) |
void |
incrementFailed(boolean isBinary) |
void |
incrementInterrupted(boolean isBinary) |
void |
incrementSucceeded(boolean isBinary) |
void |
incrementTasksQueued() |
void |
incrementUnknownInterrupted() |
void |
insertNotice(int notifyId,
Map<String,String> params,
String queueID,
Notification notification)
This method inserts a row into the notifications table in the database.
|
protected boolean |
nodeInterfaceServiceValid(Notification notif,
Event event)
nodeInterfaceServiceValid
|
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(InputStream stream)
parseXML
|
void |
parseXML(Reader reader)
Deprecated.
|
Map<String,String> |
rebuildParameterMap(int notifId,
String resolutionPrefix,
boolean skipNumericPrefix)
rebuildParameterMap
|
void |
removeNotification(String name)
removeNotification
|
void |
replaceNotification(String oldName,
Notification newNotice)
replaceNotification
|
void |
saveCurrent()
saveCurrent
|
protected abstract void |
saveXML(String xmlString)
saveXML
|
abstract void |
update()
update
|
void |
updateNoticeWithUserInfo(String userId,
int noticeId,
String media,
String contactInfo,
String autoNotify)
updateNoticeWithUserInfo
|
void |
updateStatus(String name,
String status)
Sets the status on an individual notification configuration and saves to xml.
|
public Notifications m_notifications
public static final String PARAM_TYPE
PARAM_TYPE="-t"
public static final String PARAM_DESTINATION
PARAM_DESTINATION="-d"
public static final String PARAM_TEXT_MSG
PARAM_TEXT_MSG="-tm"
public static final String PARAM_NUM_MSG
PARAM_NUM_MSG="-nm"
public static final String PARAM_RESPONSE
PARAM_RESPONSE="-r"
public static final String PARAM_NODE
PARAM_NODE="-nodeid"
public static final String PARAM_INTERFACE
PARAM_INTERFACE="-interface"
public static final String PARAM_SERVICE
PARAM_SERVICE="-service"
public static final String PARAM_SUBJECT
PARAM_SUBJECT="-subject"
public static final String PARAM_EMAIL
PARAM_EMAIL="-email"
public static final String PARAM_PAGER_EMAIL
PARAM_PAGER_EMAIL="-pemail"
public static final String PARAM_XMPP_ADDRESS
PARAM_XMPP_ADDRESS="-xmpp"
public static final String PARAM_TEXT_PAGER_PIN
PARAM_TEXT_PAGER_PIN="-tp"
public static final String PARAM_NUM_PAGER_PIN
PARAM_NUM_PAGER_PIN="-np"
public static final String PARAM_WORK_PHONE
PARAM_WORK_PHONE="-wphone"
public static final String PARAM_HOME_PHONE
PARAM_HOME_PHONE="-hphone"
public static final String PARAM_MOBILE_PHONE
PARAM_MOBILE_PHONE="-mphone"
public static final String PARAM_TUI_PIN
PARAM_TUI_PIN="-tuipin"
public static final String PARAM_MICROBLOG_USERNAME
PARAM_MICROBLOG_USERNAME="-ublog"
protected NotificationManager(NotifdConfigManager configManager, DataSource dcf)
Constructor for NotificationManager.
configManager
- a NotifdConfigManager
object.dcf
- a DataSource
object.public static String expandNotifParms(String input, Map<String,String> paramMap)
NOTE: This function only replaces one particular parameter, the
%noticeid%
parameter.
input
- the input stringparamMap
- a map that will supply the substitution valuesString
object.@Deprecated public void parseXML(Reader reader)
parseXML
reader
- a Reader
object.public void parseXML(InputStream stream) throws IOException
parseXML
stream
- a InputStream
object.IOException
public boolean hasUei(String uei) throws IOException
hasUei
uei
- a String
object.IOException
- if any.public Notification[] getNotifForEvent(Event event) throws IOException
getNotifForEvent
event
- a Event
object.Notification
objects.IOException
- if any.protected NotifdConfigManager getConfigManager()
getConfigManager
NotifdConfigManager
object.protected boolean nodeInterfaceServiceValid(Notification notif, Event event)
nodeInterfaceServiceValid
notif
- a Notification
object.event
- a Event
object.public int getNoticeId() throws SQLException, IOException
SQLException
- if any.IOException
- if any.public int getUserNotifId() throws SQLException, IOException
getUserNotifId
SQLException
- if any.IOException
- if any.public boolean noticeOutstanding(int noticeId) throws IOException
noticeId
- a int.IOException
- if any.public Collection<Integer> acknowledgeNotice(Event event, String uei, String[] matchList) throws SQLException, IOException
acknowledgeNotice
event
- a Event
object.uei
- a String
object.matchList
- an array of String
objects.Collection
object.SQLException
- if any.IOException
- if any.public Collection<Integer> acknowledgeNoticeBasedOnAlarms(Event event) throws SQLException, IOException
acknowledgeNoticeBasedOnAlarms
event
- a Event
object.Collection
object.SQLException
- if any.IOException
- if any.public List<Integer> getActiveNodes() throws SQLException
getActiveNodes
List
object.SQLException
- if any.public String getServiceNoticeStatus(String nodeID, String ipaddr, String service) throws SQLException
getServiceNoticeStatus
nodeID
- a String
object.ipaddr
- a String
object.service
- a String
object.String
object.SQLException
- if any.public void updateNoticeWithUserInfo(String userId, int noticeId, String media, String contactInfo, String autoNotify) throws SQLException, IOException
updateNoticeWithUserInfo
userId
- a String
object.noticeId
- a int.media
- a String
object.contactInfo
- a String
object.autoNotify
- a String
object.IOException
- if any.SQLException
- if any.public void insertNotice(int notifyId, Map<String,String> params, String queueID, Notification notification) throws SQLException
queueID
- a String
object.notification
- TODOnotifyId
- a int.params
- a Map
object.SQLException
- if any.public Map<String,Notification> getNotifications() throws IOException
getNotifications
Map
object.IOException
- if any.public List<String> getServiceNames() throws SQLException
getServiceNames
List
object.SQLException
public Notification getNotification(String name) throws IOException
getNotification
name
- a String
object.Notification
object.IOException
- if any.public List<String> getNotificationNames() throws IOException
getNotificationNames
List
object.IOException
- if any.public void removeNotification(String name) throws IOException, ClassNotFoundException
removeNotification
name
- a String
object.IOException
- if any.ClassNotFoundException
- if any.public void addNotification(Notification notice) throws IOException, ClassNotFoundException
notice
- The Notification to add.IOException
- if any.ClassNotFoundException
- if any.public void replaceNotification(String oldName, Notification newNotice) throws IOException, ClassNotFoundException
replaceNotification
oldName
- a String
object.newNotice
- a Notification
object.IOException
- if any.ClassNotFoundException
- if any.public void updateStatus(String name, String status) throws IOException, ClassNotFoundException
name
- The name of the notification.status
- The status (either "on" or "off").IOException
- if any.ClassNotFoundException
- if any.public void saveCurrent() throws IOException, ClassNotFoundException
saveCurrent
IOException
- if any.ClassNotFoundException
- if any.protected abstract void saveXML(String xmlString) throws IOException
saveXML
xmlString
- a String
object.IOException
- if any.public abstract void update() throws IOException
update
IOException
- if any.public Map<String,String> rebuildParameterMap(int notifId, String resolutionPrefix, boolean skipNumericPrefix) throws Exception
rebuildParameterMap
public static void addNotificationParams(Map<String,String> paramMap, Notification notification)
paramMap
- a Map
object.notification
- a Notification
object.public void forEachUserNotification(int notifId, RowProcessor rp)
forEachUserNotification
notifId
- a int.rp
- a RowProcessor
object.public String getQueueForNotification(int notifId)
getQueueForNotification
notifId
- a int.String
object.public Event getEvent(int eventid)
eventid
- a int.public void incrementTasksQueued()
public void incrementAttempted(boolean isBinary)
public void incrementSucceeded(boolean isBinary)
public void incrementFailed(boolean isBinary)
public void incrementInterrupted(boolean isBinary)
public void incrementUnknownInterrupted()
public long getNotificationTasksQueued()
public long getBinaryNoticesAttempted()
public long getJavaNoticesAttempted()
public long getBinaryNoticesSucceeded()
public long getJavaNoticesSucceeded()
public long getBinaryNoticesFailed()
public long getJavaNoticesFailed()
public long getBinaryNoticesInterrupted()
public long getJavaNoticesInterrupted()
public long getUnknownNoticesInterrupted()
Copyright © 2021. All rights reserved.