Class MongoDBDirectory

java.lang.Object
org.nuxeo.ecm.directory.AbstractDirectory
org.nuxeo.directory.mongodb.MongoDBDirectory
All Implemented Interfaces:
Directory

public class MongoDBDirectory extends AbstractDirectory
MongoDB implementation of a Directory
Since:
9.1
  • Field Details

    • DIRECTORY_CONNECTION_PREFIX

      public static final String DIRECTORY_CONNECTION_PREFIX
      Prefix used to retrieve a MongoDB connection from MongoDBConnectionService.

      The connection id will be directory/[DIRECTORY_NAME].

      Since:
      10.10
      See Also:
    • database

      protected com.mongodb.client.MongoDatabase database
    • collection

      protected com.mongodb.client.MongoCollection<org.bson.Document> collection
    • countersCollection

      protected com.mongodb.client.MongoCollection<org.bson.Document> countersCollection
  • Constructor Details

  • Method Details

    • getDescriptor

      public MongoDBDirectoryDescriptor getDescriptor()
      Description copied from interface: Directory
      Get descriptor
    • addReferences

      protected void addReferences()
      Overrides:
      addReferences in class AbstractDirectory
    • getSession

      public MongoDBSession getSession()
      Description copied from interface: Directory
      Creates a session for accessing entries in this directory.
      Returns:
      a Session object
    • isMultiTenant

      public boolean isMultiTenant()
      Description copied from interface: Directory
      Returns true if this directory is a multi tenant directory, false otherwise.
      Specified by:
      isMultiTenant in interface Directory
      Overrides:
      isMultiTenant in class AbstractDirectory
    • initialize

      public void initialize()
      Description copied from interface: Directory
      INTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.
      Specified by:
      initialize in interface Directory
      Overrides:
      initialize in class AbstractDirectory
    • createIndexes

      protected void createIndexes()
    • initializeReferences

      public void initializeReferences()
      Description copied from interface: Directory
      INTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.
      Specified by:
      initializeReferences in interface Directory
      Overrides:
      initializeReferences in class AbstractDirectory
    • hasCollection

      protected boolean hasCollection(String collection)
      Checks if the MongoDB server has the collection.
      Parameters:
      collection - the collection name
      Returns:
      true if the server has the collection, false otherwise
    • getCollection

      protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection()
      Retrieves the collection associated to this directory.
      Returns:
      the MongoDB collection
    • getCountersCollection

      protected com.mongodb.client.MongoCollection<org.bson.Document> getCountersCollection()
      Retrieves the counters collection associated to this directory.
      Returns:
      the MongoDB counters collection