All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.ydb.jdbc.settings.YdbConnectionProperties Maven / Gradle / Ivy

There is a newer version: 2.3.5
Show newest version
package tech.ydb.jdbc.settings;

import java.util.Map;
import java.util.Objects;

import javax.annotation.Nullable;

import tech.ydb.core.auth.StaticCredentials;


public class YdbConnectionProperties {
    private final String safeURL;
    private final String connectionString;
    private final String username;
    private final String password;
    private final Map, ParsedProperty> params;

    public YdbConnectionProperties(String safeURL, String connectionString, String username, String password,
                                   Map, ParsedProperty> params) {
        this.safeURL = safeURL;
        this.connectionString = Objects.requireNonNull(connectionString);
        this.username = username;
        this.password = password;
        this.params = Objects.requireNonNull(params);
    }

    public String getSafeUrl() {
        return safeURL;
    }

    public String getConnectionString() {
        return connectionString;
    }

    @Nullable
    public ParsedProperty getProperty(YdbConnectionProperty property) {
        return params.get(property);
    }

    public Map, ParsedProperty> getParams() {
        return params;
    }

    public boolean hasStaticCredentials() {
        return username != null && !username.isEmpty();
    }

    public StaticCredentials getStaticCredentials() {
        return new StaticCredentials(username, password);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy