Package tigase.archive.db
Class JDBCMessageArchiveRepository<Q extends QueryCriteria>
- java.lang.Object
-
- tigase.archive.db.AbstractMessageArchiveRepository<Q,tigase.db.DataRepository>
-
- 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> implements tigase.db.util.RepositoryVersionAware
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description 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>, MessageArchiveRepository.Direction
-
-
Field Summary
Fields Modifier and Type Field Description protected StringADD_MESSAGE_QUERYprotected StringADD_TAG_TO_MESSAGE_QUERYprotected tigase.db.DataRepositorydata_repoprotected StringDELETE_EXPIRED_MESSAGES_QUERYprotected StringGET_COLLECTIONS_COUNT_QUERYprotected StringGET_COLLECTIONS_QUERYprotected StringGET_MESSAGE_POSITION_QUERYprotected StringGET_MESSAGES_COUNT_QUERYprotected StringGET_MESSAGES_QUERYprotected StringGET_TAGS_FOR_USER_COUNT_QUERYprotected StringGET_TAGS_FOR_USER_QUERYprotected 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 Deprecated Methods Modifier and Type Method Description protected intaddMessageAdditionalInfo(PreparedStatement stmt, int i, Map<String,Object> additionalData)voidarchiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.JID buddy, MessageArchiveRepository.Direction direction, Date timestamp, tigase.xml.Element msg, Set<String> tags)Deprecated.protected LongarchiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.JID buddy, MessageArchiveRepository.Direction direction, Date timestamp, tigase.xml.Element msg, Set<String> tags, Map<String,Object> additionalData)protected TimestampconvertToTimestamp(Date date)voiddeleteExpiredMessages(tigase.xmpp.jid.BareJID owner, LocalDateTime before)List<String>getTags(tigase.xmpp.jid.BareJID owner, String startsWith, Q crit)protected voidinitPreparedStatements(tigase.db.DataRepository data_repo)protected JDBCMessageArchiveRepository.ItemnewItemInstance()QnewQuery()voidqueryCollections(Q crit, MessageArchiveRepository.CollectionHandler<Q> collectionHandler)voidqueryItems(Q crit, tigase.xmpp.mam.MAMRepository.ItemHandler<Q,tigase.xmpp.mam.MAMRepository.Item> itemHandler)voidremoveItems(tigase.xmpp.jid.BareJID owner, String withJid, Date start, Date end)protected intsetCountQueryParams(PreparedStatement stmt, String ownerJid, Q crit, Boolean groupByType)voidsetDataSource(tigase.db.DataRepository data_repo)voidsetItemsQueryParams(PreparedStatement stmt, String ownerJid, Q crit, Boolean groupByType)protected intsetQueryParams(PreparedStatement stmt, Q crit, Boolean groupByType, int i)-
Methods inherited from class tigase.archive.db.AbstractMessageArchiveRepository
calculateOffsetAndPosition, generateHashOfMessage
-
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 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 String ADD_TAG_TO_MESSAGE_QUERY
-
DELETE_EXPIRED_MESSAGES_QUERY
@ConfigField(desc="Query to delete expired messages", alias="delete-expired-messages-query") protected String DELETE_EXPIRED_MESSAGES_QUERY
-
GET_COLLECTIONS_COUNT_QUERY
@ConfigField(desc="Query to retrieve number of collections", alias="get-collections-count-query") protected String GET_COLLECTIONS_COUNT_QUERY
-
GET_COLLECTIONS_QUERY
@ConfigField(desc="Query to retrieve list of collections", alias="get-collections-query") protected String GET_COLLECTIONS_QUERY
-
GET_MESSAGES_COUNT_QUERY
@ConfigField(desc="Query to retrieve number of messages", alias="get-messages-count-query") protected String GET_MESSAGES_COUNT_QUERY
-
GET_MESSAGES_QUERY
@ConfigField(desc="Query to retrieve list of messages", alias="get-messages-query") protected String GET_MESSAGES_QUERY
-
GET_MESSAGE_POSITION_QUERY
@ConfigField(desc="Query to retrieve message possition", alias="get-message-position-query") protected 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 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 String GET_TAGS_FOR_USER_QUERY
-
REMOVE_MESSAGES_QUERY
@ConfigField(desc="Query to remove messages", alias="remove-messages-query") protected 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
@Deprecated public void archiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.JID buddy, MessageArchiveRepository.Direction direction, Date timestamp, tigase.xml.Element msg, Set<String> tags)
Deprecated.- Specified by:
archiveMessagein interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>
-
deleteExpiredMessages
public void deleteExpiredMessages(tigase.xmpp.jid.BareJID owner, LocalDateTime before) throws tigase.db.TigaseDBException- Specified by:
deleteExpiredMessagesin interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>- Throws:
tigase.db.TigaseDBException
-
queryCollections
public void queryCollections(Q crit, MessageArchiveRepository.CollectionHandler<Q> 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, String withJid, Date start, Date end) throws tigase.db.TigaseDBException- Specified by:
removeItemsin interfaceMessageArchiveRepository<Q extends QueryCriteria,tigase.db.DataRepository>- Throws:
tigase.db.TigaseDBException
-
getTags
public List<String> getTags(tigase.xmpp.jid.BareJID owner, 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(PreparedStatement stmt, String ownerJid, Q crit, Boolean groupByType) throws SQLException
- Throws:
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 SQLException- Throws:
SQLException
-
archiveMessage
protected Long archiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.JID buddy, MessageArchiveRepository.Direction direction, Date timestamp, tigase.xml.Element msg, Set<String> tags, Map<String,Object> additionalData)
-
addMessageAdditionalInfo
protected int addMessageAdditionalInfo(PreparedStatement stmt, int i, Map<String,Object> additionalData) throws SQLException
- Throws:
SQLException
-
setCountQueryParams
protected int setCountQueryParams(PreparedStatement stmt, String ownerJid, Q crit, Boolean groupByType) throws SQLException
- Throws:
SQLException
-
setQueryParams
protected int setQueryParams(PreparedStatement stmt, Q crit, Boolean groupByType, int i) throws SQLException
- Throws:
SQLException
-
newItemInstance
protected JDBCMessageArchiveRepository.Item newItemInstance()
-
-