Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.storage.sql
Class CachingMapper

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.CachingRowMapper
      extended by org.nuxeo.ecm.core.storage.sql.CachingMapper
All Implemented Interfaces:
javax.transaction.xa.XAResource, Mapper, RowMapper

public class CachingMapper
extends CachingRowMapper
implements Mapper

A Mapper that uses a CachingRowMapper 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.CopyHierarchyResult, RowMapper.RowBatch, RowMapper.RowUpdate
 
Field Summary
 
Fields inherited from interface org.nuxeo.ecm.core.storage.sql.Mapper
CLOSE, GET_IDENTIFICATION
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
CachingMapper(Mapper mapper, InvalidationsPropagator cachePropagator, InvalidationsPropagator eventPropagator, InvalidationsQueue repositoryEventQueue)
           
 
Method Summary
 void close()
           
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
           
 void createClusterNode()
          Informs the cluster that this node exists.
 void createDatabase()
          Creates the necessary structures in the database.
 void end(javax.transaction.xa.Xid xid, int flags)
           
 void forget(javax.transaction.xa.Xid xid)
           
 Invalidations getClusterInvalidations()
          Gets the invalidations from other cluster nodes.
 Mapper.Identification getIdentification()
          Returns the repository id and mapper id assigned.
 java.io.Serializable getLastVersionId(java.io.Serializable versionSeriesId)
          Gets the id of the last version given a version series id.
 java.io.Serializable getRootId(java.io.Serializable repositoryId)
          Gets the root id for a given repository, if registered.
 int getTableSize(java.lang.String tableName)
           
 int getTransactionTimeout()
           
 java.io.Serializable getVersionIdByLabel(java.io.Serializable versionSeriesId, java.lang.String label)
          Gets the id of a version given a version series id and a label.
 void insertClusterInvalidations(Invalidations invalidations)
          Inserts the invalidation rows for the other cluster nodes.
 boolean isSameRM(javax.transaction.xa.XAResource xares)
           
 int prepare(javax.transaction.xa.Xid xid)
           
 PartialList<java.io.Serializable> query(java.lang.String query, QueryFilter queryFilter, boolean countTotal)
          Makes a NXQL query to the database.
 IterableQueryResult queryAndFetch(java.lang.String query, java.lang.String queryType, QueryFilter queryFilter, java.lang.Object... params)
          Makes a query to the database and returns an iterable (which must be closed when done).
 void rebuildReadAcls()
           
 javax.transaction.xa.Xid[] recover(int flag)
           
 void removeClusterNode()
          Removes this node from the cluster.
 void setRootId(java.io.Serializable repositoryId, java.io.Serializable id)
          Records the newly generated root id for a given repository.
 boolean setTransactionTimeout(int seconds)
           
 void start(javax.transaction.xa.Xid xid, int flags)
           
 void updateReadAcls()
           
 
Methods inherited from class org.nuxeo.ecm.core.storage.sql.CachingRowMapper
clearCache, copyHierarchy, getProxyRows, getVersionRows, read, readChildHierRow, readChildHierRows, readCollectionRowArray, readSimpleRow, receiveInvalidations, rollback, sendInvalidations, setEventQueue, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuxeo.ecm.core.storage.sql.RowMapper
clearCache, copyHierarchy, getProxyRows, getVersionRows, read, readChildHierRow, readChildHierRows, readCollectionRowArray, readSimpleRow, receiveInvalidations, rollback, sendInvalidations, write
 
Methods inherited from interface javax.transaction.xa.XAResource
rollback
 

Constructor Detail

CachingMapper

public CachingMapper(Mapper mapper,
                     InvalidationsPropagator cachePropagator,
                     InvalidationsPropagator eventPropagator,
                     InvalidationsQueue repositoryEventQueue)
Method Detail

getIdentification

public Mapper.Identification getIdentification()
                                        throws StorageException
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 interface Mapper
Returns:
the repository and mapper identification
Throws:
StorageException - when initial connection failed (for a NetMapper)

close

public void close()
           throws StorageException
Specified by:
close in interface Mapper
Throws:
StorageException

getTableSize

public int getTableSize(java.lang.String tableName)
                 throws StorageException
Specified by:
getTableSize in interface Mapper
Throws:
StorageException

createDatabase

public void createDatabase()
                    throws StorageException
Description copied from interface: Mapper
Creates the necessary structures in the database.

Specified by:
createDatabase in interface Mapper
Throws:
StorageException

getRootId

public java.io.Serializable getRootId(java.io.Serializable repositoryId)
                               throws StorageException
Description copied from interface: Mapper
Gets the root id for a given repository, if registered.

Specified by:
getRootId in interface Mapper
Parameters:
repositoryId - the repository id, usually 0
Returns:
the root id, or null if not found
Throws:
StorageException

setRootId

public void setRootId(java.io.Serializable repositoryId,
                      java.io.Serializable id)
               throws StorageException
Description copied from interface: Mapper
Records the newly generated root id for a given repository.

Specified by:
setRootId in interface Mapper
Parameters:
repositoryId - the repository id, usually 0
id - the root id
Throws:
StorageException

getVersionIdByLabel

public java.io.Serializable getVersionIdByLabel(java.io.Serializable versionSeriesId,
                                                java.lang.String label)
                                         throws StorageException
Description copied from interface: Mapper
Gets the id of a version given a version series id and a label.

Specified by:
getVersionIdByLabel in interface Mapper
Parameters:
versionSeriesId - the version series id
label - the label
Returns:
the id of the version, or null if not found
Throws:
StorageException

getLastVersionId

public java.io.Serializable getLastVersionId(java.io.Serializable versionSeriesId)
                                      throws StorageException
Description copied from interface: Mapper
Gets the id of the last version given a version series id.

Specified by:
getLastVersionId in interface Mapper
Parameters:
versionSeriesId - the version series id
Returns:
the id of the last version, or null if not found
Throws:
StorageException

query

public PartialList<java.io.Serializable> query(java.lang.String query,
                                               QueryFilter queryFilter,
                                               boolean countTotal)
                                        throws StorageException
Description copied from interface: Mapper
Makes a NXQL query to the database.

Specified by:
query in interface Mapper
Parameters:
query - the query
queryFilter - the query filter
countTotal - if true, count the total size without limit/offset
Returns:
the list of matching document ids
Throws:
StorageException

queryAndFetch

public IterableQueryResult queryAndFetch(java.lang.String query,
                                         java.lang.String queryType,
                                         QueryFilter queryFilter,
                                         java.lang.Object... params)
                                  throws StorageException
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 interface Mapper
Parameters:
query - the query
queryType - the query type
queryFilter - the query filter
params - optional query-type-dependent parameters
Returns:
an iterable, which must be closed when done
Throws:
StorageException

updateReadAcls

public void updateReadAcls()
                    throws StorageException
Specified by:
updateReadAcls in interface Mapper
Throws:
StorageException

rebuildReadAcls

public void rebuildReadAcls()
                     throws StorageException
Specified by:
rebuildReadAcls in interface Mapper
Throws:
StorageException

createClusterNode

public void createClusterNode()
                       throws StorageException
Description copied from interface: Mapper
Informs the cluster that this node exists.

Specified by:
createClusterNode in interface Mapper
Throws:
StorageException

removeClusterNode

public void removeClusterNode()
                       throws StorageException
Description copied from interface: Mapper
Removes this node from the cluster.

Specified by:
removeClusterNode in interface Mapper
Throws:
StorageException

insertClusterInvalidations

public void insertClusterInvalidations(Invalidations invalidations)
                                throws StorageException
Description copied from interface: Mapper
Inserts the invalidation rows for the other cluster nodes.

Specified by:
insertClusterInvalidations in interface Mapper
Throws:
StorageException

getClusterInvalidations

public Invalidations getClusterInvalidations()
                                      throws StorageException
Description copied from interface: Mapper
Gets the invalidations from other cluster nodes.

Specified by:
getClusterInvalidations in interface Mapper
Throws:
StorageException

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Specified by:
start in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Specified by:
end in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Specified by:
prepare in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Specified by:
commit in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Specified by:
forget in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

recover

public javax.transaction.xa.Xid[] recover(int flag)
                                   throws javax.transaction.xa.XAException
Specified by:
recover in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws javax.transaction.xa.XAException
Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xares)
                 throws javax.transaction.xa.XAException
Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.