Package tigase.archive.db
Class JDBCMessageArchiveRepository<Q extends QueryCriteria>
- java.lang.Object
-
- tigase.archive.db.AbstractMessageArchiveRepository<Q,tigase.db.DataRepository,JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider>
-
- tigase.archive.db.JDBCMessageArchiveRepository<Q>
-
- All Implemented Interfaces:
MessageArchiveRepository<Q,tigase.db.DataRepository>
,tigase.db.DataSourceAware<tigase.db.DataRepository>
,tigase.db.util.RepositoryVersionAware
,tigase.xmpp.mam.MAMRepository<Q,tigase.xmpp.mam.MAMRepository.Item>
public class JDBCMessageArchiveRepository<Q extends QueryCriteria> extends AbstractMessageArchiveRepository<Q,tigase.db.DataRepository,JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider> implements tigase.db.util.RepositoryVersionAware
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider
static class
JDBCMessageArchiveRepository.Collection<Q extends QueryCriteria>
static class
JDBCMessageArchiveRepository.Item<Q extends QueryCriteria>
-
Nested classes/interfaces inherited from interface tigase.xmpp.mam.MAMRepository
tigase.xmpp.mam.MAMRepository.ItemHandler<Q extends tigase.xmpp.mam.Query,I extends tigase.xmpp.mam.MAMRepository.Item>
-
Nested classes/interfaces inherited from interface tigase.archive.db.MessageArchiveRepository
MessageArchiveRepository.CollectionHandler<Q extends tigase.xmpp.mam.Query,C extends MessageArchiveRepository.Collection>, MessageArchiveRepository.Direction
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
ADD_MESSAGE_QUERY
protected java.lang.String
ADD_TAG_TO_MESSAGE_QUERY
protected tigase.db.DataRepository
data_repo
protected java.lang.String
DELETE_EXPIRED_MESSAGES_QUERY
protected java.lang.String
GET_COLLECTIONS_COUNT_QUERY
protected java.lang.String
GET_COLLECTIONS_QUERY
protected java.lang.String
GET_MESSAGE_POSITION_QUERY
protected java.lang.String
GET_MESSAGES_COUNT_QUERY
protected java.lang.String
GET_MESSAGES_QUERY
protected java.lang.String
GET_TAGS_FOR_USER_COUNT_QUERY
protected java.lang.String
GET_TAGS_FOR_USER_QUERY
protected java.lang.String
REMOVE_MESSAGES_QUERY
-
Fields inherited from class tigase.archive.db.AbstractMessageArchiveRepository
MSG_BODY_PATH, MSG_SUBJECT_PATH
-
-
Constructor Summary
Constructors Constructor Description JDBCMessageArchiveRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
archiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, java.util.Date timestamp, tigase.xml.Element msg, java.lang.String stableId, java.lang.String stanzaId, java.lang.String refStableId, java.util.Set<java.lang.String> tags, JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider additionParametersProvider)
void
archiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.JID buddy, java.util.Date timestamp, tigase.xml.Element msg, java.lang.String stableId, java.util.Set<java.lang.String> tags)
protected java.sql.Timestamp
convertToTimestamp(java.util.Date date)
void
deleteExpiredMessages(tigase.xmpp.jid.BareJID owner, java.time.LocalDateTime before)
java.lang.String
getStableId(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, java.lang.String stanzaId)
java.util.List<java.lang.String>
getTags(tigase.xmpp.jid.BareJID owner, java.lang.String startsWith, Q crit)
protected void
initPreparedStatements(tigase.db.DataRepository data_repo)
protected JDBCMessageArchiveRepository.Collection
newCollectionInstance()
protected JDBCMessageArchiveRepository.Item
newItemInstance()
Q
newQuery()
void
queryCollections(Q crit, MessageArchiveRepository.CollectionHandler<Q,MessageArchiveRepository.Collection> collectionHandler)
void
queryItems(Q crit, tigase.xmpp.mam.MAMRepository.ItemHandler<Q,tigase.xmpp.mam.MAMRepository.Item> itemHandler)
void
removeItems(tigase.xmpp.jid.BareJID owner, java.lang.String withJid, java.util.Date start, java.util.Date end)
protected int
setCountQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation)
void
setDataSource(tigase.db.DataRepository data_repo)
void
setItemsQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation)
protected int
setQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation)
-
Methods inherited from class tigase.archive.db.AbstractMessageArchiveRepository
archiveMessage, calculateOffsetAndPosition, calculateOffsetAndPosition, extractOriginId, findRefStableId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tigase.archive.db.MessageArchiveRepository
destroy
-
-
-
-
Field Detail
-
ADD_MESSAGE_QUERY
@ConfigField(desc="Query to add message to store", alias="add-message-query") protected java.lang.String ADD_MESSAGE_QUERY
-
ADD_TAG_TO_MESSAGE_QUERY
@ConfigField(desc="Query to add tag to message in store", alias="add-tag-to-message-query") protected java.lang.String ADD_TAG_TO_MESSAGE_QUERY
-
DELETE_EXPIRED_MESSAGES_QUERY
@ConfigField(desc="Query to delete expired messages", alias="delete-expired-messages-query") protected java.lang.String DELETE_EXPIRED_MESSAGES_QUERY
-
GET_COLLECTIONS_COUNT_QUERY
@ConfigField(desc="Query to retrieve number of collections", alias="get-collections-count-query") protected java.lang.String GET_COLLECTIONS_COUNT_QUERY
-
GET_COLLECTIONS_QUERY
@ConfigField(desc="Query to retrieve list of collections", alias="get-collections-query") protected java.lang.String GET_COLLECTIONS_QUERY
-
GET_MESSAGES_COUNT_QUERY
@ConfigField(desc="Query to retrieve number of messages", alias="get-messages-count-query") protected java.lang.String GET_MESSAGES_COUNT_QUERY
-
GET_MESSAGES_QUERY
@ConfigField(desc="Query to retrieve list of messages", alias="get-messages-query") protected java.lang.String GET_MESSAGES_QUERY
-
GET_MESSAGE_POSITION_QUERY
@ConfigField(desc="Query to retrieve message possition", alias="get-message-position-query") protected java.lang.String GET_MESSAGE_POSITION_QUERY
-
GET_TAGS_FOR_USER_COUNT_QUERY
@ConfigField(desc="Query to retrieve number of tags used by user", alias="get-tags-for-user-count-query") protected java.lang.String GET_TAGS_FOR_USER_COUNT_QUERY
-
GET_TAGS_FOR_USER_QUERY
@ConfigField(desc="Query to retrieve tags used by user", alias="get-tags-for-user-query") protected java.lang.String GET_TAGS_FOR_USER_QUERY
-
REMOVE_MESSAGES_QUERY
@ConfigField(desc="Query to remove messages", alias="remove-messages-query") protected java.lang.String REMOVE_MESSAGES_QUERY
-
data_repo
protected tigase.db.DataRepository data_repo
-
-
Method Detail
-
setDataSource
public void setDataSource(tigase.db.DataRepository data_repo)
- Specified by:
setDataSource
in interfacetigase.db.DataSourceAware<Q extends QueryCriteria>
-
archiveMessage
public void archiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.JID buddy, java.util.Date timestamp, tigase.xml.Element msg, java.lang.String stableId, java.util.Set<java.lang.String> tags)
- Specified by:
archiveMessage
in interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>
-
deleteExpiredMessages
public void deleteExpiredMessages(tigase.xmpp.jid.BareJID owner, java.time.LocalDateTime before) throws tigase.db.TigaseDBException
- Specified by:
deleteExpiredMessages
in interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>
- Throws:
tigase.db.TigaseDBException
-
getStableId
public java.lang.String getStableId(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, java.lang.String stanzaId) throws tigase.db.TigaseDBException
- Specified by:
getStableId
in interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>
- Throws:
tigase.db.TigaseDBException
-
queryCollections
public void queryCollections(Q crit, MessageArchiveRepository.CollectionHandler<Q,MessageArchiveRepository.Collection> collectionHandler) throws tigase.db.TigaseDBException
- Specified by:
queryCollections
in interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>
- Throws:
tigase.db.TigaseDBException
-
queryItems
public void queryItems(Q crit, tigase.xmpp.mam.MAMRepository.ItemHandler<Q,tigase.xmpp.mam.MAMRepository.Item> itemHandler) throws tigase.db.TigaseDBException, tigase.component.exceptions.ComponentException
- Specified by:
queryItems
in interfacetigase.xmpp.mam.MAMRepository<Q extends QueryCriteria,tigase.xmpp.mam.MAMRepository.Item>
- Throws:
tigase.db.TigaseDBException
tigase.component.exceptions.ComponentException
-
removeItems
public void removeItems(tigase.xmpp.jid.BareJID owner, java.lang.String withJid, java.util.Date start, java.util.Date end) throws tigase.db.TigaseDBException
- Specified by:
removeItems
in interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>
- Throws:
tigase.db.TigaseDBException
-
getTags
public java.util.List<java.lang.String> getTags(tigase.xmpp.jid.BareJID owner, java.lang.String startsWith, Q crit) throws tigase.db.TigaseDBException
- Specified by:
getTags
in interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>
- Throws:
tigase.db.TigaseDBException
-
setItemsQueryParams
public void setItemsQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
newQuery
public Q newQuery()
- Specified by:
newQuery
in interfacetigase.xmpp.mam.MAMRepository<Q extends QueryCriteria,tigase.xmpp.mam.MAMRepository.Item>
-
initPreparedStatements
protected void initPreparedStatements(tigase.db.DataRepository data_repo) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
archiveMessage
protected void archiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, java.util.Date timestamp, tigase.xml.Element msg, java.lang.String stableId, java.lang.String stanzaId, java.lang.String refStableId, java.util.Set<java.lang.String> tags, JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider additionParametersProvider)
- Specified by:
archiveMessage
in classAbstractMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository,JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider>
-
convertToTimestamp
protected java.sql.Timestamp convertToTimestamp(java.util.Date date)
-
setCountQueryParams
protected int setCountQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setQueryParams
protected int setQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
newCollectionInstance
protected JDBCMessageArchiveRepository.Collection newCollectionInstance()
-
newItemInstance
protected JDBCMessageArchiveRepository.Item newItemInstance()
-
-