public abstract class MsgRepository<T,S extends DataSource> extends Object implements MsgRepositoryIfc<S>
Modifier and Type | Class and Description |
---|---|
static class |
MsgRepository.MSG_TYPES |
static class |
MsgRepository.MsgDBItem<T> |
static class |
MsgRepository.MsgRepositoryMDBean
Bean used to provide MsgRepository implementations
|
static interface |
MsgRepository.OfflineMessagesProcessor |
Repository.Meta, Repository.SchemaId
Modifier and Type | Field and Description |
---|---|
protected long |
earliestOffline |
protected DelayQueue<MsgRepository.MsgDBItem<T>> |
expiredQueue |
protected static int |
MAX_QUEUE_SIZE |
static String |
MSGS_STORE_LIMIT_KEY |
static String |
OFFLINE_MSGS_KEY |
protected SimpleParser |
parser |
Constructor and Description |
---|
MsgRepository() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
deleteMessage(T db_id) |
abstract int |
deleteMessagesToJID(List<String> db_ids,
XMPPResourceConnection session) |
static MsgRepositoryIfc |
getInstance(String cls,
String id_string) |
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.
|
protected long |
getMsgsStoreLimit(BareJID userJid,
NonAuthUserRepository userRepo) |
void |
initRepository(String conn_str,
Map<String,String> map)
Deprecated.
|
protected abstract void |
loadExpiredQueue(Date expired) |
protected abstract void |
loadExpiredQueue(int max) |
abstract Queue<Element> |
loadMessagesToJID(List<String> db_ids,
XMPPResourceConnection session,
boolean delete,
MsgRepository.OfflineMessagesProcessor proc) |
void |
setCondition(ReentrantLock lock,
Condition condition) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessagesCount, getMessagesList
loadMessagesToJID, storeMessage
setDataSource
public static final String OFFLINE_MSGS_KEY
public static final String MSGS_STORE_LIMIT_KEY
protected static final int MAX_QUEUE_SIZE
protected long earliestOffline
protected SimpleParser parser
protected DelayQueue<MsgRepository.MsgDBItem<T>> expiredQueue
public static MsgRepositoryIfc getInstance(String cls, String id_string) throws TigaseDBException
TigaseDBException
public abstract Queue<Element> loadMessagesToJID(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException
loadMessagesToJID
in interface MsgRepositoryIfc<S extends DataSource>
UserNotFoundException
public abstract int deleteMessagesToJID(List<String> db_ids, XMPPResourceConnection session) throws UserNotFoundException
deleteMessagesToJID
in interface MsgRepositoryIfc<S extends DataSource>
UserNotFoundException
@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
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 Element getMessageExpired(long time, boolean delete)
OfflineMsgRepositoryIfc
getMessageExpired
in interface OfflineMsgRepositoryIfc
time
- time in milliseconds representing time after which given message would be considered as expireddelete
- boolean parameter controlling whether messages should be removed from repository after they
retrieved.public void setCondition(ReentrantLock lock, Condition condition)
setCondition
in interface MsgRepositoryIfc<S extends DataSource>
protected abstract void loadExpiredQueue(int max)
protected abstract void loadExpiredQueue(Date expired)
protected abstract void deleteMessage(T db_id)
protected long getMsgsStoreLimit(BareJID userJid, NonAuthUserRepository userRepo) throws UserNotFoundException
UserNotFoundException
Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.