Class RDBDocumentStoreJDBC
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStoreJDBC
-
public class RDBDocumentStoreJDBC extends java.lang.Object
Implements (most) DB interactions used inRDBDocumentStore
.
-
-
Constructor Summary
Constructors Constructor Description RDBDocumentStoreJDBC(RDBDocumentStoreDB dbInfo, RDBDocumentSerializer ser, int queryHitsLimit, int queryTimeLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
appendingUpdate(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String id, java.lang.Long modified, boolean setModifiedConditionally, java.lang.Number hasBinary, java.lang.Boolean deletedOnce, java.lang.Long modcount, java.lang.Long cmodcount, java.lang.Long oldmodcount, java.lang.String appendData)
int
delete(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<java.lang.String> allIds)
int
delete(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.Map<java.lang.String,java.lang.Long> toDelete)
int
deleteWithCondition(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<RDBDocumentStore.QueryCondition> conditions)
long
determineServerTimeDifferenceMillis(java.sql.Connection connection)
long
getLong(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String aggregate, java.lang.String field, java.lang.String minId, java.lang.String maxId, java.util.List<java.lang.String> excludeKeyPatterns, java.util.List<RDBDocumentStore.QueryCondition> conditions)
<T extends Document>
java.util.Set<java.lang.String>insert(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<T> documents)
@NotNull java.util.List<RDBRow>
query(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String minId, java.lang.String maxId, java.util.List<java.lang.String> excludeKeyPatterns, java.util.List<RDBDocumentStore.QueryCondition> conditions, int limit)
@NotNull java.util.Iterator<RDBRow>
queryAsIterator(RDBConnectionHandler ch, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String minId, java.lang.String maxId, java.util.List<java.lang.String> excludeKeyPatterns, java.util.List<RDBDocumentStore.QueryCondition> conditions, int limit, java.lang.String sortBy)
@Nullable RDBRow
read(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String id, long lastmodcount, long lastmodified)
java.util.List<RDBRow>
read(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.Collection<java.lang.String> allKeys)
boolean
update(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String id, java.lang.Long modified, java.lang.Number hasBinary, java.lang.Boolean deletedOnce, java.lang.Long modcount, java.lang.Long cmodcount, java.lang.Long oldmodcount, java.lang.String data)
<T extends Document>
java.util.Set<java.lang.String>update(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<T> documents, boolean upsert)
Update a list of documents using JDBC batches.
-
-
-
Constructor Detail
-
RDBDocumentStoreJDBC
public RDBDocumentStoreJDBC(RDBDocumentStoreDB dbInfo, RDBDocumentSerializer ser, int queryHitsLimit, int queryTimeLimit)
-
-
Method Detail
-
appendingUpdate
public boolean appendingUpdate(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String id, java.lang.Long modified, boolean setModifiedConditionally, java.lang.Number hasBinary, java.lang.Boolean deletedOnce, java.lang.Long modcount, java.lang.Long cmodcount, java.lang.Long oldmodcount, java.lang.String appendData) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
delete
public int delete(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<java.lang.String> allIds) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
delete
public int delete(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.Map<java.lang.String,java.lang.Long> toDelete) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
deleteWithCondition
public int deleteWithCondition(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<RDBDocumentStore.QueryCondition> conditions) throws java.sql.SQLException, DocumentStoreException
- Throws:
java.sql.SQLException
DocumentStoreException
-
determineServerTimeDifferenceMillis
public long determineServerTimeDifferenceMillis(java.sql.Connection connection)
-
insert
public <T extends Document> java.util.Set<java.lang.String> insert(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<T> documents) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
update
public <T extends Document> java.util.Set<java.lang.String> update(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.List<T> documents, boolean upsert) throws java.sql.SQLException
Update a list of documents using JDBC batches. Some of the updates may fail because of the concurrent changes. The method returns a set of successfully updated documents. It's the caller responsibility to compare the set with the list of input documents, find out which documents conflicted and take appropriate action.If the
upsert
parameter is set to true, the method will also try to insert new documents, those which modcount equals to 1.The order of applying updates will be different than order of the passed list, so there shouldn't be two updates related to the same document. An
IllegalArgumentException
will be thrown if there are.- Parameters:
connection
- JDBC connectiontmd
- Table metadatadocuments
- List of documents to updateupsert
- Insert new documents- Returns:
- set containing ids of successfully updated documents
- Throws:
java.sql.SQLException
-
query
@NotNull public @NotNull java.util.List<RDBRow> query(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String minId, java.lang.String maxId, java.util.List<java.lang.String> excludeKeyPatterns, java.util.List<RDBDocumentStore.QueryCondition> conditions, int limit) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getLong
public long getLong(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String aggregate, java.lang.String field, java.lang.String minId, java.lang.String maxId, java.util.List<java.lang.String> excludeKeyPatterns, java.util.List<RDBDocumentStore.QueryCondition> conditions) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
queryAsIterator
@NotNull public @NotNull java.util.Iterator<RDBRow> queryAsIterator(RDBConnectionHandler ch, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String minId, java.lang.String maxId, java.util.List<java.lang.String> excludeKeyPatterns, java.util.List<RDBDocumentStore.QueryCondition> conditions, int limit, java.lang.String sortBy) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
read
public java.util.List<RDBRow> read(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.util.Collection<java.lang.String> allKeys) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
read
@Nullable public @Nullable RDBRow read(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String id, long lastmodcount, long lastmodified) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
update
public boolean update(java.sql.Connection connection, org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData tmd, java.lang.String id, java.lang.Long modified, java.lang.Number hasBinary, java.lang.Boolean deletedOnce, java.lang.Long modcount, java.lang.Long cmodcount, java.lang.Long oldmodcount, java.lang.String data) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-