mongoDBConfiguration = builder.build();
mongoDBConfiguration = builder.build();
public MongoDBAdaptorFactory(Configuration catalogConfiguration) throws CatalogDBException { MongoDBConfiguration mongoDBConfiguration = MongoDBConfiguration.builder() .setUserPassword( catalogConfiguration.getCatalog().getDatabase().getUser(), catalogConfiguration.getCatalog().getDatabase().getPassword()) .load(catalogConfiguration.getCatalog().getDatabase().getOptions()) .build(); List<DataStoreServerAddress> dataStoreServerAddresses = new LinkedList<>(); for (String hostPort : catalogConfiguration.getCatalog().getDatabase().getHosts()) { if (hostPort.contains(":")) { String[] split = hostPort.split(":"); int port = Integer.valueOf(split[1]); dataStoreServerAddresses.add(new DataStoreServerAddress(split[0], port)); } else { dataStoreServerAddresses.add(new DataStoreServerAddress(hostPort, 27017)); } } this.mongoManager = new MongoDataStoreManager(dataStoreServerAddresses); this.configuration = mongoDBConfiguration; this.database = getCatalogDatabase(catalogConfiguration.getDatabasePrefix()); logger = LoggerFactory.getLogger(this.getClass()); connect(); }
.add("username", mongodbCredentials.getUser()) .add("password", mongodbCredentials.getPassword()) .add("authenticationDatabase", mongodbCredentials.getOptions().get("authenticationDatabase")).build(); logger.debug("MongoDB 'authenticationDatabase' database parameter set to '{}'", mongodbCredentials.getOptions().get("authenticationDatabase")); mongoDBConfiguration = MongoDBConfiguration.builder() .add("username", mongodbCredentials.getUser()) .add("password", mongodbCredentials.getPassword()).build();
.add("username", mongodbCredentials.getUser()) .add("password", mongodbCredentials.getPassword()) .add("authenticationDatabase", mongodbCredentials.getOptions().get("authenticationDatabase")).build(); logger.debug("MongoDB 'authenticationDatabase' database parameter set to '{}'", mongodbCredentials.getOptions().get("authenticationDatabase")); mongoDBConfiguration = MongoDBConfiguration.builder() .add("username", mongodbCredentials.getUser()) .add("password", mongodbCredentials.getPassword()).build();
.add("password", configuration.getCatalog().getDatabase().getPassword()) .add("authenticationDatabase", configuration.getCatalog().getDatabase().getOptions().get("authenticationDatabase")) .build();
.add("password", configuration.getCatalog().getDatabase().getPassword()) .add("authenticationDatabase", configuration.getCatalog().getDatabase().getOptions().get("authenticationDatabase")) .build();
.add("password", configuration.getCatalog().getDatabase().getPassword()) .add("authenticationDatabase", configuration.getCatalog().getDatabase().getOptions().get("authenticationDatabase")) .build();
public MongoDataStore get(String database) { return get(database, builder().init().build()); }
public MongoCredentials(List<DataStoreServerAddress> dataStoreServerAddresses, String dbName, String mongoUser, String mongoPassword, Map<? extends String, ?> inputOptions, boolean checkConnection) throws IllegalOpenCGACredentialsException { this.mongoDbName = dbName; mongoDBConfiguration = MongoDBConfiguration.builder() .setUserPassword(mongoUser, mongoPassword) .setServerAddress(dataStoreServerAddresses) .load(inputOptions == null ? Collections.emptyMap() : inputOptions) .build(); if (checkConnection) { check(); } }
public MongoCredentials(String mongoHost, int mongoPort, String mongoDbName, String mongoUser, String mongoPassword, boolean checkConnection) throws IllegalOpenCGACredentialsException { this.mongoDbName = mongoDbName; mongoDBConfiguration = MongoDBConfiguration.builder() .setUserPassword(mongoUser, mongoPassword) .addServerAddress(new DataStoreServerAddress(mongoHost, mongoPort)) .build(); if (checkConnection) { check(); } }