Interface NessieClientBuilder

All Known Subinterfaces:
NessieHttpClientBuilder
All Known Implementing Classes:
NessieClientBuilder.AbstractNessieClientBuilder, NessieHttpClientBuilder.AbstractNessieHttpClientBuilder, NessieHttpClientBuilderImpl

public interface NessieClientBuilder
NessieApi builder interface.
  • Method Details

    • name

      String name()
      The name of the Nessie client implementation, for example HTTP for the HTTP/REST client.
    • names

      default Set<String> names()
      Client names supported by this implementation.
    • priority

      int priority()
      Priority ordinal used to select the most relevant NessieClientBuilder implementation.
    • asInstanceOf

      <I extends NessieClientBuilder> I asInstanceOf(Class<I> builderInterfaceType)
    • withApiCompatibilityCheck

      @CanIgnoreReturnValue NessieClientBuilder withApiCompatibilityCheck(boolean enable)
    • fromSystemProperties

      @CanIgnoreReturnValue @Deprecated NessieClientBuilder fromSystemProperties()
      Same semantics as fromConfig(Function), uses the system properties.
      Returns:
      this
      See Also:
    • fromConfig

      @CanIgnoreReturnValue NessieClientBuilder fromConfig(Function<String,String> configuration)
      Configure this HttpClientBuilder instance using a configuration object and standard Nessie configuration keys defined by the constants defined in NessieConfigConstants. Non-null values returned by the configuration-function will override previously configured values.

      Calls withAuthenticationFromConfig(Function).

      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 in NessieConfigConstants.
      Parameters:
      configuration - The function that returns a configuration value for a configuration key.
      Returns:
      this
      See Also:
    • withAuthentication

      @CanIgnoreReturnValue NessieClientBuilder withAuthentication(NessieAuthentication authentication)
      Sets the NessieAuthentication instance to be used.
      Parameters:
      authentication - authentication for this client
      Returns:
      this
    • withTracing

      @CanIgnoreReturnValue NessieClientBuilder withTracing(boolean tracing)
    • withUri

      @CanIgnoreReturnValue NessieClientBuilder withUri(URI uri)
      Set the Nessie server URI. A server URI must be configured.
      Parameters:
      uri - server URI
      Returns:
      this
    • withUri

      @CanIgnoreReturnValue NessieClientBuilder withUri(String uri)
      Convenience method for withUri(URI) taking a string.
      Parameters:
      uri - server URI
      Returns:
      this
    • withReadTimeout

      @CanIgnoreReturnValue NessieClientBuilder withReadTimeout(int readTimeoutMillis)
      Sets the read-timeout in milliseconds for remote requests.
    • withConnectionTimeout

      @CanIgnoreReturnValue NessieClientBuilder withConnectionTimeout(int connectionTimeoutMillis)
      Sets the connect-timeout in milliseconds for remote requests.
    • withDisableCompression

      @CanIgnoreReturnValue NessieClientBuilder withDisableCompression(boolean disableCompression)
      Disables compression for remote requests.
    • withSSLCertificateVerificationDisabled

      @CanIgnoreReturnValue NessieClientBuilder withSSLCertificateVerificationDisabled(boolean certificateVerificationDisabled)
      Optional, disables certificate verifications, if set to true. Can be useful for testing purposes, not recommended for production systems.
    • withSSLContext

      @CanIgnoreReturnValue NessieClientBuilder withSSLContext(SSLContext sslContext)
      Optionally configure a specific SSLContext, currently only the Java 11+ accepts this option.
    • withSSLParameters

      @CanIgnoreReturnValue NessieClientBuilder withSSLParameters(SSLParameters sslParameters)
      Optionally configure specific SSLParameters.
    • withHttpHeader

      @CanIgnoreReturnValue NessieClientBuilder withHttpHeader(String header, String value)
      Optionally configure additional HTTP headers.
      Parameters:
      header - header name
      value - header value
    • 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

      <API extends NessieApi> API build(Class<API> apiContract)
      Builds a new NessieApi.
      Returns:
      A new NessieApi.
    • createClientBuilderFromSystemSettings

      static NessieClientBuilder 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 loader mechanism.

      The selection mechanism uses the given Nessie client name or 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 highest priority() 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 by names(), or null
      clientBuilderImpl - the class that implements the Nessie client builder, or null
      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