Package tigase.db.xml
Class XMLMsgRepository
- All Implemented Interfaces:
DataSourceAware<XMLDataSource>
,MsgRepositoryIfc<XMLDataSource>
,OfflineMsgRepositoryIfc
,Repository
Created by andrzej on 04.04.2017.
-
Nested Class Summary
Nested classes/interfaces inherited from class tigase.server.amp.db.MsgRepository
MsgRepository.MSG_TYPES, MsgRepository.MsgDBItem<T>, MsgRepository.MsgRepositoryMDBean, MsgRepository.MsgRepositoryPoolBean<T>, MsgRepository.OfflineMessagesProcessor
Nested classes/interfaces inherited from interface tigase.db.Repository
Repository.Meta, Repository.SchemaId
-
Field Summary
Fields inherited from class tigase.server.amp.db.MsgRepository
awaitingInExpiredQueue, earliestOffline, expiredQueue, MAX_QUEUE_SIZE, MSGS_STORE_LIMIT_KEY, OFFLINE_MSGS_KEY, parser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
deleteMessage
(String db_id) int
deleteMessagesToJID
(List<String> db_ids, XMPPResourceConnection session) getMessagesCount
(tigase.xmpp.jid.JID to) List<tigase.xml.Element>
getMessagesList
(tigase.xmpp.jid.JID to) protected void
loadExpiredQueue
(int max) protected void
loadExpiredQueue
(Date expired) Queue<tigase.xml.Element>
loadMessagesToJID
(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) Queue<tigase.xml.Element>
loadMessagesToJID
(XMPPResourceConnection session, boolean delete) Loads all payloads for the given user'sJID
from repository.void
setDataSource
(XMLDataSource dataSource) Method called to provide class with instance of a data source.boolean
storeMessage
(tigase.xmpp.jid.JID from, tigase.xmpp.jid.JID to, Date expired, tigase.xml.Element msg, NonAuthUserRepository userRepo) Saves the massage to the repositoryMethods inherited from class tigase.server.amp.db.MsgRepository
getInstance, getMessageExpired, getMsgsStoreLimit, initRepository, setCondition
-
Constructor Details
-
XMLMsgRepository
public XMLMsgRepository()
-
-
Method Details
-
setDataSource
Description copied from interface:DataSourceAware
Method called to provide class with instance of a data source. -
getMessagesCount
- Throws:
UserNotFoundException
-
getMessagesList
public List<tigase.xml.Element> getMessagesList(tigase.xmpp.jid.JID to) throws UserNotFoundException - Throws:
UserNotFoundException
-
loadMessagesToJID
public Queue<tigase.xml.Element> loadMessagesToJID(XMPPResourceConnection session, boolean delete) throws UserNotFoundException Description copied from interface:OfflineMsgRepositoryIfc
Loads all payloads for the given user'sJID
from repository.- 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
ofElement
objects representing stored payloads for the given user'sJID
- Throws:
UserNotFoundException
-
storeMessage
public boolean storeMessage(tigase.xmpp.jid.JID from, tigase.xmpp.jid.JID to, Date expired, tigase.xml.Element msg, NonAuthUserRepository userRepo) throws UserNotFoundException Description copied from interface:OfflineMsgRepositoryIfc
Saves the massage to the repository- Parameters:
from
-JID
denotes address of the senderto
-JID
denotes address of the receiverexpired
-Date
object denoting expiration date of the messagemsg
-Element
payload of the stanza to be saveduserRepo
-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
-
loadMessagesToJID
public Queue<tigase.xml.Element> loadMessagesToJID(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException - Specified by:
loadMessagesToJID
in interfaceMsgRepositoryIfc<XMLDataSource>
- Specified by:
loadMessagesToJID
in classMsgRepository<String,
XMLDataSource> - Throws:
UserNotFoundException
-
deleteMessagesToJID
public int deleteMessagesToJID(List<String> db_ids, XMPPResourceConnection session) throws UserNotFoundException - Specified by:
deleteMessagesToJID
in interfaceMsgRepositoryIfc<XMLDataSource>
- Specified by:
deleteMessagesToJID
in classMsgRepository<String,
XMLDataSource> - Throws:
UserNotFoundException
-
loadExpiredQueue
protected void loadExpiredQueue(int max) - Specified by:
loadExpiredQueue
in classMsgRepository<String,
XMLDataSource>
-
loadExpiredQueue
- Specified by:
loadExpiredQueue
in classMsgRepository<String,
XMLDataSource>
-
deleteMessage
- Specified by:
deleteMessage
in classMsgRepository<String,
XMLDataSource>
-