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
public class UnifiedCachingMapper extends UnifiedCachingRowMapper implements CachingMapper
AMapperthat uses aUnifiedCachingRowMapperfor row-related operation, and delegates to theMapperfor 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 Modifier and Type Field Description MappermapperTheMapperto which operations are delegated.-
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
Constructors Constructor Description UnifiedCachingMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcleanupDeletedRows(int max, Calendar beforeTime)Cleans up (hard-delete) any rows that have been soft-deleted in the database.voidclose()voidcreateClusterNode(Serializable nodeId)Informs the cluster that this node exists.Set<Serializable>getAncestorsIds(Collection<Serializable> ids)Gets the ids for all the ancestors of the given row ids.VCSInvalidationsgetClusterInvalidations(Serializable nodeId)Gets the invalidations from other cluster nodes.intgetClusterNodeIdType()Mapper.IdentificationgetIdentification()Returns the repository id and mapper id assigned.SerializablegetRootId(String repositoryId)Gets the root id for a given repository, if registered.intgetTableSize(String tableName)voidinitialize(String repositoryName, Model model, Mapper mapper, VCSInvalidationsPropagator invalidationsPropagator, Map<String,String> properties)Initialize the caching mapper instancevoidinsertClusterInvalidations(Serializable nodeId, VCSInvalidations invalidations)Inserts the invalidation rows for the other cluster nodes.voidmarkReferencedBlobs(BiConsumer<String,String> markerCallback)Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).PartialList<Serializable>query(String query, String queryType, QueryFilter queryFilter, boolean countTotal)Makes a NXQL query to the database.PartialList<Serializable>query(String query, String queryType, QueryFilter queryFilter, long countUpTo)Makes a NXQL query to the database.IterableQueryResultqueryAndFetch(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).PartialList<Map<String,Serializable>>queryProjection(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, long countUpTo, Object... params)Makes a query to the database.voidrebuildReadAcls()voidremoveClusterNode(Serializable nodeId)Removes this node from the cluster.ScrollResultscroll(String scrollId)Get the next batch of results containing id of documents, thescrollIdis part of the previousScrollResultresponse.ScrollResultscroll(String query, 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 thekeepAliveSecondsdelay.ScrollResultscroll(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 thekeepAliveSecondsdelay.voidsetRootId(Serializable repositoryId, Serializable id)Records the newly generated root id for a given repository.voidupdateReadAcls()-
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
-
-
-
-
Method Detail
-
initialize
public void initialize(String repositoryName, Model model, Mapper mapper, VCSInvalidationsPropagator invalidationsPropagator, Map<String,String> properties)
Description copied from interface:CachingMapperInitialize the caching mapper instance- Specified by:
initializein interfaceCachingMapper
-
scroll
public ScrollResult scroll(String query, int batchSize, int keepAliveSeconds)
Description copied from interface:MapperExecutes the given query and returns the first batch of results containing id of documents, next batch must be requested within thekeepAliveSecondsdelay.
-
scroll
public ScrollResult scroll(String query, QueryFilter queryFilter, int batchSize, int keepAliveSeconds)
Description copied from interface:MapperExecutes the given query and returns the first batch of results containing id of documents, next batch must be requested within thekeepAliveSecondsdelay.
-
scroll
public ScrollResult scroll(String scrollId)
Description copied from interface:MapperGet the next batch of results containing id of documents, thescrollIdis part of the previousScrollResultresponse.
-
getIdentification
public Mapper.Identification getIdentification()
Description copied from interface:MapperReturns 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:
getIdentificationin interfaceMapper- Returns:
- the repository and mapper identification
-
close
public void close()
- Specified by:
closein interfaceMapper- Overrides:
closein classUnifiedCachingRowMapper
-
getTableSize
public int getTableSize(String tableName)
- Specified by:
getTableSizein interfaceMapper
-
getRootId
public Serializable getRootId(String repositoryId)
Description copied from interface:MapperGets the root id for a given repository, if registered.
-
setRootId
public void setRootId(Serializable repositoryId, Serializable id)
Description copied from interface:MapperRecords 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:MapperMakes a NXQL query to the database.
-
query
public PartialList<Serializable> query(String query, String queryType, QueryFilter queryFilter, long countUpTo)
Description copied from interface:MapperMakes a NXQL query to the database.- Specified by:
queryin 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:MapperMakes a query to the database and returns an iterable (which must be closed when done).- Specified by:
queryAndFetchin interfaceMapper- Parameters:
query- the queryqueryType- the query typequeryFilter- the query filterdistinctDocuments- iftruethen 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:MapperMakes a query to the database.- Specified by:
queryProjectionin interfaceMapper- Parameters:
query- the queryqueryType- the query typequeryFilter- the query filterdistinctDocuments- iftruethen 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
public Set<Serializable> getAncestorsIds(Collection<Serializable> ids)
Description copied from interface:MapperGets the ids for all the ancestors of the given row ids.- Specified by:
getAncestorsIdsin interfaceMapper- Parameters:
ids- the ids- Returns:
- the set of ancestor ids
-
updateReadAcls
public void updateReadAcls()
- Specified by:
updateReadAclsin interfaceMapper
-
rebuildReadAcls
public void rebuildReadAcls()
- Specified by:
rebuildReadAclsin interfaceMapper
-
getClusterNodeIdType
public int getClusterNodeIdType()
- Specified by:
getClusterNodeIdTypein interfaceMapper
-
createClusterNode
public void createClusterNode(Serializable nodeId)
Description copied from interface:MapperInforms the cluster that this node exists.- Specified by:
createClusterNodein interfaceMapper
-
removeClusterNode
public void removeClusterNode(Serializable nodeId)
Description copied from interface:MapperRemoves this node from the cluster.- Specified by:
removeClusterNodein interfaceMapper
-
insertClusterInvalidations
public void insertClusterInvalidations(Serializable nodeId, VCSInvalidations invalidations)
Description copied from interface:MapperInserts the invalidation rows for the other cluster nodes.- Specified by:
insertClusterInvalidationsin interfaceMapper
-
getClusterInvalidations
public VCSInvalidations getClusterInvalidations(Serializable nodeId)
Description copied from interface:MapperGets the invalidations from other cluster nodes.- Specified by:
getClusterInvalidationsin interfaceMapper
-
markReferencedBlobs
public void markReferencedBlobs(BiConsumer<String,String> markerCallback)
Description copied from interface:MapperMarks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).- Specified by:
markReferencedBlobsin interfaceMapper
-
cleanupDeletedRows
public int cleanupDeletedRows(int max, Calendar beforeTime)Description copied from interface:MapperCleans up (hard-delete) any rows that have been soft-deleted in the database.- Specified by:
cleanupDeletedRowsin 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
-
-