Interface NessieClientBuilder
- All Known Subinterfaces:
NessieHttpClientBuilder
- All Known Implementing Classes:
NessieClientBuilder.AbstractNessieClientBuilder,NessieHttpClientBuilder.AbstractNessieHttpClientBuilder,NessieHttpClientBuilderImpl
NessieApi builder interface.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classConvenience base class for implementations ofNessieClientBuilder. -
Method Summary
Modifier and TypeMethodDescription<I extends NessieClientBuilder>
IasInstanceOf(Class<I> builderInterfaceType) <API extends NessieApi>
APIBuilds a newNessieApi.static NessieClientBuildercreateClientBuilder(String clientName, String clientBuilderImpl) Returns the Nessie client builder that matches the requested client name or client builder implementation class.static NessieClientBuilderConstructs a client builder instance using config settings from Java system properties, process environment, Nessie client config file~/.config/nessie/nessie-client.properties, dot-env file~/.env.static NessieClientBuildercreateClientBuilderFromSystemSettings(NessieClientConfigSource mainConfigSource) fromConfig(Function<String, String> configuration) Configure this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants.Deprecated.name()The name of the Nessie client implementation, for exampleHTTPfor the HTTP/REST client.names()Client names supported by this implementation.intpriority()Priority ordinal used to select the most relevantNessieClientBuilderimplementation.withApiCompatibilityCheck(boolean enable) withAuthentication(NessieAuthentication authentication) Sets theNessieAuthenticationinstance to be used.withAuthenticationFromConfig(Function<String, String> configuration) Configure only authentication in this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants.withCancellationFuture(CompletionStage<?> cancellationFuture) Registers a future to cancel an ongoing, blocking client setup.withConnectionTimeout(int connectionTimeoutMillis) Sets the connect-timeout in milliseconds for remote requests.withDisableCompression(boolean disableCompression) Disables compression for remote requests.withReadTimeout(int readTimeoutMillis) Sets the read-timeout in milliseconds for remote requests.withSSLCertificateVerificationDisabled(boolean certificateVerificationDisabled) Optional, disables certificate verifications, if set totrue.withSSLContext(SSLContext sslContext) Optionally configure a specificSSLContext, currently only the Java 11+ accepts this option.withSSLParameters(SSLParameters sslParameters) Optionally configure specificSSLParameters.withTracing(boolean tracing) Convenience method forwithUri(URI)taking a string.Set the Nessie server URI.
-
Method Details
-
name
String name()The name of the Nessie client implementation, for exampleHTTPfor the HTTP/REST client. -
names
Client names supported by this implementation. -
priority
int priority()Priority ordinal used to select the most relevantNessieClientBuilderimplementation. -
asInstanceOf
-
withApiCompatibilityCheck
-
fromSystemProperties
Deprecated.UsefromConfig(Function)with config sources fromNessieClientConfigSources, preferablyNessieClientConfigSources.defaultConfigSources().Same semantics asfromConfig(Function), uses the system properties.- Returns:
this- See Also:
-
fromConfig
Configure this HttpClientBuilder 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:
-
withAuthenticationFromConfig
@CanIgnoreReturnValue NessieClientBuilder withAuthenticationFromConfig(Function<String, String> configuration) Configure only authentication in this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined inNessieConfigConstants.- Parameters:
configuration- The function that returns a configuration value for a configuration key.- Returns:
this- See Also:
-
withAuthentication
Sets theNessieAuthenticationinstance to be used.- Parameters:
authentication- authentication for this client- Returns:
this
-
withTracing
-
withUri
Set the Nessie server URI. A server URI must be configured.- Parameters:
uri- server URI- Returns:
this
-
withUri
Convenience method forwithUri(URI)taking a string.- Parameters:
uri- server URI- Returns:
this
-
withReadTimeout
Sets the read-timeout in milliseconds for remote requests. -
withConnectionTimeout
Sets the connect-timeout in milliseconds for remote requests. -
withDisableCompression
Disables compression for remote requests. -
withSSLCertificateVerificationDisabled
@CanIgnoreReturnValue NessieClientBuilder withSSLCertificateVerificationDisabled(boolean certificateVerificationDisabled) Optional, disables certificate verifications, if set totrue. Can be useful for testing purposes, not recommended for production systems. -
withSSLContext
Optionally configure a specificSSLContext, currently only the Java 11+ accepts this option. -
withSSLParameters
Optionally configure specificSSLParameters. -
withCancellationFuture
@CanIgnoreReturnValue NessieClientBuilder withCancellationFuture(CompletionStage<?> cancellationFuture) Registers a future to cancel an ongoing, blocking client setup.When using "blocking" authentication, for example OAuth2 device or code flows, is being used, users may want to cancel an ongoing authentication. An application can register a callback that can be called asynchronously, for example from a SIGINT handler.
To implement cancellation:
CompletableFuture<?> cancel = new CompletableFuture<>(); registerYourInterruptHandler(cancel::complete); NessieClientBuilder.createClientBuilderFromSystemSettings(...) .withCancellationFuture(cancel); -
build
Builds a newNessieApi.- Returns:
- A new
NessieApi.
-
createClientBuilderFromSystemSettings
Constructs a client builder instance using config settings from Java system properties, process environment, Nessie client config file~/.config/nessie/nessie-client.properties, dot-env file~/.env. -
createClientBuilderFromSystemSettings
static NessieClientBuilder createClientBuilderFromSystemSettings(NessieClientConfigSource mainConfigSource) -
createClientBuilder
@Nonnull @Nonnull static NessieClientBuilder createClientBuilder(String clientName, String clientBuilderImpl) Returns the Nessie client builder that matches the requested client name or client builder implementation class.Nessie clients are discovered using Java's
service loadermechanism.The selection mechanism uses the given
Nessie client nameor Nessie client builder implementation class name to select the client builder from the list of available implementations.If neither a name nor an implementation class are specified, aka both parameters are
null, the Nessie client builder with the highestpriority()will be returned.Either the name or the implementation class should be specified. Specifying both is discouraged.
- Parameters:
clientName- the name of the Nessie client, as returned bynames(), ornullclientBuilderImpl- the class that implements the Nessie client builder, ornull- Returns:
- Nessie client builder for the requested name or implementation class.
- Throws:
IllegalArgumentException- if no Nessie client matching the requested name and/or implementation class could be found
-
fromConfig(Function)with config sources fromNessieClientConfigSources, preferablyNessieClientConfigSources.defaultConfigSources().