Package org.nuxeo.runtime.mongodb
Class MongoDBComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.runtime.mongodb.MongoDBComponent
- All Implemented Interfaces:
Adaptable,Component,Extensible,MongoDBConnectionService,TimestampedService
Component used to get a database connection to MongoDB. Don't expose
MongoClient directly, because it's this
component which is responsible for creating and closing it.- Since:
- 9.1
-
Field Summary
FieldsFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintThe component notification order forComponent.start(ComponentContext).com.mongodb.client.MongoClientGets the MongoDB client for the given id.Gets the MongoDB configuration for the given id.com.mongodb.client.MongoDatabasegetDatabase(String id) Gets the MongoDB database name for the given id.Iterable<com.mongodb.client.MongoDatabase> voidstart(ComponentContext context) Start the component.voidstop(ComponentContext context) Stop the component.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
-
Field Details
-
COMPONENT_NAME
- Since:
- 10.3
- See Also:
-
-
Constructor Details
-
MongoDBComponent
public MongoDBComponent()
-
-
Method Details
-
start
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent- Throws:
InterruptedException
-
getApplicationStartedOrder
public int getApplicationStartedOrder()Description copied from interface:ComponentThe component notification order forComponent.start(ComponentContext).Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Specified by:
getApplicationStartedOrderin interfaceComponent- Returns:
- the order, 1000 by default
-
getClient
Description copied from interface:MongoDBConnectionServiceGets the MongoDB client for the given id.- Specified by:
getClientin interfaceMongoDBConnectionService- Parameters:
id- the connection id- Returns:
- the client configured by
MongoDBConnectionConfigfor the input id, or the default one if it doesn't exist
-
getConfig
Description copied from interface:MongoDBConnectionServiceGets the MongoDB configuration for the given id.- Specified by:
getConfigin interfaceMongoDBConnectionService
-
getDatabaseName
Description copied from interface:MongoDBConnectionServiceGets the MongoDB database name for the given id.- Specified by:
getDatabaseNamein interfaceMongoDBConnectionService- Parameters:
id- the connection id- Returns:
- the database name configured by
MongoDBConnectionConfigfor the input id, or the default one if it doesn't exist
-
getDatabase
- Specified by:
getDatabasein interfaceMongoDBConnectionService- Parameters:
id- the connection id- Returns:
- the database configured by
MongoDBConnectionConfigfor the input id, or the default one if it doesn't exist
-
getDatabases
- Specified by:
getDatabasesin interfaceMongoDBConnectionService- Returns:
- all configured databases
-