public class SubscriptionPersistor extends Object
PersistentStore
.
The SubscriptionPersistor
serves as the data-access object for all Subscription
s across any endpoint. The object that actually gets stored is a
SubscriptionMetadata
, but combined with a SubscriptionFactory
, the original Subscription
object can be re-created and registered with the OSGi framework.
SubscriptionPersistor
knows how to marshall and unmarshall between SubscriptionMetadata
and PersistentItem
, effectively hiding the persistence details of
subscriptions from the rest of the service.
Constructor and Description |
---|
SubscriptionPersistor(PersistentStore persistentStore) |
Modifier and Type | Method and Description |
---|---|
void |
delete(String subscriptionId)
Remove the subscription metadata from the persistent store that corresponds to the given id.
|
Map<String,SubscriptionMetadata> |
getSubscriptions()
Get all the subscription metadata objects in the persistent store, regardless of type.
|
void |
insert(SubscriptionMetadata metadata)
Add the subscription metadata to the persistent store using its id for the document key.
|
public SubscriptionPersistor(PersistentStore persistentStore)
public Map<String,SubscriptionMetadata> getSubscriptions()
SubscriptionStoreException
- if a problem occurs during the read.public void insert(SubscriptionMetadata metadata)
Insertion operations with the same key overwrite the previous value, which means a duplicate being added is a no-op, minus the network overhead.
metadata
- the subscription metadata to add to the persistent store.SubscriptionStoreException
- if a problem occurs during insert.public void delete(String subscriptionId)
Redundant deletes are valid as a no-op to support javax.cache events propogating* write-through processing to other cache nodes.
subscriptionId
- the unique id of the subscription to delete.SubscriptionStoreException
- if a problem occurs during delete.This work is licensed under a Creative Commons Attribution 4.0 International License.