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>
collection
protected com.mongodb.client.MongoCollection<org.bson.Document>
countersCollection
protected com.mongodb.client.MongoDatabase
database
static String
DIRECTORY_CONNECTION_PREFIX
Prefix 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 void
addReferences()
protected void
createIndexes()
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.MongoDBDirectoryDescriptor
getDescriptor()
Get descriptorMongoDBSession
getSession()
Creates a session for accessing entries in this directory.protected boolean
hasCollection(String collection)
Checks if the MongoDB server has the collection.void
initialize()
INTERNAL, DO NOT CALL.void
initializeReferences()
INTERNAL, DO NOT CALL.boolean
isMultiTenant()
Returnstrue
if this directory is a multi tenant directory,false
otherwise.-
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:Directory
Get descriptor
-
addReferences
protected void addReferences()
- Overrides:
addReferences
in classAbstractDirectory
-
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
Returnstrue
if this directory is a multi tenant directory,false
otherwise.- Specified by:
isMultiTenant
in interfaceDirectory
- Overrides:
isMultiTenant
in classAbstractDirectory
-
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 interfaceDirectory
- Overrides:
initialize
in classAbstractDirectory
-
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 interfaceDirectory
- Overrides:
initializeReferences
in 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
-
-