tigase.server.amp.db

## Class MsgRepository.MsgRepositoryMDBean

- java.lang.Object
- - tigase.db.beans.MDRepositoryBean<T>
  - - tigase.db.beans.MDRepositoryBeanWithStatistics<MsgRepositoryIfc>
    - - tigase.server.amp.db.MsgRepository.MsgRepositoryMDBean

- All Implemented Interfaces:
    DataSourceAware, MsgRepositoryIfc, OfflineMsgRepositoryIfc, Repository, Initializable, RegistrarBean, RegistrarBeanWithDefaultBeanClass, UnregisterAware, ComponentStatisticsProvider, StatisticsProviderIfc
  Enclosing class:
    MsgRepository<T,S extends DataSource>

      @Bean(name="msgRepository",
            parent=Kernel.class,
            active=true,
            exportable=true)
       @ConfigType(value={DefaultMode,SessionManagerMode,ConnectionManagersMode,ComponentMode})
      public static class MsgRepository.MsgRepositoryMDBean
      extends MDRepositoryBeanWithStatistics<MsgRepositoryIfc>
      implements MsgRepositoryIfc

  Bean used to provide MsgRepository implementations

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MsgRepository.MsgRepositoryMDBean.MsgRepositoryConfigBean`

    - ### Nested classes/interfaces inherited from class tigase.db.beans.MDRepositoryBean

      `MDRepositoryBean.MDRepositoryConfigBean<A extends DataSourceAware>, MDRepositoryBean.SelectorType`

    - ### Nested classes/interfaces inherited from interface tigase.db.Repository

      `Repository.Meta, Repository.SchemaId`

  - ### Field Summary

    - ### Fields inherited from class tigase.db.beans.MDRepositoryBean

      `aliases, dataSourceSelection`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MsgRepositoryMDBean()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `belongsTo(Class<? extends BasicComponent> component)`
    `int` | `deleteMessagesToJID(List db_ids, XMPPResourceConnection session)`
    `protected Class<? extends MsgRepositoryIfc>` | `findClassForDataSource(DataSource dataSource)` Method returns class implementing repository which supports data source instance provided in parameter.
    `Class<?>` | `getDefaultBeanClass()` Returns default class for all bean which are defined using configuration as subbeans of bean implementing this interface.
    `Element` | `getMessageExpired(long time, boolean delete)` Loads head of the payloads queue which holds items that would be expired after stated time with an option to delete them from repository after being retrieved.
    `Map<Enum,Long>` | `getMessagesCount(JID to)`
    `List<Element>` | `getMessagesList(JID to)`
    `protected <T> T` | `getValueForDomain(Map<String,T> map, String domain)`
    `protected void` | `initializeRepository(String domain, MsgRepositoryIfc repo)` Method called to initialized passed repository instance for passed domain.
    `void` | `initRepository(String resource_uri, Map<String,String> params)` Deprecated.
    `Queue<Element>` | `loadMessagesToJID(List db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc)`
    `Queue<Element>` | `loadMessagesToJID(XMPPResourceConnection session, boolean delete)` Loads all payloads for the given user's `JID` from repository.
    `void` | `setCondition(ReentrantLock lock, Condition condition)`
    `void` | `setDataSource(DataSource dataSource)` Method called to provide class with instance of a data source.
    `boolean` | `storeMessage(JID from, JID to, Date expired, Element msg, NonAuthUserRepository userRepo)` Saves the massage to the repository

    - ### 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, 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

    - #### MsgRepositoryMDBean

          public MsgRepositoryMDBean()

  - ### Method Detail

    - #### belongsTo

          public boolean belongsTo(Class<? extends BasicComponent> component)

      Specified by:
        `belongsTo` in interface `ComponentStatisticsProvider`

    - #### getMessageExpired

          public Element getMessageExpired(long time,
                                           boolean delete)

      Description copied from interface: `OfflineMsgRepositoryIfc`
      Loads head of the payloads queue which holds items that would be expired after stated time with an option to delete them from repository after being retrieved. This is blocking method, which means if there is not data to return, implementation should block the call until data is available.
      Specified by:
        `getMessageExpired` in interface `OfflineMsgRepositoryIfc`
      Parameters:
        `time` - time in milliseconds representing time after which given message would be considered as expired
        `delete` - boolean parameter controlling whether messages should be removed from repository after they retrieved.
      Returns:
        head of the payloads queue which holds items that would be expired after stated time with an option to delete them from repository after being retrieved.

    - #### loadMessagesToJID

          public Queue<Element> loadMessagesToJID(XMPPResourceConnection session,
                                                  boolean delete)
                                           throws UserNotFoundException

      Description copied from interface: `OfflineMsgRepositoryIfc`
      Loads all payloads for the given user's `JID` from repository.
      Specified by:
        `loadMessagesToJID` in interface `OfflineMsgRepositoryIfc`
      Parameters:
        `session` - user session which keeps all the user session data and also gives an access to the user's repository data.
        `delete` - boolean parameter controlling whether messages should be removed from repository after they retrieved.
      Returns:
        a `Queue` of `Element` objects representing stored payloads for the given user's `JID`
      Throws:
        `UserNotFoundException`

    - #### storeMessage

          public boolean storeMessage(JID from,
                                      JID to,
                                      Date expired,
                                      Element msg,
                                      NonAuthUserRepository userRepo)
                               throws UserNotFoundException

      Description copied from interface: `OfflineMsgRepositoryIfc`
      Saves the massage to the repository
      Specified by:
        `storeMessage` in interface `OfflineMsgRepositoryIfc`
      Parameters:
        `from` - `JID` denotes address of the sender
        `to` - `JID` denotes address of the receiver
        `expired` - `Date` object denoting expiration date of the message
        `msg` - `Element` payload of the stanza to be saved
        `userRepo` - `NonAuthUserRepository` instance of non auth user repository to get user settings for offline messages
      Returns:
        `true` if the packet was correctly saved to repository, `false` otherwise.
      Throws:
        `UserNotFoundException`

    - #### initRepository

          @Deprecated
          public void initRepository(String resource_uri,
                                                 Map<String,String> params)
                                          throws DBInitException

      Deprecated.
      Description copied from interface: `Repository`
      Method is deprecated and should not be user any more.
      The method is called to initialize the data repository. Depending on the implementation all the initialization parameters can be passed either via `resource_uri` parameter as the database connection string or via `params` map if the required repository parameters are more complex or both.
      Specified by:
        `initRepository` in interface `Repository`
      Parameters:
        `resource_uri` - value in most cases representing the database connection string.
        `params` - is a `Map` with repository properties necessary to initialize and perform all the functions. The initialization parameters are implementation dependent.
      Throws:
        `DBInitException` - if there was an error during repository initialization. Some implementations, though, perform so called lazy initialization so even though there is a problem with the underlying repository it may not be signaled through this method call.

    - #### getMessagesCount

          public Map<Enum,Long> getMessagesCount(JID to)
                                          throws UserNotFoundException

      Specified by:
        `getMessagesCount` in interface `MsgRepositoryIfc`
      Throws:
        `UserNotFoundException`

    - #### getMessagesList

          public List<Element> getMessagesList(JID to)
                                        throws UserNotFoundException

      Specified by:
        `getMessagesList` in interface `MsgRepositoryIfc`
      Throws:
        `UserNotFoundException`

    - #### setCondition

          public void setCondition(ReentrantLock lock,
                                   Condition condition)

      Specified by:
        `setCondition` in interface `MsgRepositoryIfc`

    - #### deleteMessagesToJID

          public int deleteMessagesToJID(List db_ids,
                                         XMPPResourceConnection session)
                                  throws UserNotFoundException

      Specified by:
        `deleteMessagesToJID` in interface `MsgRepositoryIfc`
      Throws:
        `UserNotFoundException`

    - #### loadMessagesToJID

          public Queue<Element> loadMessagesToJID(List db_ids,
                                                  XMPPResourceConnection session,
                                                  boolean delete,
                                                  MsgRepository.OfflineMessagesProcessor proc)
                                           throws UserNotFoundException

      Specified by:
        `loadMessagesToJID` in interface `MsgRepositoryIfc`
      Throws:
        `UserNotFoundException`

    - #### setDataSource

          public void setDataSource(DataSource dataSource)

      Description copied from interface: `DataSourceAware`
      Method called to provide class with instance of a data source.
      Specified by:
        `setDataSource` in interface `DataSourceAware`

    - #### getDefaultBeanClass

          public Class<?> getDefaultBeanClass()

      Description copied from interface: `RegistrarBeanWithDefaultBeanClass`
      Returns default class for all bean which are defined using configuration as subbeans of bean implementing this interface. This allows users to have more convenient configuration file without the need to specify class for each of subbbeans if most of them will have the same class.
      Specified by:
        `getDefaultBeanClass` in interface `RegistrarBeanWithDefaultBeanClass`

    - #### findClassForDataSource

          protected Class<? extends MsgRepositoryIfc> findClassForDataSource(DataSource dataSource)
                                                                      throws DBInitException

      Description copied from class: `MDRepositoryBean`
      Method returns class implementing repository which supports data source instance provided in parameter.
      Specified by:
        `findClassForDataSource` in class `MDRepositoryBean<MsgRepositoryIfc>`
      Returns:
        repository class
      Throws:
        `DBInitException`

    - #### initializeRepository

          protected void initializeRepository(String domain,
                                              MsgRepositoryIfc repo)

      Description copied from class: `MDRepositoryBean`
      Method called to initialized passed repository instance for passed domain.
      Should be empty if no custom initialization is required.
      Overrides:
        `initializeRepository` in class `MDRepositoryBean<MsgRepositoryIfc>`

    - #### getValueForDomain

          protected <T> T getValueForDomain(Map<String,T> map,
                                            String domain)

Copyright © 2004–2021 "Tigase, Inc.". All rights reserved.