Package gov.usgs.earthquake.distribution
Interface NotificationIndex
- All Superinterfaces:
Configurable
- All Known Implementing Classes:
JDBCNotificationIndex
,JsonNotificationIndex
Stores and retrieves Notifications.
This is typically used by a NotificationReceiver to track its Notifications,
but may also be used by NotificationListeners. Each object should maintain a
separate NotificationIndex.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addNotification
(Notification notification) Add a notification to the index.Search the index for expired notifications.Search the index for notifications matching id.findNotifications
(String source, String type, String code) Search the index for notifications matching the sources, types, and codes.Search the index for notifications matching the sources, types, and codes.void
removeNotification
(Notification notification) Remove a notification from the index.void
removeNotifications
(List<Notification> notifications) Remove notifications from index.
-
Method Details
-
addNotification
Add a notification to the index. If an identical notification is already in the index, the implementation may choose whether or not to store the duplicate information.- Parameters:
notification
- the notification to add.- Throws:
Exception
- if an error occurs while storing the notification.
-
removeNotification
Remove a notification from the index. All matching notifications should be removed from the index.- Parameters:
notification
- the notification to remove.- Throws:
Exception
- if an error occurs while removing the notification.
-
removeNotifications
Remove notifications from index.- Parameters:
notifications
- notifications to be removed from index- Throws:
Exception
- if error occurs
-
findNotifications
Search the index for notifications matching id. If more than one notification matches, all should be returned.- Parameters:
id
- the ProductId to find.- Returns:
- a list of matching notifications.
- Throws:
Exception
- if an error occurs while searching the index.
-
findNotifications
Search the index for notifications matching the sources, types, and codes. Only one notification for each unique ProductId (source+type+code+updateTime) should be returned. If sources, types, and/or codes are null, that parameter should be considered a wildcard. If sources, types, and codes are all null, a notification for each unique ProductId in the index should be returned.- Parameters:
source
- sources to include, or all if null.type
- types to include, or all if null.code
- codes to include, or all if null.- Returns:
- a list of matching notifications.
- Throws:
Exception
- if an error occurs while searching the index.
-
findNotifications
List<Notification> findNotifications(List<String> sources, List<String> types, List<String> codes) throws Exception Search the index for notifications matching the sources, types, and codes. Only one notification for each unique ProductId (source+type+code+updateTime) should be returned. If sources, types, and/or codes are null, that parameter should be considered a wildcard. If sources, types, and codes are all null, a notification for each unique ProductId in the index should be returned.- Parameters:
sources
- sources to include, or all if null.types
- types to include, or all if null.codes
- codes to include, or all if null.- Returns:
- a list of matching notifications.
- Throws:
Exception
- if an error occurs while searching the index.
-
findExpiredNotifications
Search the index for expired notifications. All expired notifications, even if duplicate, should be returned.- Returns:
- a list of expired notifications.
- Throws:
Exception
- if an error occurs while searching the index.
-