Class PubSubDAOPool<T,​S extends tigase.db.DataSource,​Q extends Query>

  • All Implemented Interfaces:
    tigase.db.DataSourceAware<S>, tigase.kernel.beans.Initializable, tigase.kernel.beans.RegistrarBean, tigase.kernel.beans.RegistrarBeanWithDefaultBeanClass, tigase.kernel.beans.UnregisterAware, IPubSubDAO<T,​S,​Q>, tigase.stats.ComponentStatisticsProvider, tigase.stats.StatisticsProviderIfc

    @Bean(name="dao",
          parent=PubSubComponent.class,
          active=true)
    public class PubSubDAOPool<T,​S extends tigase.db.DataSource,​Q extends Query>
    extends tigase.db.beans.MDRepositoryBeanWithStatistics<IPubSubDAO<T,​S,​Q>>
    implements IPubSubDAO<T,​S,​Q>
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PubSubDAOPool.PubSubDAOConfigBean  
      • Nested classes/interfaces inherited from class tigase.db.beans.MDRepositoryBean

        tigase.db.beans.MDRepositoryBean.MDRepositoryConfigBean<A extends tigase.db.DataSourceAware>, tigase.db.beans.MDRepositoryBean.SelectorType
    • Field Summary

      • Fields inherited from class tigase.db.beans.MDRepositoryBean

        aliases, dataSourceSelection
    • Constructor Summary

      Constructors 
      Constructor Description
      PubSubDAOPool()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addToRootCollection​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      boolean belongsTo​(java.lang.Class<? extends tigase.server.BasicComponent> component)  
      T createNode​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName, tigase.xmpp.jid.BareJID ownerJid, AbstractNodeConfig nodeConfig, NodeType nodeType, T collectionId)  
      void deleteItem​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String id)  
      void deleteNode​(tigase.xmpp.jid.BareJID serviceJid, T nodeId)  
      void destroy()  
      protected java.lang.Class<? extends IPubSubDAO<T,​S,​Q>> findClassForDataSource​(tigase.db.DataSource dataSource)  
      java.lang.String[] getAllNodesList​(tigase.xmpp.jid.BareJID serviceJid)  
      java.lang.String[] getBuddyGroups​(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID bareJid)  
      java.lang.String getBuddySubscription​(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy)  
      java.lang.String[] getChildNodes​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      java.lang.Class<?> getDefaultBeanClass()  
      tigase.xml.Element getItem​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String id)  
      java.util.Date getItemCreationDate​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String id)  
      java.lang.String[] getItemsIds​(tigase.xmpp.jid.BareJID serviceJid, T nodeId)  
      java.lang.String[] getItemsIdsSince​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.util.Date since)  
      java.util.List<IItems.ItemMeta> getItemsMeta​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String nodeName)  
      java.util.Date getItemUpdateDate​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String id)  
      NodeAffiliations getNodeAffiliations​(tigase.xmpp.jid.BareJID serviceJid, T nodeId)  
      java.lang.String getNodeConfig​(tigase.xmpp.jid.BareJID serviceJid, T nodeId)  
      T getNodeId​(tigase.xmpp.jid.BareJID serviceJid, java.lang.String nodeName)  
      INodeMeta<T> 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)  
      NodeSubscriptions getNodeSubscriptions​(tigase.xmpp.jid.BareJID serviceJid, T nodeId)  
      protected java.lang.String getPoolDetails​(tigase.xmpp.jid.BareJID serviceJid)
      Deprecated.
      java.util.Map<java.lang.String,​UsersAffiliation> getUserAffiliations​(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid)  
      java.util.Map<tigase.xmpp.jid.BareJID,​tigase.xmpp.impl.roster.RosterElement> getUserRoster​(tigase.xmpp.jid.BareJID owner)  
      java.util.Map<java.lang.String,​UsersSubscription> getUserSubscriptions​(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.BareJID jid)  
      protected void offerDao​(tigase.xmpp.jid.BareJID serviceJid, IPubSubDAO dao)
      Deprecated.
      AbstractNodeConfig parseConfig​(java.lang.String nodeName, java.lang.String cfgData)  
      void queryItems​(Query query, java.util.List nodesIds, tigase.xmpp.mam.MAMRepository.ItemHandler itemHandler)  
      void removeAllFromRootCollection​(tigase.xmpp.jid.BareJID serviceJid)  
      void removeFromRootCollection​(tigase.xmpp.jid.BareJID serviceJid, T nodeId)  
      void removeNodeSubscription​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, tigase.xmpp.jid.BareJID jid)  
      void removeService​(tigase.xmpp.jid.BareJID serviceJid)  
      void setDataSource​(tigase.db.DataSource dataSource)  
      IPubSubDAO takeDao​(tigase.xmpp.jid.BareJID serviceJid)  
      void updateNodeAffiliation​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String nodeName, UsersAffiliation affiliation)  
      void updateNodeConfig​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String serializedData, T collectionId)  
      void updateNodeSubscription​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, java.lang.String nodeName, UsersSubscription subscription)  
      void writeItem​(tigase.xmpp.jid.BareJID serviceJid, T nodeId, long timeInMilis, java.lang.String id, java.lang.String publisher, tigase.xml.Element item)  
      • Methods inherited from class tigase.db.beans.MDRepositoryBeanWithStatistics

        everyHour, everyMinute, everySecond, getRepositories, getRepository, getStatistics, setStatisticsEnabled, updateDataSourceAware, wrapInProxy
      • Methods inherited from class tigase.db.beans.MDRepositoryBean

        beforeUnregister, getName, initialize, initializeRepository, onDataSourceChange, register, registerIfNotExists, repositoriesStream, setDataSourceBean, unregister
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PubSubDAOPool

        public PubSubDAOPool()
    • 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 IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • belongsTo

        public boolean belongsTo​(java.lang.Class<? extends tigase.server.BasicComponent> component)
        Specified by:
        belongsTo in interface tigase.stats.ComponentStatisticsProvider
      • createNode

        public T createNode​(tigase.xmpp.jid.BareJID serviceJid,
                            java.lang.String nodeName,
                            tigase.xmpp.jid.BareJID ownerJid,
                            AbstractNodeConfig nodeConfig,
                            NodeType nodeType,
                            T collectionId)
                     throws tigase.component.exceptions.RepositoryException
        Specified by:
        createNode in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • deleteItem

        public void deleteItem​(tigase.xmpp.jid.BareJID serviceJid,
                               T nodeId,
                               java.lang.String id)
                        throws tigase.component.exceptions.RepositoryException
        Specified by:
        deleteItem in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • deleteNode

        public void deleteNode​(tigase.xmpp.jid.BareJID serviceJid,
                               T nodeId)
                        throws tigase.component.exceptions.RepositoryException
        Specified by:
        deleteNode in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • destroy

        public void destroy()
        Specified by:
        destroy in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
      • getAllNodesList

        public java.lang.String[] getAllNodesList​(tigase.xmpp.jid.BareJID serviceJid)
                                           throws tigase.component.exceptions.RepositoryException
        Specified by:
        getAllNodesList in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getBuddyGroups

        public java.lang.String[] getBuddyGroups​(tigase.xmpp.jid.BareJID owner,
                                                 tigase.xmpp.jid.BareJID bareJid)
                                          throws tigase.component.exceptions.RepositoryException
        Specified by:
        getBuddyGroups in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getBuddySubscription

        public java.lang.String getBuddySubscription​(tigase.xmpp.jid.BareJID owner,
                                                     tigase.xmpp.jid.BareJID buddy)
                                              throws tigase.component.exceptions.RepositoryException
        Specified by:
        getBuddySubscription in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends 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 IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItem

        public tigase.xml.Element getItem​(tigase.xmpp.jid.BareJID serviceJid,
                                          T nodeId,
                                          java.lang.String id)
                                   throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItem in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemCreationDate

        public java.util.Date getItemCreationDate​(tigase.xmpp.jid.BareJID serviceJid,
                                                  T nodeId,
                                                  java.lang.String id)
                                           throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemCreationDate in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemsIds

        public java.lang.String[] getItemsIds​(tigase.xmpp.jid.BareJID serviceJid,
                                              T nodeId)
                                       throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemsIds in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemsIdsSince

        public java.lang.String[] getItemsIdsSince​(tigase.xmpp.jid.BareJID serviceJid,
                                                   T nodeId,
                                                   java.util.Date since)
                                            throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemsIdsSince in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemsMeta

        public java.util.List<IItems.ItemMeta> getItemsMeta​(tigase.xmpp.jid.BareJID serviceJid,
                                                            T nodeId,
                                                            java.lang.String nodeName)
                                                     throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemsMeta in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getItemUpdateDate

        public java.util.Date getItemUpdateDate​(tigase.xmpp.jid.BareJID serviceJid,
                                                T nodeId,
                                                java.lang.String id)
                                         throws tigase.component.exceptions.RepositoryException
        Specified by:
        getItemUpdateDate in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getNodeAffiliations

        public NodeAffiliations getNodeAffiliations​(tigase.xmpp.jid.BareJID serviceJid,
                                                    T nodeId)
                                             throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeAffiliations in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getNodeConfig

        public java.lang.String getNodeConfig​(tigase.xmpp.jid.BareJID serviceJid,
                                              T nodeId)
                                       throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeConfig in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getNodeId

        public T getNodeId​(tigase.xmpp.jid.BareJID serviceJid,
                           java.lang.String nodeName)
                    throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeId in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getNodeMeta

        public INodeMeta<T> getNodeMeta​(tigase.xmpp.jid.BareJID serviceJid,
                                        java.lang.String nodeName)
                                 throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeMeta in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends 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 IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends 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 IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getNodeSubscriptions

        public NodeSubscriptions getNodeSubscriptions​(tigase.xmpp.jid.BareJID serviceJid,
                                                      T nodeId)
                                               throws tigase.component.exceptions.RepositoryException
        Specified by:
        getNodeSubscriptions in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getUserAffiliations

        public java.util.Map<java.lang.String,​UsersAffiliation> getUserAffiliations​(tigase.xmpp.jid.BareJID serviceJid,
                                                                                          tigase.xmpp.jid.BareJID jid)
                                                                                   throws tigase.component.exceptions.RepositoryException
        Specified by:
        getUserAffiliations in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getUserRoster

        public java.util.Map<tigase.xmpp.jid.BareJID,​tigase.xmpp.impl.roster.RosterElement> getUserRoster​(tigase.xmpp.jid.BareJID owner)
                                                                                                         throws tigase.component.exceptions.RepositoryException
        Specified by:
        getUserRoster in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • getUserSubscriptions

        public java.util.Map<java.lang.String,​UsersSubscription> getUserSubscriptions​(tigase.xmpp.jid.BareJID serviceJid,
                                                                                            tigase.xmpp.jid.BareJID jid)
                                                                                     throws tigase.component.exceptions.RepositoryException
        Specified by:
        getUserSubscriptions in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • parseConfig

        public AbstractNodeConfig parseConfig​(java.lang.String nodeName,
                                              java.lang.String cfgData)
                                       throws tigase.component.exceptions.RepositoryException
        Specified by:
        parseConfig in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • queryItems

        public void queryItems​(Query query,
                               java.util.List nodesIds,
                               tigase.xmpp.mam.MAMRepository.ItemHandler itemHandler)
                        throws tigase.component.exceptions.ComponentException,
                               tigase.component.exceptions.RepositoryException
        Specified by:
        queryItems in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.ComponentException
        tigase.component.exceptions.RepositoryException
      • removeAllFromRootCollection

        public void removeAllFromRootCollection​(tigase.xmpp.jid.BareJID serviceJid)
                                         throws tigase.component.exceptions.RepositoryException
        Specified by:
        removeAllFromRootCollection in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • removeFromRootCollection

        public void removeFromRootCollection​(tigase.xmpp.jid.BareJID serviceJid,
                                             T nodeId)
                                      throws tigase.component.exceptions.RepositoryException
        Specified by:
        removeFromRootCollection in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • removeNodeSubscription

        public void removeNodeSubscription​(tigase.xmpp.jid.BareJID serviceJid,
                                           T nodeId,
                                           tigase.xmpp.jid.BareJID jid)
                                    throws tigase.component.exceptions.RepositoryException
        Specified by:
        removeNodeSubscription in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • takeDao

        public IPubSubDAO takeDao​(tigase.xmpp.jid.BareJID serviceJid)
      • updateNodeAffiliation

        public void updateNodeAffiliation​(tigase.xmpp.jid.BareJID serviceJid,
                                          T nodeId,
                                          java.lang.String nodeName,
                                          UsersAffiliation affiliation)
                                   throws tigase.component.exceptions.RepositoryException
        Specified by:
        updateNodeAffiliation in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • updateNodeConfig

        public void updateNodeConfig​(tigase.xmpp.jid.BareJID serviceJid,
                                     T nodeId,
                                     java.lang.String serializedData,
                                     T collectionId)
                              throws tigase.component.exceptions.RepositoryException
        Specified by:
        updateNodeConfig in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • updateNodeSubscription

        public void updateNodeSubscription​(tigase.xmpp.jid.BareJID serviceJid,
                                           T nodeId,
                                           java.lang.String nodeName,
                                           UsersSubscription subscription)
                                    throws tigase.component.exceptions.RepositoryException
        Specified by:
        updateNodeSubscription in interface IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • writeItem

        public void writeItem​(tigase.xmpp.jid.BareJID serviceJid,
                              T 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 IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends 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 IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>
        Throws:
        tigase.component.exceptions.RepositoryException
      • setDataSource

        public void setDataSource​(tigase.db.DataSource dataSource)
        Specified by:
        setDataSource in interface tigase.db.DataSourceAware<T>
      • getDefaultBeanClass

        public java.lang.Class<?> getDefaultBeanClass()
        Specified by:
        getDefaultBeanClass in interface tigase.kernel.beans.RegistrarBeanWithDefaultBeanClass
      • getPoolDetails

        @Deprecated
        protected java.lang.String getPoolDetails​(tigase.xmpp.jid.BareJID serviceJid)
        Deprecated.
      • offerDao

        @Deprecated
        protected void offerDao​(tigase.xmpp.jid.BareJID serviceJid,
                                IPubSubDAO dao)
        Deprecated.
      • findClassForDataSource

        protected java.lang.Class<? extends IPubSubDAO<T,​S,​Q>> findClassForDataSource​(tigase.db.DataSource dataSource)
                                                                                           throws tigase.db.DBInitException
        Specified by:
        findClassForDataSource in class tigase.db.beans.MDRepositoryBean<IPubSubDAO<T,​S extends tigase.db.DataSource,​Q extends Query>>
        Throws:
        tigase.db.DBInitException