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.OfflineMessagesProcessorNested 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 voiddeleteMessage(String db_id) intdeleteMessagesToJID(List<String> db_ids, XMPPResourceConnection session) getMessagesCount(JID to) getMessagesList(JID to) protected voidloadExpiredQueue(int max) protected voidloadExpiredQueue(Date expired) loadMessagesToJID(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) loadMessagesToJID(XMPPResourceConnection session, boolean delete) Loads all payloads for the given user'sJIDfrom repository.voidsetDataSource(XMLDataSource dataSource) Method called to provide class with instance of a data source.booleanstoreMessage(JID from, JID to, Date expired, 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:DataSourceAwareMethod called to provide class with instance of a data source. -
getMessagesCount
- Throws:
UserNotFoundException
-
getMessagesList
- Throws:
UserNotFoundException
-
loadMessagesToJID
public Queue<Element> loadMessagesToJID(XMPPResourceConnection session, boolean delete) throws UserNotFoundException Description copied from interface:OfflineMsgRepositoryIfcLoads all payloads for the given user'sJIDfrom 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
QueueofElementobjects representing stored payloads for the given user'sJID - Throws:
UserNotFoundException
-
storeMessage
public boolean storeMessage(JID from, JID to, Date expired, Element msg, NonAuthUserRepository userRepo) throws UserNotFoundException Description copied from interface:OfflineMsgRepositoryIfcSaves the massage to the repository- Parameters:
from-JIDdenotes address of the senderto-JIDdenotes address of the receiverexpired-Dateobject denoting expiration date of the messagemsg-Elementpayload of the stanza to be saveduserRepo-NonAuthUserRepositoryinstance of non auth user repository to get user settings for offline messages- Returns:
trueif the packet was correctly saved to repository,falseotherwise.- Throws:
UserNotFoundException
-
loadMessagesToJID
public Queue<Element> loadMessagesToJID(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException - Specified by:
loadMessagesToJIDin interfaceMsgRepositoryIfc<XMLDataSource>- Specified by:
loadMessagesToJIDin classMsgRepository<String,XMLDataSource> - Throws:
UserNotFoundException
-
deleteMessagesToJID
public int deleteMessagesToJID(List<String> db_ids, XMPPResourceConnection session) throws UserNotFoundException - Specified by:
deleteMessagesToJIDin interfaceMsgRepositoryIfc<XMLDataSource>- Specified by:
deleteMessagesToJIDin classMsgRepository<String,XMLDataSource> - Throws:
UserNotFoundException
-
loadExpiredQueue
protected void loadExpiredQueue(int max) - Specified by:
loadExpiredQueuein classMsgRepository<String,XMLDataSource>
-
loadExpiredQueue
- Specified by:
loadExpiredQueuein classMsgRepository<String,XMLDataSource>
-
deleteMessage
- Specified by:
deleteMessagein classMsgRepository<String,XMLDataSource>
-