Example usage for com.mongodb MongoClientOptions.Builder sslEnabled

List of usage examples for com.mongodb MongoClientOptions.Builder sslEnabled

Introduction

In this page you can find the example usage for com.mongodb MongoClientOptions.Builder sslEnabled.

Prototype

boolean sslEnabled

To view the source code for com.mongodb MongoClientOptions.Builder sslEnabled.

Click Source Link

Usage

From source file:com.eightkdata.mongowp.client.wrapper.MongoClientWrapper.java

License:Open Source License

private MongoClientOptions toMongoClientOptions(MongoClientConfiguration configuration) {
    MongoClientOptions.Builder optionsBuilder = MongoClientOptions.builder();
    if (configuration.isSslEnabled()) {
        optionsBuilder.sslEnabled(configuration.isSslEnabled());
        if (configuration.getSocketFactory() != null) {
            optionsBuilder.socketFactory(configuration.getSocketFactory());
            optionsBuilder.sslInvalidHostNameAllowed(configuration.isSslAllowInvalidHostnames());
        }//from www .  j  av a  2s  .  c o m
    }
    return optionsBuilder.build();
}

From source file:com.hurence.logisland.service.mongodb.AbstractMongoDBControllerService.java

License:Apache License

protected Builder getClientOptions(final SSLContext sslContext) {
    MongoClientOptions.Builder builder = MongoClientOptions.builder();
    builder.sslEnabled(true);
    builder.socketFactory(sslContext.getSocketFactory());
    return builder;
}

From source file:io.gravitee.repository.mongodb.common.MongoFactory.java

License:Apache License

private MongoClientOptions.Builder builder() {
    MongoClientOptions.Builder builder = MongoClientOptions.builder();

    builder.writeConcern(WriteConcern.SAFE);

    Integer connectionsPerHost = readPropertyValue(propertyPrefix + "connectionsPerHost", Integer.class);
    Integer connectTimeout = readPropertyValue(propertyPrefix + "connectTimeout", Integer.class, 500);
    Integer maxWaitTime = readPropertyValue(propertyPrefix + "maxWaitTime", Integer.class);
    Integer socketTimeout = readPropertyValue(propertyPrefix + "socketTimeout", Integer.class, 500);
    Boolean socketKeepAlive = readPropertyValue(propertyPrefix + "socketKeepAlive", Boolean.class);
    Integer maxConnectionLifeTime = readPropertyValue(propertyPrefix + "maxConnectionLifeTime", Integer.class);
    Integer maxConnectionIdleTime = readPropertyValue(propertyPrefix + "maxConnectionIdleTime", Integer.class);

    // We do not want to wait for a server
    Integer serverSelectionTimeout = readPropertyValue(propertyPrefix + "serverSelectionTimeout", Integer.class,
            0);/*from w w w.  j a  v a 2s. c o  m*/
    Integer minHeartbeatFrequency = readPropertyValue(propertyPrefix + "minHeartbeatFrequency", Integer.class);
    String description = readPropertyValue(propertyPrefix + "description", String.class, "gravitee.io");
    Integer heartbeatConnectTimeout = readPropertyValue(propertyPrefix + "heartbeatConnectTimeout",
            Integer.class, 1000);
    Integer heartbeatFrequency = readPropertyValue(propertyPrefix + "heartbeatFrequency", Integer.class);
    Integer heartbeatSocketTimeout = readPropertyValue(propertyPrefix + "heartbeatSocketTimeout",
            Integer.class);
    Integer localThreshold = readPropertyValue(propertyPrefix + "localThreshold", Integer.class);
    Integer minConnectionsPerHost = readPropertyValue(propertyPrefix + "minConnectionsPerHost", Integer.class);
    Boolean sslEnabled = readPropertyValue(propertyPrefix + "sslEnabled", Boolean.class);
    Integer threadsAllowedToBlockForConnectionMultiplier = readPropertyValue(
            propertyPrefix + "threadsAllowedToBlockForConnectionMultiplier", Integer.class);
    Boolean cursorFinalizerEnabled = readPropertyValue(propertyPrefix + "cursorFinalizerEnabled",
            Boolean.class);

    if (connectionsPerHost != null)
        builder.connectionsPerHost(connectionsPerHost);
    if (maxWaitTime != null)
        builder.maxWaitTime(maxWaitTime);
    if (connectTimeout != null)
        builder.connectTimeout(connectTimeout);
    if (socketTimeout != null)
        builder.socketTimeout(socketTimeout);
    if (socketKeepAlive != null)
        builder.socketKeepAlive(socketKeepAlive);
    if (maxConnectionLifeTime != null)
        builder.maxConnectionLifeTime(maxConnectionLifeTime);
    if (maxConnectionIdleTime != null)
        builder.maxConnectionIdleTime(maxConnectionIdleTime);
    if (minHeartbeatFrequency != null)
        builder.minHeartbeatFrequency(minHeartbeatFrequency);
    if (description != null)
        builder.description(description);
    if (heartbeatConnectTimeout != null)
        builder.heartbeatConnectTimeout(heartbeatConnectTimeout);
    if (heartbeatFrequency != null)
        builder.heartbeatFrequency(heartbeatFrequency);
    if (heartbeatSocketTimeout != null)
        builder.heartbeatSocketTimeout(heartbeatSocketTimeout);
    if (localThreshold != null)
        builder.localThreshold(localThreshold);
    if (minConnectionsPerHost != null)
        builder.minConnectionsPerHost(minConnectionsPerHost);
    if (sslEnabled != null)
        builder.sslEnabled(sslEnabled);
    if (threadsAllowedToBlockForConnectionMultiplier != null)
        builder.threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier);
    if (cursorFinalizerEnabled != null)
        builder.cursorFinalizerEnabled(cursorFinalizerEnabled);
    if (serverSelectionTimeout != null)
        builder.serverSelectionTimeout(serverSelectionTimeout);

    return builder;
}

From source file:io.lumeer.storage.mongodb.MongoDbStorage.java

License:Open Source License

@Override
public void connect(final List<StorageConnection> connections, final String database, final Boolean useSsl) {
    final List<ServerAddress> addresses = new ArrayList<>();

    connections.forEach(c -> {/*from www .j a v a2  s  .c  o m*/
        addresses.add(new ServerAddress(c.getHost(), c.getPort()));
    });

    MongoCredential credential = null;
    if (connections.size() > 0 && connections.get(0).getUserName() != null
            && !connections.get(0).getUserName().isEmpty()) {
        credential = MongoCredential.createScramSha1Credential(connections.get(0).getUserName(), database,
                connections.get(0).getPassword());
    }

    final MongoClientOptions.Builder optionsBuilder = (new MongoClientOptions.Builder()).connectTimeout(30000);

    if (useSsl) {
        optionsBuilder.sslEnabled(true).socketFactory(NaiveTrustManager.getSocketFactory())
                .sslInvalidHostNameAllowed(true);
    }

    final CodecRegistry defaultRegistry = MongoClient.getDefaultCodecRegistry();
    final CodecRegistry codecRegistry = CodecRegistries.fromCodecs(new BigDecimalCodec(), new RoleCodec());
    final CodecRegistry providersRegistry = CodecRegistries.fromProviders(new PermissionsCodecProvider(),
            new PermissionCodecProvider(), new QueryCodecProvider(), new ViewCodecProvider(),
            new AttributeCodecProvider(), new LinkInstanceCodecProvider(), new LinkTypeCodecProvider(),
            new UserCodecProvider(), new GroupCodecProvider(), new PaymentCodecProvider(),
            new CompanyContactCodedProvider(), new UserLoginEventCodecProvider(), new FeedbackCodecProvider());
    final CodecRegistry registry = CodecRegistries.fromRegistries(defaultRegistry, codecRegistry,
            providersRegistry);

    if (credential != null) {
        this.mongoClient = new MongoClient(addresses, credential,
                optionsBuilder.codecRegistry(registry).build());
    } else {
        this.mongoClient = new MongoClient(addresses, optionsBuilder.codecRegistry(registry).build());
    }

    this.database = mongoClient.getDatabase(database);
    this.datastore = (AdvancedDatastore) morphia.createDatastore(this.mongoClient, database);
}

From source file:org.apache.beam.sdk.io.mongodb.MongoDbIO.java

License:Apache License

private static MongoClientOptions.Builder getOptions(int maxConnectionIdleTime, boolean sslEnabled,
        boolean sslInvalidHostNameAllowed) {
    MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder();
    optionsBuilder.maxConnectionIdleTime(maxConnectionIdleTime);
    if (sslEnabled) {
        optionsBuilder.sslEnabled(sslEnabled).sslInvalidHostNameAllowed(sslInvalidHostNameAllowed)
                .sslContext(SSLUtils.ignoreSSLCertificate());
    }// w  w w. j  av  a 2 s  . com
    return optionsBuilder;
}

From source file:org.opencb.commons.datastore.mongodb.MongoDataStoreManager.java

License:Apache License

private MongoDataStore create(String database, MongoDBConfiguration mongoDBConfiguration) {
    MongoDataStore mongoDataStore = null;
    MongoClient mc = null;//  w w  w .j  av a 2 s.c  o m
    logger.debug(
            "MongoDataStoreManager: creating a MongoDataStore object for database: '" + database + "' ...");
    long t0 = System.currentTimeMillis();
    if (database != null && !database.trim().equals("")) {
        // read DB configuration for that SPECIES.VERSION, by default
        // PRIMARY_DB is selected
        //            String dbPrefix = applicationProperties.getProperty(speciesVersionPrefix + ".DB", "PRIMARY_DB");
        // We create the MongoClientOptions
        MongoClientOptions mongoClientOptions;
        MongoClientOptions.Builder builder = new MongoClientOptions.Builder()
                .connectionsPerHost(
                        mongoDBConfiguration.getInt(CONNECTIONS_PER_HOST, CONNECTIONS_PER_HOST_DEFAULT))
                .connectTimeout(mongoDBConfiguration.getInt(CONNECT_TIMEOUT, CONNECT_TIMEOUT_DEFAULT))
                .readPreference(ReadPreference.valueOf(
                        mongoDBConfiguration.getString(READ_PREFERENCE, READ_PREFERENCE_DEFAULT.getValue())));

        if (mongoDBConfiguration.getString(REPLICA_SET) != null
                && !mongoDBConfiguration.getString(REPLICA_SET).isEmpty()) {
            logger.debug("Setting replicaSet to " + mongoDBConfiguration.getString(REPLICA_SET));
            builder = builder.requiredReplicaSetName(mongoDBConfiguration.getString(REPLICA_SET));
        }

        if (mongoDBConfiguration.getBoolean(SSL_ENABLED)) {
            logger.debug("SSL connections enabled for " + database);
            builder = builder.sslEnabled(mongoDBConfiguration.getBoolean(SSL_ENABLED));
        }

        mongoClientOptions = builder.build();

        assert (dataStoreServerAddresses != null);

        // We create the MongoCredential object
        String user = mongoDBConfiguration.getString(USERNAME, "");
        String pass = mongoDBConfiguration.getString(PASSWORD, "");
        MongoCredential mongoCredential = null;
        if ((user != null && !user.equals("")) || (pass != null && !pass.equals(""))) {
            //                final DB authenticationDatabase;
            if (mongoDBConfiguration.get(AUTHENTICATION_DATABASE) != null
                    && !mongoDBConfiguration.getString(AUTHENTICATION_DATABASE).isEmpty()) {
                //                        authenticationDatabase = mc.getDB(mongoDBConfiguration.getString("authenticationDatabase"));
                mongoCredential = MongoCredential.createScramSha1Credential(user,
                        mongoDBConfiguration.getString(AUTHENTICATION_DATABASE), pass.toCharArray());
            } else {
                //                        authenticationDatabase = db;
                mongoCredential = MongoCredential.createScramSha1Credential(user, "", pass.toCharArray());
            }
            //                    authenticationDatabase.authenticate(user, pass.toCharArray());
        }

        mc = newMongoClient(mongoClientOptions, mongoCredential);

        //                mc.setReadPreference(ReadPreference.secondary(new BasicDBObject("dc", "PG")));
        //                mc.setReadPreference(ReadPreference.primary());
        //                System.out.println("Replica Status: "+mc.getReplicaSetStatus());
        logger.debug(mongoDBConfiguration.toString());
        MongoDatabase db = mc.getDatabase(database);
        //                db.setReadPreference(ReadPreference.secondary(new BasicDBObject("dc", "PG")));
        //                db.setReadPreference(ReadPreference.primary());

        long t1 = System.currentTimeMillis();
        logger.debug("MongoDataStoreManager: MongoDataStore object for database: '" + database + "' created in "
                + (t0 - t1) + "ms");
        mongoDataStore = new MongoDataStore(mc, db, mongoDBConfiguration);
    } else {
        logger.debug("MongoDB database is null or empty");
    }
    return mongoDataStore;
}

From source file:org.venice.piazza.servicecontroller.data.mongodb.accessors.MongoAccessor.java

License:Apache License

@PostConstruct
private void initialize() {
    try {/*from   w  ww. jav  a  2  s .com*/
        MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
        // Enable SSL if the `mongossl` Profile is enabled
        if (Arrays.stream(environment.getActiveProfiles()).anyMatch(env -> env.equalsIgnoreCase("mongossl"))) {
            builder.sslEnabled(true);
            builder.sslInvalidHostNameAllowed(true);
        }
        // If a username and password are provided, then associate these credentials with the connection
        if ((!StringUtils.isEmpty(DATABASE_USERNAME)) && (!StringUtils.isEmpty(DATABASE_CREDENTIAL))) {
            mongoClient = new MongoClient(new ServerAddress(DATABASE_HOST, DATABASE_PORT),
                    Arrays.asList(MongoCredential.createCredential(DATABASE_USERNAME, DATABASE_NAME,
                            DATABASE_CREDENTIAL.toCharArray())),
                    builder.threadsAllowedToBlockForConnectionMultiplier(mongoThreadMultiplier).build());
        } else {
            mongoClient = new MongoClient(new ServerAddress(DATABASE_HOST, DATABASE_PORT),
                    builder.threadsAllowedToBlockForConnectionMultiplier(mongoThreadMultiplier).build());
        }

    } catch (Exception exception) {
        LOGGER.error(String.format("Error connecting to MongoDB Instance. %s", exception.getMessage()),
                exception);

    }
}

From source file:org.wso2.carbon.datasource.reader.mongo.MongoDataSourceReaderUtil.java

License:Open Source License

public static MongoClient loadConfiguration(String xmlConfiguration) throws DataSourceException {
    ByteArrayInputStream baos = null;
    try {/*from w  w  w.ja v a  2  s.co  m*/
        xmlConfiguration = CarbonUtils.replaceSystemVariablesInXml(xmlConfiguration);
        JAXBContext ctx = JAXBContext.newInstance(MongoDataSourceConfiguration.class);
        baos = new ByteArrayInputStream(xmlConfiguration.getBytes());
        MongoDataSourceConfiguration fileConfig = (MongoDataSourceConfiguration) ctx.createUnmarshaller()
                .unmarshal(baos);
        MongoClient result = null;
        MongoClientOptions.Builder builder = MongoClientOptions.builder();
        if (fileConfig.getUrl() != null) {
            if (fileConfig.getSslInvalidHostNameAllowed() != null) {
                builder.sslInvalidHostNameAllowed(fileConfig.getSslInvalidHostNameAllowed());
            }
            MongoClientURI uri = new MongoClientURI(fileConfig.getUrl(), builder);
            result = new MongoClient(uri);
        } else {
            List<ServerAddress> addressList = new ArrayList<ServerAddress>();
            if (fileConfig.getReplicaSetConfig() != null) {
                ServerAddress address1 = new ServerAddress(fileConfig.getReplicaSetConfig().getHost1(),
                        Integer.parseInt(fileConfig.getReplicaSetConfig().getPort1()));
                addressList.add(address1);
                if (fileConfig.getReplicaSetConfig().getHost2() != null
                        && fileConfig.getReplicaSetConfig().getPort2() != null) {
                    ServerAddress address2 = new ServerAddress(fileConfig.getReplicaSetConfig().getHost2(),
                            Integer.parseInt(fileConfig.getReplicaSetConfig().getPort2()));
                    addressList.add(address2);
                }
                if (fileConfig.getReplicaSetConfig().getHost3() != null
                        && fileConfig.getReplicaSetConfig().getPort3() != null) {
                    ServerAddress address3 = new ServerAddress(fileConfig.getReplicaSetConfig().getHost3(),
                            Integer.parseInt(fileConfig.getReplicaSetConfig().getPort3()));
                    addressList.add(address3);
                }
            } else {
                ServerAddress address = new ServerAddress(fileConfig.getHost(),
                        Integer.parseInt(fileConfig.getPort()));
                addressList.add(address);
            }
            MongoCredential credential = null;
            if (fileConfig.getWithSSL() != null) {
                builder.sslEnabled(fileConfig.getWithSSL());
            }
            if (fileConfig.getSslInvalidHostNameAllowed() != null) {
                builder.sslInvalidHostNameAllowed(fileConfig.getSslInvalidHostNameAllowed());
            }
            if (fileConfig.getAuthenticationMethodEnum() != null && fileConfig.getUsername() != null) {
                credential = createCredentials(fileConfig);
            }
            if (credential != null) {
                result = new MongoClient(addressList, Arrays.asList(new MongoCredential[] { credential }),
                        builder.build());
            } else {
                result = new MongoClient(addressList, builder.build());
            }
        }
        return result;
    } catch (Exception e) {
        throw new DataSourceException("Error loading Mongo Datasource configuration: " + e.getMessage(), e);
    } finally {
        if (baos != null) {
            try {
                baos.close();
            } catch (IOException ignore) {
                // ignore
            }
        }
    }
}

From source file:org.wso2.extension.siddhi.store.mongodb.util.MongoTableUtils.java

License:Open Source License

/**
 * Utility method which can be used to create MongoClientOptionsBuilder from values defined in the
 * deployment yaml file./* ww w .j a va  2s.  c om*/
 *
 * @param storeAnnotation the source annotation which contains the needed parameters.
 * @param configReader    {@link ConfigReader} Configuration Reader
 * @return MongoClientOptions.Builder
 */
public static MongoClientOptions.Builder extractMongoClientOptionsBuilder(Annotation storeAnnotation,
        ConfigReader configReader) {

    MongoClientOptions.Builder mongoClientOptionsBuilder = MongoClientOptions.builder();
    try {
        mongoClientOptionsBuilder.connectionsPerHost(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.CONNECTIONS_PER_HOST, "100")));
        mongoClientOptionsBuilder.connectTimeout(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.CONNECT_TIMEOUT, "10000")));
        mongoClientOptionsBuilder.heartbeatConnectTimeout(Integer
                .parseInt(configReader.readConfig(MongoTableConstants.HEARTBEAT_CONNECT_TIMEOUT, "20000")));
        mongoClientOptionsBuilder.heartbeatSocketTimeout(Integer
                .parseInt(configReader.readConfig(MongoTableConstants.HEARTBEAT_SOCKET_TIMEOUT, "20000")));
        mongoClientOptionsBuilder.heartbeatFrequency(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.HEARTBEAT_FREQUENCY, "10000")));
        mongoClientOptionsBuilder.localThreshold(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.LOCAL_THRESHOLD, "15")));
        mongoClientOptionsBuilder.maxWaitTime(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.MAX_WAIT_TIME, "120000")));
        mongoClientOptionsBuilder.minConnectionsPerHost(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.MIN_CONNECTIONS_PER_HOST, "0")));
        mongoClientOptionsBuilder.minHeartbeatFrequency(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.MIN_HEARTBEAT_FREQUENCY, "500")));
        mongoClientOptionsBuilder.serverSelectionTimeout(Integer
                .parseInt(configReader.readConfig(MongoTableConstants.SERVER_SELECTION_TIMEOUT, "30000")));
        mongoClientOptionsBuilder.socketTimeout(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.SOCKET_TIMEOUT, "0")));
        mongoClientOptionsBuilder.threadsAllowedToBlockForConnectionMultiplier(
                Integer.parseInt(configReader.readConfig(MongoTableConstants.THREADS_ALLOWED_TO_BLOCK, "5")));
        mongoClientOptionsBuilder.socketKeepAlive(
                Boolean.parseBoolean(configReader.readConfig(MongoTableConstants.SOCKET_KEEP_ALIVE, "false")));
        mongoClientOptionsBuilder.sslEnabled(
                Boolean.parseBoolean(configReader.readConfig(MongoTableConstants.SSL_ENABLED, "false")));
        mongoClientOptionsBuilder.cursorFinalizerEnabled(Boolean
                .parseBoolean(configReader.readConfig(MongoTableConstants.CURSOR_FINALIZER_ENABLED, "true")));
        mongoClientOptionsBuilder.readPreference(ReadPreference
                .valueOf(configReader.readConfig(MongoTableConstants.READ_PREFERENCE, "primary")));
        mongoClientOptionsBuilder.writeConcern(WriteConcern
                .valueOf(configReader.readConfig(MongoTableConstants.WRITE_CONCERN, "acknowledged")));

        String readConcern = configReader.readConfig(MongoTableConstants.READ_CONCERN, "DEFAULT");
        if (!readConcern.matches("DEFAULT")) {
            mongoClientOptionsBuilder.readConcern(new ReadConcern(ReadConcernLevel.fromString(readConcern)));
        }

        int maxConnectionIdleTime = Integer
                .parseInt(configReader.readConfig(MongoTableConstants.MAX_CONNECTION_IDLE_TIME, "0"));
        if (maxConnectionIdleTime != 0) {
            mongoClientOptionsBuilder.maxConnectionIdleTime(maxConnectionIdleTime);
        }

        int maxConnectionLifeTime = Integer
                .parseInt(configReader.readConfig(MongoTableConstants.MAX_CONNECTION_LIFE_TIME, "0"));
        if (maxConnectionIdleTime != 0) {
            mongoClientOptionsBuilder.maxConnectionLifeTime(maxConnectionLifeTime);
        }

        String requiredReplicaSetName = configReader.readConfig(MongoTableConstants.REQUIRED_REPLICA_SET_NAME,
                "");
        if (!requiredReplicaSetName.equals("")) {
            mongoClientOptionsBuilder.requiredReplicaSetName(requiredReplicaSetName);
        }

        String applicationName = configReader.readConfig(MongoTableConstants.APPLICATION_NAME, "");
        if (!applicationName.equals("")) {
            mongoClientOptionsBuilder.applicationName(applicationName);
        }

        String secureConnectionEnabled = storeAnnotation
                .getElement(MongoTableConstants.ANNOTATION_ELEMENT_SECURE_CONNECTION);
        secureConnectionEnabled = secureConnectionEnabled == null ? "false" : secureConnectionEnabled;

        if (secureConnectionEnabled.equalsIgnoreCase("true")) {
            mongoClientOptionsBuilder.sslEnabled(true);
            String trustStore = storeAnnotation.getElement(MongoTableConstants.ANNOTATION_ELEMENT_TRUSTSTORE);
            trustStore = trustStore == null ? configReader.readConfig("trustStore", DEFAULT_TRUST_STORE_FILE)
                    : trustStore;
            trustStore = resolveCarbonHome(trustStore);

            String trustStorePassword = storeAnnotation
                    .getElement(MongoTableConstants.ANNOTATION_ELEMENT_TRUSTSTOREPASS);
            trustStorePassword = trustStorePassword == null
                    ? configReader.readConfig("trustStorePassword", DEFAULT_TRUST_STORE_PASSWORD)
                    : trustStorePassword;

            String keyStore = storeAnnotation.getElement(MongoTableConstants.ANNOTATION_ELEMENT_KEYSTORE);
            keyStore = keyStore == null ? configReader.readConfig("keyStore", DEFAULT_KEY_STORE_FILE)
                    : keyStore;
            keyStore = resolveCarbonHome(keyStore);

            String keyStorePassword = storeAnnotation
                    .getElement(MongoTableConstants.ANNOTATION_ELEMENT_STOREPASS);
            keyStorePassword = keyStorePassword == null
                    ? configReader.readConfig("keyStorePassword", DEFAULT_KEY_STORE_PASSWORD)
                    : keyStorePassword;

            mongoClientOptionsBuilder.socketFactory(MongoTableUtils.extractSocketFactory(trustStore,
                    trustStorePassword, keyStore, keyStorePassword));
        }
        return mongoClientOptionsBuilder;
    } catch (IllegalArgumentException e) {
        throw new MongoTableException("Values Read from config readers have illegal values : ", e);
    }
}