Package tigase.mongodb.pubsub
Class PubSubDAOMongo
java.lang.Object
tigase.pubsub.repository.PubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.ExtendedQueryImpl>
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.ExtendedQueryImpl>
public class PubSubDAOMongo
extends tigase.pubsub.repository.PubSubDAO<org.bson.types.ObjectId,MongoDataSource,tigase.pubsub.modules.mam.ExtendedQueryImpl>
implements MongoRepositoryVersionAware
- Author:
- andrzej
-
Nested Class Summary
Nested classes/interfaces inherited from class tigase.pubsub.repository.PubSubDAO
tigase.pubsub.repository.PubSubDAO.MAMItemNested classes/interfaces inherited from interface tigase.db.util.RepositoryVersionAware
tigase.db.util.RepositoryVersionAware.SchemaVersion -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class tigase.pubsub.repository.PubSubDAO
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMAMItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String uuid, tigase.xml.Element message, String itemId) 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, boolean autocreate) voidcreateService(tigase.xmpp.jid.BareJID serviceJid, boolean isPublic) voiddeleteItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String id) voiddeleteNode(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) voiddeleteService(tigase.xmpp.jid.BareJID serviceJid) String[]getAllNodesList(tigase.xmpp.jid.BareJID serviceJid) String[]getChildNodes(tigase.xmpp.jid.BareJID serviceJid, String nodeName) tigase.pubsub.repository.IItems.IItemList<tigase.pubsub.repository.IItems.IItem>getItems(tigase.xmpp.jid.BareJID serviceJid, List<org.bson.types.ObjectId> nodeIds, Date afterDate, Date beforeDate, tigase.xmpp.rsm.RSM rsm, tigase.pubsub.CollectionItemsOrdering collectionItemsOrdering) 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) Map<tigase.xmpp.jid.BareJID,tigase.pubsub.repository.stateless.UsersAffiliation> getNodeAffiliations(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) 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) Map<tigase.xmpp.jid.BareJID,tigase.pubsub.repository.stateless.UsersSubscription> getNodeSubscriptions(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId) List<tigase.xmpp.jid.BareJID>getServices(tigase.xmpp.jid.BareJID bareJID, Boolean isPublic) getUserAffiliations(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid) getUserSubscriptions(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid) tigase.pubsub.modules.mam.ExtendedQueryImplnewQuery(tigase.xmpp.jid.BareJID serviceJid) voidqueryItems(tigase.pubsub.modules.mam.ExtendedQueryImpl query, org.bson.types.ObjectId nodeId, tigase.xmpp.mam.MAMRepository.ItemHandler<tigase.pubsub.modules.mam.ExtendedQueryImpl, tigase.xmpp.mam.MAMRepository.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) voidremoveNodeSubscription(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.xmpp.jid.BareJID jid) 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, String uuid) Methods inherited from class tigase.pubsub.repository.PubSubDAO
calculateOffsetAndPosition, destroy, getNodeConfig, getUserRoster, itemDataToElement, itemDataToElement, parseConfig, parseConfigFormMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tigase.pubsub.repository.IPubSubDAO
newQueryMethods inherited from interface tigase.mongodb.MongoRepositoryVersionAware
getVersion
-
Field Details
-
PUBSUB_AFFILIATIONS
- See Also:
-
PUBSUB_ITEMS
- See Also:
-
PUBSUB_MAM
- See Also:
-
PUBSUB_NODES
- See Also:
-
PUBSUB_SERVICE_JIDS
- See Also:
-
PUBSUB_SUBSCRIPTIONS
- See Also:
-
-
Constructor Details
-
PubSubDAOMongo
public PubSubDAOMongo()
-
-
Method Details
-
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, boolean autocreate) throws tigase.component.exceptions.RepositoryException - Specified by:
createNodein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
createService
public void createService(tigase.xmpp.jid.BareJID serviceJid, boolean isPublic) throws tigase.component.exceptions.RepositoryException - Specified by:
createServicein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
getItem
public tigase.pubsub.repository.IItems.IItem 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.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
getItems
public List<tigase.pubsub.repository.IItems.IItem> getItems(tigase.xmpp.jid.BareJID serviceJid, List<org.bson.types.ObjectId> nodeIds, Date afterDate, Date beforeDate, tigase.xmpp.rsm.RSM rsm, tigase.pubsub.CollectionItemsOrdering collectionItemsOrdering) throws tigase.component.exceptions.RepositoryException - Specified by:
getItemsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
getNodeAffiliations
public Map<tigase.xmpp.jid.BareJID,tigase.pubsub.repository.stateless.UsersAffiliation> 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
getNodeSubscriptions
public Map<tigase.xmpp.jid.BareJID,tigase.pubsub.repository.stateless.UsersSubscription> 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
addMAMItem
public void addMAMItem(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, String uuid, tigase.xml.Element message, String itemId) throws tigase.component.exceptions.RepositoryException - Specified by:
addMAMItemin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
newQuery
public tigase.pubsub.modules.mam.ExtendedQueryImpl newQuery(tigase.xmpp.jid.BareJID serviceJid) - Specified by:
newQueryin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl>
-
queryItems
public void queryItems(tigase.pubsub.modules.mam.ExtendedQueryImpl query, org.bson.types.ObjectId nodeId, tigase.xmpp.mam.MAMRepository.ItemHandler<tigase.pubsub.modules.mam.ExtendedQueryImpl, tigase.xmpp.mam.MAMRepository.Item> itemHandler) throws tigase.component.exceptions.RepositoryException- Specified by:
queryItemsin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
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 - 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.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
deleteService
public void deleteService(tigase.xmpp.jid.BareJID serviceJid) throws tigase.component.exceptions.RepositoryException - Specified by:
deleteServicein interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
getServices
public List<tigase.xmpp.jid.BareJID> getServices(tigase.xmpp.jid.BareJID bareJID, Boolean isPublic) throws tigase.component.exceptions.RepositoryException - Specified by:
getServicesin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-
setDataSource
- 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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.ExtendedQueryImpl> - 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, String uuid) throws tigase.component.exceptions.RepositoryException - Specified by:
writeItemin interfacetigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,MongoDataSource, tigase.pubsub.modules.mam.ExtendedQueryImpl> - Throws:
tigase.component.exceptions.RepositoryException
-