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
  • Field Details

  • 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, Tools.ClientSupplier<C> clientSupplier, Tools.HttpClientBuilderConsumer<C> builderConsumer, Tools.UriConsumer<C> uriConsumer, Tools.ApiProvider<A,C> apiProvider)
      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
    • fromCache

      public static <A> A fromCache(de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup, String uri, Class<A> cls, Supplier<A> supplier)
      Fetches an API instance from the cache.
      Type Parameters:
      A - the API type
      Parameters:
      setup - the component setup carrying endpoint, keystore, authentication
      uri - specific URI, may be null for endpoint
      supplier - the API instance supplier
      Returns:
      the API instance
    • getApi

      public static <A, C> A getApi(de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup, String uri, Tools.ClientSupplier<C> client, Tools.HttpClientBuilderConsumer<C> builderConsumer, Tools.UriConsumer<C> uriConsumer, Tools.ApiProvider<A,C> apiProvider, Class<A> cls)
      Fetches an API instance from cache or creates it 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
      cls - the API class
      Returns:
      the API instance
    • clearCache

      public static void clearCache()
      Clears the cache. [testing]