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 interfaceJDBCMessageArchiveRepository.AddMessageAdditionalDataProviderstatic classJDBCMessageArchiveRepository.Collection<Q extends QueryCriteria>static classJDBCMessageArchiveRepository.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.StringADD_MESSAGE_QUERYprotected java.lang.StringADD_TAG_TO_MESSAGE_QUERYprotected tigase.db.DataRepositorydata_repoprotected java.lang.StringDELETE_EXPIRED_MESSAGES_QUERYprotected java.lang.StringGET_COLLECTIONS_COUNT_QUERYprotected java.lang.StringGET_COLLECTIONS_QUERYprotected java.lang.StringGET_MESSAGE_POSITION_QUERYprotected java.lang.StringGET_MESSAGES_COUNT_QUERYprotected java.lang.StringGET_MESSAGES_QUERYprotected java.lang.StringGET_TAGS_FOR_USER_COUNT_QUERYprotected java.lang.StringGET_TAGS_FOR_USER_QUERYprotected java.lang.StringREMOVE_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 voidarchiveMessage(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)voidarchiveMessage(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.TimestampconvertToTimestamp(java.util.Date date)voiddeleteExpiredMessages(tigase.xmpp.jid.BareJID owner, java.time.LocalDateTime before)java.lang.StringgetStableId(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 voidinitPreparedStatements(tigase.db.DataRepository data_repo)protected JDBCMessageArchiveRepository.CollectionnewCollectionInstance()protected JDBCMessageArchiveRepository.ItemnewItemInstance()QnewQuery()voidqueryCollections(Q crit, MessageArchiveRepository.CollectionHandler<Q,MessageArchiveRepository.Collection> collectionHandler)voidqueryItems(Q crit, tigase.xmpp.mam.MAMRepository.ItemHandler<Q,tigase.xmpp.mam.MAMRepository.Item> itemHandler)voidremoveItems(tigase.xmpp.jid.BareJID owner, java.lang.String withJid, java.util.Date start, java.util.Date end)protected intsetCountQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation)voidsetDataSource(tigase.db.DataRepository data_repo)voidsetItemsQueryParams(java.sql.PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation)protected intsetQueryParams(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:
setDataSourcein 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:
archiveMessagein 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:
deleteExpiredMessagesin 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:
getStableIdin 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:
queryCollectionsin 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:
queryItemsin interfacetigase.xmpp.mam.MAMRepository<Q extends QueryCriteria,tigase.xmpp.mam.MAMRepository.Item>- Throws:
tigase.db.TigaseDBExceptiontigase.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:
removeItemsin 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:
getTagsin 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:
newQueryin 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:
archiveMessagein 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()
-
-