Package tigase.server.amp.db
Class MsgRepository<T,S extends DataSource>
- java.lang.Object
-
- tigase.server.amp.db.MsgRepository<T,S>
-
- All Implemented Interfaces:
DataSourceAware<S>,MsgRepositoryIfc<S>,OfflineMsgRepositoryIfc,Repository
- Direct Known Subclasses:
JDBCMsgRepository,XMLMsgRepository
public abstract class MsgRepository<T,S extends DataSource> extends java.lang.Object implements MsgRepositoryIfc<S>
- Author:
- andrzej
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMsgRepository.MSG_TYPESstatic classMsgRepository.MsgDBItem<T>static classMsgRepository.MsgRepositoryMDBeanBean used to provide MsgRepository implementationsstatic interfaceMsgRepository.MsgRepositoryPoolBean<T>Deprecated.static interfaceMsgRepository.OfflineMessagesProcessor-
Nested classes/interfaces inherited from interface tigase.db.Repository
Repository.Meta, Repository.SchemaId
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.atomic.AtomicIntegerawaitingInExpiredQueueprotected longearliestOfflineprotected java.util.concurrent.DelayQueue<MsgRepository.MsgDBItem<T>>expiredQueueprotected static intMAX_QUEUE_SIZEstatic java.lang.StringMSGS_STORE_LIMIT_KEYstatic java.lang.StringOFFLINE_MSGS_KEYprotected SimpleParserparser
-
Constructor Summary
Constructors Constructor Description MsgRepository()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract voiddeleteMessage(T db_id)abstract intdeleteMessagesToJID(java.util.List<java.lang.String> db_ids, XMPPResourceConnection session)static MsgRepositoryIfcgetInstance(java.lang.String cls, java.lang.String id_string)ElementgetMessageExpired(long time, boolean delete)Deprecated.protected longgetMsgsStoreLimit(BareJID userJid, NonAuthUserRepository userRepo)voidinitRepository(java.lang.String conn_str, java.util.Map<java.lang.String,java.lang.String> map)Deprecated.protected abstract voidloadExpiredQueue(int max)Deprecated.protected abstract voidloadExpiredQueue(java.util.Date expired)Deprecated.abstract java.util.Queue<Element>loadMessagesToJID(java.util.List<java.lang.String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc)voidsetCondition(java.util.concurrent.locks.ReentrantLock lock, java.util.concurrent.locks.Condition condition)Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tigase.db.DataSourceAware
setDataSource
-
Methods inherited from interface tigase.db.MsgRepositoryIfc
getMessagesCount, getMessagesList
-
Methods inherited from interface tigase.db.OfflineMsgRepositoryIfc
loadMessagesToJID, storeMessage
-
-
-
-
Field Detail
-
OFFLINE_MSGS_KEY
public static final java.lang.String OFFLINE_MSGS_KEY
- See Also:
- Constant Field Values
-
MSGS_STORE_LIMIT_KEY
public static final java.lang.String MSGS_STORE_LIMIT_KEY
- See Also:
- Constant Field Values
-
MAX_QUEUE_SIZE
protected static final int MAX_QUEUE_SIZE
- See Also:
- Constant Field Values
-
awaitingInExpiredQueue
protected java.util.concurrent.atomic.AtomicInteger awaitingInExpiredQueue
-
earliestOffline
protected long earliestOffline
-
parser
protected SimpleParser parser
-
expiredQueue
protected java.util.concurrent.DelayQueue<MsgRepository.MsgDBItem<T>> expiredQueue
-
-
Method Detail
-
getInstance
public static MsgRepositoryIfc getInstance(java.lang.String cls, java.lang.String id_string) throws TigaseDBException
- Throws:
TigaseDBException
-
loadMessagesToJID
public abstract java.util.Queue<Element> loadMessagesToJID(java.util.List<java.lang.String> db_ids, XMPPResourceConnection session, boolean delete, MsgRepository.OfflineMessagesProcessor proc) throws UserNotFoundException
- Specified by:
loadMessagesToJIDin interfaceMsgRepositoryIfc<T>- Throws:
UserNotFoundException
-
deleteMessagesToJID
public abstract int deleteMessagesToJID(java.util.List<java.lang.String> db_ids, XMPPResourceConnection session) throws UserNotFoundException- Specified by:
deleteMessagesToJIDin interfaceMsgRepositoryIfc<T>- Throws:
UserNotFoundException
-
initRepository
@Deprecated public void initRepository(java.lang.String conn_str, java.util.Map<java.lang.String,java.lang.String> map) throws DBInitExceptionDeprecated.Description copied from interface:RepositoryMethod is deprecated and should not be user any more.
The method is called to initialize the data repository. Depending on the implementation all the initialization parameters can be passed either viaresource_uriparameter as the database connection string or viaparamsmap if the required repository parameters are more complex or both.- Specified by:
initRepositoryin interfaceRepository- Parameters:
conn_str- value in most cases representing the database connection string.map- is aMapwith repository properties necessary to initialize and perform all the functions. The initialization parameters are implementation dependent.- Throws:
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.
-
getMessageExpired
@Deprecated public Element getMessageExpired(long time, boolean delete)
Deprecated.Description copied from interface:OfflineMsgRepositoryIfcLoads 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. This is blocking method, which means if there is not data to return, implementation should block the call until data is available.- Specified by:
getMessageExpiredin interfaceOfflineMsgRepositoryIfc- Parameters:
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.- Returns:
- 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.
-
setCondition
@Deprecated public void setCondition(java.util.concurrent.locks.ReentrantLock lock, java.util.concurrent.locks.Condition condition)Deprecated.- Specified by:
setConditionin interfaceMsgRepositoryIfc<T>
-
loadExpiredQueue
@Deprecated protected abstract void loadExpiredQueue(int max)
Deprecated.
-
loadExpiredQueue
@Deprecated protected abstract void loadExpiredQueue(java.util.Date expired)
Deprecated.
-
deleteMessage
protected abstract void deleteMessage(T db_id)
-
getMsgsStoreLimit
protected long getMsgsStoreLimit(BareJID userJid, NonAuthUserRepository userRepo) throws UserNotFoundException
- Throws:
UserNotFoundException
-
-