public String buildSanitizedConnectionString()

in common/src/main/java/software/amazon/documentdb/jdbc/DocumentDbConnectionProperties.java [734:800]


    public String buildSanitizedConnectionString() {
        final String connectionStringTemplate = "//%s%s/%s%s";
        final String loginInfo = isNullOrWhitespace(getUser()) ? "" : getUser() + "@";
        final String hostInfo = isNullOrWhitespace(getHostname()) ? "" : getHostname();
        final String databaseInfo = isNullOrWhitespace(getDatabase()) ? "" : getDatabase();
        final StringBuilder optionalInfo = new StringBuilder();
        if (!getApplicationName()
                .equals(DocumentDbConnectionProperty.APPLICATION_NAME.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.APPLICATION_NAME, getApplicationName());
        }
        if (getLoginTimeout() != Integer.parseInt(DocumentDbConnectionProperty.LOGIN_TIMEOUT_SEC.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.LOGIN_TIMEOUT_SEC, getLoginTimeout());
        }
        if (getMetadataScanLimit() != Integer.parseInt(DocumentDbConnectionProperty.METADATA_SCAN_LIMIT.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.METADATA_SCAN_LIMIT, getMetadataScanLimit());
        }
        if (getMetadataScanMethod() != DocumentDbMetadataScanMethod.fromString(DocumentDbConnectionProperty.METADATA_SCAN_METHOD.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.METADATA_SCAN_METHOD, getMetadataScanMethod().getName());
        }
        if (getRetryReadsEnabled() != Boolean.parseBoolean(DocumentDbConnectionProperty.RETRY_READS_ENABLED.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.RETRY_READS_ENABLED, getRetryReadsEnabled());
        }
        if (getReadPreference() != null) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.READ_PREFERENCE, getReadPreference().getName());
        }
        if (getReplicaSet() != null) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.REPLICA_SET, getReplicaSet());
        }
        if (getTlsEnabled() != Boolean.parseBoolean(DocumentDbConnectionProperty.TLS_ENABLED.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.TLS_ENABLED, getTlsEnabled());
        }
        if (getTlsAllowInvalidHostnames() != Boolean.parseBoolean(DocumentDbConnectionProperty.TLS_ALLOW_INVALID_HOSTNAMES.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.TLS_ALLOW_INVALID_HOSTNAMES, getTlsAllowInvalidHostnames());
        }
        if (getTlsCAFilePath() != null) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.TLS_CA_FILE, getTlsCAFilePath());
        }
        if (!DocumentDbConnectionProperty.SCHEMA_NAME.getDefaultValue().equals(getSchemaName())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.SCHEMA_NAME, getSchemaName());
        }
        if (getSshUser() != null) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.SSH_USER, getSshUser());
        }
        if (getSshHostname() != null) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.SSH_HOSTNAME, getSshHostname());
        }
        if (getSshPrivateKeyFile() != null) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.SSH_PRIVATE_KEY_FILE, getSshPrivateKeyFile());
        }
        if (getSshStrictHostKeyChecking() != Boolean.parseBoolean(DocumentDbConnectionProperty.SSH_STRICT_HOST_KEY_CHECKING.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.SSH_STRICT_HOST_KEY_CHECKING, getSshStrictHostKeyChecking());
        }
        if (getSshKnownHostsFile() != null && !DocumentDbConnectionProperty.SSH_KNOWN_HOSTS_FILE.getDefaultValue().equals(getSshKnownHostsFile())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.SSH_KNOWN_HOSTS_FILE, getSshKnownHostsFile());
        }
        if (getDefaultFetchSize() != Integer.parseInt(DocumentDbConnectionProperty.DEFAULT_FETCH_SIZE.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.DEFAULT_FETCH_SIZE, getDefaultFetchSize());
        }
        if (getRefreshSchema() != Boolean.parseBoolean(DocumentDbConnectionProperty.REFRESH_SCHEMA.getDefaultValue())) {
            appendOption(optionalInfo, DocumentDbConnectionProperty.REFRESH_SCHEMA, getRefreshSchema());
        }
        return String.format(connectionStringTemplate,
                loginInfo,
                hostInfo,
                databaseInfo,
                optionalInfo);
    }