add explicit dependencies for Groovy grape usage, explicit class loader handling for Groovy class loading
This commit is contained in:
parent
469ca41001
commit
e79c3f07b2
33 changed files with 87 additions and 62 deletions
|
@ -4,4 +4,16 @@ dependencies {
|
||||||
// override old artifacts in ES x-content. We must use jackson smile/cbor/yaml and log4j2 api here.
|
// override old artifacts in ES x-content. We must use jackson smile/cbor/yaml and log4j2 api here.
|
||||||
api libs.jackson
|
api libs.jackson
|
||||||
api libs.log4j.api
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ package org.xbib.elx.api;
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface AdminClientProvider<C extends AdminClient> {
|
public interface AdminClientProvider<C extends AdminClient> {
|
||||||
|
|
||||||
C getClient();
|
C getClient(ClassLoader classLoader);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ package org.xbib.elx.api;
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface BulkClientProvider<C extends BulkClient> {
|
public interface BulkClientProvider<C extends BulkClient> {
|
||||||
|
|
||||||
C getClient();
|
C getClient(ClassLoader classLoader);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ package org.xbib.elx.api;
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface SearchClientProvider<C extends SearchClient> {
|
public interface SearchClientProvider<C extends SearchClient> {
|
||||||
|
|
||||||
C getClient();
|
C getClient(ClassLoader classLoader);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ public class ClientBuilder {
|
||||||
|
|
||||||
private final ElasticsearchClient client;
|
private final ElasticsearchClient client;
|
||||||
|
|
||||||
private final ClassLoader classLoader;
|
|
||||||
|
|
||||||
private final Settings.Builder settingsBuilder;
|
private final Settings.Builder settingsBuilder;
|
||||||
|
|
||||||
|
private ClassLoader classLoader;
|
||||||
|
|
||||||
private Class<? extends AdminClientProvider> adminClientProvider;
|
private Class<? extends AdminClientProvider> adminClientProvider;
|
||||||
|
|
||||||
private Class<? extends BulkClientProvider> bulkClientProvider;
|
private Class<? extends BulkClientProvider> bulkClientProvider;
|
||||||
|
@ -39,12 +39,7 @@ public class ClientBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientBuilder(ElasticsearchClient client) {
|
public ClientBuilder(ElasticsearchClient client) {
|
||||||
this(client, ClassLoader.getSystemClassLoader());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClientBuilder(ElasticsearchClient client, ClassLoader classLoader) {
|
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.classLoader = classLoader;
|
|
||||||
this.settingsBuilder = Settings.builder();
|
this.settingsBuilder = Settings.builder();
|
||||||
settingsBuilder.put("node.name", "elx-client-" + Version.CURRENT);
|
settingsBuilder.put("node.name", "elx-client-" + Version.CURRENT);
|
||||||
for (Parameters p : Parameters.values()) {
|
for (Parameters p : Parameters.values()) {
|
||||||
|
@ -68,6 +63,11 @@ public class ClientBuilder {
|
||||||
return new ClientBuilder(client);
|
return new ClientBuilder(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ClientBuilder setClassLoader(ClassLoader classLoader) {
|
||||||
|
this.classLoader = classLoader;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ClientBuilder setAdminClientProvider(Class<? extends AdminClientProvider> adminClientProvider) {
|
public ClientBuilder setAdminClientProvider(Class<? extends AdminClientProvider> adminClientProvider) {
|
||||||
this.adminClientProvider = adminClientProvider;
|
this.adminClientProvider = adminClientProvider;
|
||||||
return this;
|
return this;
|
||||||
|
@ -148,7 +148,7 @@ public class ClientBuilder {
|
||||||
if (adminClientProvider != null) {
|
if (adminClientProvider != null) {
|
||||||
for (AdminClientProvider provider : ServiceLoader.load(AdminClientProvider.class, classLoader)) {
|
for (AdminClientProvider provider : ServiceLoader.load(AdminClientProvider.class, classLoader)) {
|
||||||
if (provider.getClass().isAssignableFrom(adminClientProvider)) {
|
if (provider.getClass().isAssignableFrom(adminClientProvider)) {
|
||||||
C c = (C) provider.getClient();
|
C c = (C) provider.getClient(classLoader);
|
||||||
c.setClient(client);
|
c.setClient(client);
|
||||||
c.init(settings, null);
|
c.init(settings, null);
|
||||||
return c;
|
return c;
|
||||||
|
@ -158,7 +158,7 @@ public class ClientBuilder {
|
||||||
if (bulkClientProvider != null) {
|
if (bulkClientProvider != null) {
|
||||||
for (BulkClientProvider provider : ServiceLoader.load(BulkClientProvider.class, classLoader)) {
|
for (BulkClientProvider provider : ServiceLoader.load(BulkClientProvider.class, classLoader)) {
|
||||||
if (provider.getClass().isAssignableFrom(bulkClientProvider)) {
|
if (provider.getClass().isAssignableFrom(bulkClientProvider)) {
|
||||||
C c = (C) provider.getClient();
|
C c = (C) provider.getClient(classLoader);
|
||||||
c.setClient(client);
|
c.setClient(client);
|
||||||
c.init(settings, null);
|
c.init(settings, null);
|
||||||
return c;
|
return c;
|
||||||
|
@ -168,7 +168,7 @@ public class ClientBuilder {
|
||||||
if (searchClientProvider != null) {
|
if (searchClientProvider != null) {
|
||||||
for (SearchClientProvider provider : ServiceLoader.load(SearchClientProvider.class, classLoader)) {
|
for (SearchClientProvider provider : ServiceLoader.load(SearchClientProvider.class, classLoader)) {
|
||||||
if (provider.getClass().isAssignableFrom(searchClientProvider)) {
|
if (provider.getClass().isAssignableFrom(searchClientProvider)) {
|
||||||
C c = (C) provider.getClient();
|
C c = (C) provider.getClient(classLoader);
|
||||||
c.setClient(client);
|
c.setClient(client);
|
||||||
c.init(settings, null);
|
c.init(settings, null);
|
||||||
return c;
|
return c;
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class DefaultIndexDefinition implements IndexDefinition {
|
||||||
setEnabled(true);
|
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 {
|
throws IOException {
|
||||||
String indexName = settings.get("name", index);
|
String indexName = settings.get("name", index);
|
||||||
String indexType = settings.get("type", type);
|
String indexType = settings.get("type", type);
|
||||||
|
@ -92,8 +92,8 @@ public class DefaultIndexDefinition implements IndexDefinition {
|
||||||
setStopBulkRefreshSeconds(settings.getAsInt(Parameters.BULK_STOP_REFRESH_SECONDS.getName(),
|
setStopBulkRefreshSeconds(settings.getAsInt(Parameters.BULK_STOP_REFRESH_SECONDS.getName(),
|
||||||
Parameters.BULK_STOP_REFRESH_SECONDS.getInteger()));
|
Parameters.BULK_STOP_REFRESH_SECONDS.getInteger()));
|
||||||
if (settings.get("settings") != null && settings.get("mapping") != null) {
|
if (settings.get("settings") != null && settings.get("mapping") != null) {
|
||||||
setSettings(findSettingsFrom(settings.get("settings")));
|
setSettings(findSettingsFrom(settings.get("settings"), classLoader));
|
||||||
setMappings(findMappingsFrom(settings.get("mapping")));
|
setMappings(findMappingsFrom(settings.get("mapping"), classLoader));
|
||||||
}
|
}
|
||||||
boolean shift = settings.getAsBoolean("shift", false);
|
boolean shift = settings.getAsBoolean("shift", false);
|
||||||
setShift(shift);
|
setShift(shift);
|
||||||
|
@ -307,13 +307,14 @@ public class DefaultIndexDefinition implements IndexDefinition {
|
||||||
public int getMinToKeep() {
|
public int getMinToKeep() {
|
||||||
return minToKeep;
|
return minToKeep;
|
||||||
}
|
}
|
||||||
private static String findSettingsFrom(String string) throws IOException {
|
|
||||||
|
private static String findSettingsFrom(String string, ClassLoader classLoader) throws IOException {
|
||||||
if (string == null) {
|
if (string == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
XContentBuilder builder = JsonXContent.contentBuilder();
|
XContentBuilder builder = JsonXContent.contentBuilder();
|
||||||
try (InputStream inputStream = findInputStream(string)) {
|
try (InputStream inputStream = findInputStream(string, classLoader)) {
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
Settings settings = Settings.builder().loadFromStream(string, inputStream, true).build();
|
Settings settings = Settings.builder().loadFromStream(string, inputStream, true).build();
|
||||||
builder.startObject();
|
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) {
|
if (string == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
XContentBuilder builder = JsonXContent.contentBuilder();
|
XContentBuilder builder = JsonXContent.contentBuilder();
|
||||||
try (InputStream inputStream = findInputStream(string)) {
|
try (InputStream inputStream = findInputStream(string, classLoader)) {
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
if (string.endsWith(".json")) {
|
if (string.endsWith(".json")) {
|
||||||
Map<String, ?> mappings = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY,
|
Map<String, ?> 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) {
|
if (string == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
URL url = ClassLoader.getSystemClassLoader().getResource(string);
|
URL url = classLoader.getResource(string);
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
url = new URL(string);
|
url = new URL(string);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@ package org.xbib.elx.common;
|
||||||
import org.xbib.elx.api.AdminClientProvider;
|
import org.xbib.elx.api.AdminClientProvider;
|
||||||
|
|
||||||
public class MockAdminClientProvider implements AdminClientProvider<MockAdminClient> {
|
public class MockAdminClientProvider implements AdminClientProvider<MockAdminClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockAdminClient getClient() {
|
public MockAdminClient getClient(ClassLoader classLoader) {
|
||||||
return new MockAdminClient();
|
return new MockAdminClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider;
|
||||||
public class MockBulkClientProvider implements BulkClientProvider<MockBulkClient> {
|
public class MockBulkClientProvider implements BulkClientProvider<MockBulkClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockBulkClient getClient() {
|
public MockBulkClient getClient(ClassLoader classLoader) {
|
||||||
return new MockBulkClient();
|
return new MockBulkClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider;
|
||||||
public class MockSearchClientProvider implements SearchClientProvider<MockSearchClient> {
|
public class MockSearchClientProvider implements SearchClientProvider<MockSearchClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockSearchClient getClient() {
|
public MockSearchClient getClient(ClassLoader classLoader) {
|
||||||
return new MockSearchClient();
|
return new MockSearchClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ public class HttpAdminClient extends AbstractAdminClient implements Elasticsearc
|
||||||
|
|
||||||
private final HttpClientHelper helper;
|
private final HttpClientHelper helper;
|
||||||
|
|
||||||
public HttpAdminClient() {
|
public HttpAdminClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new HttpClientHelper();
|
this.helper = new HttpClientHelper(classLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.AdminClientProvider;
|
||||||
public class HttpAdminClientProvider implements AdminClientProvider<HttpAdminClient> {
|
public class HttpAdminClientProvider implements AdminClientProvider<HttpAdminClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpAdminClient getClient() {
|
public HttpAdminClient getClient(ClassLoader classLoader) {
|
||||||
return new HttpAdminClient();
|
return new HttpAdminClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ public class HttpBulkClient extends AbstractBulkClient implements ElasticsearchC
|
||||||
|
|
||||||
private final HttpClientHelper helper;
|
private final HttpClientHelper helper;
|
||||||
|
|
||||||
public HttpBulkClient() {
|
public HttpBulkClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new HttpClientHelper();
|
this.helper = new HttpClientHelper(classLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider;
|
||||||
public class HttpBulkClientProvider implements BulkClientProvider<HttpBulkClient> {
|
public class HttpBulkClientProvider implements BulkClientProvider<HttpBulkClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpBulkClient getClient() {
|
public HttpBulkClient getClient(ClassLoader classLoader) {
|
||||||
return new HttpBulkClient();
|
return new HttpBulkClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,15 +50,15 @@ public class HttpClientHelper {
|
||||||
|
|
||||||
private final AtomicBoolean closed;
|
private final AtomicBoolean closed;
|
||||||
|
|
||||||
public HttpClientHelper() {
|
public HttpClientHelper(ClassLoader classLoader) {
|
||||||
this(Collections.emptyList(), Thread.currentThread().getContextClassLoader());
|
this(Collections.emptyList(), classLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpClientHelper(List<NamedXContentRegistry.Entry> namedXContentEntries,
|
public HttpClientHelper(List<NamedXContentRegistry.Entry> namedXContentEntries,
|
||||||
ClassLoader classLoader) {
|
ClassLoader classLoader) {
|
||||||
this.registry = new NamedXContentRegistry(Stream.of(getNamedXContents().stream(),
|
this.registry = new NamedXContentRegistry(Stream.of(getNamedXContents().stream(),
|
||||||
namedXContentEntries.stream()).flatMap(Function.identity()).collect(Collectors.toList()));
|
namedXContentEntries.stream()).flatMap(Function.identity()).collect(Collectors.toList()));
|
||||||
this.classLoader = classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader();
|
this.classLoader = classLoader;
|
||||||
this.actionMap = new HashMap<>();
|
this.actionMap = new HashMap<>();
|
||||||
this.closed = new AtomicBoolean();
|
this.closed = new AtomicBoolean();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ public class HttpSearchClient extends AbstractSearchClient implements Elasticsea
|
||||||
|
|
||||||
private final HttpClientHelper helper;
|
private final HttpClientHelper helper;
|
||||||
|
|
||||||
public HttpSearchClient() {
|
public HttpSearchClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new HttpClientHelper();
|
this.helper = new HttpClientHelper(classLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider;
|
||||||
public class HttpSearchClientProvider implements SearchClientProvider<HttpSearchClient> {
|
public class HttpSearchClientProvider implements SearchClientProvider<HttpSearchClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpSearchClient getClient() {
|
public HttpSearchClient getClient(ClassLoader classLoader) {
|
||||||
return new HttpSearchClient();
|
return new HttpSearchClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class SmokeTest {
|
||||||
.put(helper.getClientSettings())
|
.put(helper.getClientSettings())
|
||||||
.build()) {
|
.build()) {
|
||||||
IndexDefinition indexDefinition =
|
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(1, indexDefinition.getReplicaCount());
|
||||||
assertEquals(helper.getClusterName(), adminClient.getClusterName());
|
assertEquals(helper.getClusterName(), adminClient.getClusterName());
|
||||||
bulkClient.newIndex(indexDefinition);
|
bulkClient.newIndex(indexDefinition);
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class NodeAdminClient extends AbstractAdminClient {
|
||||||
|
|
||||||
private final NodeClientHelper helper;
|
private final NodeClientHelper helper;
|
||||||
|
|
||||||
public NodeAdminClient() {
|
public NodeAdminClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new NodeClientHelper();
|
this.helper = new NodeClientHelper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.AdminClientProvider;
|
||||||
public class NodeAdminClientProvider implements AdminClientProvider<NodeAdminClient> {
|
public class NodeAdminClientProvider implements AdminClientProvider<NodeAdminClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeAdminClient getClient() {
|
public NodeAdminClient getClient(ClassLoader classLoader) {
|
||||||
return new NodeAdminClient();
|
return new NodeAdminClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class NodeBulkClient extends AbstractBulkClient {
|
||||||
|
|
||||||
private final NodeClientHelper helper;
|
private final NodeClientHelper helper;
|
||||||
|
|
||||||
public NodeBulkClient() {
|
public NodeBulkClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new NodeClientHelper();
|
this.helper = new NodeClientHelper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider;
|
||||||
public class NodeBulkClientProvider implements BulkClientProvider<NodeBulkClient> {
|
public class NodeBulkClientProvider implements BulkClientProvider<NodeBulkClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeBulkClient getClient() {
|
public NodeBulkClient getClient(ClassLoader classLoader) {
|
||||||
return new NodeBulkClient();
|
return new NodeBulkClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class NodeSearchClient extends AbstractSearchClient {
|
||||||
|
|
||||||
private final NodeClientHelper helper;
|
private final NodeClientHelper helper;
|
||||||
|
|
||||||
public NodeSearchClient() {
|
public NodeSearchClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new NodeClientHelper();
|
this.helper = new NodeClientHelper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider;
|
||||||
public class NodeSearchClientProvider implements SearchClientProvider<NodeSearchClient> {
|
public class NodeSearchClientProvider implements SearchClientProvider<NodeSearchClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSearchClient getClient() {
|
public NodeSearchClient getClient(ClassLoader classLoader) {
|
||||||
return new NodeSearchClient();
|
return new NodeSearchClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class SmokeTest {
|
||||||
.put(helper.getClientSettings())
|
.put(helper.getClientSettings())
|
||||||
.build()) {
|
.build()) {
|
||||||
IndexDefinition indexDefinition =
|
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());
|
assertEquals("test_smoke", indexDefinition.getIndex());
|
||||||
assertTrue(indexDefinition.getFullIndexName().startsWith("test_smoke"));
|
assertTrue(indexDefinition.getFullIndexName().startsWith("test_smoke"));
|
||||||
assertEquals(1, indexDefinition.getReplicaCount());
|
assertEquals(1, indexDefinition.getReplicaCount());
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class TransportAdminClient extends AbstractAdminClient {
|
||||||
|
|
||||||
private final TransportClientHelper helper;
|
private final TransportClientHelper helper;
|
||||||
|
|
||||||
public TransportAdminClient() {
|
public TransportAdminClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new TransportClientHelper();
|
this.helper = new TransportClientHelper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.AdminClientProvider;
|
||||||
public class TransportAdminClientProvider implements AdminClientProvider<TransportAdminClient> {
|
public class TransportAdminClientProvider implements AdminClientProvider<TransportAdminClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TransportAdminClient getClient() {
|
public TransportAdminClient getClient(ClassLoader classLoader) {
|
||||||
return new TransportAdminClient();
|
return new TransportAdminClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class TransportBulkClient extends AbstractBulkClient {
|
||||||
|
|
||||||
private final TransportClientHelper helper;
|
private final TransportClientHelper helper;
|
||||||
|
|
||||||
public TransportBulkClient() {
|
public TransportBulkClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new TransportClientHelper();
|
this.helper = new TransportClientHelper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.BulkClientProvider;
|
||||||
public class TransportBulkClientProvider implements BulkClientProvider<TransportBulkClient> {
|
public class TransportBulkClientProvider implements BulkClientProvider<TransportBulkClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TransportBulkClient getClient() {
|
public TransportBulkClient getClient(ClassLoader classLoader) {
|
||||||
return new TransportBulkClient();
|
return new TransportBulkClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class TransportSearchClient extends AbstractSearchClient {
|
||||||
|
|
||||||
private final TransportClientHelper helper;
|
private final TransportClientHelper helper;
|
||||||
|
|
||||||
public TransportSearchClient() {
|
public TransportSearchClient(ClassLoader classLoader) {
|
||||||
super();
|
super();
|
||||||
this.helper = new TransportClientHelper();
|
this.helper = new TransportClientHelper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.xbib.elx.api.SearchClientProvider;
|
||||||
public class TransportSearchClientProvider implements SearchClientProvider<TransportSearchClient> {
|
public class TransportSearchClientProvider implements SearchClientProvider<TransportSearchClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TransportSearchClient getClient() {
|
public TransportSearchClient getClient(ClassLoader classLoader) {
|
||||||
return new TransportSearchClient();
|
return new TransportSearchClient(classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class SmokeTest {
|
||||||
.put(helper.getClientSettings())
|
.put(helper.getClientSettings())
|
||||||
.build()) {
|
.build()) {
|
||||||
IndexDefinition indexDefinition =
|
IndexDefinition indexDefinition =
|
||||||
new DefaultIndexDefinition(adminClient, "test", "doc", Settings.EMPTY);
|
new DefaultIndexDefinition(adminClient, "test", "doc", Settings.EMPTY, getClass().getClassLoader());
|
||||||
assertEquals("test", indexDefinition.getIndex());
|
assertEquals("test", indexDefinition.getIndex());
|
||||||
assertTrue(indexDefinition.getFullIndexName().startsWith("test"));
|
assertTrue(indexDefinition.getFullIndexName().startsWith("test"));
|
||||||
assertEquals(1, indexDefinition.getReplicaCount());
|
assertEquals(1, indexDefinition.getReplicaCount());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = elx
|
name = elx
|
||||||
version = 7.10.2.21
|
version = 7.10.2.22
|
||||||
|
|
||||||
org.gradle.warning.mode = ALL
|
org.gradle.warning.mode = ALL
|
||||||
|
|
|
@ -4,6 +4,7 @@ dependencyResolutionManagement {
|
||||||
version('gradle', '7.4.2')
|
version('gradle', '7.4.2')
|
||||||
version('junit', '5.8.2')
|
version('junit', '5.8.2')
|
||||||
version('elasticsearch', '7.10.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
|
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-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
|
||||||
library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').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-slf4j', 'org.apache.logging.log4j', 'log4j-slf4j-impl').versionRef('log4j')
|
||||||
library('log4j-jul', 'org.apache.logging.log4j', 'log4j-jul').versionRef('log4j')
|
library('log4j-jul', 'org.apache.logging.log4j', 'log4j-jul').versionRef('log4j')
|
||||||
library('elasticsearch', 'org.elasticsearch', 'elasticsearch').versionRef('elasticsearch')
|
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('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('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
|
library('netty-http', 'org.xbib', 'netty-http-client').version('4.1.77.0') // ES 7.10.2 uses Netty 4.1.49
|
||||||
|
|
Loading…
Reference in a new issue