tigase.server.amp

## Class MsgRepository<T>

- java.lang.Object
- - tigase.server.amp.MsgRepository<T>

- All Implemented Interfaces:
    MsgRepositoryIfc, Repository
  Direct Known Subclasses:
    JDBCMsgRepository

      public abstract class MsgRepository<T>
      extends Object
      implements MsgRepositoryIfc

  Author:
    andrzej

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `MsgRepository.BroadcastMsg`
    `static class` | `MsgRepository.MSG_TYPES`
    `protected class` | `MsgRepository.MsgDBItem`
    `static interface` | `MsgRepository.OfflineMessagesProcessor`

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

      `Repository.Meta`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,MsgRepository.BroadcastMsg>` | `broadcastMessages`
    `protected long` | `broadcastMessagesLastCleanup`
    `protected long` | `earliestOffline`
    `protected DelayQueue<MsgRepository.MsgDBItem>` | `expiredQueue`
    `protected static int` | `MAX_QUEUE_SIZE`
    `static String` | `MSGS_STORE_LIMIT_KEY`
    `static long` | `MSGS_STORE_LIMIT_VAL`
    `protected tigase.xml.SimpleParser` | `parser`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MsgRepository()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `deleteMessage(T db_id)`
    `abstract int` | `deleteMessagesToJID(List<String> db_ids, tigase.xmpp.JID to)`
    `String` | `dumpBroadcastMessageKeys()`
    `protected abstract void` | `ensureBroadcastMessageRecipient(String id, tigase.xmpp.BareJID recipient)`
    `Collection<MsgRepository.BroadcastMsg>` | `getBroadcastMessages()`
    `MsgRepository.BroadcastMsg` | `getBroadcastMsg(String id)`
    `static MsgRepositoryIfc` | `getInstance(String cls, String id_string)`
    `tigase.xml.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.
    `abstract Map<MsgRepository.MSG_TYPES,Long>` | `getMessagesCount(tigase.xmpp.JID to)`
    `abstract List<tigase.xml.Element>` | `getMessagesList(tigase.xmpp.JID to)`
    `String` | `getStanzaTo()`
    `protected abstract void` | `insertBroadcastMessage(String id, tigase.xml.Element msg, Date expire, tigase.xmpp.BareJID recipient)`
    `protected abstract void` | `loadExpiredQueue(Date expired)`
    `protected abstract void` | `loadExpiredQueue(int max)`
    `abstract void` | `loadMessagesToBroadcast()`
    `abstract Queue<tigase.xml.Element>` | `loadMessagesToJID(List<String> db_ids, tigase.xmpp.JID to, boolean delete, MsgRepository.OfflineMessagesProcessor proc)`
    `boolean` | `updateBroadcastMessage(String id, tigase.xml.Element msg, Date expire, tigase.xmpp.BareJID recipient)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface tigase.db.MsgRepositoryIfc

      `loadMessagesToJID, storeMessage`

    - ### Methods inherited from interface tigase.db.Repository

      `initRepository`

- - ### Field Detail

    - #### MSGS_STORE_LIMIT_VAL

          public static final long MSGS_STORE_LIMIT_VAL

      See Also:
        Constant Field Values

    - #### MSGS_STORE_LIMIT_KEY

          public static final String MSGS_STORE_LIMIT_KEY

      See Also:
        Constant Field Values

    - #### MAX_QUEUE_SIZE

          protected static final int MAX_QUEUE_SIZE

      See Also:
        Constant Field Values

    - #### parser

          protected tigase.xml.SimpleParser parser

    - #### earliestOffline

          protected long earliestOffline

    - #### expiredQueue

          protected DelayQueue<MsgRepository.MsgDBItem> expiredQueue

    - #### broadcastMessagesLastCleanup

          protected long broadcastMessagesLastCleanup

    - #### broadcastMessages

          protected Map<String,MsgRepository.BroadcastMsg> broadcastMessages

  - ### Constructor Detail

    - #### MsgRepository

          public MsgRepository()

  - ### Method Detail

    - #### getInstance

          public static MsgRepositoryIfc getInstance(String cls,
                                                     String id_string)
                                              throws TigaseDBException

      Throws:
        `TigaseDBException`

    - #### loadExpiredQueue

          protected abstract void loadExpiredQueue(int max)

    - #### loadExpiredQueue

          protected abstract void loadExpiredQueue(Date expired)

    - #### deleteMessage

          protected abstract void deleteMessage(T db_id)

    - #### loadMessagesToBroadcast

          public abstract void loadMessagesToBroadcast()

    - #### ensureBroadcastMessageRecipient

          protected abstract void ensureBroadcastMessageRecipient(String id,
                                                                  tigase.xmpp.BareJID recipient)

    - #### insertBroadcastMessage

          protected abstract void insertBroadcastMessage(String id,
                                                         tigase.xml.Element msg,
                                                         Date expire,
                                                         tigase.xmpp.BareJID recipient)

    - #### getMessagesCount

          public abstract Map<MsgRepository.MSG_TYPES,Long> getMessagesCount(tigase.xmpp.JID to)
                                                                      throws UserNotFoundException

      Throws:
        `UserNotFoundException`

    - #### getMessagesList

          public abstract List<tigase.xml.Element> getMessagesList(tigase.xmpp.JID to)
                                                            throws UserNotFoundException

      Throws:
        `UserNotFoundException`

    - #### loadMessagesToJID

          public abstract Queue<tigase.xml.Element> loadMessagesToJID(List<String> db_ids,
                                                                      tigase.xmpp.JID to,
                                                                      boolean delete,
                                                                      MsgRepository.OfflineMessagesProcessor proc)
                                                               throws UserNotFoundException

      Throws:
        `UserNotFoundException`

    - #### deleteMessagesToJID

          public abstract int deleteMessagesToJID(List<String> db_ids,
                                                  tigase.xmpp.JID to)
                                           throws UserNotFoundException

      Throws:
        `UserNotFoundException`

    - #### getBroadcastMsg

          public MsgRepository.BroadcastMsg getBroadcastMsg(String id)

    - #### dumpBroadcastMessageKeys

          public String dumpBroadcastMessageKeys()

    - #### getBroadcastMessages

          public Collection<MsgRepository.BroadcastMsg> getBroadcastMessages()

    - #### updateBroadcastMessage

          public boolean updateBroadcastMessage(String id,
                                                tigase.xml.Element msg,
                                                Date expire,
                                                tigase.xmpp.BareJID recipient)

    - #### getMessageExpired

          public tigase.xml.Element getMessageExpired(long time,
                                                      boolean delete)

      Description copied from interface: `MsgRepositoryIfc`
      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 `MsgRepositoryIfc`
      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.

    - #### getStanzaTo

          public String getStanzaTo()

Copyright © 2016 "Tigase, Inc.". All rights reserved.