java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.common.Tools

public class Tools extends Object
Some common utilities, e.g., for client/server.
Author:
Holger Eichelberger, SSE
  • Constructor Details

    • Tools

      public Tools()
  • Method Details

    • createApi

      public static <A, C> A createApi(de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup, String uri, C client, Tools.HttpClientBuilderConsumer<C> builderConsumer, Tools.UriConsumer<C> uriConsumer, Tools.ApiProvider<A,C> apiProvider, Class<A> cls)
      Creates an API instance.
      Type Parameters:
      A - the API type
      C - the client type
      Parameters:
      setup - the component setup carrying endpoint, keystore, authentication
      uri - specific URI, may be null for endpoint
      builderConsumer - applies the configured HTTPClient builder to the client
      uriConsumer - applies the uri (either uri or endpoint to the client
      apiProvider - creates the API instance
      Returns:
      the API instance
    • createHttpClient

      public static HttpClient.Builder createHttpClient(de.iip_ecosphere.platform.support.net.KeyStoreDescriptor desc) throws IOException
      Creates a HTTP client builder from a keystore descriptor.
      Parameters:
      desc - the descriptor
      Returns:
      the client builder
      Throws:
      IOException - if creating the SSL/TSL context from desc fails
    • setJdkHostnameVerification

      public static boolean setJdkHostnameVerification(de.iip_ecosphere.platform.support.net.KeyStoreDescriptor desc)
      Sets JDK HTTP/SSL hostname verification.
      Parameters:
      desc - the keystore descriptor indicating whether verification is enabled or disabled
      Returns:
      the value of the flag before, by default false
    • setJdkHostnameVerification

      public static boolean setJdkHostnameVerification(boolean disable)
      Sets JDK HTTP/SSL hostname verification.
      Parameters:
      disable - true the verification, false enables it
      Returns:
      the value of the flag before, by default false