builder.setUserPassword(mongodbCredentials.getUser(), mongodbCredentials.getPassword()); if (mongodbCredentials.getOptions().containsKey(MongoDBConfiguration.AUTHENTICATION_DATABASE)) { builder.setAuthenticationDatabase(mongodbCredentials.getOptions()
builder.setUserPassword(mongodbCredentials.getUser(), mongodbCredentials.getPassword()); if (mongodbCredentials.getOptions().containsKey(MongoDBConfiguration.AUTHENTICATION_DATABASE)) { builder.setAuthenticationDatabase(mongodbCredentials.getOptions()
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(); }
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(); } }