diff --git a/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java index be609e44fa1..5ae074a1027 100644 --- a/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -260,7 +260,7 @@ public class TransportClient extends AbstractClient { // ignore, might not be bounded } - for (Class plugin : injector.getInstance(PluginsService.class).services()) { + for (Class plugin : injector.getInstance(PluginsService.class).nodeServices()) { injector.getInstance(plugin).close(); } try { diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 7b9ed73bd3d..45e5522a22c 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -230,7 +230,7 @@ public class Node implements Releasable { // hack around dependency injection problem (for now...) injector.getInstance(Discovery.class).setRoutingService(injector.getInstance(RoutingService.class)); - for (Class plugin : pluginsService.services()) { + for (Class plugin : pluginsService.nodeServices()) { injector.getInstance(plugin).start(); } @@ -297,7 +297,7 @@ public class Node implements Releasable { injector.getInstance(RestController.class).stop(); injector.getInstance(TransportService.class).stop(); - for (Class plugin : pluginsService.services()) { + for (Class plugin : pluginsService.nodeServices()) { injector.getInstance(plugin).stop(); } // we should stop this last since it waits for resources to get released @@ -364,7 +364,7 @@ public class Node implements Releasable { stopWatch.stop().start("percolator_service"); injector.getInstance(PercolatorService.class).close(); - for (Class plugin : pluginsService.services()) { + for (Class plugin : pluginsService.nodeServices()) { stopWatch.stop().start("plugin(" + plugin.getName() + ")"); injector.getInstance(plugin).close(); } diff --git a/core/src/main/java/org/elasticsearch/plugins/AbstractPlugin.java b/core/src/main/java/org/elasticsearch/plugins/AbstractPlugin.java deleted file mode 100644 index 0beff2444c5..00000000000 --- a/core/src/main/java/org/elasticsearch/plugins/AbstractPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.plugins; - -import com.google.common.collect.ImmutableList; -import org.elasticsearch.common.component.LifecycleComponent; -import org.elasticsearch.common.inject.Module; -import org.elasticsearch.common.settings.Settings; - -import java.io.Closeable; -import java.util.Collection; - -/** - * A base class for a plugin. - *

- * A plugin can be dynamically injected with {@link Module} by implementing onModule(AnyModule) method - * removing the need to override {@link #processModule(org.elasticsearch.common.inject.Module)} and check using - * instanceof. - */ -public abstract class AbstractPlugin implements Plugin { - - /** - * Defaults to return an empty list. - */ - @Override - public Collection> modules() { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection modules(Settings settings) { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection> services() { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection> indexModules() { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection indexModules(Settings settings) { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection> indexServices() { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection> shardModules() { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection shardModules(Settings settings) { - return ImmutableList.of(); - } - - /** - * Defaults to return an empty list. - */ - @Override - public Collection> shardServices() { - return ImmutableList.of(); - } - - @Override - public void processModule(Module module) { - // nothing to do here - } - - @Override - public Settings additionalSettings() { - return Settings.Builder.EMPTY_SETTINGS; - } - -} diff --git a/core/src/main/java/org/elasticsearch/plugins/IndexPluginsModule.java b/core/src/main/java/org/elasticsearch/plugins/IndexPluginsModule.java index d9f35aedd52..a45f7d7a08e 100644 --- a/core/src/main/java/org/elasticsearch/plugins/IndexPluginsModule.java +++ b/core/src/main/java/org/elasticsearch/plugins/IndexPluginsModule.java @@ -19,18 +19,12 @@ package org.elasticsearch.plugins; -import com.google.common.collect.Lists; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.PreProcessModule; import org.elasticsearch.common.inject.SpawnModules; import org.elasticsearch.common.settings.Settings; -import java.util.Collection; -import java.util.List; - -import static org.elasticsearch.common.inject.Modules.createModule; - /** * */ @@ -47,13 +41,7 @@ public class IndexPluginsModule extends AbstractModule implements SpawnModules, @Override public Iterable spawnModules() { - List modules = Lists.newArrayList(); - Collection> modulesClasses = pluginsService.indexModules(); - for (Class moduleClass : modulesClasses) { - modules.add(createModule(moduleClass, settings)); - } - modules.addAll(pluginsService.indexModules(settings)); - return modules; + return pluginsService.indexModules(settings); } @Override diff --git a/core/src/main/java/org/elasticsearch/plugins/Plugin.java b/core/src/main/java/org/elasticsearch/plugins/Plugin.java index 0a459a55277..986d397f6b6 100644 --- a/core/src/main/java/org/elasticsearch/plugins/Plugin.java +++ b/core/src/main/java/org/elasticsearch/plugins/Plugin.java @@ -25,82 +25,73 @@ import org.elasticsearch.common.settings.Settings; import java.io.Closeable; import java.util.Collection; +import java.util.Collections; /** * An extension point allowing to plug in custom functionality. *

- * A plugin can be dynamically injected with {@link Module} by implementing onModule(AnyModule) method - * removing the need to override {@link #processModule(org.elasticsearch.common.inject.Module)} and check using - * instanceof. + * A plugin can be register custom extensions to builtin behavior by implementing onModule(AnyModule), + * and registering the extension with the given module. */ -public interface Plugin { +public abstract class Plugin { /** * The name of the plugin. */ - String name(); + public abstract String name(); /** * The description of the plugin. */ - String description(); + public abstract String description(); /** - * Node level modules (classes, will automatically be created). + * Node level modules. */ - Collection> modules(); - - /** - * Node level modules (instances) - * - * @param settings The node level settings. - */ - Collection modules(Settings settings); + public Collection nodeModules() { + return Collections.emptyList(); + } /** * Node level services that will be automatically started/stopped/closed. */ - Collection> services(); + public Collection> nodeServices() { + return Collections.emptyList(); + } /** * Per index modules. */ - Collection> indexModules(); - - /** - * Per index modules. - */ - Collection indexModules(Settings settings); + public Collection indexModules(Settings indexSettings) { + return Collections.emptyList(); + } /** * Per index services that will be automatically closed. */ - Collection> indexServices(); + public Collection> indexServices() { + return Collections.emptyList(); + } /** * Per index shard module. */ - Collection> shardModules(); - - /** - * Per index shard module. - */ - Collection shardModules(Settings settings); + public Collection shardModules(Settings indexSettings) { + return Collections.emptyList(); + } /** * Per index shard service that will be automatically closed. */ - Collection> shardServices(); - - /** - * Process a specific module. Note, its simpler to implement a custom onModule(AnyModule module) - * method, which will be automatically be called by the relevant type. - */ - void processModule(Module module); + public Collection> shardServices() { + return Collections.emptyList(); + } /** * Additional node settings loaded by the plugin. Note that settings that are explicit in the nodes settings can't be * overwritten with the additional settings. These settings added if they don't exist. */ - Settings additionalSettings(); + public Settings additionalSettings() { + return Settings.Builder.EMPTY_SETTINGS; + } } diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginsModule.java b/core/src/main/java/org/elasticsearch/plugins/PluginsModule.java index baf9f591d2b..050a90140eb 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginsModule.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginsModule.java @@ -19,18 +19,12 @@ package org.elasticsearch.plugins; -import com.google.common.collect.Lists; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.PreProcessModule; import org.elasticsearch.common.inject.SpawnModules; import org.elasticsearch.common.settings.Settings; -import java.util.Collection; -import java.util.List; - -import static org.elasticsearch.common.inject.Modules.createModule; - /** * */ @@ -47,13 +41,7 @@ public class PluginsModule extends AbstractModule implements SpawnModules, PrePr @Override public Iterable spawnModules() { - List modules = Lists.newArrayList(); - Collection> modulesClasses = pluginsService.modules(); - for (Class moduleClass : modulesClasses) { - modules.add(createModule(moduleClass, settings)); - } - modules.addAll(pluginsService.modules(settings)); - return modules; + return pluginsService.nodeModules(); } @Override diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java index c1dfd7403b9..e20418ce01b 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -47,7 +47,6 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -184,7 +183,6 @@ public class PluginsService extends AbstractComponent { public void processModule(Module module) { for (Tuple plugin : plugins()) { - plugin.v2().processModule(module); // see if there are onModule references List references = onModuleReferences.get(plugin.v2()); if (references != null) { @@ -218,42 +216,26 @@ public class PluginsService extends AbstractComponent { return builder.put(this.settings).build(); } - public Collection> modules() { - List> modules = new ArrayList<>(); - for (Tuple plugin : plugins) { - modules.addAll(plugin.v2().modules()); - } - return modules; - } - - public Collection modules(Settings settings) { + public Collection nodeModules() { List modules = new ArrayList<>(); for (Tuple plugin : plugins) { - modules.addAll(plugin.v2().modules(settings)); + modules.addAll(plugin.v2().nodeModules()); } return modules; } - public Collection> services() { + public Collection> nodeServices() { List> services = new ArrayList<>(); for (Tuple plugin : plugins) { - services.addAll(plugin.v2().services()); + services.addAll(plugin.v2().nodeServices()); } return services; } - public Collection> indexModules() { - List> modules = new ArrayList<>(); - for (Tuple plugin : plugins) { - modules.addAll(plugin.v2().indexModules()); - } - return modules; - } - - public Collection indexModules(Settings settings) { + public Collection indexModules(Settings indexSettings) { List modules = new ArrayList<>(); for (Tuple plugin : plugins) { - modules.addAll(plugin.v2().indexModules(settings)); + modules.addAll(plugin.v2().indexModules(indexSettings)); } return modules; } @@ -266,18 +248,10 @@ public class PluginsService extends AbstractComponent { return services; } - public Collection> shardModules() { - List> modules = new ArrayList<>(); - for (Tuple plugin : plugins) { - modules.addAll(plugin.v2().shardModules()); - } - return modules; - } - - public Collection shardModules(Settings settings) { + public Collection shardModules(Settings indexSettings) { List modules = new ArrayList<>(); for (Tuple plugin : plugins) { - modules.addAll(plugin.v2().shardModules(settings)); + modules.addAll(plugin.v2().shardModules(indexSettings)); } return modules; } diff --git a/core/src/main/java/org/elasticsearch/plugins/ShardsPluginsModule.java b/core/src/main/java/org/elasticsearch/plugins/ShardsPluginsModule.java index b9e2178c6f3..5797b2d0575 100644 --- a/core/src/main/java/org/elasticsearch/plugins/ShardsPluginsModule.java +++ b/core/src/main/java/org/elasticsearch/plugins/ShardsPluginsModule.java @@ -19,18 +19,12 @@ package org.elasticsearch.plugins; -import com.google.common.collect.Lists; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.PreProcessModule; import org.elasticsearch.common.inject.SpawnModules; import org.elasticsearch.common.settings.Settings; -import java.util.Collection; -import java.util.List; - -import static org.elasticsearch.common.inject.Modules.createModule; - /** * */ @@ -47,13 +41,7 @@ public class ShardsPluginsModule extends AbstractModule implements SpawnModules, @Override public Iterable spawnModules() { - List modules = Lists.newArrayList(); - Collection> modulesClasses = pluginsService.shardModules(); - for (Class moduleClass : modulesClasses) { - modules.add(createModule(moduleClass, settings)); - } - modules.addAll(pluginsService.shardModules(settings)); - return modules; + return pluginsService.shardModules(settings); } @Override diff --git a/core/src/main/java/org/elasticsearch/plugins/SitePlugin.java b/core/src/main/java/org/elasticsearch/plugins/SitePlugin.java index 0f49764bbb2..4c12f2095bb 100644 --- a/core/src/main/java/org/elasticsearch/plugins/SitePlugin.java +++ b/core/src/main/java/org/elasticsearch/plugins/SitePlugin.java @@ -19,16 +19,8 @@ package org.elasticsearch.plugins; -import org.elasticsearch.common.component.LifecycleComponent; -import org.elasticsearch.common.inject.Module; -import org.elasticsearch.common.settings.Settings; - -import java.io.Closeable; -import java.util.Collection; -import java.util.Collections; - /** A site-only plugin, just serves resources */ -final class SitePlugin implements Plugin { +final class SitePlugin extends Plugin { final String name; final String description; @@ -46,58 +38,4 @@ final class SitePlugin implements Plugin { public String description() { return description; } - - @Override - public Collection> modules() { - return Collections.emptyList(); - } - - @Override - public Collection modules(Settings settings) { - return Collections.emptyList(); - } - - @Override - public Collection> services() { - return Collections.emptyList(); - } - - @Override - public Collection> indexModules() { - return Collections.emptyList(); - } - - @Override - public Collection indexModules(Settings settings) { - return Collections.emptyList(); - } - - @Override - public Collection> indexServices() { - return Collections.emptyList(); - } - - @Override - public Collection> shardModules() { - return Collections.emptyList(); - } - - @Override - public Collection shardModules(Settings settings) { - return Collections.emptyList(); - } - - @Override - public Collection> shardServices() { - return Collections.emptyList(); - } - - @Override - public void processModule(Module module) { - } - - @Override - public Settings additionalSettings() { - return Settings.EMPTY; - } } diff --git a/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java b/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java index 3d017cf8f6e..10b34493334 100644 --- a/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java +++ b/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java @@ -89,7 +89,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.Script; import org.elasticsearch.search.action.SearchServiceTransportAction; import org.elasticsearch.test.ESIntegTestCase; @@ -144,7 +144,7 @@ public class IndicesRequestIT extends ESIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) - .extendArray("plugin.types", InterceptingTransportService.Plugin.class.getName()) + .extendArray("plugin.types", InterceptingTransportService.TestPlugin.class.getName()) .build(); } @@ -844,7 +844,7 @@ public class IndicesRequestIT extends ESIntegTestCase { public static class InterceptingTransportService extends TransportService { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "intercepting-transport-service"; diff --git a/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/NativeScriptPlugin.java b/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/NativeScriptPlugin.java index c2e8bb9ff7d..92f19a7c358 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/NativeScriptPlugin.java +++ b/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/NativeScriptPlugin.java @@ -19,10 +19,10 @@ package org.elasticsearch.benchmark.scripts.expression; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptModule; -public class NativeScriptPlugin extends AbstractPlugin { +public class NativeScriptPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/plugin/NativeScriptExamplesPlugin.java b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/plugin/NativeScriptExamplesPlugin.java index 0d90d9fd6d2..2a25f8f21a5 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/plugin/NativeScriptExamplesPlugin.java +++ b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/plugin/NativeScriptExamplesPlugin.java @@ -18,11 +18,15 @@ */ package org.elasticsearch.benchmark.scripts.score.plugin; -import org.elasticsearch.benchmark.scripts.score.script.*; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.benchmark.scripts.score.script.NativeConstantForLoopScoreScript; +import org.elasticsearch.benchmark.scripts.score.script.NativeConstantScoreScript; +import org.elasticsearch.benchmark.scripts.score.script.NativeNaiveTFIDFScoreScript; +import org.elasticsearch.benchmark.scripts.score.script.NativePayloadSumNoRecordScoreScript; +import org.elasticsearch.benchmark.scripts.score.script.NativePayloadSumScoreScript; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptModule; -public class NativeScriptExamplesPlugin extends AbstractPlugin { +public class NativeScriptExamplesPlugin extends Plugin { @Override diff --git a/core/src/test/java/org/elasticsearch/cache/recycler/MockPageCacheRecycler.java b/core/src/test/java/org/elasticsearch/cache/recycler/MockPageCacheRecycler.java index 1f8ec84e193..ef5e50cfd68 100644 --- a/core/src/test/java/org/elasticsearch/cache/recycler/MockPageCacheRecycler.java +++ b/core/src/test/java/org/elasticsearch/cache/recycler/MockPageCacheRecycler.java @@ -25,8 +25,6 @@ import com.google.common.collect.Sets; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.recycler.Recycler.V; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.node.NodeModule; -import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.threadpool.ThreadPool; diff --git a/core/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java b/core/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java index 758dc3fe0a9..20d14f33dd4 100644 --- a/core/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java +++ b/core/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java @@ -35,9 +35,17 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.LocalTransportAddress; import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.*; +import org.elasticsearch.transport.ConnectTransportException; +import org.elasticsearch.transport.Transport; +import org.elasticsearch.transport.TransportException; +import org.elasticsearch.transport.TransportModule; +import org.elasticsearch.transport.TransportRequest; +import org.elasticsearch.transport.TransportRequestOptions; +import org.elasticsearch.transport.TransportResponse; +import org.elasticsearch.transport.TransportResponseHandler; +import org.elasticsearch.transport.TransportService; import org.junit.Test; import java.util.concurrent.CountDownLatch; @@ -58,7 +66,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests { TransportClient client = TransportClient.builder().settings(Settings.builder() .put("client.transport.sniff", false) .put("node.name", "transport_client_" + this.getTestName()) - .put("plugin.types", InternalTransportService.Plugin.class.getName()) + .put("plugin.types", InternalTransportService.TestPlugin.class.getName()) .put(headersSettings) .build()).build(); @@ -73,7 +81,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests { .put("cluster.name", "cluster1") .put("node.name", "transport_client_" + this.getTestName() + "_1") .put("client.transport.nodes_sampler_interval", "1s") - .put("plugin.types", InternalTransportService.Plugin.class.getName()) + .put("plugin.types", InternalTransportService.TestPlugin.class.getName()) .put(HEADER_SETTINGS) .put("path.home", createTempDir().toString()) .build()).build(); @@ -96,7 +104,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests { public static class InternalTransportService extends TransportService { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-transport-service"; diff --git a/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java b/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java index 40dec515f9c..6368e5aa1d9 100644 --- a/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java @@ -35,11 +35,14 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.store.Store; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.transport.MockTransportService; -import org.elasticsearch.transport.*; +import org.elasticsearch.transport.TransportException; +import org.elasticsearch.transport.TransportRequest; +import org.elasticsearch.transport.TransportRequestOptions; +import org.elasticsearch.transport.TransportService; import org.hamcrest.Matchers; import org.junit.Test; @@ -64,7 +67,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0) public class ClusterInfoServiceIT extends ESIntegTestCase { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { @@ -143,7 +146,7 @@ public class ClusterInfoServiceIT extends ESIntegTestCase { return Settings.builder() // manual collection or upon cluster forming. .put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT, "1s") - .putArray("plugin.types", Plugin.class.getName(), MockTransportService.Plugin.class.getName()) + .putArray("plugin.types", TestPlugin.class.getName(), MockTransportService.TestPlugin.class.getName()) .build(); } diff --git a/core/src/test/java/org/elasticsearch/cluster/ClusterServiceIT.java b/core/src/test/java/org/elasticsearch/cluster/ClusterServiceIT.java index a174215a174..71c2c2941a9 100644 --- a/core/src/test/java/org/elasticsearch/cluster/ClusterServiceIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/ClusterServiceIT.java @@ -20,7 +20,6 @@ package org.elasticsearch.cluster; import com.google.common.base.Predicate; import com.google.common.util.concurrent.ListenableFuture; - import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; @@ -36,7 +35,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Singleton; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.MockLogAppender; @@ -44,7 +43,12 @@ import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.threadpool.ThreadPool; import org.junit.Test; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -52,7 +56,11 @@ import java.util.concurrent.atomic.AtomicBoolean; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ESIntegTestCase.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; /** * @@ -992,7 +1000,7 @@ public class ClusterServiceIT extends ESIntegTestCase { } } - public static class TestPlugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { @@ -1005,7 +1013,7 @@ public class ClusterServiceIT extends ESIntegTestCase { } @Override - public Collection> services() { + public Collection> nodeServices() { List> services = new ArrayList<>(1); services.add(MasterAwareService.class); return services; diff --git a/core/src/test/java/org/elasticsearch/cluster/MockInternalClusterInfoService.java b/core/src/test/java/org/elasticsearch/cluster/MockInternalClusterInfoService.java index 93318346ac2..33ae26e6ebe 100644 --- a/core/src/test/java/org/elasticsearch/cluster/MockInternalClusterInfoService.java +++ b/core/src/test/java/org/elasticsearch/cluster/MockInternalClusterInfoService.java @@ -28,7 +28,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.MockDiskUsagesIT; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.settings.NodeSettingsService; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.threadpool.ThreadPool; import java.util.concurrent.CountDownLatch; @@ -39,7 +39,7 @@ import java.util.concurrent.CountDownLatch; */ public class MockInternalClusterInfoService extends InternalClusterInfoService { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-cluster-info-service"; diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java index b0ae30a06d4..35b5ffefae3 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java @@ -51,7 +51,7 @@ public class MockDiskUsagesIT extends ESIntegTestCase { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) // Use the mock internal cluster info service, which has fake-able disk usages - .extendArray("plugin.types", MockInternalClusterInfoService.Plugin.class.getName()) + .extendArray("plugin.types", MockInternalClusterInfoService.TestPlugin.class.getName()) // Update more frequently .put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, "1s") .build(); diff --git a/core/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringIT.java b/core/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringIT.java index 8b3b871113e..32551a4fe58 100644 --- a/core/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringIT.java @@ -25,12 +25,13 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.junit.Test; import java.util.Collection; +import java.util.Collections; import static com.google.common.collect.Lists.newArrayList; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; @@ -49,7 +50,7 @@ public class SettingsFilteringIT extends ESIntegTestCase { .build(); } - public static class SettingsFilteringPlugin extends AbstractPlugin { + public static class SettingsFilteringPlugin extends Plugin { /** * The name of the plugin. */ @@ -67,10 +68,8 @@ public class SettingsFilteringIT extends ESIntegTestCase { } @Override - public Collection> indexModules() { - Collection> modules = newArrayList(); - modules.add(SettingsFilteringModule.class); - return modules; + public Collection indexModules(Settings indexSettings) { + return Collections.singletonList(new SettingsFilteringModule()); } } diff --git a/core/src/test/java/org/elasticsearch/common/util/MockBigArrays.java b/core/src/test/java/org/elasticsearch/common/util/MockBigArrays.java index 4eb4a376962..1e94285beea 100644 --- a/core/src/test/java/org/elasticsearch/common/util/MockBigArrays.java +++ b/core/src/test/java/org/elasticsearch/common/util/MockBigArrays.java @@ -24,14 +24,12 @@ import com.carrotsearch.randomizedtesting.SeedUtils; import com.google.common.base.Predicate; import com.google.common.collect.Maps; import com.google.common.collect.Sets; - import org.apache.lucene.util.Accountable; import org.apache.lucene.util.Accountables; import org.apache.lucene.util.BytesRef; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.indices.breaker.CircuitBreakerService; -import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.test.ESTestCase; import java.util.Collection; diff --git a/core/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsIT.java b/core/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsIT.java index 6c466599e66..84b206dec68 100644 --- a/core/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsIT.java +++ b/core/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsIT.java @@ -143,7 +143,7 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase { .put(DiscoverySettings.PUBLISH_TIMEOUT, "1s") // <-- for hitting simulated network failures quickly .put("http.enabled", false) // just to make test quicker .put("gateway.local.list_timeout", "10s") // still long to induce failures but to long so test won't time out - .put("plugin.types", MockTransportService.Plugin.class.getName()) + .put("plugin.types", MockTransportService.TestPlugin.class.getName()) .build(); private void configureCluster(int numberOfNodes, int minimumMasterNode) throws ExecutionException, InterruptedException { diff --git a/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java b/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java index 0df33c5c9b8..ee85af93215 100644 --- a/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java +++ b/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java @@ -416,7 +416,7 @@ public class IndexWithShadowReplicasIT extends ESIntegTestCase { Path dataPath = createTempDir(); Settings nodeSettings = Settings.builder() .put("node.add_id_to_custom_path", false) - .put("plugin.types", MockTransportService.Plugin.class.getName()) + .put("plugin.types", MockTransportService.TestPlugin.class.getName()) .put("path.shared_data", dataPath) .build(); diff --git a/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java b/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java index 7efc56115ce..77250476aa9 100644 --- a/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java +++ b/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java @@ -56,7 +56,7 @@ public class TransportIndexFailuresIT extends ESIntegTestCase { .put(FaultDetection.SETTING_PING_RETRIES, "1") // <-- for hitting simulated network failures quickly .put(DiscoverySettings.PUBLISH_TIMEOUT, "1s") // <-- for hitting simulated network failures quickly .put("discovery.zen.minimum_master_nodes", 1) - .put("plugin.types", MockTransportService.Plugin.class.getName()) + .put("plugin.types", MockTransportService.TestPlugin.class.getName()) .build(); @Override diff --git a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalMapperPlugin.java b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalMapperPlugin.java index d9821af6382..d9cee69f8b0 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalMapperPlugin.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalMapperPlugin.java @@ -20,33 +20,25 @@ package org.elasticsearch.index.mapper.externalvalues; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.plugins.Plugin; import java.util.Collection; +import java.util.Collections; -import static com.google.common.collect.Lists.newArrayList; - -public class ExternalMapperPlugin extends AbstractPlugin { - /** - * The name of the plugin. - */ +public class ExternalMapperPlugin extends Plugin { @Override public String name() { return "external-mappers"; } - /** - * The description of the plugin. - */ @Override public String description() { return "External Mappers Plugin"; } @Override - public Collection> indexModules() { - Collection> modules = newArrayList(); - modules.add(ExternalIndexModule.class); - return modules; + public Collection indexModules(Settings indexSettings) { + return Collections.singletonList(new ExternalIndexModule()); } } diff --git a/core/src/test/java/org/elasticsearch/index/query/plugin/DummyQueryParserPlugin.java b/core/src/test/java/org/elasticsearch/index/query/plugin/DummyQueryParserPlugin.java index cdffcc8c36b..dbbc3581602 100644 --- a/core/src/test/java/org/elasticsearch/index/query/plugin/DummyQueryParserPlugin.java +++ b/core/src/test/java/org/elasticsearch/index/query/plugin/DummyQueryParserPlugin.java @@ -30,11 +30,11 @@ import org.elasticsearch.index.query.QueryParseContext; import org.elasticsearch.index.query.QueryParser; import org.elasticsearch.index.query.QueryParsingException; import org.elasticsearch.indices.IndicesModule; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import java.io.IOException; -public class DummyQueryParserPlugin extends AbstractPlugin { +public class DummyQueryParserPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/index/shard/MockEngineFactoryPlugin.java b/core/src/test/java/org/elasticsearch/index/shard/MockEngineFactoryPlugin.java index 8ed60609683..d1b50487c63 100644 --- a/core/src/test/java/org/elasticsearch/index/shard/MockEngineFactoryPlugin.java +++ b/core/src/test/java/org/elasticsearch/index/shard/MockEngineFactoryPlugin.java @@ -19,16 +19,16 @@ package org.elasticsearch.index.shard; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.engine.MockEngineFactory; import org.elasticsearch.test.engine.MockEngineSupportModule; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; +import java.util.Collections; // this must exist in the same package as IndexShardModule to allow access to setting the impl -public class MockEngineFactoryPlugin extends AbstractPlugin { +public class MockEngineFactoryPlugin extends Plugin { @Override public String name() { return "mock-engine-factory"; @@ -38,10 +38,8 @@ public class MockEngineFactoryPlugin extends AbstractPlugin { return "a mock engine factory for testing"; } @Override - public Collection> indexModules() { - List> modules = new ArrayList<>(); - modules.add(MockEngineSupportModule.class); - return modules; + public Collection indexModules(Settings indexSettings) { + return Collections.singletonList(new MockEngineSupportModule()); } public void onModule(IndexShardModule module) { module.engineFactoryImpl = MockEngineFactory.class; diff --git a/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java b/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java index 4a2f560c4f4..b9d00741720 100644 --- a/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java +++ b/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java @@ -98,7 +98,7 @@ public class CorruptedFileIT extends ESIntegTestCase { // we really need local GW here since this also checks for corruption etc. // and we need to make sure primaries are not just trashed if we don't have replicas .put(super.nodeSettings(nodeOrdinal)) - .extendArray("plugin.types", MockTransportService.Plugin.class.getName()) + .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName()) // speed up recoveries .put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_STREAMS, 10) .put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_SMALL_FILE_STREAMS, 10) diff --git a/core/src/test/java/org/elasticsearch/index/store/CorruptedTranslogIT.java b/core/src/test/java/org/elasticsearch/index/store/CorruptedTranslogIT.java index ec5d24254a1..04b0ed38742 100644 --- a/core/src/test/java/org/elasticsearch/index/store/CorruptedTranslogIT.java +++ b/core/src/test/java/org/elasticsearch/index/store/CorruptedTranslogIT.java @@ -66,7 +66,7 @@ public class CorruptedTranslogIT extends ESIntegTestCase { // we really need local GW here since this also checks for corruption etc. // and we need to make sure primaries are not just trashed if we don't have replicas .put(super.nodeSettings(nodeOrdinal)) - .extendArray("plugin.types", MockTransportService.Plugin.class.getName()).build(); + .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName()).build(); } @Test diff --git a/core/src/test/java/org/elasticsearch/index/store/ExceptionRetryIT.java b/core/src/test/java/org/elasticsearch/index/store/ExceptionRetryIT.java index bd2adc1e579..9fe2a0fd629 100644 --- a/core/src/test/java/org/elasticsearch/index/store/ExceptionRetryIT.java +++ b/core/src/test/java/org/elasticsearch/index/store/ExceptionRetryIT.java @@ -54,7 +54,7 @@ public class ExceptionRetryIT extends ESIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .extendArray("plugin.types", MockTransportService.Plugin.class.getName()) + .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName()) .build(); } diff --git a/core/src/test/java/org/elasticsearch/indices/analysis/DummyAnalysisPlugin.java b/core/src/test/java/org/elasticsearch/indices/analysis/DummyAnalysisPlugin.java index 55d22eb8c91..003771f8cc7 100644 --- a/core/src/test/java/org/elasticsearch/indices/analysis/DummyAnalysisPlugin.java +++ b/core/src/test/java/org/elasticsearch/indices/analysis/DummyAnalysisPlugin.java @@ -19,14 +19,14 @@ package org.elasticsearch.indices.analysis; -import com.google.common.collect.ImmutableList; import org.elasticsearch.common.inject.Module; import org.elasticsearch.index.analysis.AnalysisModule; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import java.util.Collection; +import java.util.Collections; -public class DummyAnalysisPlugin extends AbstractPlugin { +public class DummyAnalysisPlugin extends Plugin { /** * The name of the plugin. */ @@ -44,8 +44,8 @@ public class DummyAnalysisPlugin extends AbstractPlugin { } @Override - public Collection> modules() { - return ImmutableList.>of(DummyIndicesAnalysisModule.class); + public Collection nodeModules() { + return Collections.singletonList(new DummyIndicesAnalysisModule()); } public void onModule(AnalysisModule module) { diff --git a/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java b/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java index 2e8c1658270..6ff35daf55a 100644 --- a/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java +++ b/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java @@ -35,7 +35,7 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.engine.MockEngineSupport; @@ -107,7 +107,7 @@ public class RandomExceptionCircuitBreakerIT extends ESIntegTestCase { Settings.Builder settings = settingsBuilder() .put(indexSettings()) - .extendArray("plugin.types", RandomExceptionDirectoryReaderWrapper.Plugin.class.getName()) + .extendArray("plugin.types", RandomExceptionDirectoryReaderWrapper.TestPlugin.class.getName()) .put(EXCEPTION_TOP_LEVEL_RATIO_KEY, topLevelRate) .put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate) .put(MockEngineSupport.WRAP_READER_RATIO, 1.0d); @@ -202,7 +202,7 @@ public class RandomExceptionCircuitBreakerIT extends ESIntegTestCase { // TODO: Generalize this class and add it as a utility public static class RandomExceptionDirectoryReaderWrapper extends MockEngineSupport.DirectoryReaderWrapper { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "random-exception-reader-wrapper"; diff --git a/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java b/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java index a6263eee9d5..c2860c75033 100644 --- a/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java +++ b/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java @@ -519,7 +519,7 @@ public class IndexRecoveryIT extends ESIntegTestCase { final Settings nodeSettings = Settings.builder() .put(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK, "100ms") .put(RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT, "1s") - .put("plugin.types", MockTransportService.Plugin.class.getName()) + .put("plugin.types", MockTransportService.TestPlugin.class.getName()) .put(MockFSDirectoryService.RANDOM_PREVENT_DOUBLE_WRITE, false) // restarted recoveries will delete temp files and write them again .build(); // start a master node diff --git a/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java b/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java index 8417b227845..898415152ca 100644 --- a/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java +++ b/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java @@ -87,7 +87,7 @@ public class IndicesStoreIntegrationIT extends ESIntegTestCase { // which is between 1 and 2 sec can cause each of the shard deletion requests to timeout. // to prevent this we are setting the timeout here to something highish ie. the default in practice .put(IndicesStore.INDICES_STORE_DELETE_SHARD_TIMEOUT, new TimeValue(30, TimeUnit.SECONDS)) - .extendArray("plugin.types", MockTransportService.Plugin.class.getName()) + .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName()) .build(); } diff --git a/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringIT.java b/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringIT.java index fdabe10888b..e441a952f21 100644 --- a/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringIT.java +++ b/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringIT.java @@ -27,7 +27,7 @@ import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; @@ -80,7 +80,7 @@ public class IndexTemplateFilteringIT extends ESIntegTestCase { } } - public static class TestPlugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "test-plugin"; diff --git a/core/src/test/java/org/elasticsearch/node/NodeMocksPlugin.java b/core/src/test/java/org/elasticsearch/node/NodeMocksPlugin.java index 8eed1e16713..f958b2b752e 100644 --- a/core/src/test/java/org/elasticsearch/node/NodeMocksPlugin.java +++ b/core/src/test/java/org/elasticsearch/node/NodeMocksPlugin.java @@ -20,9 +20,9 @@ package org.elasticsearch.node; import org.elasticsearch.cache.recycler.MockPageCacheRecycler; import org.elasticsearch.common.util.MockBigArrays; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -public class NodeMocksPlugin extends AbstractPlugin { +public class NodeMocksPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/nodesinfo/plugin/dummy1/TestPlugin.java b/core/src/test/java/org/elasticsearch/nodesinfo/plugin/dummy1/TestPlugin.java index 274e5e51a05..8455a3bf562 100644 --- a/core/src/test/java/org/elasticsearch/nodesinfo/plugin/dummy1/TestPlugin.java +++ b/core/src/test/java/org/elasticsearch/nodesinfo/plugin/dummy1/TestPlugin.java @@ -19,9 +19,9 @@ package org.elasticsearch.nodesinfo.plugin.dummy1; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -public class TestPlugin extends AbstractPlugin { +public class TestPlugin extends Plugin { static final public class Fields { static public final String NAME = "test-plugin"; diff --git a/core/src/test/java/org/elasticsearch/nodesinfo/plugin/dummy2/TestNoVersionPlugin.java b/core/src/test/java/org/elasticsearch/nodesinfo/plugin/dummy2/TestNoVersionPlugin.java deleted file mode 100644 index 58b5ee007f2..00000000000 --- a/core/src/test/java/org/elasticsearch/nodesinfo/plugin/dummy2/TestNoVersionPlugin.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.nodesinfo.plugin.dummy2; - -import org.elasticsearch.plugins.AbstractPlugin; - -public class TestNoVersionPlugin extends AbstractPlugin { - - static final public class Fields { - static public final String NAME = "test-no-version-plugin"; - static public final String DESCRIPTION = NAME + " description"; - } - - @Override - public String name() { - return Fields.NAME; - } - - @Override - public String description() { - return Fields.DESCRIPTION; - } -} diff --git a/core/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleIT.java b/core/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleIT.java index 514e8460f08..07904389d3c 100644 --- a/core/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleIT.java +++ b/core/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleIT.java @@ -73,7 +73,7 @@ public class PluggableTransportModuleIT extends ESIntegTestCase { assertThat("Expected send request counter to be greather than zero", countAfterRequest, is(greaterThan(countBeforeRequest))); } - public static class CountingSentRequestsPlugin extends AbstractPlugin { + public static class CountingSentRequestsPlugin extends Plugin { @Override public String name() { return "counting-pipelines-plugin"; diff --git a/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java b/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java index 8a1c8b14693..6ac34c2297e 100644 --- a/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java +++ b/core/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.index.store.IndexStoreModule; import org.elasticsearch.test.ESTestCase; public class PluginsServiceTests extends ESTestCase { - public static class AdditionalSettingsPlugin1 extends AbstractPlugin { + public static class AdditionalSettingsPlugin1 extends Plugin { @Override public String name() { return "additional-settings1"; @@ -39,7 +39,7 @@ public class PluginsServiceTests extends ESTestCase { return Settings.builder().put("foo.bar", "1").put(IndexStoreModule.STORE_TYPE, IndexStoreModule.Type.MMAPFS.getSettingsKey()).build(); } } - public static class AdditionalSettingsPlugin2 extends AbstractPlugin { + public static class AdditionalSettingsPlugin2 extends Plugin { @Override public String name() { return "additional-settings2"; diff --git a/core/src/test/java/org/elasticsearch/plugins/loading/classpath/InClassPathPlugin.java b/core/src/test/java/org/elasticsearch/plugins/loading/classpath/InClassPathPlugin.java index cf4959e62d1..79b1f244eff 100644 --- a/core/src/test/java/org/elasticsearch/plugins/loading/classpath/InClassPathPlugin.java +++ b/core/src/test/java/org/elasticsearch/plugins/loading/classpath/InClassPathPlugin.java @@ -19,9 +19,9 @@ package org.elasticsearch.plugins.loading.classpath; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -public class InClassPathPlugin extends AbstractPlugin { +public class InClassPathPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderPlugin.java b/core/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderPlugin.java index 48b00b23754..b9282cf05ad 100644 --- a/core/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderPlugin.java +++ b/core/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderPlugin.java @@ -19,10 +19,10 @@ package org.elasticsearch.plugins.responseheader; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.rest.RestModule; -public class TestResponseHeaderPlugin extends AbstractPlugin { +public class TestResponseHeaderPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java b/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java index 53a71e1dc7b..39622287ea2 100644 --- a/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java +++ b/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java @@ -102,7 +102,7 @@ public class RelocationIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() - .put("plugin.types", MockTransportService.Plugin.class.getName()).build(); + .put("plugin.types", MockTransportService.TestPlugin.class.getName()).build(); } diff --git a/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java b/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java index c8943d1ff27..943a1485100 100644 --- a/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java +++ b/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java @@ -58,7 +58,7 @@ public class TruncatedRecoveryIT extends ESIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { Settings.Builder builder = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) - .extendArray("plugin.types", MockTransportService.Plugin.class.getName()) + .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName()) .put(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, new ByteSizeValue(randomIntBetween(50, 300), ByteSizeUnit.BYTES)); return builder.build(); } diff --git a/core/src/test/java/org/elasticsearch/script/CustomScriptContextIT.java b/core/src/test/java/org/elasticsearch/script/CustomScriptContextIT.java index ef9c4e3ced4..efac975fcc3 100644 --- a/core/src/test/java/org/elasticsearch/script/CustomScriptContextIT.java +++ b/core/src/test/java/org/elasticsearch/script/CustomScriptContextIT.java @@ -20,10 +20,8 @@ package org.elasticsearch.script; import com.google.common.collect.ImmutableSet; - -import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.expression.ExpressionScriptEngineService; import org.elasticsearch.script.groovy.GroovyScriptEngineService; import org.elasticsearch.script.mustache.MustacheScriptEngineService; @@ -117,7 +115,7 @@ public class CustomScriptContextIT extends ESIntegTestCase { } } - public static class CustomScriptContextPlugin extends AbstractPlugin { + public static class CustomScriptContextPlugin extends Plugin { @Override public String name() { return "custom_script_context_plugin"; @@ -128,14 +126,10 @@ public class CustomScriptContextIT extends ESIntegTestCase { return "Custom script context plugin"; } - @Override - public void processModule(Module module) { - if (module instanceof ScriptModule) { - ScriptModule scriptModule = (ScriptModule) module; - scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_op")); - scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_exp_disabled_op")); - scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_globally_disabled_op")); - } + public void onModule(ScriptModule scriptModule) { + scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_op")); + scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_exp_disabled_op")); + scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_globally_disabled_op")); } } } diff --git a/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java b/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java index 2ad584bfec5..3c35a286e3b 100644 --- a/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java +++ b/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.script; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; - import org.elasticsearch.common.Nullable; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; @@ -29,7 +28,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; import org.elasticsearch.env.EnvironmentModule; -import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.script.ScriptService.ScriptType; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; diff --git a/core/src/test/java/org/elasticsearch/script/ScriptFieldIT.java b/core/src/test/java/org/elasticsearch/script/ScriptFieldIT.java index 471cbb4cf20..c9707f7bdbb 100644 --- a/core/src/test/java/org/elasticsearch/script/ScriptFieldIT.java +++ b/core/src/test/java/org/elasticsearch/script/ScriptFieldIT.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptService.ScriptType; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.ESIntegTestCase; @@ -152,7 +152,7 @@ public class ScriptFieldIT extends ESIntegTestCase { } } - public static class CustomScriptPlugin extends AbstractPlugin { + public static class CustomScriptPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/search/MockSearchService.java b/core/src/test/java/org/elasticsearch/search/MockSearchService.java index 077f730f2c9..9a7a3efa3dc 100644 --- a/core/src/test/java/org/elasticsearch/search/MockSearchService.java +++ b/core/src/test/java/org/elasticsearch/search/MockSearchService.java @@ -28,9 +28,8 @@ import org.elasticsearch.indices.IndicesService; import org.elasticsearch.indices.IndicesWarmer; import org.elasticsearch.indices.cache.request.IndicesRequestCache; import org.elasticsearch.node.settings.NodeSettingsService; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptService; -import org.elasticsearch.search.SearchService; import org.elasticsearch.search.dfs.DfsPhase; import org.elasticsearch.search.fetch.FetchPhase; import org.elasticsearch.search.internal.SearchContext; @@ -43,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap; public class MockSearchService extends SearchService { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-search-service"; diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java index f167ce3cbef..c3780e98064 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreIT.java @@ -30,7 +30,7 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryParsingException; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptService; @@ -45,7 +45,14 @@ import org.elasticsearch.search.aggregations.bucket.significant.SignificantStrin import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms; import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregatorFactory; import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsBuilder; -import org.elasticsearch.search.aggregations.bucket.significant.heuristics.*; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.GND; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.ScriptHeuristic; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristicBuilder; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristicParser; +import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristicStreams; import org.elasticsearch.search.aggregations.bucket.terms.StringTerms; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; @@ -53,7 +60,12 @@ import org.elasticsearch.test.ESIntegTestCase; import org.junit.Test; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutionException; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; @@ -61,7 +73,10 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.closeTo; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.is; /** * @@ -154,7 +169,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase { } } - public static class CustomSignificanceHeuristicPlugin extends AbstractPlugin { + public static class CustomSignificanceHeuristicPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java b/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java index 64375138efd..76e24467049 100644 --- a/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java +++ b/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java @@ -35,7 +35,7 @@ import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.test.ESIntegTestCase; @@ -252,7 +252,7 @@ public class SearchWithRandomExceptionsIT extends ESIntegTestCase { Builder settings = settingsBuilder() .put(indexSettings()) - .extendArray("plugin.types", RandomExceptionDirectoryReaderWrapper.Plugin.class.getName()) + .extendArray("plugin.types", RandomExceptionDirectoryReaderWrapper.TestPlugin.class.getName()) .put(EXCEPTION_TOP_LEVEL_RATIO_KEY, topLevelRate) .put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate) .put(MockEngineSupport.WRAP_READER_RATIO, 1.0d); @@ -313,7 +313,7 @@ public class SearchWithRandomExceptionsIT extends ESIntegTestCase { public static class RandomExceptionDirectoryReaderWrapper extends MockEngineSupport.DirectoryReaderWrapper { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "random-exception-reader-wrapper"; diff --git a/core/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java b/core/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java index daf4d11a080..58ec58bfdf3 100644 --- a/core/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java +++ b/core/src/test/java/org/elasticsearch/search/fetch/FetchSubPhasePluginIT.java @@ -29,7 +29,7 @@ import org.elasticsearch.action.termvectors.TermVectorsResponse; import org.elasticsearch.common.Priority; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.SearchHitField; import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchParseElement; @@ -99,7 +99,7 @@ public class FetchSubPhasePluginIT extends ESIntegTestCase { assertThat(((Map) response.getHits().getAt(0).field("term_vectors_fetch").getValues().get(0)).get("sam"), equalTo(1)); } - public static class FetchTermVectorsPlugin extends AbstractPlugin { + public static class FetchTermVectorsPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptPlugin.java b/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptPlugin.java index d30c9453ec3..a32baa526b5 100644 --- a/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptPlugin.java +++ b/core/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptPlugin.java @@ -19,10 +19,10 @@ package org.elasticsearch.search.functionscore; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptModule; -public class ExplainableScriptPlugin extends AbstractPlugin { +public class ExplainableScriptPlugin extends Plugin { public ExplainableScriptPlugin() {} @Override diff --git a/core/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java b/core/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java index 61f50a17a26..d1dd06d8d82 100644 --- a/core/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java +++ b/core/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginIT.java @@ -28,7 +28,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.functionscore.DecayFunction; import org.elasticsearch.index.query.functionscore.DecayFunctionBuilder; import org.elasticsearch.index.query.functionscore.DecayFunctionParser; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.SearchModule; import org.elasticsearch.test.ESIntegTestCase; @@ -95,7 +95,7 @@ public class FunctionScorePluginIT extends ESIntegTestCase { } - public static class CustomDistanceScorePlugin extends AbstractPlugin { + public static class CustomDistanceScorePlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterPlugin.java b/core/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterPlugin.java index 705265ea5f6..80e39a2a6dd 100644 --- a/core/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterPlugin.java +++ b/core/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterPlugin.java @@ -19,10 +19,10 @@ package org.elasticsearch.search.highlight; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.SearchModule; -public class CustomHighlighterPlugin extends AbstractPlugin { +public class CustomHighlighterPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterPlugin.java b/core/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterPlugin.java index 9ba9c530e56..c5e36da2ea7 100644 --- a/core/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterPlugin.java +++ b/core/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterPlugin.java @@ -18,13 +18,13 @@ */ package org.elasticsearch.search.suggest; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.SearchModule; /** * */ -public class CustomSuggesterPlugin extends AbstractPlugin { +public class CustomSuggesterPlugin extends Plugin { @Override public String name() { diff --git a/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java b/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java index c346e5817bc..e430827d881 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java +++ b/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java @@ -20,7 +20,6 @@ package org.elasticsearch.snapshots.mockstore; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.SnapshotId; @@ -37,7 +36,6 @@ import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.env.Environment; import org.elasticsearch.index.snapshots.IndexShardRepository; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository; -import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.repositories.RepositoriesModule; import org.elasticsearch.repositories.RepositoryName; import org.elasticsearch.repositories.RepositorySettings; @@ -50,8 +48,6 @@ import java.io.UnsupportedEncodingException; import java.nio.file.Path; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -64,7 +60,7 @@ import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class MockRepository extends FsRepository { - public static class Plugin extends AbstractPlugin { + public static class Plugin extends org.elasticsearch.plugins.Plugin { @Override public String name() { @@ -81,10 +77,8 @@ public class MockRepository extends FsRepository { } @Override - public Collection> modules() { - Collection> modules = new ArrayList<>(); - modules.add(SettingsFilteringModule.class); - return modules; + public Collection nodeModules() { + return Collections.singletonList(new SettingsFilteringModule()); } public static class SettingsFilteringModule extends AbstractModule { diff --git a/core/src/test/java/org/elasticsearch/test/InternalTestCluster.java b/core/src/test/java/org/elasticsearch/test/InternalTestCluster.java index edf133e3fe7..31ddd9699a9 100644 --- a/core/src/test/java/org/elasticsearch/test/InternalTestCluster.java +++ b/core/src/test/java/org/elasticsearch/test/InternalTestCluster.java @@ -384,14 +384,14 @@ public final class InternalTestCluster extends TestCluster { .put(SETTING_CLUSTER_NODE_SEED, seed); if (ENABLE_MOCK_MODULES && usually(random)) { builder.extendArray("plugin.types", - MockTransportService.Plugin.class.getName(), - MockFSIndexStore.Plugin.class.getName(), + MockTransportService.TestPlugin.class.getName(), + MockFSIndexStore.TestPlugin.class.getName(), NodeMocksPlugin.class.getName(), MockEngineFactoryPlugin.class.getName(), - MockSearchService.Plugin.class.getName()); + MockSearchService.TestPlugin.class.getName()); } if (isLocalTransportConfigured()) { - builder.extendArray("plugin.types", AssertingLocalTransport.Plugin.class.getName()); + builder.extendArray("plugin.types", AssertingLocalTransport.TestPlugin.class.getName()); } else { builder.put(Transport.TransportSettings.TRANSPORT_TCP_COMPRESS, rarely(random)); } diff --git a/core/src/test/java/org/elasticsearch/test/disruption/NetworkPartitionIT.java b/core/src/test/java/org/elasticsearch/test/disruption/NetworkPartitionIT.java index a1ec62b64fa..e0cbfa5ed90 100644 --- a/core/src/test/java/org/elasticsearch/test/disruption/NetworkPartitionIT.java +++ b/core/src/test/java/org/elasticsearch/test/disruption/NetworkPartitionIT.java @@ -35,7 +35,7 @@ public class NetworkPartitionIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() - .put("plugin.types", MockTransportService.Plugin.class.getName()) + .put("plugin.types", MockTransportService.TestPlugin.class.getName()) .build(); } diff --git a/core/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java b/core/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java index 47b0baa7c54..c5b5ac36f00 100644 --- a/core/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java +++ b/core/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java @@ -28,11 +28,11 @@ import org.elasticsearch.index.store.DirectoryService; import org.elasticsearch.index.store.IndexStore; import org.elasticsearch.index.store.IndexStoreModule; import org.elasticsearch.indices.store.IndicesStore; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; public class MockFSIndexStore extends IndexStore { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-index-store"; diff --git a/core/src/test/java/org/elasticsearch/test/transport/AssertingLocalTransport.java b/core/src/test/java/org/elasticsearch/test/transport/AssertingLocalTransport.java index 7bda47b94c8..d9b9b491c9d 100644 --- a/core/src/test/java/org/elasticsearch/test/transport/AssertingLocalTransport.java +++ b/core/src/test/java/org/elasticsearch/test/transport/AssertingLocalTransport.java @@ -24,12 +24,17 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.VersionUtils; import org.elasticsearch.test.hamcrest.ElasticsearchAssertions; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.*; +import org.elasticsearch.transport.TransportException; +import org.elasticsearch.transport.TransportModule; +import org.elasticsearch.transport.TransportRequest; +import org.elasticsearch.transport.TransportRequestOptions; +import org.elasticsearch.transport.TransportResponse; +import org.elasticsearch.transport.TransportResponseHandler; import org.elasticsearch.transport.local.LocalTransport; import java.io.IOException; @@ -37,7 +42,7 @@ import java.util.Random; public class AssertingLocalTransport extends LocalTransport { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "asserting-local-transport"; diff --git a/core/src/test/java/org/elasticsearch/test/transport/MockTransportService.java b/core/src/test/java/org/elasticsearch/test/transport/MockTransportService.java index ce381af6263..0aa2e3487fa 100644 --- a/core/src/test/java/org/elasticsearch/test/transport/MockTransportService.java +++ b/core/src/test/java/org/elasticsearch/test/transport/MockTransportService.java @@ -32,12 +32,24 @@ import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.*; +import org.elasticsearch.transport.ConnectTransportException; +import org.elasticsearch.transport.RequestHandlerRegistry; +import org.elasticsearch.transport.Transport; +import org.elasticsearch.transport.TransportException; +import org.elasticsearch.transport.TransportModule; +import org.elasticsearch.transport.TransportRequest; +import org.elasticsearch.transport.TransportRequestOptions; +import org.elasticsearch.transport.TransportService; +import org.elasticsearch.transport.TransportServiceAdapter; import java.io.IOException; -import java.util.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArrayList; @@ -46,7 +58,7 @@ import java.util.concurrent.CopyOnWriteArrayList; */ public class MockTransportService extends TransportService { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-transport-service"; diff --git a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java index ff6a21b1cef..811f6e5928d 100644 --- a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java +++ b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java @@ -21,7 +21,12 @@ package org.elasticsearch.transport; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import org.elasticsearch.action.*; +import org.elasticsearch.action.Action; +import org.elasticsearch.action.ActionListener; +import org.elasticsearch.action.ActionModule; +import org.elasticsearch.action.ActionRequest; +import org.elasticsearch.action.ActionRequestBuilder; +import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.index.IndexRequest; @@ -41,8 +46,12 @@ import org.elasticsearch.common.inject.PreProcessModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.http.HttpServerTransport; -import org.elasticsearch.index.query.*; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.index.query.BoolQueryBuilder; +import org.elasticsearch.index.query.GeoShapeQueryBuilder; +import org.elasticsearch.index.query.MoreLikeThisQueryBuilder; +import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.index.query.TermsLookupQueryBuilder; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.rest.RestController; import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.groovy.GroovyScriptEngineService; @@ -55,7 +64,13 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; @@ -64,8 +79,13 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.node.Node.HTTP_ENABLED; import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; -import static org.hamcrest.Matchers.*; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasStatus; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; @ClusterScope(scope = SUITE) public class ContextAndHeaderTransportIT extends ESIntegTestCase { @@ -365,7 +385,7 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase { return filterClient; } - public static class ActionLoggingPlugin extends AbstractPlugin { + public static class ActionLoggingPlugin extends Plugin { @Override public String name() { @@ -378,10 +398,8 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase { } @Override - public Collection> modules() { - Collection> classes = new ArrayList<>(); - classes.add(ActionLoggingModule.class); - return classes; + public Collection nodeModules() { + return Collections.singletonList(new ActionLoggingModule()); } } diff --git a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java index ad38b4c8925..e26998cc0a6 100644 --- a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java +++ b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java @@ -33,7 +33,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.concurrent.AbstractRunnable; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.ActionNotFoundTransportException; @@ -67,7 +67,7 @@ public class NettyTransportIT extends ESIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) .put("node.mode", "network") - .extendArray("plugin.types", ExceptionThrowingNettyTransport.Plugin.class.getName()).build(); + .extendArray("plugin.types", ExceptionThrowingNettyTransport.TestPlugin.class.getName()).build(); } @Test @@ -87,7 +87,7 @@ public class NettyTransportIT extends ESIntegTestCase { public static final class ExceptionThrowingNettyTransport extends NettyTransport { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "exception-throwing-netty-transport"; diff --git a/core/src/test/java/org/elasticsearch/update/UpdateByNativeScriptIT.java b/core/src/test/java/org/elasticsearch/update/UpdateByNativeScriptIT.java index 8a7279261f0..2e2edb64bbb 100644 --- a/core/src/test/java/org/elasticsearch/update/UpdateByNativeScriptIT.java +++ b/core/src/test/java/org/elasticsearch/update/UpdateByNativeScriptIT.java @@ -19,10 +19,9 @@ package org.elasticsearch.update; import com.google.common.collect.Maps; - import org.elasticsearch.common.Nullable; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.AbstractExecutableScript; import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.NativeScriptEngineService; @@ -50,7 +49,7 @@ public class UpdateByNativeScriptIT extends ESIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) - .extendArray("plugin.types", CustomNativeScriptFactory.Plugin.class.getName()) + .extendArray("plugin.types", CustomNativeScriptFactory.TestPlugin.class.getName()) .build(); } @@ -72,7 +71,7 @@ public class UpdateByNativeScriptIT extends ESIntegTestCase { } public static class CustomNativeScriptFactory implements NativeScriptFactory { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-native-script"; diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java index be73376fd24..6b9314cacff 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/plugin/analysis/icu/AnalysisICUPlugin.java @@ -23,15 +23,15 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.IcuAnalysisBinderProcessor; import org.elasticsearch.indices.analysis.IcuIndicesAnalysisModule; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; /** * */ -public class AnalysisICUPlugin extends AbstractPlugin { +public class AnalysisICUPlugin extends Plugin { @Override public String name() { @@ -44,10 +44,8 @@ public class AnalysisICUPlugin extends AbstractPlugin { } @Override - public Collection> modules() { - Collection> classes = new ArrayList<>(); - classes.add(IcuIndicesAnalysisModule.class); - return classes; + public Collection nodeModules() { + return Collections.singletonList(new IcuIndicesAnalysisModule()); } /** diff --git a/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/plugin/analysis/kuromoji/AnalysisKuromojiPlugin.java b/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/plugin/analysis/kuromoji/AnalysisKuromojiPlugin.java index 88d3cee3037..46dce43b307 100644 --- a/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/plugin/analysis/kuromoji/AnalysisKuromojiPlugin.java +++ b/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/plugin/analysis/kuromoji/AnalysisKuromojiPlugin.java @@ -20,17 +20,25 @@ package org.elasticsearch.plugin.analysis.kuromoji; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.index.analysis.*; +import org.elasticsearch.index.analysis.AnalysisModule; +import org.elasticsearch.index.analysis.JapaneseStopTokenFilterFactory; +import org.elasticsearch.index.analysis.KuromojiAnalyzerProvider; +import org.elasticsearch.index.analysis.KuromojiBaseFormFilterFactory; +import org.elasticsearch.index.analysis.KuromojiIterationMarkCharFilterFactory; +import org.elasticsearch.index.analysis.KuromojiKatakanaStemmerFactory; +import org.elasticsearch.index.analysis.KuromojiPartOfSpeechFilterFactory; +import org.elasticsearch.index.analysis.KuromojiReadingFormFilterFactory; +import org.elasticsearch.index.analysis.KuromojiTokenizerFactory; import org.elasticsearch.indices.analysis.KuromojiIndicesAnalysisModule; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; /** * */ -public class AnalysisKuromojiPlugin extends AbstractPlugin { +public class AnalysisKuromojiPlugin extends Plugin { @Override public String name() { @@ -43,10 +51,8 @@ public class AnalysisKuromojiPlugin extends AbstractPlugin { } @Override - public Collection> modules() { - Collection> classes = new ArrayList<>(); - classes.add(KuromojiIndicesAnalysisModule.class); - return classes; + public Collection nodeModules() { + return Collections.singletonList(new KuromojiIndicesAnalysisModule()); } public void onModule(AnalysisModule module) { diff --git a/plugins/analysis-phonetic/src/main/java/org/elasticsearch/plugin/analysis/AnalysisPhoneticPlugin.java b/plugins/analysis-phonetic/src/main/java/org/elasticsearch/plugin/analysis/AnalysisPhoneticPlugin.java index dacea45e049..1ef97c62e73 100644 --- a/plugins/analysis-phonetic/src/main/java/org/elasticsearch/plugin/analysis/AnalysisPhoneticPlugin.java +++ b/plugins/analysis-phonetic/src/main/java/org/elasticsearch/plugin/analysis/AnalysisPhoneticPlugin.java @@ -21,11 +21,11 @@ package org.elasticsearch.plugin.analysis; import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.PhoneticAnalysisBinderProcessor; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; /** */ -public class AnalysisPhoneticPlugin extends AbstractPlugin { +public class AnalysisPhoneticPlugin extends Plugin { @Override public String name() { diff --git a/plugins/analysis-smartcn/src/main/java/org/elasticsearch/plugin/analysis/smartcn/AnalysisSmartChinesePlugin.java b/plugins/analysis-smartcn/src/main/java/org/elasticsearch/plugin/analysis/smartcn/AnalysisSmartChinesePlugin.java index 08759e284c2..92b933fd725 100644 --- a/plugins/analysis-smartcn/src/main/java/org/elasticsearch/plugin/analysis/smartcn/AnalysisSmartChinesePlugin.java +++ b/plugins/analysis-smartcn/src/main/java/org/elasticsearch/plugin/analysis/smartcn/AnalysisSmartChinesePlugin.java @@ -23,15 +23,15 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.SmartChineseAnalysisBinderProcessor; import org.elasticsearch.indices.analysis.smartcn.SmartChineseIndicesAnalysisModule; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; /** * */ -public class AnalysisSmartChinesePlugin extends AbstractPlugin { +public class AnalysisSmartChinesePlugin extends Plugin { @Override public String name() { @@ -44,10 +44,8 @@ public class AnalysisSmartChinesePlugin extends AbstractPlugin { } @Override - public Collection> modules() { - Collection> classes = new ArrayList<>(); - classes.add(SmartChineseIndicesAnalysisModule.class); - return classes; + public Collection nodeModules() { + return Collections.singletonList(new SmartChineseIndicesAnalysisModule()); } public void onModule(AnalysisModule module) { diff --git a/plugins/analysis-stempel/src/main/java/org/elasticsearch/plugin/analysis/stempel/AnalysisStempelPlugin.java b/plugins/analysis-stempel/src/main/java/org/elasticsearch/plugin/analysis/stempel/AnalysisStempelPlugin.java index 8f9fa7d3027..b22cda173a4 100644 --- a/plugins/analysis-stempel/src/main/java/org/elasticsearch/plugin/analysis/stempel/AnalysisStempelPlugin.java +++ b/plugins/analysis-stempel/src/main/java/org/elasticsearch/plugin/analysis/stempel/AnalysisStempelPlugin.java @@ -23,14 +23,15 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.pl.PolishAnalysisBinderProcessor; import org.elasticsearch.indices.analysis.pl.PolishIndicesAnalysisModule; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -import java.util.*; +import java.util.Collection; +import java.util.Collections; /** * */ -public class AnalysisStempelPlugin extends AbstractPlugin { +public class AnalysisStempelPlugin extends Plugin { @Override public String name() { @@ -43,10 +44,8 @@ public class AnalysisStempelPlugin extends AbstractPlugin { } @Override - public Collection> modules() { - Collection> classes = new ArrayList<>(); - classes.add(PolishIndicesAnalysisModule.class); - return classes; + public Collection nodeModules() { + return Collections.singletonList(new PolishIndicesAnalysisModule()); } public void onModule(AnalysisModule module) { diff --git a/plugins/cloud-aws/src/main/java/org/elasticsearch/plugin/cloud/aws/CloudAwsPlugin.java b/plugins/cloud-aws/src/main/java/org/elasticsearch/plugin/cloud/aws/CloudAwsPlugin.java index 55a0ae51fb1..d5d7f6b01ed 100644 --- a/plugins/cloud-aws/src/main/java/org/elasticsearch/plugin/cloud/aws/CloudAwsPlugin.java +++ b/plugins/cloud-aws/src/main/java/org/elasticsearch/plugin/cloud/aws/CloudAwsPlugin.java @@ -26,8 +26,8 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoveryModule; import org.elasticsearch.discovery.ec2.Ec2Discovery; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository; -import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.repositories.RepositoriesModule; import org.elasticsearch.repositories.s3.S3Repository; @@ -37,7 +37,7 @@ import java.util.Collection; /** * */ -public class CloudAwsPlugin extends AbstractPlugin { +public class CloudAwsPlugin extends Plugin { private final Settings settings; @@ -56,7 +56,7 @@ public class CloudAwsPlugin extends AbstractPlugin { } @Override - public Collection modules(Settings settings) { + public Collection nodeModules() { Collection modules = new ArrayList<>(); if (settings.getAsBoolean("cloud.enabled", true)) { modules.add(new AwsModule()); @@ -65,7 +65,7 @@ public class CloudAwsPlugin extends AbstractPlugin { } @Override - public Collection> services() { + public Collection> nodeServices() { Collection> services = new ArrayList<>(); if (settings.getAsBoolean("cloud.enabled", true)) { services.add(AwsModule.getS3ServiceImpl()); diff --git a/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java b/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java index 082f9ca49f6..a44a0f46b3a 100644 --- a/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java +++ b/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java @@ -75,7 +75,7 @@ public abstract class AbstractAwsTest extends ESIntegTestCase { Settings.Builder settings = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("path.home", createTempDir()) - .extendArray("plugin.types", CloudAwsPlugin.class.getName(), TestAwsS3Service.Plugin.class.getName()) + .extendArray("plugin.types", CloudAwsPlugin.class.getName(), TestAwsS3Service.TestPlugin.class.getName()) .put("cloud.aws.test.random", randomInt()) .put("cloud.aws.test.write_failures", 0.1) .put("cloud.aws.test.read_failures", 0.1); diff --git a/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/TestAwsS3Service.java b/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/TestAwsS3Service.java index 1124150ccf0..92e4d72ac27 100644 --- a/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/TestAwsS3Service.java +++ b/plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/TestAwsS3Service.java @@ -22,12 +22,12 @@ import com.amazonaws.services.s3.AmazonS3; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import java.util.IdentityHashMap; public class TestAwsS3Service extends InternalAwsS3Service { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-s3-service"; diff --git a/plugins/cloud-azure/src/main/java/org/elasticsearch/plugin/cloud/azure/CloudAzurePlugin.java b/plugins/cloud-azure/src/main/java/org/elasticsearch/plugin/cloud/azure/CloudAzurePlugin.java index f60f05da8c3..66673804fc2 100644 --- a/plugins/cloud-azure/src/main/java/org/elasticsearch/plugin/cloud/azure/CloudAzurePlugin.java +++ b/plugins/cloud-azure/src/main/java/org/elasticsearch/plugin/cloud/azure/CloudAzurePlugin.java @@ -30,19 +30,20 @@ import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository import org.elasticsearch.index.store.IndexStoreModule; import org.elasticsearch.index.store.smbmmapfs.SmbMmapFsIndexStore; import org.elasticsearch.index.store.smbsimplefs.SmbSimpleFsIndexStore; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.repositories.RepositoriesModule; import org.elasticsearch.repositories.azure.AzureRepository; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import static org.elasticsearch.cloud.azure.AzureModule.isSnapshotReady; /** * */ -public class CloudAzurePlugin extends AbstractPlugin { +public class CloudAzurePlugin extends Plugin { private final Settings settings; protected final ESLogger logger = Loggers.getLogger(CloudAzurePlugin.class); @@ -63,10 +64,10 @@ public class CloudAzurePlugin extends AbstractPlugin { } @Override - public Collection> modules() { - Collection> modules = new ArrayList<>(); + public Collection nodeModules() { + List modules = new ArrayList<>(); if (AzureModule.isCloudReady(settings)) { - modules.add(AzureModule.class); + modules.add(new AzureModule(settings)); } return modules; } diff --git a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTest.java b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTest.java index 620c10465f5..2dc5add0a3a 100644 --- a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTest.java +++ b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTest.java @@ -20,14 +20,10 @@ package org.elasticsearch.cloud.azure; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; -import org.elasticsearch.cloud.azure.AzureModule; -import org.elasticsearch.cloud.azure.management.AzureComputeService; import org.elasticsearch.cloud.azure.management.AzureComputeService.Discovery; import org.elasticsearch.cloud.azure.management.AzureComputeService.Management; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugin.cloud.azure.CloudAzurePlugin; -import org.elasticsearch.plugins.AbstractPlugin; -import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; public abstract class AbstractAzureComputeServiceTest extends ESIntegTestCase { diff --git a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTest.java b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTest.java index 9fae8158c3d..fa4131cf7d0 100644 --- a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTest.java +++ b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTest.java @@ -26,7 +26,7 @@ import org.elasticsearch.cloud.azure.storage.AzureStorageServiceMock; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugin.cloud.azure.CloudAzurePlugin; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.repositories.RepositoryMissingException; import org.elasticsearch.test.store.MockFSDirectoryService; import org.junit.After; @@ -36,7 +36,7 @@ import java.net.URISyntaxException; public abstract class AbstractAzureRepositoryServiceTest extends AbstractAzureTest { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-stoarge-service"; @@ -77,7 +77,7 @@ public abstract class AbstractAzureRepositoryServiceTest extends AbstractAzureTe @Override protected Settings nodeSettings(int nodeOrdinal) { Settings.Builder builder = Settings.settingsBuilder() - .extendArray("plugin.types", CloudAzurePlugin.class.getName(), Plugin.class.getName()) + .extendArray("plugin.types", CloudAzurePlugin.class.getName(), TestPlugin.class.getName()) .put(Storage.API_IMPLEMENTATION, mock) .put(Storage.CONTAINER, "snapshots"); diff --git a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceSimpleMock.java b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceSimpleMock.java index 2f161bbd602..6323e91d1df 100644 --- a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceSimpleMock.java +++ b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceSimpleMock.java @@ -19,12 +19,16 @@ package org.elasticsearch.cloud.azure; -import com.microsoft.windowsazure.management.compute.models.*; +import com.microsoft.windowsazure.management.compute.models.DeploymentSlot; +import com.microsoft.windowsazure.management.compute.models.DeploymentStatus; +import com.microsoft.windowsazure.management.compute.models.HostedServiceGetDetailedResponse; +import com.microsoft.windowsazure.management.compute.models.InstanceEndpoint; +import com.microsoft.windowsazure.management.compute.models.RoleInstance; import org.elasticsearch.cloud.azure.management.AzureComputeServiceAbstractMock; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.CollectionUtils; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import java.net.InetAddress; @@ -33,7 +37,7 @@ import java.net.InetAddress; */ public class AzureComputeServiceSimpleMock extends AzureComputeServiceAbstractMock { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-compute-service"; diff --git a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceTwoNodesMock.java b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceTwoNodesMock.java index e8f7fa9e37c..a87a4ef3434 100644 --- a/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceTwoNodesMock.java +++ b/plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/AzureComputeServiceTwoNodesMock.java @@ -20,13 +20,11 @@ package org.elasticsearch.cloud.azure; import com.microsoft.windowsazure.management.compute.models.*; -import org.elasticsearch.cloud.azure.AzureModule; import org.elasticsearch.cloud.azure.management.AzureComputeServiceAbstractMock; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.CollectionUtils; -import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin; import java.net.InetAddress; @@ -36,7 +34,7 @@ import java.net.InetAddress; * Mock Azure API with two started nodes */ public class AzureComputeServiceTwoNodesMock extends AzureComputeServiceAbstractMock { - public static class Plugin extends AbstractPlugin { + public static class TestPlugin extends Plugin { @Override public String name() { return "mock-compute-service"; diff --git a/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTest.java b/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTest.java index c0cde86ccc6..2cbdf4eaa3b 100644 --- a/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTest.java +++ b/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTest.java @@ -44,7 +44,7 @@ import static org.hamcrest.Matchers.nullValue; public class AzureMinimumMasterNodesTest extends AbstractAzureComputeServiceTest { public AzureMinimumMasterNodesTest() { - super(AzureComputeServiceTwoNodesMock.Plugin.class.getName()); + super(AzureComputeServiceTwoNodesMock.TestPlugin.class.getName()); } @Override diff --git a/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTest.java b/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTest.java index d99267e3b90..be69bde31ff 100644 --- a/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTest.java +++ b/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTest.java @@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.notNullValue; public class AzureSimpleTest extends AbstractAzureComputeServiceTest { public AzureSimpleTest() { - super(AzureComputeServiceSimpleMock.Plugin.class.getName()); + super(AzureComputeServiceSimpleMock.TestPlugin.class.getName()); } @Test diff --git a/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTest.java b/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTest.java index 818d828197a..f5ec7427cfb 100644 --- a/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTest.java +++ b/plugins/cloud-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTest.java @@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.notNullValue; public class AzureTwoStartedNodesTest extends AbstractAzureComputeServiceTest { public AzureTwoStartedNodesTest() { - super(AzureComputeServiceTwoNodesMock.Plugin.class.getName()); + super(AzureComputeServiceTwoNodesMock.TestPlugin.class.getName()); } @Test diff --git a/plugins/cloud-gce/src/main/java/org/elasticsearch/plugin/cloud/gce/CloudGcePlugin.java b/plugins/cloud-gce/src/main/java/org/elasticsearch/plugin/cloud/gce/CloudGcePlugin.java index 465b68028d1..8b2a3d27da3 100644 --- a/plugins/cloud-gce/src/main/java/org/elasticsearch/plugin/cloud/gce/CloudGcePlugin.java +++ b/plugins/cloud-gce/src/main/java/org/elasticsearch/plugin/cloud/gce/CloudGcePlugin.java @@ -25,15 +25,16 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoveryModule; import org.elasticsearch.discovery.gce.GceDiscovery; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import java.util.ArrayList; import java.util.Collection; +import java.util.List; /** * */ -public class CloudGcePlugin extends AbstractPlugin { +public class CloudGcePlugin extends Plugin { private final Settings settings; @@ -52,16 +53,16 @@ public class CloudGcePlugin extends AbstractPlugin { } @Override - public Collection> modules() { - Collection> modules = new ArrayList<>(); + public Collection nodeModules() { + List modules = new ArrayList<>(); if (settings.getAsBoolean("cloud.enabled", true)) { - modules.add(GceModule.class); + modules.add(new GceModule()); } return modules; } @Override - public Collection> services() { + public Collection> nodeServices() { Collection> services = new ArrayList<>(); if (settings.getAsBoolean("cloud.enabled", true)) { services.add(GceModule.getComputeServiceImpl()); diff --git a/plugins/delete-by-query/src/main/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryPlugin.java b/plugins/delete-by-query/src/main/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryPlugin.java index bcc13174ee7..7e50e932bf6 100644 --- a/plugins/delete-by-query/src/main/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryPlugin.java +++ b/plugins/delete-by-query/src/main/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryPlugin.java @@ -20,13 +20,12 @@ package org.elasticsearch.plugin.deletebyquery; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; -import java.util.Arrays; import java.util.Collection; +import java.util.Collections; -public class DeleteByQueryPlugin extends AbstractPlugin { +public class DeleteByQueryPlugin extends Plugin { public static final String NAME = "delete-by-query"; @@ -41,7 +40,7 @@ public class DeleteByQueryPlugin extends AbstractPlugin { } @Override - public Collection modules(Settings settings) { - return Arrays.asList((Module) new DeleteByQueryModule()); + public Collection nodeModules() { + return Collections.singletonList(new DeleteByQueryModule()); } } diff --git a/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/ExamplePluginConfiguration.java b/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/ExamplePluginConfiguration.java index 8b8dc255935..430d880766c 100644 --- a/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/ExamplePluginConfiguration.java +++ b/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/ExamplePluginConfiguration.java @@ -20,28 +20,17 @@ package org.elasticsearch.plugin.example; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.inject.Module; -import org.elasticsearch.common.inject.multibindings.Multibinder; -import org.elasticsearch.common.inject.name.Names; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.yaml.YamlXContent; -import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.env.Environment; -import org.elasticsearch.plugins.AbstractPlugin; -import org.elasticsearch.rest.action.cat.AbstractCatAction; import java.io.IOException; import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; - -import static org.elasticsearch.common.io.Streams.copyToString; import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.file.Files.newBufferedReader; +import static org.elasticsearch.common.io.Streams.copyToString; /** * Example configuration. diff --git a/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/JvmExamplePlugin.java b/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/JvmExamplePlugin.java index b67765a1951..fc9de8912d6 100644 --- a/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/JvmExamplePlugin.java +++ b/plugins/jvm-example/src/main/java/org/elasticsearch/plugin/example/JvmExamplePlugin.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.multibindings.Multibinder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.repositories.RepositoriesModule; import org.elasticsearch.rest.action.cat.AbstractCatAction; @@ -37,7 +36,7 @@ import java.util.Collections; /** * Example of a plugin. */ -public class JvmExamplePlugin implements Plugin { +public class JvmExamplePlugin extends Plugin { private final Settings settings; @@ -56,31 +55,18 @@ public class JvmExamplePlugin implements Plugin { } @Override - public Collection> modules() { - Collection> modules = new ArrayList<>(); - modules.add(ConfiguredExampleModule.class); - return modules; + public Collection nodeModules() { + return Collections.singletonList(new ConfiguredExampleModule()); } @Override - public Collection modules(Settings settings) { - Collection modules = new ArrayList<>(); - return modules; - } - - @Override - public Collection> services() { + public Collection> nodeServices() { Collection> services = new ArrayList<>(); return services; } @Override - public Collection> indexModules() { - return Collections.emptyList(); - } - - @Override - public Collection indexModules(Settings settings) { + public Collection indexModules(Settings indexSettings) { return Collections.emptyList(); } @@ -90,12 +76,7 @@ public class JvmExamplePlugin implements Plugin { } @Override - public Collection> shardModules() { - return Collections.emptyList(); - } - - @Override - public Collection shardModules(Settings settings) { + public Collection shardModules(Settings indexSettings) { return Collections.emptyList(); } @@ -104,11 +85,6 @@ public class JvmExamplePlugin implements Plugin { return Collections.emptyList(); } - @Override - public void processModule(Module module) { - - } - @Override public Settings additionalSettings() { return Settings.EMPTY; diff --git a/plugins/lang-javascript/src/main/java/org/elasticsearch/plugin/javascript/JavaScriptPlugin.java b/plugins/lang-javascript/src/main/java/org/elasticsearch/plugin/javascript/JavaScriptPlugin.java index 0b4ffd7fae5..a6832fe7afe 100644 --- a/plugins/lang-javascript/src/main/java/org/elasticsearch/plugin/javascript/JavaScriptPlugin.java +++ b/plugins/lang-javascript/src/main/java/org/elasticsearch/plugin/javascript/JavaScriptPlugin.java @@ -19,14 +19,14 @@ package org.elasticsearch.plugin.javascript; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.javascript.JavaScriptScriptEngineService; /** * */ -public class JavaScriptPlugin extends AbstractPlugin { +public class JavaScriptPlugin extends Plugin { @Override public String name() { diff --git a/plugins/lang-python/src/main/java/org/elasticsearch/plugin/python/PythonPlugin.java b/plugins/lang-python/src/main/java/org/elasticsearch/plugin/python/PythonPlugin.java index 78f05311a6f..28dad5135ab 100644 --- a/plugins/lang-python/src/main/java/org/elasticsearch/plugin/python/PythonPlugin.java +++ b/plugins/lang-python/src/main/java/org/elasticsearch/plugin/python/PythonPlugin.java @@ -19,14 +19,14 @@ package org.elasticsearch.plugin.python; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.python.PythonScriptEngineService; /** * */ -public class PythonPlugin extends AbstractPlugin { +public class PythonPlugin extends Plugin { @Override public String name() { diff --git a/plugins/mapper-murmur3/src/main/java/org/elasticsearch/plugin/mapper/MapperMurmur3Plugin.java b/plugins/mapper-murmur3/src/main/java/org/elasticsearch/plugin/mapper/MapperMurmur3Plugin.java index 9b6611decde..429db165b75 100644 --- a/plugins/mapper-murmur3/src/main/java/org/elasticsearch/plugin/mapper/MapperMurmur3Plugin.java +++ b/plugins/mapper-murmur3/src/main/java/org/elasticsearch/plugin/mapper/MapperMurmur3Plugin.java @@ -20,12 +20,13 @@ package org.elasticsearch.plugin.mapper; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.plugins.Plugin; import java.util.Collection; import java.util.Collections; -public class MapperMurmur3Plugin extends AbstractPlugin { +public class MapperMurmur3Plugin extends Plugin { @Override public String name() { @@ -38,8 +39,8 @@ public class MapperMurmur3Plugin extends AbstractPlugin { } @Override - public Collection> indexModules() { - return Collections.>singleton(MapperMurmur3IndexModule.class); + public Collection indexModules(Settings settings) { + return Collections.singletonList(new MapperMurmur3IndexModule()); } } diff --git a/plugins/mapper-size/src/main/java/org/elasticsearch/plugin/mapper/MapperSizePlugin.java b/plugins/mapper-size/src/main/java/org/elasticsearch/plugin/mapper/MapperSizePlugin.java index 20f52541eef..df95a4e9e67 100644 --- a/plugins/mapper-size/src/main/java/org/elasticsearch/plugin/mapper/MapperSizePlugin.java +++ b/plugins/mapper-size/src/main/java/org/elasticsearch/plugin/mapper/MapperSizePlugin.java @@ -20,12 +20,13 @@ package org.elasticsearch.plugin.mapper; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.plugins.AbstractPlugin; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.plugins.Plugin; import java.util.Collection; import java.util.Collections; -public class MapperSizePlugin extends AbstractPlugin { +public class MapperSizePlugin extends Plugin { @Override public String name() { @@ -38,8 +39,8 @@ public class MapperSizePlugin extends AbstractPlugin { } @Override - public Collection> indexModules() { - return Collections.>singleton(MapperSizeIndexModule.class); + public Collection indexModules(Settings indexSettings) { + return Collections.singletonList(new MapperSizeIndexModule()); } }