Class ClientConfigurator


  • public class ClientConfigurator
    extends Object
    This class is responsible for configuring the Databricks config based on the connection context. The databricks config is then used to create the SDK or Thrift client.
    • Method Detail

      • getConnectionSocketFactoryRegistry

        public static org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> getConnectionSocketFactoryRegistry​(IDatabricksConnectionContext connectionContext)
        This function returns the registry of connection socket factories based on the truststore and properties set in the connection context.
        Parameters:
        connectionContext - The connection context to use to get the truststore, certificate revocation settings.
        Returns:
        The registry of connection socket factories.
      • loadTruststoreOrNull

        public static KeyStore loadTruststoreOrNull​(IDatabricksConnectionContext connectionContext)
        Parameters:
        connectionContext - The connection context to use to get the truststore.
        Returns:
        The truststore loaded from the connection context or null if the truststore is not set.
      • buildTrustManagerParameters

        public static CertPathTrustManagerParameters buildTrustManagerParameters​(Set<TrustAnchor> trustAnchors,
                                                                                 boolean checkCertificateRevocation,
                                                                                 boolean acceptUndeterminedCertificateRevocation)
        Parameters:
        trustAnchors - The trust anchors to use in the trust manager.
        checkCertificateRevocation - Whether to check certificate revocation.
        acceptUndeterminedCertificateRevocation - Whether to accept undetermined certificate
        Returns:
        The trust manager parameters based on the input parameters.
      • getTrustAnchorsFromTrustStore

        public static Set<TrustAnchor> getTrustAnchorsFromTrustStore​(KeyStore trustStore)
        Parameters:
        trustStore - The trust store from which to get the trust anchors.
        Returns:
        The set of trust anchors from the trust store.
      • setupProxyConfig

        public void setupProxyConfig​(com.databricks.sdk.core.commons.CommonsHttpClient.Builder httpClientBuilder)
        Setup proxy settings in the databricks config.
      • getWorkspaceClient

        public com.databricks.sdk.WorkspaceClient getWorkspaceClient()
      • setupAuthConfig

        public void setupAuthConfig()
        Setup the workspace authentication settings in the databricks config.
      • resetAccessTokenInConfig

        public void resetAccessTokenInConfig​(String newAccessToken)
      • convertNonProxyHostConfigToBeSystemPropertyCompliant

        public static String convertNonProxyHostConfigToBeSystemPropertyCompliant​(String nonProxyHosts)
        Currently, the ODBC driver takes in nonProxyHosts as a comma separated list of suffix of non-proxy hosts i.e. suffix1|suffix2|suffix3. Whereas, the SDK takes in nonProxyHosts as a list of patterns separated by '|'. This pattern conforms to the system property format in the Java Proxy Guide.
        Parameters:
        nonProxyHosts - Comma separated list of suffix of non-proxy hosts
        Returns:
        nonProxyHosts in system property compliant format from Java Proxy Guide
      • getDatabricksConfig

        public com.databricks.sdk.core.DatabricksConfig getDatabricksConfig()