Class Keys.BuilderBase<BUILDER extends Keys.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Keys>

java.lang.Object
io.helidon.common.pki.Keys.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
Keys.Builder
Enclosing interface:
Keys

public abstract static class Keys.BuilderBase<BUILDER extends Keys.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Keys> extends Object implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for Keys.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(Keys prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(Keys.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface Prototype.ConfiguredBuilder<BUILDER extends Keys.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends Keys>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • clearKeystore

      public BUILDER clearKeystore()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • keystore

      public BUILDER keystore(KeystoreKeys keystore)
      Configure keys from a keystore. Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      keystore - keystore configuration
      Returns:
      updated builder instance
      See Also:
    • keystore

      public BUILDER keystore(Consumer<KeystoreKeys.Builder> consumer)
      Configure keys from a keystore. Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      consumer - keystore configuration
      Returns:
      updated builder instance
      See Also:
    • clearPem

      public BUILDER clearPem()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • pem

      public BUILDER pem(PemKeys pem)
      Configure keys from pem file(s). Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      pem - pem based definition
      Returns:
      updated builder instance
      See Also:
    • pem

      public BUILDER pem(Consumer<PemKeys.Builder> consumer)
      Configure keys from pem file(s). Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Parameters:
      consumer - pem based definition
      Returns:
      updated builder instance
      See Also:
    • clearPublicKey

      public BUILDER clearPublicKey()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • publicKey

      public BUILDER publicKey(PublicKey publicKey)
      The public key of this config if configured.
      Parameters:
      publicKey - the public key of this config or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearPrivateKey

      public BUILDER clearPrivateKey()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • privateKey

      public BUILDER privateKey(PrivateKey privateKey)
      The private key of this config if configured.
      Parameters:
      privateKey - the private key of this config or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearPublicCert

      public BUILDER clearPublicCert()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • publicCert

      public BUILDER publicCert(X509Certificate publicCert)
      The public X.509 Certificate if configured.
      Parameters:
      publicCert - the public certificate of this config or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • certChain

      public BUILDER certChain(List<? extends X509Certificate> certChain)
      The X.509 Certificate Chain.
      Parameters:
      certChain - the certificate chain or empty list if not configured
      Returns:
      updated builder instance
      See Also:
    • addCertChain

      public BUILDER addCertChain(List<? extends X509Certificate> certChain)
      The X.509 Certificate Chain.
      Parameters:
      certChain - the certificate chain or empty list if not configured
      Returns:
      updated builder instance
      See Also:
    • addCertChain

      public BUILDER addCertChain(X509Certificate certChain)
      The X.509 Certificate Chain.
      Parameters:
      certChain - the certificate chain or empty list if not configured
      Returns:
      updated builder instance
      See Also:
    • certs

      public BUILDER certs(List<? extends X509Certificate> certs)
      The X.509 Certificates.
      Parameters:
      certs - the certificates configured or empty list if none configured
      Returns:
      updated builder instance
      See Also:
    • addCerts

      public BUILDER addCerts(List<? extends X509Certificate> certs)
      The X.509 Certificates.
      Parameters:
      certs - the certificates configured or empty list if none configured
      Returns:
      updated builder instance
      See Also:
    • addCert

      public BUILDER addCert(X509Certificate cert)
      The X.509 Certificates.
      Parameters:
      cert - the certificates configured or empty list if none configured
      Returns:
      updated builder instance
      See Also:
    • keystore

      public Optional<KeystoreKeys> keystore()
      Configure keys from a keystore. Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Returns:
      the keystore
    • pem

      public Optional<PemKeys> pem()
      Configure keys from pem file(s). Once the config object is built, this option will ALWAYS be empty. All keys from the keystore will be populated to privateKey(), publicKey(), publicCert() etc.
      Returns:
      the pem
    • publicKey

      public Optional<PublicKey> publicKey()
      The public key of this config if configured.
      Returns:
      the public key
    • privateKey

      public Optional<PrivateKey> privateKey()
      The private key of this config if configured.
      Returns:
      the private key
    • publicCert

      public Optional<X509Certificate> publicCert()
      The public X.509 Certificate if configured.
      Returns:
      the public cert
    • certChain

      public List<X509Certificate> certChain()
      The X.509 Certificate Chain.
      Returns:
      the cert chain
    • certs

      public List<X509Certificate> certs()
      The X.509 Certificates.
      Returns:
      the certs
    • config

      public Optional<Config> config()
      If this instance was configured, this would be the config instance used.
      Returns:
      config node used to configure this builder, or empty if not configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.