Package gov.usgs.earthquake.distribution
Interface NotificationIndex
-
- All Superinterfaces:
Configurable
- All Known Implementing Classes:
JDBCNotificationIndex,JsonNotificationIndex
public interface NotificationIndex extends Configurable
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddNotification(Notification notification)Add a notification to the index.java.util.List<Notification>findExpiredNotifications()Search the index for expired notifications.java.util.List<Notification>findNotifications(ProductId id)Search the index for notifications matching id.java.util.List<Notification>findNotifications(java.lang.String source, java.lang.String type, java.lang.String code)Search the index for notifications matching the sources, types, and codes.java.util.List<Notification>findNotifications(java.util.List<java.lang.String> sources, java.util.List<java.lang.String> types, java.util.List<java.lang.String> codes)Search the index for notifications matching the sources, types, and codes.voidremoveNotification(Notification notification)Remove a notification from the index.voidremoveNotifications(java.util.List<Notification> notifications)Remove notifications from index.
-
-
-
Method Detail
-
addNotification
void addNotification(Notification notification) throws java.lang.Exception
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:
java.lang.Exception- if an error occurs while storing the notification.
-
removeNotification
void removeNotification(Notification notification) throws java.lang.Exception
Remove a notification from the index. All matching notifications should be removed from the index.- Parameters:
notification- the notification to remove.- Throws:
java.lang.Exception- if an error occurs while removing the notification.
-
removeNotifications
void removeNotifications(java.util.List<Notification> notifications) throws java.lang.Exception
Remove notifications from index. Tracker URLs are ignored.- Parameters:
notifications- notifications to be removed from index- Throws:
java.lang.Exception- if error occurs
-
findNotifications
java.util.List<Notification> findNotifications(ProductId id) throws java.lang.Exception
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:
java.lang.Exception- if an error occurs while searching the index.
-
findNotifications
java.util.List<Notification> findNotifications(java.lang.String source, java.lang.String type, java.lang.String code) throws java.lang.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:
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:
java.lang.Exception- if an error occurs while searching the index.
-
findNotifications
java.util.List<Notification> findNotifications(java.util.List<java.lang.String> sources, java.util.List<java.lang.String> types, java.util.List<java.lang.String> codes) throws java.lang.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:
java.lang.Exception- if an error occurs while searching the index.
-
findExpiredNotifications
java.util.List<Notification> findExpiredNotifications() throws java.lang.Exception
Search the index for expired notifications. All expired notifications, even if duplicate, should be returned.- Returns:
- a list of expired notifications.
- Throws:
java.lang.Exception- if an error occurs while searching the index.
-
-