Class PubSubDAOMongo

    • Nested Class Summary

      • Nested classes/interfaces inherited from class tigase.pubsub.repository.PubSubDAO

        tigase.pubsub.repository.PubSubDAO.Item<T extends java.lang.Object>
      • Nested classes/interfaces inherited from interface tigase.db.util.RepositoryVersionAware

        tigase.db.util.RepositoryVersionAware.SchemaVersion
    • Constructor Summary

      Constructors 
      Constructor Description
      PubSubDAOMongo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToRootCollection​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      org.bson.types.ObjectId createNode​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName, tigase.xmpp.jid.BareJID ownerJid, tigase.pubsub.AbstractNodeConfig nodeConfig, tigase.pubsub.NodeType nodeType, org.bson.types.ObjectId collectionId)  
      void deleteItem​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String id)  
      void deleteNode​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)  
      java.lang.String[] getAllNodesList​(tigase.xmpp.jid.BareJID serviceJid)  
      java.lang.String[] getChildNodes​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      tigase.xml.Element getItem​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String id)  
      java.util.Date getItemCreationDate​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String id)  
      java.lang.String[] getItemsIds​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.pubsub.CollectionItemsOrdering order)  
      java.lang.String[] getItemsIdsSince​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.pubsub.CollectionItemsOrdering order, java.util.Date since)  
      java.util.List<tigase.pubsub.repository.IItems.ItemMeta> getItemsMeta​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String nodeName)  
      java.util.Date getItemUpdateDate​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String id)  
      tigase.pubsub.repository.NodeAffiliations getNodeAffiliations​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)  
      java.lang.String getNodeConfig​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)  
      org.bson.types.ObjectId getNodeId​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      tigase.pubsub.repository.INodeMeta<org.bson.types.ObjectId> getNodeMeta​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      long getNodesCount​(tigase.xmpp.jid.BareJID serviceJid)  
      java.lang.String[] getNodesList​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      tigase.pubsub.repository.NodeSubscriptions getNodeSubscriptions​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)  
      java.util.Map<java.lang.String,​tigase.pubsub.repository.stateless.UsersAffiliation> getUserAffiliations​(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid)  
      java.util.Map<java.lang.String,​tigase.pubsub.repository.stateless.UsersSubscription> getUserSubscriptions​(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid)  
      void queryItems​(tigase.pubsub.modules.mam.Query query, java.util.List<org.bson.types.ObjectId> nodesIds, tigase.xmpp.mam.MAMRepository.ItemHandler<tigase.pubsub.modules.mam.Query,​tigase.pubsub.repository.IPubSubRepository.Item> itemHandler)  
      protected <T> java.util.List<T> readAllValuesForField​(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.String field, org.bson.conversions.Bson filter)  
      protected <T> java.util.List<T> readAllValuesForField​(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.String field, org.bson.conversions.Bson filter, org.bson.conversions.Bson sort)  
      void removeAllFromRootCollection​(tigase.xmpp.jid.BareJID serviceJid)  
      void removeFromRootCollection​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId)  
      void removeNodeSubscription​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, tigase.xmpp.jid.BareJID jid)  
      void removeService​(tigase.xmpp.jid.BareJID serviceJid)  
      void setDataSource​(MongoDataSource dataSource)  
      void updateNodeAffiliation​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String nodeName, tigase.pubsub.repository.stateless.UsersAffiliation userAffiliation)  
      void updateNodeConfig​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String serializedNodeConfig, org.bson.types.ObjectId collectionId)  
      void updateNodeSubscription​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, java.lang.String nodeName, tigase.pubsub.repository.stateless.UsersSubscription userSubscription)  
      tigase.db.util.SchemaLoader.Result updateSchema​(java.util.Optional<tigase.util.Version> oldVersion, tigase.util.Version newVersion)  
      void writeItem​(tigase.xmpp.jid.BareJID serviceJid, org.bson.types.ObjectId nodeId, long timeInMilis, java.lang.String id, java.lang.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.pubsub.repository.IPubSubDAO

        getItemsIds, getItemsIdsSince
    • Constructor Detail

      • PubSubDAOMongo

        public PubSubDAOMongo()
    • Method Detail

      • addToRootCollection

        public void addToRootCollection​(tigase.xmpp.jid.BareJID serviceJid,
                                        java.lang.String nodeName)
                                 throws tigase.component.exceptions.RepositoryException
        Specified by:
        addToRootCollection in interface tigase.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,
                                                  java.lang.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:
        createNode in interface tigase.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,
                               java.lang.String id)
                        throws tigase.component.exceptions.RepositoryException
        Specified by:
        deleteItem in interface tigase.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:
        deleteNode in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getAllNodesList

        public java.lang.String[] getAllNodesList​(tigase.xmpp.jid.BareJID serviceJid)
                                           throws tigase.component.exceptions.RepositoryException
        Specified by:
        getAllNodesList in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getChildNodes

        public java.lang.String[] getChildNodes​(tigase.xmpp.jid.BareJID serviceJid,
                                                java.lang.String nodeName)
                                         throws tigase.component.exceptions.RepositoryException
        Specified by:
        getChildNodes in interface tigase.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,
                                          java.lang.String id)
                                   throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItem in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemCreationDate

        public java.util.Date getItemCreationDate​(tigase.xmpp.jid.BareJID serviceJid,
                                                  org.bson.types.ObjectId nodeId,
                                                  java.lang.String id)
                                           throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemCreationDate in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemUpdateDate

        public java.util.Date getItemUpdateDate​(tigase.xmpp.jid.BareJID serviceJid,
                                                org.bson.types.ObjectId nodeId,
                                                java.lang.String id)
                                         throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemUpdateDate in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemsIds

        public java.lang.String[] getItemsIds​(tigase.xmpp.jid.BareJID serviceJid,
                                              org.bson.types.ObjectId nodeId,
                                              tigase.pubsub.CollectionItemsOrdering order)
                                       throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemsIds in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemsIdsSince

        public java.lang.String[] getItemsIdsSince​(tigase.xmpp.jid.BareJID serviceJid,
                                                   org.bson.types.ObjectId nodeId,
                                                   tigase.pubsub.CollectionItemsOrdering order,
                                                   java.util.Date since)
                                            throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemsIdsSince in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemsMeta

        public java.util.List<tigase.pubsub.repository.IItems.ItemMeta> getItemsMeta​(tigase.xmpp.jid.BareJID serviceJid,
                                                                                     org.bson.types.ObjectId nodeId,
                                                                                     java.lang.String nodeName)
                                                                              throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemsMeta in interface tigase.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:
        getNodeAffiliations in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getNodeConfig

        public java.lang.String getNodeConfig​(tigase.xmpp.jid.BareJID serviceJid,
                                              org.bson.types.ObjectId nodeId)
                                       throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeConfig in interface tigase.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,
                                                 java.lang.String nodeName)
                                          throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeId in interface tigase.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,
                                                                                       java.lang.String nodeName)
                                                                                throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeMeta in interface tigase.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:
        getNodeSubscriptions in interface tigase.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:
        getNodesCount in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getNodesList

        public java.lang.String[] getNodesList​(tigase.xmpp.jid.BareJID serviceJid,
                                               java.lang.String nodeName)
                                        throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodesList in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getUserAffiliations

        public java.util.Map<java.lang.String,​tigase.pubsub.repository.stateless.UsersAffiliation> getUserAffiliations​(tigase.xmpp.jid.BareJID serviceJid,
                                                                                                                             tigase.xmpp.jid.BareJID jid)
                                                                                                                      throws tigase.component.exceptions.RepositoryException
        Specified by:
        getUserAffiliations in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getUserSubscriptions

        public java.util.Map<java.lang.String,​tigase.pubsub.repository.stateless.UsersSubscription> getUserSubscriptions​(tigase.xmpp.jid.BareJID serviceJid,
                                                                                                                               tigase.xmpp.jid.BareJID jid)
                                                                                                                        throws tigase.component.exceptions.RepositoryException
        Specified by:
        getUserSubscriptions in interface tigase.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,
                               java.util.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:
        queryItems in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException
        tigase.component.exceptions.ComponentException
      • readAllValuesForField

        protected <T> java.util.List<T> readAllValuesForField​(com.mongodb.client.MongoCollection<org.bson.Document> collection,
                                                              java.lang.String field,
                                                              org.bson.conversions.Bson filter)
                                                       throws com.mongodb.MongoException
        Throws:
        com.mongodb.MongoException
      • readAllValuesForField

        protected <T> java.util.List<T> readAllValuesForField​(com.mongodb.client.MongoCollection<org.bson.Document> collection,
                                                              java.lang.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:
        removeAllFromRootCollection in interface tigase.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:
        removeFromRootCollection in interface tigase.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:
        removeNodeSubscription in interface tigase.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:
        removeService in interface tigase.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:
        setDataSource in interface tigase.db.DataSourceAware<MongoDataSource>
      • updateNodeAffiliation

        public void updateNodeAffiliation​(tigase.xmpp.jid.BareJID serviceJid,
                                          org.bson.types.ObjectId nodeId,
                                          java.lang.String nodeName,
                                          tigase.pubsub.repository.stateless.UsersAffiliation userAffiliation)
                                   throws tigase.component.exceptions.RepositoryException
        Specified by:
        updateNodeAffiliation in interface tigase.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,
                                     java.lang.String serializedNodeConfig,
                                     org.bson.types.ObjectId collectionId)
                              throws tigase.component.exceptions.RepositoryException
        Specified by:
        updateNodeConfig in interface tigase.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,
                                           java.lang.String nodeName,
                                           tigase.pubsub.repository.stateless.UsersSubscription userSubscription)
                                    throws tigase.component.exceptions.RepositoryException
        Specified by:
        updateNodeSubscription in interface tigase.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​(java.util.Optional<tigase.util.Version> oldVersion,
                                                               tigase.util.Version newVersion)
                                                        throws tigase.component.exceptions.RepositoryException
        Specified by:
        updateSchema in interface tigase.db.util.RepositoryVersionAware
        Throws:
        tigase.component.exceptions.RepositoryException
      • writeItem

        public void writeItem​(tigase.xmpp.jid.BareJID serviceJid,
                              org.bson.types.ObjectId nodeId,
                              long timeInMilis,
                              java.lang.String id,
                              java.lang.String publisher,
                              tigase.xml.Element item)
                       throws tigase.component.exceptions.RepositoryException
        Specified by:
        writeItem in interface tigase.pubsub.repository.IPubSubDAO<org.bson.types.ObjectId,​MongoDataSource,​tigase.pubsub.modules.mam.Query>
        Throws:
        tigase.component.exceptions.RepositoryException