Class MongoDbAccess

    • Constructor Detail

      • MongoDbAccess

        public MongoDbAccess​(com.mongodb.client.MongoClient mongoClient,
                             java.lang.String dbname)
        Parameters:
        mongoClient - MongoClient
        dbname - MongoDB database name
        Throws:
        java.lang.IllegalArgumentException - if mongoClient or dbname is null
    • Method Detail

      • getMongoClient

        public com.mongodb.client.MongoClient getMongoClient()
        Returns:
        MongoClient
      • setMongoClient

        public MongoDbAccess setMongoClient​(com.mongodb.client.MongoClient mongoClient)
        Parameters:
        mongoClient - MongoClient
        Returns:
        MongoDbAccess
      • getMongoDatabase

        public com.mongodb.client.MongoDatabase getMongoDatabase()
        Returns:
        MongoDatabase
      • setMongoDatabase

        public MongoDbAccess setMongoDatabase​(com.mongodb.client.MongoDatabase mongoDatabase)
        Parameters:
        mongoDatabase - MongoDatabase
        Returns:
        MongoDbAccess
      • getMongoAdmin

        public com.mongodb.client.MongoDatabase getMongoAdmin()
        Returns:
        MongoDatabase
      • setMongoAdmin

        public MongoDbAccess setMongoAdmin​(com.mongodb.client.MongoDatabase mongoAdmin)
        Parameters:
        mongoAdmin - MongoDatabase
        Returns:
        MongoDbAccess
      • close

        public void close()
        Close database access
      • getInfo

        public java.lang.String getInfo()
        Description copied from interface: DatabaseConnection
        Get information on a Database
        Specified by:
        getInfo in interface DatabaseConnection
        Returns:
        information on the database
      • createMongoClient

        public static com.mongodb.client.MongoClient createMongoClient​(DbConfiguration configuration)
        Create a mongoDB client according to the configuration and using the MongoClientOptions specific to the sub-systems (ex: metadata,logbook)
        Parameters:
        configuration - the configuration of mongo client (host/port to connect)
        Returns:
        the MongoClient
      • createMongoClient

        public static com.mongodb.client.MongoClient createMongoClient​(DbConfiguration configuration,
                                                                       java.util.List<java.lang.Class<?>> classList)
      • getMongoClientSettingsBuilder

        public static com.mongodb.MongoClientSettings.Builder getMongoClientSettingsBuilder​(java.lang.Class<?>... classes)
      • getMongoClientSettingsBuilder

        public static com.mongodb.MongoClientSettings.Builder getMongoClientSettingsBuilder​(java.util.List<java.lang.Class<?>> classList)
      • setDatabase

        public void setDatabase​(java.lang.String dbname)
        Change the target database
        Parameters:
        dbname - Name of the target database