public class SoftRefCachingMapper extends SoftRefCachingRowMapper implements CachingMapper
Mapper
that uses a SoftRefCachingRowMapper
for row-related operation, and delegates to the
Mapper
for others.Mapper.Identification
RowMapper.CopyResult, RowMapper.IdWithTypes, RowMapper.NodeInfo, RowMapper.RowBatch, RowMapper.RowUpdate
Modifier and Type | Field and Description |
---|---|
Mapper |
mapper
The
Mapper to which operations are delegated. |
cacheGetTimer, cacheHitCount, cacheQueue, registry, sorGetTimer, sorRows
CLOSE, GET_IDENTIFICATION
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
Constructor and Description |
---|
SoftRefCachingMapper() |
Modifier and Type | Method and Description |
---|---|
int |
cleanupDeletedRows(int max,
Calendar beforeTime)
Cleans up (hard-delete) any rows that have been soft-deleted in the database.
|
void |
close() |
void |
commit(Xid xid,
boolean onePhase) |
void |
connect() |
void |
createClusterNode(Serializable nodeId)
Informs the cluster that this node exists.
|
void |
createDatabase(String ddlMode)
Creates the necessary structures in the database.
|
void |
disconnect() |
void |
end(Xid xid,
int flags) |
void |
forget(Xid xid) |
Set<Serializable> |
getAncestorsIds(Collection<Serializable> ids)
Gets the ids for all the ancestors of the given row ids.
|
Invalidations |
getClusterInvalidations(Serializable nodeId)
Gets the invalidations from other cluster nodes.
|
int |
getClusterNodeIdType() |
Mapper.Identification |
getIdentification()
Returns the repository id and mapper id assigned.
|
Lock |
getLock(Serializable id)
Gets the lock state of a document.
|
Serializable |
getRootId(String repositoryId)
Gets the root id for a given repository, if registered.
|
int |
getTableSize(String tableName) |
int |
getTransactionTimeout() |
void |
initialize(String repositoryName,
Model model,
Mapper mapper,
InvalidationsPropagator cachePropagator,
Map<String,String> properties)
Initialize the caching mapper instance
|
void |
insertClusterInvalidations(Serializable nodeId,
Invalidations invalidations)
Inserts the invalidation rows for the other cluster nodes.
|
boolean |
isConnected() |
boolean |
isSameRM(XAResource xares) |
void |
markReferencedBinaries()
Marks the binaries in use by passing them to the binary manager(s)'s GC mark() method.
|
int |
prepare(Xid xid) |
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.
|
IterableQueryResult |
queryAndFetch(String query,
String queryType,
QueryFilter queryFilter,
Object... params)
Makes a query to the database and returns an iterable (which must be closed when done).
|
void |
rebuildReadAcls() |
Xid[] |
recover(int flag) |
void |
removeClusterNode(Serializable nodeId)
Removes this node from the cluster.
|
Lock |
removeLock(Serializable id,
String owner,
boolean force)
Removes a lock from a document.
|
Lock |
setLock(Serializable id,
Lock lock)
Sets a lock on a document.
|
void |
setRootId(Serializable repositoryId,
Serializable id)
Records the newly generated root id for a given repository.
|
boolean |
setTransactionTimeout(int seconds) |
void |
start(Xid xid,
int flags) |
void |
updateReadAcls() |
cacheGet, cachePut, cachePutAbsent, cachePutAbsentIfNull, cachePutAbsentIfRowId, cacheRemove, clearCache, copy, generateNewId, getBinaryFulltext, getCacheSize, initialize, isAbsent, read, readCollectionRowArray, readSelectionRows, readSimpleRow, receiveInvalidations, remove, rollback, sendInvalidations, setMetrics, sortACLRows, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearCache, copy, generateNewId, getBinaryFulltext, getCacheSize, read, readCollectionRowArray, readSelectionRows, readSimpleRow, receiveInvalidations, remove, rollback, sendInvalidations, write
rollback
public SoftRefCachingMapper()
public void initialize(String repositoryName, Model model, Mapper mapper, InvalidationsPropagator cachePropagator, Map<String,String> properties)
CachingMapper
initialize
in interface CachingMapper
public Mapper.Identification getIdentification()
Mapper
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.
getIdentification
in interface Mapper
public void close()
close
in interface Mapper
close
in class SoftRefCachingRowMapper
public int getTableSize(String tableName)
getTableSize
in interface Mapper
public void createDatabase(String ddlMode)
Mapper
createDatabase
in interface Mapper
ddlMode
- the DDL execution modepublic Serializable getRootId(String repositoryId)
Mapper
public void setRootId(Serializable repositoryId, Serializable id)
Mapper
public PartialList<Serializable> query(String query, String queryType, QueryFilter queryFilter, boolean countTotal)
Mapper
public PartialList<Serializable> query(String query, String queryType, QueryFilter queryFilter, long countUpTo)
Mapper
query
in interface Mapper
query
- the queryqueryFilter
- the query filtercountUpTo
- if -1
, count the total size without offset/limit.0
, don't count the total size.n
, count the total number if there are less than n documents otherwise set the size to
-1
.public IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, Object... params)
Mapper
queryAndFetch
in interface Mapper
query
- the queryqueryType
- the query typequeryFilter
- the query filterparams
- optional query-type-dependent parameterspublic Set<Serializable> getAncestorsIds(Collection<Serializable> ids)
Mapper
getAncestorsIds
in interface Mapper
ids
- the idspublic void updateReadAcls()
updateReadAcls
in interface Mapper
public void rebuildReadAcls()
rebuildReadAcls
in interface Mapper
public int getClusterNodeIdType()
getClusterNodeIdType
in interface Mapper
public void createClusterNode(Serializable nodeId)
Mapper
createClusterNode
in interface Mapper
public void removeClusterNode(Serializable nodeId)
Mapper
removeClusterNode
in interface Mapper
public void insertClusterInvalidations(Serializable nodeId, Invalidations invalidations)
Mapper
insertClusterInvalidations
in interface Mapper
public Invalidations getClusterInvalidations(Serializable nodeId)
Mapper
getClusterInvalidations
in interface Mapper
public Lock getLock(Serializable id)
Mapper
If the document does not exist, null
is returned.
public Lock setLock(Serializable id, Lock lock)
Mapper
If the document is already locked, returns its existing lock status (there is no re-locking, Mapper.removeLock(java.io.Serializable, java.lang.String, boolean)
must be called first).
public Lock removeLock(Serializable id, String owner, boolean force)
Mapper
The previous lock is returned.
If owner
is null
then the lock is unconditionally removed.
If owner
is not null
, it must match the existing lock owner for the lock to be removed. If it
doesn't match, the returned lock will return true
for Lock.getFailed()
.
removeLock
in interface Mapper
id
- the document idforce
- true
to just do the remove and not return the previous lockpublic void markReferencedBinaries()
Mapper
markReferencedBinaries
in interface Mapper
public int cleanupDeletedRows(int max, Calendar beforeTime)
Mapper
cleanupDeletedRows
in interface Mapper
max
- the maximum number of rows to delete at a timebeforeTime
- the maximum deletion time of the rows to deletepublic void start(Xid xid, int flags) throws XAException
start
in interface XAResource
XAException
public void end(Xid xid, int flags) throws XAException
end
in interface XAResource
XAException
public int prepare(Xid xid) throws XAException
prepare
in interface XAResource
XAException
public void commit(Xid xid, boolean onePhase) throws XAException
commit
in interface XAResource
XAException
public void forget(Xid xid) throws XAException
forget
in interface XAResource
XAException
public Xid[] recover(int flag) throws XAException
recover
in interface XAResource
XAException
public boolean setTransactionTimeout(int seconds) throws XAException
setTransactionTimeout
in interface XAResource
XAException
public int getTransactionTimeout() throws XAException
getTransactionTimeout
in interface XAResource
XAException
public boolean isSameRM(XAResource xares) throws XAException
isSameRM
in interface XAResource
XAException
public boolean isConnected()
isConnected
in interface Mapper
public void disconnect()
disconnect
in interface Mapper
Copyright © 2016 Nuxeo SA. All rights reserved.