diff --git a/elx-api/build.gradle b/elx-api/build.gradle index ae40999..93445e2 100644 --- a/elx-api/build.gradle +++ b/elx-api/build.gradle @@ -4,4 +4,16 @@ dependencies { // override old artifacts in ES x-content. We must use jackson smile/cbor/yaml and log4j2 api here. api libs.jackson api libs.log4j.api + // add dependencies which are not managed by elasticsearch as a runtime dependency. + // So, groovy grapes can load and run smoothly the elx client. + implementation libs.lucene + implementation libs.lucene.analyzers.common + implementation libs.lucene.highlighter + implementation libs.lucene.join + implementation libs.lucene.queryparser + implementation libs.lucene.grouping + implementation libs.lucene.misc + implementation libs.hppc + implementation libs.joda + implementation libs.tdigest } diff --git a/elx-api/src/main/java/org/xbib/elx/api/AdminClientProvider.java b/elx-api/src/main/java/org/xbib/elx/api/AdminClientProvider.java index 954efd5..7ef2b5c 100644 --- a/elx-api/src/main/java/org/xbib/elx/api/AdminClientProvider.java +++ b/elx-api/src/main/java/org/xbib/elx/api/AdminClientProvider.java @@ -3,5 +3,5 @@ package org.xbib.elx.api; @FunctionalInterface public interface AdminClientProvider { - C getClient(); + C getClient(ClassLoader classLoader); } diff --git a/elx-api/src/main/java/org/xbib/elx/api/BulkClientProvider.java b/elx-api/src/main/java/org/xbib/elx/api/BulkClientProvider.java index 0f013e2..b86f53c 100644 --- a/elx-api/src/main/java/org/xbib/elx/api/BulkClientProvider.java +++ b/elx-api/src/main/java/org/xbib/elx/api/BulkClientProvider.java @@ -3,5 +3,5 @@ package org.xbib.elx.api; @FunctionalInterface public interface BulkClientProvider { - C getClient(); + C getClient(ClassLoader classLoader); } diff --git a/elx-api/src/main/java/org/xbib/elx/api/SearchClientProvider.java b/elx-api/src/main/java/org/xbib/elx/api/SearchClientProvider.java index 23bfb07..eb4ac61 100644 --- a/elx-api/src/main/java/org/xbib/elx/api/SearchClientProvider.java +++ b/elx-api/src/main/java/org/xbib/elx/api/SearchClientProvider.java @@ -3,5 +3,5 @@ package org.xbib.elx.api; @FunctionalInterface public interface SearchClientProvider { - C getClient(); + C getClient(ClassLoader classLoader); } diff --git a/elx-common/src/main/java/org/xbib/elx/common/ClientBuilder.java b/elx-common/src/main/java/org/xbib/elx/common/ClientBuilder.java index 5214dc7..9c07cd8 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/ClientBuilder.java +++ b/elx-common/src/main/java/org/xbib/elx/common/ClientBuilder.java @@ -24,10 +24,10 @@ public class ClientBuilder { private final ElasticsearchClient client; - private final ClassLoader classLoader; - private final Settings.Builder settingsBuilder; + private ClassLoader classLoader; + private Class adminClientProvider; private Class bulkClientProvider; @@ -39,12 +39,7 @@ public class ClientBuilder { } public ClientBuilder(ElasticsearchClient client) { - this(client, ClassLoader.getSystemClassLoader()); - } - - public ClientBuilder(ElasticsearchClient client, ClassLoader classLoader) { this.client = client; - this.classLoader = classLoader; this.settingsBuilder = Settings.builder(); settingsBuilder.put("node.name", "elx-client-" + Version.CURRENT); for (Parameters p : Parameters.values()) { @@ -68,6 +63,11 @@ public class ClientBuilder { return new ClientBuilder(client); } + public ClientBuilder setClassLoader(ClassLoader classLoader) { + this.classLoader = classLoader; + return this; + } + public ClientBuilder setAdminClientProvider(Class adminClientProvider) { this.adminClientProvider = adminClientProvider; return this; @@ -148,7 +148,7 @@ public class ClientBuilder { if (adminClientProvider != null) { for (AdminClientProvider provider : ServiceLoader.load(AdminClientProvider.class, classLoader)) { if (provider.getClass().isAssignableFrom(adminClientProvider)) { - C c = (C) provider.getClient(); + C c = (C) provider.getClient(classLoader); c.setClient(client); c.init(settings, null); return c; @@ -158,7 +158,7 @@ public class ClientBuilder { if (bulkClientProvider != null) { for (BulkClientProvider provider : ServiceLoader.load(BulkClientProvider.class, classLoader)) { if (provider.getClass().isAssignableFrom(bulkClientProvider)) { - C c = (C) provider.getClient(); + C c = (C) provider.getClient(classLoader); c.setClient(client); c.init(settings, null); return c; @@ -168,7 +168,7 @@ public class ClientBuilder { if (searchClientProvider != null) { for (SearchClientProvider provider : ServiceLoader.load(SearchClientProvider.class, classLoader)) { if (provider.getClass().isAssignableFrom(searchClientProvider)) { - C c = (C) provider.getClient(); + C c = (C) provider.getClient(classLoader); c.setClient(client); c.init(settings, null); return c; diff --git a/elx-common/src/main/java/org/xbib/elx/common/DefaultIndexDefinition.java b/elx-common/src/main/java/org/xbib/elx/common/DefaultIndexDefinition.java index a9d2b12..078bc21 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/DefaultIndexDefinition.java +++ b/elx-common/src/main/java/org/xbib/elx/common/DefaultIndexDefinition.java @@ -73,7 +73,7 @@ public class DefaultIndexDefinition implements IndexDefinition { setEnabled(true); } - public DefaultIndexDefinition(AdminClient adminClient, String index, String type, Settings settings) + public DefaultIndexDefinition(AdminClient adminClient, String index, String type, Settings settings, ClassLoader classLoader) throws IOException { String indexName = settings.get("name", index); String indexType = settings.get("type", type); @@ -92,8 +92,8 @@ public class DefaultIndexDefinition implements IndexDefinition { setStopBulkRefreshSeconds(settings.getAsInt(Parameters.BULK_STOP_REFRESH_SECONDS.getName(), Parameters.BULK_STOP_REFRESH_SECONDS.getInteger())); if (settings.get("settings") != null && settings.get("mapping") != null) { - setSettings(findSettingsFrom(settings.get("settings"))); - setMappings(findMappingsFrom(settings.get("mapping"))); + setSettings(findSettingsFrom(settings.get("settings"), classLoader)); + setMappings(findMappingsFrom(settings.get("mapping"), classLoader)); } boolean shift = settings.getAsBoolean("shift", false); setShift(shift); @@ -307,13 +307,14 @@ public class DefaultIndexDefinition implements IndexDefinition { public int getMinToKeep() { return minToKeep; } - private static String findSettingsFrom(String string) throws IOException { + + private static String findSettingsFrom(String string, ClassLoader classLoader) throws IOException { if (string == null) { return null; } try { XContentBuilder builder = JsonXContent.contentBuilder(); - try (InputStream inputStream = findInputStream(string)) { + try (InputStream inputStream = findInputStream(string, classLoader)) { if (inputStream != null) { Settings settings = Settings.builder().loadFromStream(string, inputStream, true).build(); builder.startObject(); @@ -329,13 +330,13 @@ public class DefaultIndexDefinition implements IndexDefinition { } } - private static String findMappingsFrom(String string) throws IOException { + private static String findMappingsFrom(String string, ClassLoader classLoader) throws IOException { if (string == null) { return null; } try { XContentBuilder builder = JsonXContent.contentBuilder(); - try (InputStream inputStream = findInputStream(string)) { + try (InputStream inputStream = findInputStream(string, classLoader)) { if (inputStream != null) { if (string.endsWith(".json")) { Map mappings = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY, @@ -357,12 +358,12 @@ public class DefaultIndexDefinition implements IndexDefinition { } } - private static InputStream findInputStream(String string) { + private static InputStream findInputStream(String string, ClassLoader classLoader) { if (string == null) { return null; } try { - URL url = ClassLoader.getSystemClassLoader().getResource(string); + URL url = classLoader.getResource(string); if (url == null) { url = new URL(string); } diff --git a/elx-common/src/main/java/org/xbib/elx/common/MockAdminClientProvider.java b/elx-common/src/main/java/org/xbib/elx/common/MockAdminClientProvider.java index ca1917b..348b0c7 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/MockAdminClientProvider.java +++ b/elx-common/src/main/java/org/xbib/elx/common/MockAdminClientProvider.java @@ -3,8 +3,9 @@ package org.xbib.elx.common; import org.xbib.elx.api.AdminClientProvider; public class MockAdminClientProvider implements AdminClientProvider { + @Override - public MockAdminClient getClient() { + public MockAdminClient getClient(ClassLoader classLoader) { return new MockAdminClient(); } } diff --git a/elx-common/src/main/java/org/xbib/elx/common/MockBulkClientProvider.java b/elx-common/src/main/java/org/xbib/elx/common/MockBulkClientProvider.java index 93e032d..3ea70d2 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/MockBulkClientProvider.java +++ b/elx-common/src/main/java/org/xbib/elx/common/MockBulkClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider; public class MockBulkClientProvider implements BulkClientProvider { @Override - public MockBulkClient getClient() { + public MockBulkClient getClient(ClassLoader classLoader) { return new MockBulkClient(); } } diff --git a/elx-common/src/main/java/org/xbib/elx/common/MockSearchClientProvider.java b/elx-common/src/main/java/org/xbib/elx/common/MockSearchClientProvider.java index c943fb4..bcdcd3b 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/MockSearchClientProvider.java +++ b/elx-common/src/main/java/org/xbib/elx/common/MockSearchClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider; public class MockSearchClientProvider implements SearchClientProvider { @Override - public MockSearchClient getClient() { + public MockSearchClient getClient(ClassLoader classLoader) { return new MockSearchClient(); } } diff --git a/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClient.java b/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClient.java index 4f3c203..9b1379d 100644 --- a/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClient.java +++ b/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClient.java @@ -17,9 +17,9 @@ public class HttpAdminClient extends AbstractAdminClient implements Elasticsearc private final HttpClientHelper helper; - public HttpAdminClient() { + public HttpAdminClient(ClassLoader classLoader) { super(); - this.helper = new HttpClientHelper(); + this.helper = new HttpClientHelper(classLoader); } @Override diff --git a/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClientProvider.java b/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClientProvider.java index b544ea9..51223a6 100644 --- a/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClientProvider.java +++ b/elx-http/src/main/java/org/xbib/elx/http/HttpAdminClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.AdminClientProvider; public class HttpAdminClientProvider implements AdminClientProvider { @Override - public HttpAdminClient getClient() { - return new HttpAdminClient(); + public HttpAdminClient getClient(ClassLoader classLoader) { + return new HttpAdminClient(classLoader); } } diff --git a/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClient.java b/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClient.java index 0aae56b..c5c503f 100644 --- a/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClient.java +++ b/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClient.java @@ -17,9 +17,9 @@ public class HttpBulkClient extends AbstractBulkClient implements ElasticsearchC private final HttpClientHelper helper; - public HttpBulkClient() { + public HttpBulkClient(ClassLoader classLoader) { super(); - this.helper = new HttpClientHelper(); + this.helper = new HttpClientHelper(classLoader); } @Override diff --git a/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClientProvider.java b/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClientProvider.java index cbf1945..e6cf51e 100644 --- a/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClientProvider.java +++ b/elx-http/src/main/java/org/xbib/elx/http/HttpBulkClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider; public class HttpBulkClientProvider implements BulkClientProvider { @Override - public HttpBulkClient getClient() { - return new HttpBulkClient(); + public HttpBulkClient getClient(ClassLoader classLoader) { + return new HttpBulkClient(classLoader); } } diff --git a/elx-http/src/main/java/org/xbib/elx/http/HttpClientHelper.java b/elx-http/src/main/java/org/xbib/elx/http/HttpClientHelper.java index 6310d31..552ecb8 100644 --- a/elx-http/src/main/java/org/xbib/elx/http/HttpClientHelper.java +++ b/elx-http/src/main/java/org/xbib/elx/http/HttpClientHelper.java @@ -50,15 +50,15 @@ public class HttpClientHelper { private final AtomicBoolean closed; - public HttpClientHelper() { - this(Collections.emptyList(), Thread.currentThread().getContextClassLoader()); + public HttpClientHelper(ClassLoader classLoader) { + this(Collections.emptyList(), classLoader); } public HttpClientHelper(List namedXContentEntries, ClassLoader classLoader) { this.registry = new NamedXContentRegistry(Stream.of(getNamedXContents().stream(), namedXContentEntries.stream()).flatMap(Function.identity()).collect(Collectors.toList())); - this.classLoader = classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader(); + this.classLoader = classLoader; this.actionMap = new HashMap<>(); this.closed = new AtomicBoolean(); } diff --git a/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClient.java b/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClient.java index 28e494d..3d523cb 100644 --- a/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClient.java +++ b/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClient.java @@ -17,9 +17,9 @@ public class HttpSearchClient extends AbstractSearchClient implements Elasticsea private final HttpClientHelper helper; - public HttpSearchClient() { + public HttpSearchClient(ClassLoader classLoader) { super(); - this.helper = new HttpClientHelper(); + this.helper = new HttpClientHelper(classLoader); } @Override diff --git a/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClientProvider.java b/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClientProvider.java index 9103c1a..664870f 100644 --- a/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClientProvider.java +++ b/elx-http/src/main/java/org/xbib/elx/http/HttpSearchClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider; public class HttpSearchClientProvider implements SearchClientProvider { @Override - public HttpSearchClient getClient() { - return new HttpSearchClient(); + public HttpSearchClient getClient(ClassLoader classLoader) { + return new HttpSearchClient(classLoader); } } diff --git a/elx-http/src/test/java/org/xbib/elx/http/test/SmokeTest.java b/elx-http/src/test/java/org/xbib/elx/http/test/SmokeTest.java index 9fd2043..45ee95b 100644 --- a/elx-http/src/test/java/org/xbib/elx/http/test/SmokeTest.java +++ b/elx-http/src/test/java/org/xbib/elx/http/test/SmokeTest.java @@ -44,7 +44,7 @@ class SmokeTest { .put(helper.getClientSettings()) .build()) { IndexDefinition indexDefinition = - new DefaultIndexDefinition(adminClient, "test_smoke", "doc", Settings.EMPTY); + new DefaultIndexDefinition(adminClient, "test_smoke", "doc", Settings.EMPTY, getClass().getClassLoader()); assertEquals(1, indexDefinition.getReplicaCount()); assertEquals(helper.getClusterName(), adminClient.getClusterName()); bulkClient.newIndex(indexDefinition); diff --git a/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClient.java b/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClient.java index 772924a..9659821 100644 --- a/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClient.java +++ b/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClient.java @@ -8,7 +8,7 @@ public class NodeAdminClient extends AbstractAdminClient { private final NodeClientHelper helper; - public NodeAdminClient() { + public NodeAdminClient(ClassLoader classLoader) { super(); this.helper = new NodeClientHelper(); } diff --git a/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClientProvider.java b/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClientProvider.java index ec949e0..5a3f570 100644 --- a/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClientProvider.java +++ b/elx-node/src/main/java/org/xbib/elx/node/NodeAdminClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.AdminClientProvider; public class NodeAdminClientProvider implements AdminClientProvider { @Override - public NodeAdminClient getClient() { - return new NodeAdminClient(); + public NodeAdminClient getClient(ClassLoader classLoader) { + return new NodeAdminClient(classLoader); } } diff --git a/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClient.java b/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClient.java index 3e74426..6dc4541 100644 --- a/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClient.java +++ b/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClient.java @@ -8,7 +8,7 @@ public class NodeBulkClient extends AbstractBulkClient { private final NodeClientHelper helper; - public NodeBulkClient() { + public NodeBulkClient(ClassLoader classLoader) { super(); this.helper = new NodeClientHelper(); } diff --git a/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClientProvider.java b/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClientProvider.java index f40a021..23a9251 100644 --- a/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClientProvider.java +++ b/elx-node/src/main/java/org/xbib/elx/node/NodeBulkClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider; public class NodeBulkClientProvider implements BulkClientProvider { @Override - public NodeBulkClient getClient() { - return new NodeBulkClient(); + public NodeBulkClient getClient(ClassLoader classLoader) { + return new NodeBulkClient(classLoader); } } diff --git a/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClient.java b/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClient.java index 3269e22..eb71dbe 100644 --- a/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClient.java +++ b/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClient.java @@ -8,7 +8,7 @@ public class NodeSearchClient extends AbstractSearchClient { private final NodeClientHelper helper; - public NodeSearchClient() { + public NodeSearchClient(ClassLoader classLoader) { super(); this.helper = new NodeClientHelper(); } diff --git a/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClientProvider.java b/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClientProvider.java index 233c2a4..33098fe 100644 --- a/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClientProvider.java +++ b/elx-node/src/main/java/org/xbib/elx/node/NodeSearchClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider; public class NodeSearchClientProvider implements SearchClientProvider { @Override - public NodeSearchClient getClient() { - return new NodeSearchClient(); + public NodeSearchClient getClient(ClassLoader classLoader) { + return new NodeSearchClient(classLoader); } } diff --git a/elx-node/src/test/java/org/xbib/elx/node/test/SmokeTest.java b/elx-node/src/test/java/org/xbib/elx/node/test/SmokeTest.java index 80971ca..f8f4d8e 100644 --- a/elx-node/src/test/java/org/xbib/elx/node/test/SmokeTest.java +++ b/elx-node/src/test/java/org/xbib/elx/node/test/SmokeTest.java @@ -44,7 +44,7 @@ class SmokeTest { .put(helper.getClientSettings()) .build()) { IndexDefinition indexDefinition = - new DefaultIndexDefinition(adminClient, "test_smoke", "doc", Settings.EMPTY); + new DefaultIndexDefinition(adminClient, "test_smoke", "doc", Settings.EMPTY, getClass().getClassLoader()); assertEquals("test_smoke", indexDefinition.getIndex()); assertTrue(indexDefinition.getFullIndexName().startsWith("test_smoke")); assertEquals(1, indexDefinition.getReplicaCount()); diff --git a/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClient.java b/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClient.java index 25d6c96..51084cb 100644 --- a/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClient.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClient.java @@ -12,7 +12,7 @@ public class TransportAdminClient extends AbstractAdminClient { private final TransportClientHelper helper; - public TransportAdminClient() { + public TransportAdminClient(ClassLoader classLoader) { super(); this.helper = new TransportClientHelper(); } diff --git a/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClientProvider.java b/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClientProvider.java index 18d2368..26159e4 100644 --- a/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClientProvider.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/TransportAdminClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.AdminClientProvider; public class TransportAdminClientProvider implements AdminClientProvider { @Override - public TransportAdminClient getClient() { - return new TransportAdminClient(); + public TransportAdminClient getClient(ClassLoader classLoader) { + return new TransportAdminClient(classLoader); } } diff --git a/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClient.java b/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClient.java index b08d9d1..306303d 100644 --- a/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClient.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClient.java @@ -12,7 +12,7 @@ public class TransportBulkClient extends AbstractBulkClient { private final TransportClientHelper helper; - public TransportBulkClient() { + public TransportBulkClient(ClassLoader classLoader) { super(); this.helper = new TransportClientHelper(); } diff --git a/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClientProvider.java b/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClientProvider.java index 399d73d..73c5da4 100644 --- a/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClientProvider.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/TransportBulkClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider; public class TransportBulkClientProvider implements BulkClientProvider { @Override - public TransportBulkClient getClient() { - return new TransportBulkClient(); + public TransportBulkClient getClient(ClassLoader classLoader) { + return new TransportBulkClient(classLoader); } } diff --git a/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClient.java b/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClient.java index 5fcba6d..aa0d333 100644 --- a/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClient.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClient.java @@ -12,7 +12,7 @@ public class TransportSearchClient extends AbstractSearchClient { private final TransportClientHelper helper; - public TransportSearchClient() { + public TransportSearchClient(ClassLoader classLoader) { super(); this.helper = new TransportClientHelper(); } diff --git a/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClientProvider.java b/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClientProvider.java index c77e320..3238a96 100644 --- a/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClientProvider.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/TransportSearchClientProvider.java @@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider; public class TransportSearchClientProvider implements SearchClientProvider { @Override - public TransportSearchClient getClient() { - return new TransportSearchClient(); + public TransportSearchClient getClient(ClassLoader classLoader) { + return new TransportSearchClient(classLoader); } } diff --git a/elx-transport/src/test/java/org/xbib/elx/transport/test/SmokeTest.java b/elx-transport/src/test/java/org/xbib/elx/transport/test/SmokeTest.java index 7a9e2a0..54b639e 100644 --- a/elx-transport/src/test/java/org/xbib/elx/transport/test/SmokeTest.java +++ b/elx-transport/src/test/java/org/xbib/elx/transport/test/SmokeTest.java @@ -44,7 +44,7 @@ class SmokeTest { .put(helper.getClientSettings()) .build()) { IndexDefinition indexDefinition = - new DefaultIndexDefinition(adminClient, "test", "doc", Settings.EMPTY); + new DefaultIndexDefinition(adminClient, "test", "doc", Settings.EMPTY, getClass().getClassLoader()); assertEquals("test", indexDefinition.getIndex()); assertTrue(indexDefinition.getFullIndexName().startsWith("test")); assertEquals(1, indexDefinition.getReplicaCount()); diff --git a/gradle.properties b/gradle.properties index 89eeefa..5da3b5f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group = org.xbib name = elx -version = 7.10.2.21 +version = 7.10.2.22 org.gradle.warning.mode = ALL diff --git a/settings.gradle b/settings.gradle index a7477a9..a870418 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,6 +4,7 @@ dependencyResolutionManagement { version('gradle', '7.4.2') version('junit', '5.8.2') version('elasticsearch', '7.10.2') + version('lucene', '8.7.0') version('log4j', '2.17.1') // ES 7.10.2 uses log4j2 2.11.1 library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit') @@ -15,6 +16,16 @@ dependencyResolutionManagement { library('log4j-slf4j', 'org.apache.logging.log4j', 'log4j-slf4j-impl').versionRef('log4j') library('log4j-jul', 'org.apache.logging.log4j', 'log4j-jul').versionRef('log4j') library('elasticsearch', 'org.elasticsearch', 'elasticsearch').versionRef('elasticsearch') + library('lucene', 'org.apache.lucene', 'lucene-core').versionRef('lucene') + library('lucene-analyzers-common', 'org.apache.lucene', 'lucene-analyzers-common').versionRef('lucene') + library('lucene-highlighter', 'org.apache.lucene', 'lucene-highlighter').versionRef('lucene') + library('lucene-join', 'org.apache.lucene', 'lucene-join').versionRef('lucene') + library('lucene-queryparser', 'org.apache.lucene', 'lucene-queryparser').versionRef('lucene') + library('lucene-grouping', 'org.apache.lucene', 'lucene-grouping').versionRef('lucene') + library('lucene-misc', 'org.apache.lucene', 'lucene-misc').versionRef('lucene') + library('hppc', 'com.carrotsearch', 'hppc').version('0.8.1') + library('joda', 'joda-time', 'joda-time').version('2.10.4') + library('tdigest', 'com.tdunning', 't-digest').version('3.2') library('es-plugin-transport-netty4', 'org.elasticsearch.plugin', 'transport-netty4-client').versionRef('elasticsearch') library('jackson', 'com.fasterxml.jackson.core', 'jackson-core').version('2.12.7') // ES 7.10.2 uses Jackson 2.10.4 library('netty-http', 'org.xbib', 'netty-http-client').version('4.1.77.0') // ES 7.10.2 uses Netty 4.1.49