public class SoftRefCachingRowMapper extends Object implements RowMapper
RowMapper.CopyResult, RowMapper.IdWithTypes, RowMapper.NodeInfo, RowMapper.RowBatch, RowMapper.RowUpdate| Modifier and Type | Field and Description | 
|---|---|
protected com.codahale.metrics.Timer | 
cacheGetTimer  | 
protected com.codahale.metrics.Counter | 
cacheHitCount  | 
InvalidationsQueue | 
cacheQueue
The queue of cache invalidations received from other session, to process at pre-transaction time. 
 | 
protected com.codahale.metrics.MetricRegistry | 
registry
Cache statistics 
 | 
protected com.codahale.metrics.Timer | 
sorGetTimer  | 
protected com.codahale.metrics.Counter | 
sorRows  | 
| Constructor and Description | 
|---|
SoftRefCachingRowMapper()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected Row | 
cacheGet(RowId rowId)  | 
protected void | 
cachePut(Row row)  | 
protected void | 
cachePutAbsent(RowId rowId)  | 
protected void | 
cachePutAbsentIfNull(RowId rowId,
                    Row row)  | 
protected void | 
cachePutAbsentIfRowId(RowId rowId)  | 
protected void | 
cacheRemove(RowId rowId)  | 
void | 
clearCache()
Clears the mapper's cache (if any) 
 | 
void | 
close()  | 
RowMapper.CopyResult | 
copy(RowMapper.IdWithTypes source,
    Serializable destParentId,
    String destName,
    Row overwriteRow)
Copies the hierarchy starting from a given row to a new parent with a new name. 
 | 
Serializable | 
generateNewId()
Computes a new unique id. 
 | 
Map<String,String> | 
getBinaryFulltext(RowId rowId)
Gets the fulltext extracted from the binary fields. 
 | 
long | 
getCacheSize()
Evaluate the cached elements size 
 | 
List<RowMapper.NodeInfo> | 
getDescendantsInfo(Serializable rootId)
Gets descendants infos from a given root node. 
 | 
void | 
initialize(String repositoryName,
          Model model,
          RowMapper rowMapper,
          InvalidationsPropagator cachePropagator,
          Map<String,String> properties)  | 
protected static boolean | 
isAbsent(Row row)  | 
List<? extends RowId> | 
read(Collection<RowId> rowIds,
    boolean cacheOnly)
Reads a set of rows for the given  
RowIds. | 
Serializable[] | 
readCollectionRowArray(RowId rowId)
Gets an array for a  
CollectionFragment from the database, given its table name and id. | 
List<Row> | 
readSelectionRows(SelectionType selType,
                 Serializable selId,
                 Serializable filter,
                 Serializable criterion,
                 boolean limitToOne)
Reads the rows corresponding to a selection. 
 | 
Set<Serializable> | 
readSelectionsIds(SelectionType selType,
                 List<Serializable> values)
Gets all the selection ids for a given list of values. 
 | 
Row | 
readSimpleRow(RowId rowId)
Gets a row for a  
SimpleFragment from the database, given its table name and id. | 
Invalidations | 
receiveInvalidations()
Processes and returns the invalidations queued for processing by the cache (if any). 
 | 
void | 
remove(Serializable rootId,
      List<RowMapper.NodeInfo> nodeInfos)
Deletes a hierarchy. 
 | 
void | 
rollback(Xid xid)
Rollback the XA Resource. 
 | 
void | 
sendInvalidations(Invalidations invalidations)
Post-transaction invalidations notification. 
 | 
protected void | 
setMetrics(String repositoryName)  | 
protected ACLRow[] | 
sortACLRows(ACLRow[] acls)  | 
void | 
write(RowMapper.RowBatch batch)
Writes a set of rows. 
 | 
public final InvalidationsQueue cacheQueue
protected final com.codahale.metrics.MetricRegistry registry
protected com.codahale.metrics.Counter cacheHitCount
protected com.codahale.metrics.Timer cacheGetTimer
protected com.codahale.metrics.Counter sorRows
protected com.codahale.metrics.Timer sorGetTimer
public SoftRefCachingRowMapper()
public void initialize(String repositoryName, Model model, RowMapper rowMapper, InvalidationsPropagator cachePropagator, Map<String,String> properties)
protected void setMetrics(String repositoryName)
public void close()
public Serializable generateNewId()
RowMappergenerateNewId in interface RowMapperprotected ACLRow[] sortACLRows(ACLRow[] acls)
protected void cachePutAbsent(RowId rowId)
protected void cachePutAbsentIfNull(RowId rowId, Row row)
protected void cachePutAbsentIfRowId(RowId rowId)
protected void cacheRemove(RowId rowId)
public Invalidations receiveInvalidations()
RowMapperCalled pre-transaction by session start or transactionless save;
receiveInvalidations in interface RowMappernullpublic void sendInvalidations(Invalidations invalidations)
RowMapperCalled post-transaction by session commit/rollback or transactionless save.
sendInvalidations in interface RowMapperinvalidations - the known invalidations to send to others, or nullpublic void clearCache()
RowMapperCalled after a rollback, or a manual clear through RepositoryStatus MBean.
clearCache in interface RowMapperpublic long getCacheSize()
RowMappergetCacheSize in interface RowMapperpublic void rollback(Xid xid) throws XAException
RowMapper
 This is in the RowMapper interface because on rollback the cache must be invalidated.
rollback in interface RowMapperXAExceptionpublic List<? extends RowId> read(Collection<RowId> rowIds, boolean cacheOnly)
RowMapperpublic void write(RowMapper.RowBatch batch)
RowMapperpublic Row readSimpleRow(RowId rowId)
RowMapperSimpleFragment from the database, given its table name and id. If the row doesn't exist,
 null is returned.readSimpleRow in interface RowMapperrowId - the row idnullpublic Map<String,String> getBinaryFulltext(RowId rowId)
RowMappergetBinaryFulltext in interface RowMapperrowId - the row idnull if unsupportedpublic Serializable[] readCollectionRowArray(RowId rowId)
RowMapperCollectionFragment from the database, given its table name and id. If no rows are
 found, an empty array is returned.readCollectionRowArray in interface RowMapperrowId - the row idpublic List<Row> readSelectionRows(SelectionType selType, Serializable selId, Serializable filter, Serializable criterion, boolean limitToOne)
RowMapperreadSelectionRows in interface RowMapperselType - the selection typeselId - the selection id (parent id for a hierarchy selection)filter - the filter value (name for a hierarchy selection)criterion - an optional additional criterion depending on the selection type (complex prop flag for a
            hierarchy selection)limitToOne - whether to stop after one row retrievedpublic Set<Serializable> readSelectionsIds(SelectionType selType, List<Serializable> values)
RowMapperreadSelectionsIds in interface RowMapperpublic RowMapper.CopyResult copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow)
RowMapper
 If the new parent is null, then this is a version creation, which doesn't recurse in regular children.
 
 If overwriteRow is passed, the copy is done onto this existing node as its root (version restore) instead
 of creating a new node in the parent.
copy in interface RowMappersource - the id, primary type and mixin types of the row to copydestParentId - the new parent id, or nulldestName - the new nameoverwriteRow - when not null, the copy is done onto this existing row, and the values are set in
            hierarchypublic List<RowMapper.NodeInfo> getDescendantsInfo(Serializable rootId)
RowMappergetDescendantsInfo in interface RowMapperrootId - the root node id from which to get descendants infopublic void remove(Serializable rootId, List<RowMapper.NodeInfo> nodeInfos)
RowMapperCopyright © 2019 Nuxeo. All rights reserved.