Nuxeo ECM Projects 5.4.3-SNAPSHOT

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

All Known Subinterfaces:
Mapper
All Known Implementing Classes:
CachingMapper, CachingRowMapper, JDBCMapper, JDBCRowMapper

public interface RowMapper

A RowMapper maps Rows to and from the database.

These are the operations that can benefit from a cache.

See Also:
CachingRowMapper

Nested Class Summary
static class RowMapper.CopyResult
           
static class RowMapper.IdWithTypes
          A document id and its primary type and mixin types.
static class RowMapper.NodeInfo
          A document id, parent id and primary type, along with the version and proxy information (the potentially impacted selections).
static class RowMapper.RowBatch
          The description of a set of rows to create, update or delete.
static class RowMapper.RowUpdate
          A Row and a list of its keys that have to be updated.
 
Method Summary
 void clearCache()
          Clears the mapper's cache (if any)
 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.
 boolean isClusterReconnecting()
           
 List<? extends RowId> read(Collection<RowId> rowIds)
          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.
 Row readSimpleRow(RowId rowId)
          Gets a row for a SimpleFragment from the database, given its table name and id.
 Invalidations.InvalidationsPair receiveInvalidations()
          Processes and returns the invalidations queued for processing by the cache (if any).
 List<RowMapper.NodeInfo> remove(RowMapper.NodeInfo rootInfo)
          Deletes a hierarchy and returns information to generate invalidations.
 void rollback(Xid xid)
          Rollback the XA Resource.
 void sendInvalidations(Invalidations invalidations)
          Post-transaction invalidations notification.
 void write(RowMapper.RowBatch batch)
          Writes a set of rows.
 

Method Detail

read

List<? extends RowId> read(Collection<RowId> rowIds)
                           throws StorageException
Reads a set of rows for the given RowIds.

For each requested row, either a Row is found and returned, or a RowId (not implementing Row) is returned to signify an absent row.

Parameters:
rowIds - the row ids (including their table name)
Returns:
the collection of Rows (or RowIds if the row was absent from the database). Order is not the same as the input rowIds
Throws:
StorageException

write

void write(RowMapper.RowBatch batch)
           throws StorageException
Writes a set of rows. This includes creating, updating and deleting rows.

Parameters:
batch - the set of rows and the operations to do on them
Throws:
StorageException

readSimpleRow

Row readSimpleRow(RowId rowId)
                  throws StorageException
Gets a row for a SimpleFragment from the database, given its table name and id. If the row doesn't exist, null is returned.

Parameters:
rowId - the row id
Returns:
the row, or null
Throws:
StorageException

readCollectionRowArray

Serializable[] readCollectionRowArray(RowId rowId)
                                      throws StorageException
Gets an array for a CollectionFragment from the database, given its table name and id. If no rows are found, an empty array is returned.

Parameters:
rowId - the row id
Returns:
the array
Throws:
StorageException

readSelectionRows

List<Row> readSelectionRows(SelectionType selType,
                            Serializable selId,
                            Serializable filter,
                            Serializable criterion,
                            boolean limitToOne)
                            throws StorageException
Reads the rows corresponding to a selection.

Parameters:
selType - the selection type
selId - 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 retrieved
Returns:
the list of rows
Throws:
StorageException

copy

RowMapper.CopyResult copy(RowMapper.IdWithTypes source,
                          Serializable destParentId,
                          String destName,
                          Row overwriteRow)
                          throws StorageException
Copies the hierarchy starting from a given row to a new parent with a new name.

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.

Parameters:
source - the id, primary type and mixin types of the row to copy
destParentId - the new parent id, or null
destName - the new name
overwriteRow - when not null, the copy is done onto this existing row, and the values are set in hierarchy
Returns:
info about the copy
Throws:
StorageException

remove

List<RowMapper.NodeInfo> remove(RowMapper.NodeInfo rootInfo)
                                throws StorageException
Deletes a hierarchy and returns information to generate invalidations.

Parameters:
rootInfo - info about the root to be deleted with its children (root id, and the rest is for invalidations)
Returns:
info about the descendants removed (including the root)
Throws:
StorageException

isClusterReconnecting

boolean isClusterReconnecting()
Returns:
true if cluster mode enabled and connection is established but needs to be validated. this occurs after a connection error
Since:
5.4.3
See Also:
JDBCConnection.checkConnectionReset(java.lang.Throwable)

receiveInvalidations

Invalidations.InvalidationsPair receiveInvalidations()
                                                     throws StorageException
Processes and returns the invalidations queued for processing by the cache (if any).

Called pre-transaction by session start or transactionless save;

Returns:
the invalidations (both for the mapper and the events), or null
Throws:
StorageException

sendInvalidations

void sendInvalidations(Invalidations invalidations)
                       throws StorageException
Post-transaction invalidations notification.

Called post-transaction by session commit/rollback or transactionless save.

Parameters:
invalidations - the known invalidations to send to others, or null
Throws:
StorageException

clearCache

void clearCache()
Clears the mapper's cache (if any)

Called after a rollback, or a manual clear through RepositoryStatus MBean.


rollback

void rollback(Xid xid)
              throws XAException
Rollback the XA Resource.

This is in the RowMapper interface because on rollback the cache must be invalidated.

Throws:
XAException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.