Class ProviderEnvironment.Builder

java.lang.Object
org.wildfly.naming.client.ProviderEnvironment.Builder
Enclosing class:
ProviderEnvironment

public static final class ProviderEnvironment.Builder extends Object
The builder for ProviderEnvironment instances.
  • Constructor Details

    • Builder

      public Builder()
      Construct a new instance.
  • Method Details

    • addProviderUri

      public ProviderEnvironment.Builder addProviderUri(URI uri)
      Add a provider URL to the environment being built.
      Parameters:
      uri - the URI of the provider (must not be null)
      Returns:
      this builder
    • addProviderUris

      public ProviderEnvironment.Builder addProviderUris(Collection<URI> uris)
      Add a provider URL to the environment being built.
      Parameters:
      uris - the URIs of the provider(s) (must not be null or have null members)
      Returns:
      this builder
    • setAuthenticationContextSupplier

      public ProviderEnvironment.Builder setAuthenticationContextSupplier(Supplier<AuthenticationContext> authenticationContextSupplier)
      Set the authentication context supplier to use.
      Parameters:
      authenticationContextSupplier - the authentication context supplier to use (must not be null)
      Returns:
      this builder
    • populateFromEnvironment

      public ProviderEnvironment.Builder populateFromEnvironment(Map<String,?> environment) throws NamingException
      Populate this builder from the given JNDI environment map. The following information will be populated:
      • Provider URLs by reading standard and compatibility properties
      • Authentication information including:
        • Authentication name
        • Credential(s)
      Parameters:
      environment - the environment map (must not be null)
      Returns:
      this builder (populated from the map)
      Throws:
      ConfigurationException - if the given environment is invalid for some reason
      NamingException - if some other error occurred
    • build

      public ProviderEnvironment build()
      Build the provider environment from a point-in-time snapshot of the values in this builder.
      Returns:
      the new provider environment