Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.storage.sql
Interface Mapper

All Superinterfaces:
RowMapper, XAResource
All Known Implementing Classes:
CachingMapper, JDBCMapper

public interface Mapper
extends RowMapper, XAResource

A Mapper maps Rows to and from the database.


Nested Class Summary
static class Mapper.Identification
          Identifiers assigned by a server to identify a client mapper and its repository.
 
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
static String CLOSE
           
static String GET_IDENTIFICATION
           
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Method Summary
 void close()
           
 void createClusterNode()
          Informs the cluster that this node exists.
 void createDatabase()
          Creates the necessary structures in the database.
 Set<Serializable> getAncestorsIds(Collection<Serializable> ids)
          Gets the ids for all the ancestors of the given row ids.
 Invalidations getClusterInvalidations()
          Gets the invalidations from other cluster nodes.
 Mapper.Identification getIdentification()
          Returns the repository id and mapper id assigned.
 Lock getLock(Serializable id)
          Gets the lock state of a document.
 Serializable getRootId(Serializable repositoryId)
          Gets the root id for a given repository, if registered.
 int getTableSize(String tableName)
           
 void insertClusterInvalidations(Invalidations invalidations)
          Inserts the invalidation rows for the other cluster nodes.
 void markReferencedBinaries(BinaryGarbageCollector gc)
          Marks the binaries referenced by this mapper with the referenced binary garbage collector.
 PartialList<Serializable> query(String query, String queryType, QueryFilter queryFilter, boolean countTotal)
          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()
           
 void removeClusterNode()
          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.
 void updateReadAcls()
           
 
Methods inherited from interface org.nuxeo.ecm.core.storage.sql.RowMapper
clearCache, copy, isClusterReconnecting, read, readCollectionRowArray, readSelectionRows, readSimpleRow, receiveInvalidations, remove, rollback, sendInvalidations, write
 
Methods inherited from interface javax.transaction.xa.XAResource
commit, end, forget, getTransactionTimeout, isSameRM, prepare, recover, rollback, setTransactionTimeout, start
 

Field Detail

GET_IDENTIFICATION

static final String GET_IDENTIFICATION
See Also:
Constant Field Values

CLOSE

static final String CLOSE
See Also:
Constant Field Values
Method Detail

getIdentification

Mapper.Identification getIdentification()
                                        throws StorageException
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.

Returns:
the repository and mapper identification
Throws:
StorageException - when initial connection failed (for a NetMapper)

close

void close()
           throws StorageException
Throws:
StorageException

getTableSize

int getTableSize(String tableName)
                 throws StorageException
Throws:
StorageException

createDatabase

void createDatabase()
                    throws StorageException
Creates the necessary structures in the database.

Throws:
StorageException

getRootId

Serializable getRootId(Serializable repositoryId)
                       throws StorageException
Gets the root id for a given repository, if registered.

Parameters:
repositoryId - the repository id, usually 0
Returns:
the root id, or null if not found
Throws:
StorageException

setRootId

void setRootId(Serializable repositoryId,
               Serializable id)
               throws StorageException
Records the newly generated root id for a given repository.

Parameters:
repositoryId - the repository id, usually 0
id - the root id
Throws:
StorageException

query

PartialList<Serializable> query(String query,
                                String queryType,
                                QueryFilter queryFilter,
                                boolean countTotal)
                                throws StorageException
Makes a NXQL query to the database.

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

queryAndFetch

IterableQueryResult queryAndFetch(String query,
                                  String queryType,
                                  QueryFilter queryFilter,
                                  Object... params)
                                  throws StorageException
Makes a query to the database and returns an iterable (which must be closed when done).

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

getAncestorsIds

Set<Serializable> getAncestorsIds(Collection<Serializable> ids)
                                  throws StorageException
Gets the ids for all the ancestors of the given row ids.

Parameters:
ids - the ids
Returns:
the set of ancestor ids
Throws:
StorageException

updateReadAcls

void updateReadAcls()
                    throws StorageException
Throws:
StorageException

rebuildReadAcls

void rebuildReadAcls()
                     throws StorageException
Throws:
StorageException

createClusterNode

void createClusterNode()
                       throws StorageException
Informs the cluster that this node exists.

Throws:
StorageException

removeClusterNode

void removeClusterNode()
                       throws StorageException
Removes this node from the cluster.

Throws:
StorageException

insertClusterInvalidations

void insertClusterInvalidations(Invalidations invalidations)
                                throws StorageException
Inserts the invalidation rows for the other cluster nodes.

Throws:
StorageException

getClusterInvalidations

Invalidations getClusterInvalidations()
                                      throws StorageException
Gets the invalidations from other cluster nodes.

Throws:
StorageException

getLock

Lock getLock(Serializable id)
             throws StorageException
Gets the lock state of a document.

If the document does not exist, null is returned.

Parameters:
id - the document id
Returns:
the existing lock, or null when there is no lock
Throws:
StorageException

setLock

Lock setLock(Serializable id,
             Lock lock)
             throws StorageException
Sets a lock on a document.

If the document is already locked, returns its existing lock status (there is no re-locking, removeLock(java.io.Serializable, java.lang.String, boolean) must be called first).

Parameters:
id - the document id
lock - the lock object to set
Returns:
null if locking succeeded, or the existing lock if locking failed, or a
Throws:
StorageException

removeLock

Lock removeLock(Serializable id,
                String owner,
                boolean force)
                throws StorageException
Removes a lock from a document.

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().

Parameters:
id - the document id
the - owner to check, or null for no check
force - true to just do the remove and not return the previous lock
Returns:
the previous lock
Throws:
StorageException

markReferencedBinaries

void markReferencedBinaries(BinaryGarbageCollector gc)
                            throws StorageException
Marks the binaries referenced by this mapper with the referenced binary garbage collector.

Parameters:
gc - the binary garbage collector
Throws:
StorageException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.