public abstract class MsgRepository<T> extends Object implements MsgRepositoryIfc
Modifier and Type | Class and Description |
---|---|
class |
MsgRepository.BroadcastMsg |
static class |
MsgRepository.MSG_TYPES |
protected class |
MsgRepository.MsgDBItem |
static interface |
MsgRepository.OfflineMessagesProcessor |
Repository.Meta
Modifier and Type | Field and Description |
---|---|
protected Map<String,MsgRepository.BroadcastMsg> |
broadcastMessages |
protected long |
broadcastMessagesLastCleanup |
protected long |
earliestOffline |
protected DelayQueue<MsgRepository.MsgDBItem> |
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) |
String |
dumpBroadcastMessageKeys() |
protected abstract void |
ensureBroadcastMessageRecipient(String id,
BareJID recipient) |
Collection<MsgRepository.BroadcastMsg> |
getBroadcastMessages() |
MsgRepository.BroadcastMsg |
getBroadcastMsg(String id) |
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.
|
abstract Map<Enum,Long> |
getMessagesCount(JID to) |
abstract List<Element> |
getMessagesList(JID to) |
protected long |
getMsgsStoreLimit(BareJID userJid,
NonAuthUserRepository userRepo) |
String |
getStanzaTo() |
void |
initRepository(String conn_str,
Map<String,String> map)
The method is called to initialize the data repository.
|
protected abstract void |
insertBroadcastMessage(String id,
Element msg,
Date expire,
BareJID recipient) |
protected abstract void |
loadExpiredQueue(Date expired) |
protected abstract void |
loadExpiredQueue(int max) |
abstract void |
loadMessagesToBroadcast() |
abstract Queue<Element> |
loadMessagesToJID(List<String> db_ids,
XMPPResourceConnection session,
boolean delete,
MsgRepository.OfflineMessagesProcessor proc) |
boolean |
updateBroadcastMessage(String id,
Element msg,
Date expire,
BareJID recipient) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
loadMessagesToJID, storeMessage
public static final String OFFLINE_MSGS_KEY
public static final String MSGS_STORE_LIMIT_KEY
protected static final int MAX_QUEUE_SIZE
protected SimpleParser parser
protected long earliestOffline
protected DelayQueue<MsgRepository.MsgDBItem> expiredQueue
protected long broadcastMessagesLastCleanup
protected Map<String,MsgRepository.BroadcastMsg> broadcastMessages
public static MsgRepositoryIfc getInstance(String cls, String id_string) throws TigaseDBException
TigaseDBException
protected abstract void loadExpiredQueue(int max)
protected abstract void loadExpiredQueue(Date expired)
protected abstract void deleteMessage(T db_id)
public abstract void loadMessagesToBroadcast()
protected abstract void ensureBroadcastMessageRecipient(String id, BareJID recipient)
protected abstract void insertBroadcastMessage(String id, Element msg, Date expire, BareJID recipient)
public abstract Map<Enum,Long> getMessagesCount(JID to) throws UserNotFoundException
UserNotFoundException
public abstract List<Element> getMessagesList(JID to) throws UserNotFoundException
UserNotFoundException
public abstract Queue<Element> loadMessagesToJID(List<String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException
UserNotFoundException
public abstract int deleteMessagesToJID(List<String> db_ids, XMPPResourceConnection session) throws UserNotFoundException
UserNotFoundException
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.protected long getMsgsStoreLimit(BareJID userJid, NonAuthUserRepository userRepo)
public MsgRepository.BroadcastMsg getBroadcastMsg(String id)
public String dumpBroadcastMessageKeys()
public Collection<MsgRepository.BroadcastMsg> getBroadcastMessages()
public boolean updateBroadcastMessage(String id, Element msg, Date expire, BareJID recipient)
public Element getMessageExpired(long time, boolean delete)
MsgRepositoryIfc
getMessageExpired
in interface MsgRepositoryIfc
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 String getStanzaTo()
Copyright © 2019 "Tigase, Inc.". All rights reserved.