Class Tools
java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.common.Tools
Some common utilities, e.g., for client/server.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceConsumes a client and creates for it an API instance.static interfaceCreates a client instance.static interfaceConsumes an HTTPClient builder and applies it to client.static interfaceConsumes an URI and applies it to client. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears the cache.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.static <A> AfromCache(de.iip_ecosphere.platform.support.aas.SetupSpec.ComponentSetup setup, String uri, Class<A> cls, Supplier<A> supplier) Fetches an API instance from the cache.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.
-
Field Details
-
cache
-
-
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 typeC- the client type- Parameters:
setup- the component setup carrying endpoint, keystore, authenticationuri- specific URI, may be null forendpointbuilderConsumer- applies the configured HTTPClient builder to the clienturiConsumer- applies the uri (eitheruriorendpointto the clientapiProvider- 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, authenticationuri- specific URI, may be null forendpointsupplier- 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 typeC- the client type- Parameters:
setup- the component setup carrying endpoint, keystore, authenticationuri- specific URI, may be null forendpointbuilderConsumer- applies the configured HTTPClient builder to the clienturiConsumer- applies the uri (eitheruriorendpointto the clientapiProvider- creates the API instancecls- the API class- Returns:
- the API instance
-
clearCache
public static void clearCache()Clears the cache. [testing]
-