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
Modifier and TypeClassDescriptionstatic interface
static class
static class
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 Nested classes/interfaces inherited from interface tigase.db.util.RepositoryVersionAware
tigase.db.util.RepositoryVersionAware.SchemaVersion
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected String
protected tigase.db.DataRepository
protected String
protected String
protected String
protected String
protected String
protected String
protected String
protected String
protected String
protected String
Fields inherited from class tigase.archive.db.AbstractMessageArchiveRepository
MSG_BODY_PATH, MSG_SUBJECT_PATH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
archiveMessage
(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, Date timestamp, tigase.xml.Element msg, String stableId, String stanzaId, String refStableId, Set<String> tags, JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider additionParametersProvider) void
archiveMessage
(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.JID buddy, Date timestamp, tigase.xml.Element msg, String stableId, Set<String> tags) protected Timestamp
convertToTimestamp
(Date date) void
deleteExpiredMessages
(tigase.xmpp.jid.BareJID owner, LocalDateTime before) getStableId
(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, String stanzaId) protected void
initPreparedStatements
(tigase.db.DataRepository data_repo) protected JDBCMessageArchiveRepository.Collection
protected JDBCMessageArchiveRepository.Item
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, String withJid, Date start, Date end) protected int
setCountQueryParams
(PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) void
setDataSource
(tigase.db.DataRepository data_repo) void
setItemsQueryParams
(PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) Deprecated.void
setItemsQueryParams
(PreparedStatement stmt, Q crit, tigase.xmpp.mam.util.Range range, FasteningCollation fasteningCollation) protected int
setQueryParams
(PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) Methods inherited from class tigase.archive.db.AbstractMessageArchiveRepository
archiveMessage, calculateOffsetAndPosition, 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.xmpp.mam.MAMRepository
newQuery
Methods inherited from interface tigase.archive.db.MessageArchiveRepository
destroy
Methods inherited from interface tigase.db.util.RepositoryVersionAware
getVersion, updateSchema
-
Field Details
-
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_MESSAGE_QUERY
@ConfigField(desc="Query to retrieve message with id", alias="get-message-query") protected String GET_MESSAGE_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
-
-
Constructor Details
-
JDBCMessageArchiveRepository
public JDBCMessageArchiveRepository()
-
-
Method Details
-
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, Date timestamp, tigase.xml.Element msg, String stableId, Set<String> tags) - Specified by:
archiveMessage
in interfaceMessageArchiveRepository<Q extends QueryCriteria,
tigase.db.DataRepository>
-
deleteExpiredMessages
public void deleteExpiredMessages(tigase.xmpp.jid.BareJID owner, LocalDateTime before) throws tigase.db.TigaseDBException - Specified by:
deleteExpiredMessages
in interfaceMessageArchiveRepository<Q extends QueryCriteria,
tigase.db.DataRepository> - Throws:
tigase.db.TigaseDBException
-
getStableId
public String getStableId(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, 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, String withJid, Date start, Date end) throws tigase.db.TigaseDBException - Specified by:
removeItems
in 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:
getTags
in interfaceMessageArchiveRepository<Q extends QueryCriteria,
tigase.db.DataRepository> - Throws:
tigase.db.TigaseDBException
-
setItemsQueryParams
@Deprecated public void setItemsQueryParams(PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) throws SQLException Deprecated.- Throws:
SQLException
-
setItemsQueryParams
public void setItemsQueryParams(PreparedStatement stmt, Q crit, tigase.xmpp.mam.util.Range range, FasteningCollation fasteningCollation) throws SQLException - Throws:
SQLException
-
newQuery
- Specified by:
newQuery
in interfacetigase.xmpp.mam.MAMRepository<Q extends QueryCriteria,
tigase.xmpp.mam.MAMRepository.Item>
-
initPreparedStatements
- Throws:
SQLException
-
archiveMessage
protected void archiveMessage(tigase.xmpp.jid.BareJID owner, tigase.xmpp.jid.BareJID buddy, Date timestamp, tigase.xml.Element msg, String stableId, String stanzaId, String refStableId, Set<String> tags, JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider additionParametersProvider) - Specified by:
archiveMessage
in classAbstractMessageArchiveRepository<Q extends QueryCriteria,
tigase.db.DataRepository, JDBCMessageArchiveRepository.AddMessageAdditionalDataProvider>
-
convertToTimestamp
-
setCountQueryParams
protected int setCountQueryParams(PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) throws SQLException - Throws:
SQLException
-
setQueryParams
protected int setQueryParams(PreparedStatement stmt, Q crit, FasteningCollation fasteningCollation) throws SQLException - Throws:
SQLException
-
newCollectionInstance
-
newItemInstance
-