Package org.projectnessie.client
Class NessieClient.Builder
- java.lang.Object
-
- org.projectnessie.client.NessieClient.Builder
-
- Enclosing interface:
- NessieClient
public static class NessieClient.Builder extends Object
Builder to configure a newNessieClient. Currently, theNessieClient.Builderis only capable of building aNessieClientfor HTTP, but that may change.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NessieClientbuild()Build a newNessieClient.NessieClient.BuilderfromConfig(Function<String,String> configuration)Configure this builder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants.NessieClient.BuilderfromSystemProperties()Same semantics asfromConfig(Function), uses the system properties.NessieClient.BuilderwithAuthType(NessieClient.AuthType authType)Set the authentication type.NessieClient.BuilderwithConnectionTimeout(int connectionTimeoutMillis)Set the connection timeout in milliseconds for this client.NessieClient.BuilderwithPassword(String password)Set the password forNessieClient.AuthType.BASICauthentication.NessieClient.BuilderwithReadTimeout(int readTimeoutMillis)Set the read timeout in milliseconds for this client.NessieClient.BuilderwithTracing(boolean tracing)Whether to enable adding the HTTP headers of an active OpenTracing span to all Nessie requests.NessieClient.BuilderwithUri(String uri)Convenience method forwithUri(URI)taking a string.NessieClient.BuilderwithUri(URI uri)Set the Nessie server URI.NessieClient.BuilderwithUsername(String username)Set the username forNessieClient.AuthType.BASICauthentication.
-
-
-
Method Detail
-
fromSystemProperties
public NessieClient.Builder fromSystemProperties()
Same semantics asfromConfig(Function), uses the system properties.- Returns:
this- See Also:
fromConfig(Function)
-
fromConfig
public NessieClient.Builder fromConfig(Function<String,String> configuration)
Configure this builder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants. Non-nullvalues returned by theconfiguration-function will override previously configured values.- Parameters:
configuration- The function that returns a configuration value for a configuration key.- Returns:
this- See Also:
fromSystemProperties()
-
withAuthType
public NessieClient.Builder withAuthType(NessieClient.AuthType authType)
Set the authentication type. Default isNessieClient.AuthType.NONE.- Parameters:
authType- new auth-type- Returns:
this
-
withUri
public NessieClient.Builder withUri(URI uri)
Set the Nessie server URI. A server URI must be configured.- Parameters:
uri- server URI- Returns:
this
-
withUri
public NessieClient.Builder withUri(String uri)
Convenience method forwithUri(URI)taking a string.- Parameters:
uri- server URI- Returns:
this
-
withUsername
public NessieClient.Builder withUsername(String username)
Set the username forNessieClient.AuthType.BASICauthentication.- Parameters:
username- username- Returns:
this
-
withPassword
public NessieClient.Builder withPassword(String password)
Set the password forNessieClient.AuthType.BASICauthentication.- Parameters:
password- password- Returns:
this
-
withTracing
public NessieClient.Builder withTracing(boolean tracing)
Whether to enable adding the HTTP headers of an active OpenTracing span to all Nessie requests. If enabled, the OpenTracing dependencies must be present at runtime.- Parameters:
tracing-trueto enable passing HTTP headers for active tracing spans.- Returns:
this
-
withReadTimeout
public NessieClient.Builder withReadTimeout(int readTimeoutMillis)
Set the read timeout in milliseconds for this client. Timeout will throwHttpClientReadTimeoutException.- Parameters:
readTimeoutMillis- number of seconds to wait for a response from server.- Returns:
this
-
withConnectionTimeout
public NessieClient.Builder withConnectionTimeout(int connectionTimeoutMillis)
Set the connection timeout in milliseconds for this client. Timeout will throwHttpClientException.- Parameters:
connectionTimeoutMillis- number of seconds to wait to connect to the server.- Returns:
this
-
build
public NessieClient build()
Build a newNessieClient.- Returns:
- new
NessieClient
-
-