public class JDBCMsgRepository extends MsgRepository<Long,DataRepository> implements RepositoryVersionAware
MsgRepository.MSG_TYPES, MsgRepository.MsgDBItem<T>, MsgRepository.MsgRepositoryMDBean, MsgRepository.OfflineMessagesProcessor
RepositoryVersionAware.SchemaVersion
Repository.Meta, Repository.SchemaId
Modifier and Type | Field and Description |
---|---|
protected DataRepository |
data_repo |
earliestOffline, expiredQueue, MAX_QUEUE_SIZE, MSGS_STORE_LIMIT_KEY, OFFLINE_MSGS_KEY, parser
Constructor and Description |
---|
JDBCMsgRepository() |
getInstance, getMessageExpired, getMsgsStoreLimit, setCondition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getVersion, updateSchema
protected DataRepository data_repo
public void setDataSource(DataRepository data_repo)
DataSourceAware
setDataSource
in interface DataSourceAware<DataRepository>
@Deprecated public void initRepository(String conn_str, Map<String,String> map) throws DBInitException
Repository
resource_uri
parameter as the database connection string or via
params
map if the required repository parameters are more complex or both.initRepository
in interface Repository
initRepository
in class MsgRepository<Long,DataRepository>
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)
getMessagesCount
in interface MsgRepositoryIfc<DataRepository>
public List<Element> getMessagesList(JID to)
getMessagesList
in interface MsgRepositoryIfc<DataRepository>
public Queue<Element> loadMessagesToJID(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException
loadMessagesToJID
in interface MsgRepositoryIfc<DataRepository>
loadMessagesToJID
in class MsgRepository<Long,DataRepository>
UserNotFoundException
public int deleteMessagesToJID(List<String> db_ids, XMPPResourceConnection session) throws UserNotFoundException
deleteMessagesToJID
in interface MsgRepositoryIfc<DataRepository>
deleteMessagesToJID
in class MsgRepository<Long,DataRepository>
UserNotFoundException
public Queue<Element> loadMessagesToJID(XMPPResourceConnection session, boolean delete) throws UserNotFoundException
OfflineMsgRepositoryIfc
JID
from repository.loadMessagesToJID
in interface OfflineMsgRepositoryIfc
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 JID
UserNotFoundException
public Queue<Element> loadMessagesToJID(XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException
UserNotFoundException
public boolean storeMessage(JID from, JID to, Date expired, Element msg, NonAuthUserRepository userRepo) throws UserNotFoundException
OfflineMsgRepositoryIfc
storeMessage
in interface OfflineMsgRepositoryIfc
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 messagestrue
if the packet was correctly saved to repository, false
otherwise.UserNotFoundException
protected Queue<Element> parseLoadedMessages(MsgRepository.OfflineMessagesProcessor proc, ResultSet rs) throws SQLException
SQLException
protected void deleteMessage(Long msg_id)
deleteMessage
in class MsgRepository<Long,DataRepository>
protected void loadExpiredQueue(int min_elements)
loadExpiredQueue
in class MsgRepository<Long,DataRepository>
protected void loadExpiredQueue(Date expired)
loadExpiredQueue
in class MsgRepository<Long,DataRepository>
protected MsgRepository.MsgDBItem parseExpiredMessage(DomBuilderHandler domHandler, ResultSet rs) throws SQLException
SQLException
Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.