Package org.nuxeo.ecm.core.storage.sql
Class UnifiedCachingMapper
java.lang.Object
org.nuxeo.ecm.core.storage.sql.UnifiedCachingRowMapper
org.nuxeo.ecm.core.storage.sql.UnifiedCachingMapper
- All Implemented Interfaces:
CachingMapper
,Mapper
,RowMapper
A
Mapper
that uses a UnifiedCachingRowMapper
for row-related operation, and delegates to the
Mapper
for others.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.storage.sql.Mapper
Mapper.Identification
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.storage.sql.RowMapper
RowMapper.CopyResult, RowMapper.IdWithTypes, RowMapper.NodeInfo, RowMapper.RowBatch, RowMapper.RowUpdate
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.storage.sql.UnifiedCachingRowMapper
cacheGetTimer, cacheHitCount, isXA, registry, sorGetTimer, sorRows
Fields inherited from interface org.nuxeo.ecm.core.storage.sql.Mapper
CLOSE, GET_IDENTIFICATION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
cleanupDeletedRows
(int max, Calendar beforeTime) Cleans up (hard-delete) any rows that have been soft-deleted in the database.void
close()
void
createClusterNode
(Serializable nodeId) Informs the cluster that this node exists.Gets the ids for all the ancestors of the given row ids.getClusterInvalidations
(Serializable nodeId) Gets the invalidations from other cluster nodes.int
Returns the repository id and mapper id assigned.Gets the root id for a given repository, if registered.int
getTableSize
(String tableName) void
initialize
(String repositoryName, Model model, Mapper mapper, VCSInvalidationsPropagator invalidationsPropagator, Map<String, String> properties) Initialize the caching mapper instancevoid
insertClusterInvalidations
(Serializable nodeId, VCSInvalidations invalidations) Inserts the invalidation rows for the other cluster nodes.void
markReferencedBlobs
(BiConsumer<String, String> markerCallback) Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).query
(String query, String queryType, QueryFilter queryFilter, boolean countTotal) Makes a NXQL query to the database.query
(String query, String queryType, QueryFilter queryFilter, long countUpTo) Makes a NXQL query to the database.queryAndFetch
(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, Object... params) Makes a query to the database and returns an iterable (which must be closed when done).queryProjection
(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, long countUpTo, Object... params) Makes a query to the database.void
void
removeClusterNode
(Serializable nodeId) Removes this node from the cluster.Get the next batch of results containing id of documents, thescrollId
is part of the previousScrollResult
response.Executes the given query and returns the first batch of results containing id of documents, next batch must be requested within thekeepAliveSeconds
delay.scroll
(String query, QueryFilter queryFilter, int batchSize, int keepAliveSeconds) Executes the given query and returns the first batch of results containing id of documents, next batch must be requested within thekeepAliveSeconds
delay.void
setRootId
(Serializable repositoryId, Serializable id) Records the newly generated root id for a given repository.void
Methods inherited from class org.nuxeo.ecm.core.storage.sql.UnifiedCachingRowMapper
cacheGet, cachePut, cachePutAbsent, cachePutAbsentIfNull, cachePutAbsentIfRowId, cacheRemove, clearCache, copy, ehCacheGet, ehCacheGetSize, ehCachePut, ehCacheRemove, ehCacheRemoveAll, generateNewId, getBinaryFulltext, getCacheSize, getDescendantsInfo, hasTransaction, initialize, isAbsent, read, readCollectionRowArray, readSelectionRows, readSelectionsIds, readSimpleRow, receiveInvalidations, remove, rollback, sendInvalidations, setMetrics, sortACLRows, useEhCache, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.ecm.core.storage.sql.RowMapper
clearCache, copy, copy, generateNewId, getBinaryFulltext, getCacheSize, getDescendantsInfo, read, readCollectionRowArray, readSelectionRows, readSelectionsIds, readSimpleRow, receiveInvalidations, remove, rollback, sendInvalidations, write
-
Field Details
-
mapper
TheMapper
to which operations are delegated.
-
-
Constructor Details
-
UnifiedCachingMapper
public UnifiedCachingMapper()
-
-
Method Details
-
initialize
public void initialize(String repositoryName, Model model, Mapper mapper, VCSInvalidationsPropagator invalidationsPropagator, Map<String, String> properties) Description copied from interface:CachingMapper
Initialize the caching mapper instance- Specified by:
initialize
in interfaceCachingMapper
-
scroll
Description copied from interface:Mapper
Executes the given query and returns the first batch of results containing id of documents, next batch must be requested within thekeepAliveSeconds
delay. -
scroll
public ScrollResult scroll(String query, QueryFilter queryFilter, int batchSize, int keepAliveSeconds) Description copied from interface:Mapper
Executes the given query and returns the first batch of results containing id of documents, next batch must be requested within thekeepAliveSeconds
delay. -
scroll
Description copied from interface:Mapper
Get the next batch of results containing id of documents, thescrollId
is part of the previousScrollResult
response. -
getIdentification
Description copied from interface:Mapper
Returns the repository id and mapper id assigned.This is used in remote stateless mode to be able to identify to which mapper an incoming connection is targeted, and from which repository instance.
- Specified by:
getIdentification
in interfaceMapper
- Returns:
- the repository and mapper identification
-
close
public void close()- Specified by:
close
in interfaceMapper
- Overrides:
close
in classUnifiedCachingRowMapper
-
getTableSize
- Specified by:
getTableSize
in interfaceMapper
-
getRootId
Description copied from interface:Mapper
Gets the root id for a given repository, if registered. -
setRootId
Description copied from interface:Mapper
Records the newly generated root id for a given repository. -
query
public PartialList<Serializable> query(String query, String queryType, QueryFilter queryFilter, boolean countTotal) Description copied from interface:Mapper
Makes a NXQL query to the database. -
query
public PartialList<Serializable> query(String query, String queryType, QueryFilter queryFilter, long countUpTo) Description copied from interface:Mapper
Makes a NXQL query to the database.- Specified by:
query
in interfaceMapper
- Parameters:
query
- the queryqueryType
- the query typequeryFilter
- the query filtercountUpTo
- if-1
, count the total size without offset/limit.
If0
, don't count the total size.
Ifn
, count the total number if there are less than n documents otherwise set the size to-1
.- Returns:
- the list of matching document ids
-
queryAndFetch
public IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, Object... params) Description copied from interface:Mapper
Makes a query to the database and returns an iterable (which must be closed when done).- Specified by:
queryAndFetch
in interfaceMapper
- Parameters:
query
- the queryqueryType
- the query typequeryFilter
- the query filterdistinctDocuments
- iftrue
then a maximum of one row per document will be returnedparams
- optional query-type-dependent parameters- Returns:
- an iterable, which must be closed when done
-
queryProjection
public PartialList<Map<String,Serializable>> queryProjection(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, long countUpTo, Object... params) Description copied from interface:Mapper
Makes a query to the database.- Specified by:
queryProjection
in interfaceMapper
- Parameters:
query
- the queryqueryType
- the query typequeryFilter
- the query filterdistinctDocuments
- iftrue
then a maximum of one row per document will be returnedcountUpTo
- if-1
, also count the total size without offset/limit.
If0
, don't count the total size.
Ifn
, count the total number if there are less than n documents otherwise set the size to-1
.params
- optional query-type-dependent parameters- Returns:
- a projection
-
getAncestorsIds
Description copied from interface:Mapper
Gets the ids for all the ancestors of the given row ids.- Specified by:
getAncestorsIds
in interfaceMapper
- Parameters:
ids
- the ids- Returns:
- the set of ancestor ids
-
updateReadAcls
public void updateReadAcls()- Specified by:
updateReadAcls
in interfaceMapper
-
rebuildReadAcls
public void rebuildReadAcls()- Specified by:
rebuildReadAcls
in interfaceMapper
-
getClusterNodeIdType
public int getClusterNodeIdType()- Specified by:
getClusterNodeIdType
in interfaceMapper
-
createClusterNode
Description copied from interface:Mapper
Informs the cluster that this node exists.- Specified by:
createClusterNode
in interfaceMapper
-
removeClusterNode
Description copied from interface:Mapper
Removes this node from the cluster.- Specified by:
removeClusterNode
in interfaceMapper
-
insertClusterInvalidations
Description copied from interface:Mapper
Inserts the invalidation rows for the other cluster nodes.- Specified by:
insertClusterInvalidations
in interfaceMapper
-
getClusterInvalidations
Description copied from interface:Mapper
Gets the invalidations from other cluster nodes.- Specified by:
getClusterInvalidations
in interfaceMapper
-
markReferencedBlobs
Description copied from interface:Mapper
Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).- Specified by:
markReferencedBlobs
in interfaceMapper
-
cleanupDeletedRows
Description copied from interface:Mapper
Cleans up (hard-delete) any rows that have been soft-deleted in the database.- Specified by:
cleanupDeletedRows
in interfaceMapper
- Parameters:
max
- the maximum number of rows to delete at a timebeforeTime
- the maximum deletion time of the rows to delete- Returns:
- the number of rows deleted
-