Package org.nuxeo.directory.mongodb
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 aDirectory- Since:
- 9.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.nuxeo.ecm.directory.AbstractDirectory
AbstractDirectory.CSVLoaderConsumer
-
-
Field Summary
Fields Modifier and Type Field Description protected com.mongodb.client.MongoCollection<org.bson.Document>collectionprotected com.mongodb.client.MongoCollection<org.bson.Document>countersCollectionprotected com.mongodb.client.MongoDatabasedatabasestatic StringDIRECTORY_CONNECTION_PREFIXPrefix used to retrieve a MongoDB connection fromMongoDBConnectionService.-
Fields inherited from class org.nuxeo.ecm.directory.AbstractDirectory
cache, descriptor, fieldMapper, referenceClass, references, registry, schemaFieldMap, sessionCount, sessionMaxCount, TENANT_ID_FIELD, types
-
-
Constructor Summary
Constructors Constructor Description MongoDBDirectory(MongoDBDirectoryDescriptor descriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddReferences()protected com.mongodb.client.MongoCollection<org.bson.Document>getCollection()Retrieves the collection associated to this directory.protected com.mongodb.client.MongoCollection<org.bson.Document>getCountersCollection()Retrieves the counters collection associated to this directory.MongoDBDirectoryDescriptorgetDescriptor()Get descriptorMongoDBSessiongetSession()Creates a session for accessing entries in this directory.protected booleanhasCollection(String collection)Checks if the MongoDB server has the collection.voidinitialize()INTERNAL, DO NOT CALL.voidinitializeReferences()INTERNAL, DO NOT CALL.booleanisMultiTenant()Returnstrueif this directory is a multi tenant directory,falseotherwise.-
Methods inherited from class org.nuxeo.ecm.directory.AbstractDirectory
addInverseReferences, addReference, addSession, doSanityChecks, fallbackOnDefaultCache, getCache, getDirectoryDeleteConstraints, getFieldMapper, getIdField, getName, getParentDirectory, getPasswordField, getReference, getReferences, getReferences, getSchema, getSchemaFieldMap, getTypes, initializeInverseReferences, initSchemaFieldMap, invalidateCaches, invalidateDirectoryCache, isReadOnly, isReference, loadData, loadDataOnInit, loadFromCSV, makeOrderBy, newReference, orderEntries, removeSession, setReadOnly, shutdown
-
-
-
-
Field Detail
-
DIRECTORY_CONNECTION_PREFIX
public static final String DIRECTORY_CONNECTION_PREFIX
Prefix used to retrieve a MongoDB connection fromMongoDBConnectionService.The connection id will be
directory/[DIRECTORY_NAME].- Since:
- 10.10
- See Also:
- Constant Field Values
-
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 Detail
-
MongoDBDirectory
public MongoDBDirectory(MongoDBDirectoryDescriptor descriptor)
-
-
Method Detail
-
getDescriptor
public MongoDBDirectoryDescriptor getDescriptor()
Description copied from interface:DirectoryGet descriptor
-
addReferences
protected void addReferences()
- Overrides:
addReferencesin classAbstractDirectory
-
getSession
public MongoDBSession getSession()
Description copied from interface:DirectoryCreates a session for accessing entries in this directory.- Returns:
- a Session object
-
isMultiTenant
public boolean isMultiTenant()
Description copied from interface:DirectoryReturnstrueif this directory is a multi tenant directory,falseotherwise.- Specified by:
isMultiTenantin interfaceDirectory- Overrides:
isMultiTenantin classAbstractDirectory
-
initialize
public void initialize()
Description copied from interface:DirectoryINTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initializein interfaceDirectory- Overrides:
initializein classAbstractDirectory
-
initializeReferences
public void initializeReferences()
Description copied from interface:DirectoryINTERNAL, DO NOT CALL. Initializes the directory when Nuxeo starts. Called without a transaction.- Specified by:
initializeReferencesin interfaceDirectory- Overrides:
initializeReferencesin classAbstractDirectory
-
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
-
-