+ * Has sane defaults that match standard Weaviate deployment configuration: + *
+ * Usage: + * + *
{@code
+ * // Create a TrustManagerFactory to validate custom certificates.
+ * TrustManagerFactory tmf;
+ * try (var keys = new FileInputStream("/path/to/custom/truststore.p12")) {
+ * KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ * trustStore.load(myKeys, "secret-password".toCharArra());
+ *
+ * tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ * tmf.init(trustStore);
+ * }
+ *
+ * // Pass it to wcd -> wcd.trustManagerFactory(tmf)
+ * }
+ */
+ public WeaviateCloud trustManagerFactory(TrustManagerFactory tmf) {
+ return super.trustManagerFactory(tmf);
+ }
}
+ /** Configuration for custom Weaviate deployements. */
public static class Custom extends Builder+ * Usage: + * + *
{@code
+ * // Create a TrustManagerFactory to validate custom certificates.
+ * TrustManagerFactory tmf;
+ * try (var keys = new FileInputStream("/path/to/custom/truststore.p12")) {
+ * KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ * trustStore.load(myKeys, "secret-password".toCharArra());
+ *
+ * tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ * tmf.init(trustStore);
+ * }
+ *
+ * // Pass it to custom -> custom.trustManagerFactory(tmf)
+ * }
+ */
+ public Custom trustManagerFactory(TrustManagerFactory tmf) {
+ return super.trustManagerFactory(tmf);
+ }
}
}
diff --git a/src/main/java/io/weaviate/client6/v1/api/WeaviateClient.java b/src/main/java/io/weaviate/client6/v1/api/WeaviateClient.java
index 4fd1728f7..1e2127e22 100644
--- a/src/main/java/io/weaviate/client6/v1/api/WeaviateClient.java
+++ b/src/main/java/io/weaviate/client6/v1/api/WeaviateClient.java
@@ -28,32 +28,81 @@ public WeaviateClient(Config config) {
this.collections = new WeaviateCollectionsClient(restTransport, grpcTransport);
}
+ /**
+ * Create {@link WeaviateClientAsync} with identical configurations.
+ * It is a shorthand for:
+ *
+ * {@code
+ * var config = new Config(...);
+ * var client = new WeaviateClient(config);
+ * var async = new WeaviateClientAsync(config);
+ * }
+ *
+ * and as such, this does not manage or reuse resources (transport, gRPC
+ * channel, etc) used by the original client. Keep that in mind and make
+ * sure to close the original and async clients individually.
+ *
+ * + * Example: + * + *
{@code
+ * var client = WeaviateClient.local();
+ *
+ * // Need to make the next request non-blocking
+ * try (final var async = client.async()) {
+ * async.collections.create("Things");
+ * }
+ * // At this point only `async` resource has been auto-closed.
+ *
+ * client.close();
+ * }
+ *
+ *
+ * If you only intend to use {@link WeaviateClientAsync}, prefer creating it
+ * directly via one of its static factories:
+ *