Package org.jivesoftware.openfire.pubsub
Interface PubSubPersistenceProvider
-
- All Known Implementing Classes:
CachingPubsubPersistenceProvider
,DefaultPubSubPersistenceProvider
,InMemoryPubSubPersistenceProvider
public interface PubSubPersistenceProvider
Defines an implementation responsible for persisting pubsub-related data to a backend data store.- Author:
- Guus der Kinderen, guus.der.kinderen@gmail.com
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
bulkPublishedItems(List<PublishedItem> addList, List<PublishedItem> delList)
Writes large changesets, using batches and transactions when available.void
createAffiliation(Node node, NodeAffiliate affiliate)
Creates a new affiliation of the user in the node.void
createDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)
Creates a new default node configuration for the specified service.default void
createDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
Deprecated.void
createNode(Node node)
Schedules the node to be created in the database.void
createSubscription(Node node, NodeSubscription subscription)
Adds the new subscription of the user to the node to the database.PublishedItem
getLastPublishedItem(LeafNode node)
Fetches the last published item for the specified node.PublishedItem
getPublishedItem(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()
.void
initialize()
DefaultNodeConfiguration
loadDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, boolean isLeafType)
Loads from the database the default node configuration for the specified node type and pubsub service.default DefaultNodeConfiguration
loadDefaultConfiguration(PubSubService service, boolean isLeafType)
Deprecated.void
loadNode(PubSubService service, Node.UniqueIdentifier nodeIdentifier)
Loads all nodes from the database and adds them to the PubSub service.void
loadNodes(PubSubService service)
Loads all nodes from the database and adds them to the PubSub service.default PEPService
loadPEPServiceFromDB(String jid)
Deprecated.Replaced byloadPEPServiceFromDB(JID)
PEPService
loadPEPServiceFromDB(org.xmpp.packet.JID jid)
Loads a PEP service from the database, if it exists.void
loadSubscription(Node node, String subId)
default void
loadSubscription(PubSubService service, Node node, String subId)
Deprecated.void
purgeNode(LeafNode leafNode)
void
removeAffiliation(Node node, NodeAffiliate affiliate)
Removes the affiliation and subscription state of the user from the DB.void
removeNode(Node node)
Schedules the node to be removed in the database.void
removePublishedItem(PublishedItem item)
Removes the specified published item from the DB.void
removeSubscription(NodeSubscription subscription)
Removes the subscription of the user from the DB.void
savePublishedItem(PublishedItem item)
Creates and stores the published item in the database.void
shutdown()
void
updateAffiliation(Node node, NodeAffiliate affiliate)
Updates an affiliation of the user in the node.void
updateDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)
Updates the default node configuration for the specified service.default void
updateDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
Deprecated.void
updateNode(Node node)
Schedules the node to be updated in the database.void
updateSubscription(Node node, NodeSubscription subscription)
Updates the subscription of the user to the node to the database.
-
-
-
Method Detail
-
initialize
void initialize()
-
shutdown
void shutdown()
-
createNode
void createNode(Node node)
Schedules the node to be created in the database.- Parameters:
node
- The newly created node.
-
updateNode
void updateNode(Node node)
Schedules the node to be updated in the database.- Parameters:
node
- The updated node.
-
removeNode
void removeNode(Node node)
Schedules the node to be removed in the database.- Parameters:
node
- The node that is being deleted.
-
loadNodes
void loadNodes(PubSubService service)
Loads all nodes from the database and adds them to the PubSub service.- Parameters:
service
- the pubsub service that is hosting the nodes.
-
loadNode
void loadNode(PubSubService service, Node.UniqueIdentifier nodeIdentifier)
Loads all nodes from the database and adds them to the PubSub service.- Parameters:
service
- the pubsub service that is hosting the nodes.nodeIdentifier
- the identifier of the node to load.
-
loadSubscription
@Deprecated default void loadSubscription(PubSubService service, Node node, String subId)
Deprecated.
-
createAffiliation
void createAffiliation(Node node, NodeAffiliate affiliate)
Creates a new affiliation of the user in the node.- Parameters:
node
- The node where the affiliation of the user was updated.affiliate
- The new affiliation of the user in the node.
-
updateAffiliation
void updateAffiliation(Node node, NodeAffiliate affiliate)
Updates an affiliation of the user in the node.- Parameters:
node
- The node where the affiliation of the user was updated.affiliate
- The new affiliation of the user in the node.
-
removeAffiliation
void removeAffiliation(Node node, NodeAffiliate affiliate)
Removes the affiliation and subscription state of the user from the DB.- 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
void createSubscription(Node node, NodeSubscription subscription)
Adds the new subscription of the user to the node to the database.- Parameters:
node
- The node where the user has subscribed to.subscription
- The new subscription of the user to the node.
-
updateSubscription
void updateSubscription(Node node, NodeSubscription subscription)
Updates the subscription of the user to the node to the database.- Parameters:
node
- The node where the user has subscribed to.subscription
- The new subscription of the user to the node.
-
removeSubscription
void removeSubscription(NodeSubscription subscription)
Removes the subscription of the user from the DB.- Parameters:
subscription
- The existing subscription of the user to the node.
-
savePublishedItem
void savePublishedItem(PublishedItem item)
Creates 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.- Parameters:
item
- The published item to save.
-
removePublishedItem
void removePublishedItem(PublishedItem item)
Removes the specified published item from the DB.- Parameters:
item
- The published item to delete.
-
loadDefaultConfiguration
@Deprecated default DefaultNodeConfiguration loadDefaultConfiguration(PubSubService service, boolean isLeafType)
Deprecated.Loads from the database the default node configuration for the specified node type and pubsub service.- Parameters:
service
- the default node configuration used by this pubsub service.isLeafType
- 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.
-
loadDefaultConfiguration
DefaultNodeConfiguration loadDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, boolean isLeafType)
Loads from the database the default node configuration for the specified node type and pubsub service.- 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
@Deprecated default void createDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
Deprecated.Creates a new default node configuration for the specified service.- Parameters:
service
- the default node configuration used by this pubsub service.config
- the default node configuration to create in the database.
-
createDefaultConfiguration
void createDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)
Creates a new default node configuration for the specified service.- Parameters:
serviceIdentifier
- Identifier of the serviceconfig
- the default node configuration to create in the database.
-
updateDefaultConfiguration
@Deprecated default void updateDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
Deprecated.Updates the default node configuration for the specified service.- Parameters:
service
- the default node configuration used by this pubsub service.config
- the default node configuration to update in the database.
-
updateDefaultConfiguration
void updateDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, DefaultNodeConfiguration config)
Updates the default node configuration for the specified service.- Parameters:
serviceIdentifier
- Identifier of the serviceconfig
- the default node configuration to update in the database.
-
getPublishedItems
List<PublishedItem> getPublishedItems(LeafNode node)
Fetches all the results for the specified node, limited byLeafNode.getMaxPublishedItems()
.- Parameters:
node
- the leaf node to load its published items.
-
getPublishedItems
List<PublishedItem> getPublishedItems(LeafNode node, int maxRows)
Fetches all the results for the specified node, limited byLeafNode.getMaxPublishedItems()
.- Parameters:
node
- the leaf node to load its published items.
-
getLastPublishedItem
PublishedItem getLastPublishedItem(LeafNode node)
Fetches the last published item for the specified node.- Parameters:
node
- the leaf node to load its last published items.
-
getPublishedItem
PublishedItem getPublishedItem(LeafNode node, PublishedItem.UniqueIdentifier itemIdentifier)
-
purgeNode
void purgeNode(LeafNode leafNode)
-
loadPEPServiceFromDB
default PEPService loadPEPServiceFromDB(String jid)
Deprecated.Replaced byloadPEPServiceFromDB(JID)
Loads a PEP service from the database, if it exists.- Parameters:
jid
- the JID of the owner of the PEP service.- Returns:
- the loaded PEP service, or null if not found.
-
loadPEPServiceFromDB
PEPService loadPEPServiceFromDB(org.xmpp.packet.JID jid)
Loads a PEP service from the database, if it exists. Note that the returned service is not yet initialized!- Parameters:
jid
- the JID of the owner of the PEP service.- Returns:
- the loaded PEP service, or null if not found.
-
bulkPublishedItems
void bulkPublishedItems(List<PublishedItem> addList, List<PublishedItem> delList)
Writes 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.- Parameters:
addList
- A list of items to be added.delList
- A list of items to be removed.
-
-