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 interfaceConsumes an HTTPClient builder and applies it to client.static interfaceConsumes an URI and applies it to client. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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.static HttpClient.BuildercreateHttpClient(de.iip_ecosphere.platform.support.net.KeyStoreDescriptor desc) Creates a HTTP client builder from a keystore descriptor.static booleansetJdkHostnameVerification(boolean disable) Sets JDK HTTP/SSL hostname verification.static booleansetJdkHostnameVerification(de.iip_ecosphere.platform.support.net.KeyStoreDescriptor desc) Sets JDK HTTP/SSL hostname verification.
-
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 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
-
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 fromdescfails
-
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-truethe verification,falseenables it- Returns:
- the value of the flag before, by default
false
-