Class SMPClientConfiguration

java.lang.Object
com.helger.smpclient.config.SMPClientConfiguration

@Immutable public final class SMPClientConfiguration extends Object
This class manages the configuration properties of the SMP client. The order of the properties file resolving is as follows:
  1. Check for the value of the system property peppol.smp.client.properties.path
  2. Check for the value of the system property smp.client.properties.path
  3. The filename private-smp-client.properties in the root of the classpath
  4. The filename smp-client.properties in the root of the classpath

Note: this class is also licensed under Apache 2 license, as it was not part of the original implementation

Author:
Philip Helger
  • Method Details

    • createSMPClientValueProvider

      @Nonnull public static com.helger.config.source.MultiConfigurationValueProvider createSMPClientValueProvider()
      Returns:
      The configuration value provider for SMP client that contains backward compatibility support.
    • getConfig

      @Nonnull public static com.helger.config.fallback.IConfigWithFallback getConfig()
      Returns:
      The current global configuration. Never null.
    • setConfig

      @Nonnull public static com.helger.config.fallback.IConfigWithFallback setConfig(@Nonnull com.helger.config.fallback.IConfigWithFallback aNewConfig)
      Overwrite the global configuration. This is only needed for testing.
      Parameters:
      aNewConfig - The configuration to use globally. May not be null.
      Returns:
      The old value of IConfig. Never null.
    • getTrustStoreType

      @Nonnull public static com.helger.security.keystore.EKeyStoreType getTrustStoreType()
      Returns:
      The truststore type as specified in the configuration file by the key truststore.type. If none is present PeppolKeyStoreHelper.TRUSTSTORE_TYPE is returned as a default.
      Since:
      6.0.0
    • getTrustStorePath

      @Nonnull public static String getTrustStorePath()
      Returns:
      The truststore location as specified in the configuration file by the key truststore.path. If none is present PeppolKeyStoreHelper.TRUSTSTORE_COMPLETE_CLASSPATH is returned as a default. Note: for backwards compatibility, also the key truststore.location is evaluated.
      Since:
      6.0.0 - was getTruststoreLocation before
    • getTrustStorePasswordCharArray

      @Nonnull public static char[] getTrustStorePasswordCharArray()
      Returns:
      The truststore password as specified in the configuration file by the key truststore.password. If none is present PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD is returned as a default.
    • loadTrustStore

      @Nullable public static KeyStore loadTrustStore()
      Try to load the configured trust store.
      Returns:
      null if it cannot be loaded.
      Since:
      8.1.1
    • getHttpProxy

      @Nullable public static org.apache.hc.core5.http.HttpHost getHttpProxy()
      Returns:
      The HttpProxy object to be used by SMP clients based on the Java System properties "http.proxyHost" and "http.proxyPort". Note: https is not needed, because SMPs must run on http only.
    • getHttpProxyCredentials

      @Nullable public static org.apache.hc.client5.http.auth.UsernamePasswordCredentials getHttpProxyCredentials()
      Returns:
      The UsernamePasswordCredentials object to be used for proxy server authentication.
      Since:
      5.2.5
    • getNonProxyHosts

      @Nullable public static String getNonProxyHosts()
      Returns:
      A pipe separated list of non-proxy hosts. E.g. localhost|127.0.0.1. May be null.
      Since:
      6.2.4
    • isUseDNSClientCache

      public static boolean isUseDNSClientCache()
      Get the content of the property "http.useDNSClientCache" or true if undefined.
      Returns:
      true if the SMP client should use DNS client caching (default) or false if DNS caching should be disabled. The default behavior is to return true.
      Since:
      5.2.5
    • getConnectTimeout

      @Nonnull public static org.apache.hc.core5.util.Timeout getConnectTimeout()
      Get the content of the property "http.connect.timeout.ms" or the default value.
      Returns:
      The connection timeout of the SMP client. Defaults to 5 seconds.
      Since:
      8.8.0
    • getResponseTimeout

      @Nonnull public static org.apache.hc.core5.util.Timeout getResponseTimeout()
      Get the content of the property "http.response.timeout.ms" or the default value. The fallback value is "http.request.timeout.ms".
      Returns:
      The response timeout of the SMP client. Defaults to 10 seconds.
      Since:
      8.8.0