Package tigase.mongodb.pubsub
Class PubSubDAOMongo
- java.lang.Object
-
- tigase.pubsub.repository.PubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>
-
- tigase.mongodb.pubsub.PubSubDAOMongo
-
- All Implemented Interfaces:
tigase.db.DataSourceAware<MongoDataSource>,tigase.db.util.RepositoryVersionAware,MongoRepositoryVersionAware,tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>
public class PubSubDAOMongo extends tigase.pubsub.repository.PubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query> implements MongoRepositoryVersionAware
- Author:
- andrzej
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class tigase.pubsub.repository.PubSubDAO
tigase.pubsub.repository.PubSubDAO.Item<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static StringPUBSUB_AFFILIATIONSstatic StringPUBSUB_ITEMSstatic StringPUBSUB_NODESstatic StringPUBSUB_SERVICE_JIDSstatic StringPUBSUB_SUBSCRIPTIONS
-
Constructor Summary
Constructors Constructor Description PubSubDAOMongo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToRootCollection(tigase.xmpp.jid.BareJID serviceJid, String nodeName)org.bson.types.ObjectIdcreateNode(tigase.xmpp.jid.BareJID serviceJid, String nodeName, tigase.xmpp.jid.BareJID ownerJid, tigase.pubsub.AbstractNodeConfig nodeConfig, tigase.pubsub.NodeType nodeType, org.bson.types.ObjectId collectionId)voiddeleteItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id)voiddeleteNode(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)String[]getAllNodesList(tigase.xmpp.jid.BareJID serviceJid)String[]getChildNodes(tigase.xmpp.jid.BareJID serviceJid, String nodeName)tigase.xml.ElementgetItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id)DategetItemCreationDate(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id)String[]getItemsIds(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.pubsub.CollectionItemsOrdering order)String[]getItemsIdsSince(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.pubsub.CollectionItemsOrdering order, Date since)List<tigase.pubsub.repository.IItems.ItemMeta>getItemsMeta(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String nodeName)DategetItemUpdateDate(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id)tigase.pubsub.repository.NodeAffiliationsgetNodeAffiliations(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)StringgetNodeConfig(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)org.bson.types.ObjectIdgetNodeId(tigase.xmpp.jid.BareJID serviceJid, String nodeName)tigase.pubsub.repository.INodeMeta<org.bson.types.ObjectId>getNodeMeta(tigase.xmpp.jid.BareJID serviceJid, String nodeName)longgetNodesCount(tigase.xmpp.jid.BareJID serviceJid)String[]getNodesList(tigase.xmpp.jid.BareJID serviceJid, String nodeName)tigase.pubsub.repository.NodeSubscriptionsgetNodeSubscriptions(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)Map<String,tigase.pubsub.repository.stateless.UsersAffiliation>getUserAffiliations(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid)Map<String,tigase.pubsub.repository.stateless.UsersSubscription>getUserSubscriptions(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid)voidqueryItems(tigase.pubsub.modules.mam.Query query, List<org.bson.types.ObjectId> nodesIds, tigase.xmpp.mam.MAMRepository.ItemHandler<tigase.pubsub.modules.mam.Query,tigase.pubsub.repository.IPubSubRepository.Item> itemHandler)protected <T> List<T>readAllValuesForField(com.mongodb.client.MongoCollection<org.bson.Document> collection, String field, org.bson.conversions.Bson filter)protected <T> List<T>readAllValuesForField(com.mongodb.client.MongoCollection<org.bson.Document> collection, String field, org.bson.conversions.Bson filter, org.bson.conversions.Bson sort)voidremoveAllFromRootCollection(tigase.xmpp.jid.BareJID serviceJid)voidremoveFromRootCollection(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)voidremoveNodeSubscription(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.xmpp.jid.BareJID jid)voidremoveService(tigase.xmpp.jid.BareJID serviceJid)voidsetDataSource(MongoDataSource dataSource)voidupdateNodeAffiliation(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String nodeName, tigase.pubsub.repository.stateless.UsersAffiliation userAffiliation)voidupdateNodeConfig(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String serializedNodeConfig, org.bson.types.ObjectId collectionId)voidupdateNodeSubscription(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String nodeName, tigase.pubsub.repository.stateless.UsersSubscription userSubscription)tigase.db.util.SchemaLoader.ResultupdateSchema(Optional<tigase.util.Version> oldVersion, tigase.util.Version newVersion)voidwriteItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, long timeInMilis, String id, String publisher, tigase.xml.Element item)-
Methods inherited from class tigase.pubsub.repository.PubSubDAO
calculateOffsetAndPosition, destroy, getBuddyGroups, getBuddySubscription, getNodeConfig, getUserRoster, itemDataToElement, itemDataToElement, parseConfig, parseConfigForm
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tigase.mongodb.MongoRepositoryVersionAware
getVersion
-
-
-
-
Field Detail
-
PUBSUB_AFFILIATIONS
public static final String PUBSUB_AFFILIATIONS
- See Also:
- Constant Field Values
-
PUBSUB_ITEMS
public static final String PUBSUB_ITEMS
- See Also:
- Constant Field Values
-
PUBSUB_NODES
public static final String PUBSUB_NODES
- See Also:
- Constant Field Values
-
PUBSUB_SERVICE_JIDS
public static final String PUBSUB_SERVICE_JIDS
- See Also:
- Constant Field Values
-
PUBSUB_SUBSCRIPTIONS
public static final String PUBSUB_SUBSCRIPTIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
addToRootCollection
public void addToRootCollection(tigase.xmpp.jid.BareJID serviceJid, String nodeName) throws tigase.component.exceptions.RepositoryException- Specified by:
addToRootCollectionin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
createNode
public org.bson.types.ObjectId createNode(tigase.xmpp.jid.BareJID serviceJid, String nodeName, tigase.xmpp.jid.BareJID ownerJid, tigase.pubsub.AbstractNodeConfig nodeConfig, tigase.pubsub.NodeType nodeType, org.bson.types.ObjectId collectionId) throws tigase.component.exceptions.RepositoryException- Specified by:
createNodein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
deleteItem
public void deleteItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id) throws tigase.component.exceptions.RepositoryException- Specified by:
deleteItemin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
deleteNode
public void deleteNode(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) throws tigase.component.exceptions.RepositoryException- Specified by:
deleteNodein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getAllNodesList
public String[] getAllNodesList(tigase.xmpp.jid.BareJID serviceJid) throws tigase.component.exceptions.RepositoryException
- Specified by:
getAllNodesListin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getChildNodes
public String[] getChildNodes(tigase.xmpp.jid.BareJID serviceJid, String nodeName) throws tigase.component.exceptions.RepositoryException
- Specified by:
getChildNodesin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getItem
public tigase.xml.Element getItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id) throws tigase.component.exceptions.RepositoryException- Specified by:
getItemin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getItemCreationDate
public Date getItemCreationDate(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id) throws tigase.component.exceptions.RepositoryException
- Specified by:
getItemCreationDatein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getItemUpdateDate
public Date getItemUpdateDate(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id) throws tigase.component.exceptions.RepositoryException
- Specified by:
getItemUpdateDatein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getItemsIds
public String[] getItemsIds(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.pubsub.CollectionItemsOrdering order) throws tigase.component.exceptions.RepositoryException
- Specified by:
getItemsIdsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getItemsIdsSince
public String[] getItemsIdsSince(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.pubsub.CollectionItemsOrdering order, Date since) throws tigase.component.exceptions.RepositoryException
- Specified by:
getItemsIdsSincein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getItemsMeta
public List<tigase.pubsub.repository.IItems.ItemMeta> getItemsMeta(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String nodeName) throws tigase.component.exceptions.RepositoryException
- Specified by:
getItemsMetain interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getNodeAffiliations
public tigase.pubsub.repository.NodeAffiliations getNodeAffiliations(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) throws tigase.component.exceptions.RepositoryException- Specified by:
getNodeAffiliationsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getNodeConfig
public String getNodeConfig(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) throws tigase.component.exceptions.RepositoryException
- Specified by:
getNodeConfigin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getNodeId
public org.bson.types.ObjectId getNodeId(tigase.xmpp.jid.BareJID serviceJid, String nodeName) throws tigase.component.exceptions.RepositoryException- Specified by:
getNodeIdin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getNodeMeta
public tigase.pubsub.repository.INodeMeta<org.bson.types.ObjectId> getNodeMeta(tigase.xmpp.jid.BareJID serviceJid, String nodeName) throws tigase.component.exceptions.RepositoryException- Specified by:
getNodeMetain interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getNodeSubscriptions
public tigase.pubsub.repository.NodeSubscriptions getNodeSubscriptions(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) throws tigase.component.exceptions.RepositoryException- Specified by:
getNodeSubscriptionsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getNodesCount
public long getNodesCount(tigase.xmpp.jid.BareJID serviceJid) throws tigase.component.exceptions.RepositoryException- Specified by:
getNodesCountin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getNodesList
public String[] getNodesList(tigase.xmpp.jid.BareJID serviceJid, String nodeName) throws tigase.component.exceptions.RepositoryException
- Specified by:
getNodesListin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getUserAffiliations
public Map<String,tigase.pubsub.repository.stateless.UsersAffiliation> getUserAffiliations(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid) throws tigase.component.exceptions.RepositoryException
- Specified by:
getUserAffiliationsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
getUserSubscriptions
public Map<String,tigase.pubsub.repository.stateless.UsersSubscription> getUserSubscriptions(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid) throws tigase.component.exceptions.RepositoryException
- Specified by:
getUserSubscriptionsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
queryItems
public void queryItems(tigase.pubsub.modules.mam.Query query, List<org.bson.types.ObjectId> nodesIds, tigase.xmpp.mam.MAMRepository.ItemHandler<tigase.pubsub.modules.mam.Query,tigase.pubsub.repository.IPubSubRepository.Item> itemHandler) throws tigase.component.exceptions.RepositoryException, tigase.component.exceptions.ComponentException- Specified by:
queryItemsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryExceptiontigase.component.exceptions.ComponentException
-
readAllValuesForField
protected <T> List<T> readAllValuesForField(com.mongodb.client.MongoCollection<org.bson.Document> collection, String field, org.bson.conversions.Bson filter) throws com.mongodb.MongoException
- Throws:
com.mongodb.MongoException
-
readAllValuesForField
protected <T> List<T> readAllValuesForField(com.mongodb.client.MongoCollection<org.bson.Document> collection, String field, org.bson.conversions.Bson filter, org.bson.conversions.Bson sort) throws com.mongodb.MongoException
- Throws:
com.mongodb.MongoException
-
removeAllFromRootCollection
public void removeAllFromRootCollection(tigase.xmpp.jid.BareJID serviceJid) throws tigase.component.exceptions.RepositoryException- Specified by:
removeAllFromRootCollectionin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
removeFromRootCollection
public void removeFromRootCollection(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) throws tigase.component.exceptions.RepositoryException- Specified by:
removeFromRootCollectionin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
removeNodeSubscription
public void removeNodeSubscription(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.xmpp.jid.BareJID jid) throws tigase.component.exceptions.RepositoryException- Specified by:
removeNodeSubscriptionin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
removeService
public void removeService(tigase.xmpp.jid.BareJID serviceJid) throws tigase.component.exceptions.RepositoryException- Specified by:
removeServicein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
setDataSource
public void setDataSource(MongoDataSource dataSource)
- Specified by:
setDataSourcein interfacetigase.db.DataSourceAware<MongoDataSource>
-
updateNodeAffiliation
public void updateNodeAffiliation(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String nodeName, tigase.pubsub.repository.stateless.UsersAffiliation userAffiliation) throws tigase.component.exceptions.RepositoryException- Specified by:
updateNodeAffiliationin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
updateNodeConfig
public void updateNodeConfig(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String serializedNodeConfig, org.bson.types.ObjectId collectionId) throws tigase.component.exceptions.RepositoryException- Specified by:
updateNodeConfigin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
updateNodeSubscription
public void updateNodeSubscription(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String nodeName, tigase.pubsub.repository.stateless.UsersSubscription userSubscription) throws tigase.component.exceptions.RepositoryException- Specified by:
updateNodeSubscriptionin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
updateSchema
public tigase.db.util.SchemaLoader.Result updateSchema(Optional<tigase.util.Version> oldVersion, tigase.util.Version newVersion) throws tigase.component.exceptions.RepositoryException
- Specified by:
updateSchemain interfacetigase.db.util.RepositoryVersionAware- Throws:
tigase.component.exceptions.RepositoryException
-
writeItem
public void writeItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, long timeInMilis, String id, String publisher, tigase.xml.Element item) throws tigase.component.exceptions.RepositoryException- Specified by:
writeItemin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.Query>- Throws:
tigase.component.exceptions.RepositoryException
-
-