Class ClientConfigurator
java.lang.Object
com.databricks.jdbc.dbclient.impl.common.ClientConfigurator
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertNonProxyHostConfigToBeSystemPropertyCompliant(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.intfindAvailablePort(List<Integer> initialPorts) Finds the first available port from the provided list of ports.com.databricks.sdk.core.DatabricksConfigstatic PathgetTokenCachePath(String host, String clientId, List<String> scopes) Returns the path for the token cache file based on host, client ID, and scopes.com.databricks.sdk.WorkspaceClientvoidresetAccessTokenInConfig(String newAccessToken) voidSetup the PAT authentication settings in the databricks config.voidSetup the workspace authentication settings in the databricks config.voidSetup the OAuth M2M authentication settings in the databricks config.voidvoidSetup the OAuth authentication settings in the databricks config.voidsetupProxyConfig(com.databricks.sdk.core.commons.CommonsHttpClient.Builder httpClientBuilder) Setup proxy settings in the databricks config.voidSetup the OAuth U2M authentication settings in the databricks config.voidSetup the OAuth U2M refresh token authentication settings in the databricks config.
-
Constructor Details
-
ClientConfigurator
public ClientConfigurator(IDatabricksConnectionContext connectionContext) throws DatabricksSSLException - Throws:
DatabricksSSLException
-
-
Method Details
-
getTokenCachePath
Returns the path for the token cache file based on host, client ID, and scopes. This creates a unique cache path using a hash of these parameters.- Parameters:
host- The host URLclientId- The OAuth client IDscopes- The OAuth scopes- Returns:
- The path for the token cache file
-
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. -
setupOAuthConfig
Setup the OAuth authentication settings in the databricks config.- Throws:
DatabricksParsingException
-
setupU2MConfig
Setup the OAuth U2M authentication settings in the databricks config.- Throws:
DatabricksParsingException
-
findAvailablePort
Finds the first available port from the provided list of ports. If a single port is provided, it tries incremental ports (port, port+1, port+2, etc.) If multiple ports are provided, it tries each port in the list.- Parameters:
initialPorts- List of ports to try- Returns:
- The first available port
- Throws:
com.databricks.sdk.core.DatabricksException- if no available port is found
-
setupAccessTokenConfig
Setup the PAT authentication settings in the databricks config.- Throws:
DatabricksParsingException
-
setupOAuthAccessTokenConfig
- Throws:
DatabricksParsingException
-
resetAccessTokenInConfig
-
setupU2MRefreshConfig
Setup the OAuth U2M refresh token authentication settings in the databricks config.- Throws:
DatabricksParsingException
-
setupM2MConfig
Setup the OAuth M2M authentication settings in the databricks config.- Throws:
DatabricksParsingException
-
convertNonProxyHostConfigToBeSystemPropertyCompliant
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()
-