Class MemRepository

java.lang.Object
org.nuxeo.ecm.core.storage.dbs.DBSRepositoryBase
org.nuxeo.ecm.core.storage.mem.MemRepository
All Implemented Interfaces:
LockManager, Repository, DBSRepository

public class MemRepository extends DBSRepositoryBase
In-memory implementation of a DBSRepository.

Internally, the repository is a map from id to document object.

A document object is a JSON-like document stored as a Map recursively containing the data, see DBSDocument for the description of the document.

Since:
5.9.4
  • Field Details

  • Constructor Details

  • Method Details

    • getAllowedIdTypes

      public List<DBSRepositoryBase.IdType> getAllowedIdTypes()
      Description copied from class: DBSRepositoryBase
      Gets the allowed id types for this DBS repository. The first one is the default.
      Specified by:
      getAllowedIdTypes in class DBSRepositoryBase
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface Repository
      Overrides:
      shutdown in class DBSRepositoryBase
    • initRepository

      protected void initRepository()
    • generateNewId

      protected String generateNewId()
    • supportsTransactions

      public boolean supportsTransactions()
      Description copied from interface: DBSRepository
      Checks whether this repository supports transactions.
      Returns:
      true if the repository supports transactions
      See Also:
    • getConnection

      public MemConnection getConnection()
      Description copied from interface: DBSRepository
      Gets a new connection to this repository.
      Returns:
      a new connection
    • getLock

      public Lock getLock(String id)
      Description copied from interface: LockManager
      Gets the lock on a document.

      If the document does not exist, null is returned.

      Specified by:
      getLock in interface LockManager
      Overrides:
      getLock in class DBSRepositoryBase
      Parameters:
      id - the document id
      Returns:
      the existing lock, or null when there is no lock
    • setLock

      public Lock setLock(String id, Lock lock)
      Description copied from interface: LockManager
      Sets a lock on a document.

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

      Specified by:
      setLock in interface LockManager
      Overrides:
      setLock in class DBSRepositoryBase
      Parameters:
      id - the document id
      lock - the lock to set
      Returns:
      null if locking succeeded, or the existing lock if locking failed
    • removeLock

      public Lock removeLock(String id, String owner)
      Description copied from interface: LockManager
      Removes the 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().

      Specified by:
      removeLock in interface LockManager
      Overrides:
      removeLock in class DBSRepositoryBase
      Parameters:
      id - the document id
      owner - the owner to check, or null for no check
      Returns:
      the previous lock (may be null), with a failed flag if locking failed
    • markReferencedBlobs

      public void markReferencedBlobs(BiConsumer<String,String> markerCallback)
      Description copied from interface: Repository
      Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).
    • updateCapabilities

      public void updateCapabilities()
      Description copied from interface: DBSRepository
      Update repository capabilities after a migration. Internal use only.