Package org.jivesoftware.openfire.pubsub
Class InMemoryPubSubPersistenceProvider
- java.lang.Object
-
- org.jivesoftware.openfire.pubsub.InMemoryPubSubPersistenceProvider
-
- All Implemented Interfaces:
PubSubPersistenceProvider
public class InMemoryPubSubPersistenceProvider extends Object implements PubSubPersistenceProvider
An memory-based PubSub persistence provider. Note that any data stored in this provider will not survive a restart of the JVM.
-
-
Constructor Summary
Constructors Constructor Description InMemoryPubSubPersistenceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbulkPublishedItems(List<PublishedItem> addList, List<PublishedItem> delList)Writes large changesets, using batches and transactions when available.voidcreateAffiliation(Node node, NodeAffiliate affiliate)Creates a new affiliation of the user in the node.voidcreateDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)Creates a new default node configuration for the specified service.voidcreateNode(Node node)Schedules the node to be created in the database.voidcreateSubscription(Node node, NodeSubscription subscription)Adds the new subscription of the user to the node to the database.PublishedItemgetLastPublishedItem(LeafNode node)Fetches the last published item for the specified node.PublishedItemgetPublishedItem(LeafNode node, PublishedItem.UniqueIdentifier itemIdentifier)List<PublishedItem>getPublishedItems(LeafNode node)Fetches all the results for the specified node, limited byLeafNode.getMaxPublishedItems().List<PublishedItem>getPublishedItems(LeafNode node, int maxRows)Fetches all the results for the specified node, limited byLeafNode.getMaxPublishedItems().voidinitialize()DefaultNodeConfigurationloadDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, boolean isLeafType)Loads from the database the default node configuration for the specified node type and pubsub service.voidloadNode(PubSubService service, Node.UniqueIdentifier nodeIdentifier)Loads all nodes from the database and adds them to the PubSub service.voidloadNodes(PubSubService service)Loads all nodes from the database and adds them to the PubSub service.PEPServiceloadPEPServiceFromDB(org.xmpp.packet.JID jid)Loads a PEP service from the database, if it exists.voidloadSubscription(Node node, String subId)voidpurgeNode(LeafNode leafNode)voidremoveAffiliation(Node node, NodeAffiliate affiliate)Removes the affiliation and subscription state of the user from the DB.voidremoveNode(Node node)Schedules the node to be removed in the database.voidremovePublishedItem(PublishedItem item)Removes the specified published item from the DB.voidremoveSubscription(NodeSubscription subscription)Removes the subscription of the user from the DB.voidsaveAffiliation(Node node, NodeAffiliate affiliate, boolean create)Deprecated.voidsavePublishedItem(PublishedItem item)Creates and stores the published item in the database.voidsaveSubscription(Node node, NodeSubscription subscription, boolean create)Deprecated.voidshutdown()voidupdateAffiliation(Node node, NodeAffiliate affiliate)Updates an affiliation of the user in the node.voidupdateDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)Updates the default node configuration for the specified service.voidupdateNode(Node node)Schedules the node to be updated in the database.voidupdateSubscription(Node node, NodeSubscription subscription)Updates the subscription of the user to the node to the database.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.openfire.pubsub.PubSubPersistenceProvider
createDefaultConfiguration, loadDefaultConfiguration, loadPEPServiceFromDB, loadSubscription, updateDefaultConfiguration
-
-
-
-
Method Detail
-
initialize
public void initialize()
- Specified by:
initializein interfacePubSubPersistenceProvider
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacePubSubPersistenceProvider
-
createNode
public void createNode(Node node)
Description copied from interface:PubSubPersistenceProviderSchedules the node to be created in the database.- Specified by:
createNodein interfacePubSubPersistenceProvider- Parameters:
node- The newly created node.
-
updateNode
public void updateNode(Node node)
Description copied from interface:PubSubPersistenceProviderSchedules the node to be updated in the database.- Specified by:
updateNodein interfacePubSubPersistenceProvider- Parameters:
node- The updated node.
-
removeNode
public void removeNode(Node node)
Description copied from interface:PubSubPersistenceProviderSchedules the node to be removed in the database.- Specified by:
removeNodein interfacePubSubPersistenceProvider- Parameters:
node- The node that is being deleted.
-
loadNodes
public void loadNodes(PubSubService service)
Description copied from interface:PubSubPersistenceProviderLoads all nodes from the database and adds them to the PubSub service.- Specified by:
loadNodesin interfacePubSubPersistenceProvider- Parameters:
service- the pubsub service that is hosting the nodes.
-
loadNode
public void loadNode(PubSubService service, Node.UniqueIdentifier nodeIdentifier)
Description copied from interface:PubSubPersistenceProviderLoads all nodes from the database and adds them to the PubSub service.- Specified by:
loadNodein interfacePubSubPersistenceProvider- Parameters:
service- the pubsub service that is hosting the nodes.nodeIdentifier- the identifier of the node to load.
-
loadSubscription
public void loadSubscription(Node node, String subId)
- Specified by:
loadSubscriptionin interfacePubSubPersistenceProvider
-
createAffiliation
public void createAffiliation(Node node, NodeAffiliate affiliate)
Description copied from interface:PubSubPersistenceProviderCreates a new affiliation of the user in the node.- Specified by:
createAffiliationin interfacePubSubPersistenceProvider- Parameters:
node- The node where the affiliation of the user was updated.affiliate- The new affiliation of the user in the node.
-
updateAffiliation
public void updateAffiliation(Node node, NodeAffiliate affiliate)
Description copied from interface:PubSubPersistenceProviderUpdates an affiliation of the user in the node.- Specified by:
updateAffiliationin interfacePubSubPersistenceProvider- Parameters:
node- The node where the affiliation of the user was updated.affiliate- The new affiliation of the user in the node.
-
removeAffiliation
public void removeAffiliation(Node node, NodeAffiliate affiliate)
Description copied from interface:PubSubPersistenceProviderRemoves the affiliation and subscription state of the user from the DB.- Specified by:
removeAffiliationin interfacePubSubPersistenceProvider- Parameters:
node- The node where the affiliation of the user was updated.affiliate- The existing affiliation and subsription state of the user in the node.
-
createSubscription
public void createSubscription(Node node, NodeSubscription subscription)
Description copied from interface:PubSubPersistenceProviderAdds the new subscription of the user to the node to the database.- Specified by:
createSubscriptionin interfacePubSubPersistenceProvider- Parameters:
node- The node where the user has subscribed to.subscription- The new subscription of the user to the node.
-
updateSubscription
public void updateSubscription(Node node, NodeSubscription subscription)
Description copied from interface:PubSubPersistenceProviderUpdates the subscription of the user to the node to the database.- Specified by:
updateSubscriptionin interfacePubSubPersistenceProvider- Parameters:
node- The node where the user has subscribed to.subscription- The new subscription of the user to the node.
-
removeSubscription
public void removeSubscription(NodeSubscription subscription)
Description copied from interface:PubSubPersistenceProviderRemoves the subscription of the user from the DB.- Specified by:
removeSubscriptionin interfacePubSubPersistenceProvider- Parameters:
subscription- The existing subscription of the user to the node.
-
loadDefaultConfiguration
public DefaultNodeConfiguration loadDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, boolean isLeafType)
Description copied from interface:PubSubPersistenceProviderLoads from the database the default node configuration for the specified node type and pubsub service.- Specified by:
loadDefaultConfigurationin interfacePubSubPersistenceProvider- Parameters:
serviceIdentifier- Identifier of the serviceisLeafType- true if loading default configuration for leaf nodes.- Returns:
- the loaded default node configuration for the specified node type and service or null if none was found.
-
createDefaultConfiguration
public void createDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)
Description copied from interface:PubSubPersistenceProviderCreates a new default node configuration for the specified service.- Specified by:
createDefaultConfigurationin interfacePubSubPersistenceProvider- Parameters:
serviceIdentifier- Identifier of the serviceconfig- the default node configuration to create in the database.
-
updateDefaultConfiguration
public void updateDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)
Description copied from interface:PubSubPersistenceProviderUpdates the default node configuration for the specified service.- Specified by:
updateDefaultConfigurationin interfacePubSubPersistenceProvider- Parameters:
serviceIdentifier- Identifier of the serviceconfig- the default node configuration to update in the database.
-
savePublishedItem
public void savePublishedItem(PublishedItem item)
Description copied from interface:PubSubPersistenceProviderCreates and stores the published item in the database. When an item with the same ID was previously saved, this item will be replaced by the new item.- Specified by:
savePublishedItemin interfacePubSubPersistenceProvider- Parameters:
item- The published item to save.
-
removePublishedItem
public void removePublishedItem(PublishedItem item)
Description copied from interface:PubSubPersistenceProviderRemoves the specified published item from the DB.- Specified by:
removePublishedItemin interfacePubSubPersistenceProvider- Parameters:
item- The published item to delete.
-
getPublishedItems
public List<PublishedItem> getPublishedItems(LeafNode node)
Description copied from interface:PubSubPersistenceProviderFetches all the results for the specified node, limited byLeafNode.getMaxPublishedItems().- Specified by:
getPublishedItemsin interfacePubSubPersistenceProvider- Parameters:
node- the leaf node to load its published items.
-
getPublishedItems
public List<PublishedItem> getPublishedItems(LeafNode node, int maxRows)
Description copied from interface:PubSubPersistenceProviderFetches all the results for the specified node, limited byLeafNode.getMaxPublishedItems().- Specified by:
getPublishedItemsin interfacePubSubPersistenceProvider- Parameters:
node- the leaf node to load its published items.
-
getLastPublishedItem
public PublishedItem getLastPublishedItem(LeafNode node)
Description copied from interface:PubSubPersistenceProviderFetches the last published item for the specified node.- Specified by:
getLastPublishedItemin interfacePubSubPersistenceProvider- Parameters:
node- the leaf node to load its last published items.
-
getPublishedItem
public PublishedItem getPublishedItem(LeafNode node, PublishedItem.UniqueIdentifier itemIdentifier)
- Specified by:
getPublishedItemin interfacePubSubPersistenceProvider
-
saveSubscription
@Deprecated public void saveSubscription(Node node, NodeSubscription subscription, boolean create)
Deprecated.
-
saveAffiliation
@Deprecated public void saveAffiliation(Node node, NodeAffiliate affiliate, boolean create)
Deprecated.
-
purgeNode
public void purgeNode(LeafNode leafNode)
- Specified by:
purgeNodein interfacePubSubPersistenceProvider
-
loadPEPServiceFromDB
public PEPService loadPEPServiceFromDB(org.xmpp.packet.JID jid)
Description copied from interface:PubSubPersistenceProviderLoads a PEP service from the database, if it exists. Note that the returned service is not yet initialized!- Specified by:
loadPEPServiceFromDBin interfacePubSubPersistenceProvider- Parameters:
jid- the JID of the owner of the PEP service.- Returns:
- the loaded PEP service, or null if not found.
-
bulkPublishedItems
public void bulkPublishedItems(List<PublishedItem> addList, List<PublishedItem> delList)
Description copied from interface:PubSubPersistenceProviderWrites large changesets, using batches and transactions when available. The 'delete' list takes precedence over the 'add' list: when an item exists on both lists, it is removed (and not re-added) from storage To prevent duplicates to exist, this method will attempt to remove all items to-be-added, before re-adding them.- Specified by:
bulkPublishedItemsin interfacePubSubPersistenceProvider- Parameters:
addList- A list of items to be added.delList- A list of items to be removed.
-
-