public class JDBCMsgRepository extends MsgRepository<Long>
MsgRepository.BroadcastMsg, MsgRepository.MSG_TYPES, MsgRepository.MsgDBItem, MsgRepository.OfflineMessagesProcessorRepository.MetabroadcastMessages, broadcastMessagesLastCleanup, earliestOffline, expiredQueue, MAX_QUEUE_SIZE, MSGS_STORE_LIMIT_KEY, OFFLINE_MSGS_KEY, parser| Constructor and Description |
|---|
JDBCMsgRepository() |
dumpBroadcastMessageKeys, getBroadcastMessages, getBroadcastMsg, getInstance, getMessageExpired, getMsgsStoreLimit, getStanzaTo, updateBroadcastMessagepublic void initRepository(String conn_str, Map<String,String> map) throws DBInitException
Repositoryresource_uri
parameter as the database connection string or via params map if
the required repository parameters are more complex or both.initRepository in interface RepositoryinitRepository in class MsgRepository<Long>conn_str - value in most cases representing the database connection string.map - is a Map with repository properties necessary to initialize
and perform all the functions. The initialization parameters are implementation dependent.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.public Map<Enum,Long> getMessagesCount(JID to) throws UserNotFoundException
getMessagesCount in class MsgRepository<Long>UserNotFoundExceptionpublic List<Element> getMessagesList(JID to) throws UserNotFoundException
getMessagesList in class MsgRepository<Long>UserNotFoundExceptionpublic Queue<Element> loadMessagesToJID(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException
loadMessagesToJID in class MsgRepository<Long>UserNotFoundExceptionpublic int deleteMessagesToJID(List<String> db_ids, XMPPResourceConnection session) throws UserNotFoundException
deleteMessagesToJID in class MsgRepository<Long>UserNotFoundExceptionpublic Queue<Element> loadMessagesToJID(XMPPResourceConnection session, boolean delete) throws UserNotFoundException
MsgRepositoryIfcJID from repository.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.Queue of Element objects representing stored
payloads for the given user's JIDUserNotFoundExceptionpublic Queue<Element> loadMessagesToJID(XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException
UserNotFoundExceptionprotected Queue<Element> parseLoadedMessages(MsgRepository.OfflineMessagesProcessor proc, ResultSet rs) throws SQLException
SQLExceptionpublic boolean storeMessage(JID from, JID to, Date expired, Element msg, NonAuthUserRepository userRepo) throws UserNotFoundException
MsgRepositoryIfcfrom - 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 messagestrue if the packet was correctly saved to repository,
false otherwise.UserNotFoundExceptionpublic void loadMessagesToBroadcast()
loadMessagesToBroadcast in class MsgRepository<Long>protected void insertBroadcastMessage(String id, Element msg, Date expire, BareJID recipient)
insertBroadcastMessage in class MsgRepository<Long>protected void ensureBroadcastMessageRecipient(String id, BareJID recipient)
ensureBroadcastMessageRecipient in class MsgRepository<Long>protected void deleteMessage(Long msg_id)
deleteMessage in class MsgRepository<Long>protected void loadExpiredQueue(int min_elements)
loadExpiredQueue in class MsgRepository<Long>protected void loadExpiredQueue(Date expired)
loadExpiredQueue in class MsgRepository<Long>Copyright © 2018 "Tigase, Inc.". All rights reserved.