Merge pull request #12952 from rjernst/construct_it_yourself

Simplify Plugin API for constructing modules
This commit is contained in:
Ryan Ernst 2015-08-18 14:28:48 -07:00
commit 32a097382c
87 changed files with 347 additions and 632 deletions

View File

@ -260,7 +260,7 @@ public class TransportClient extends AbstractClient {
// ignore, might not be bounded // ignore, might not be bounded
} }
for (Class<? extends LifecycleComponent> plugin : injector.getInstance(PluginsService.class).services()) { for (Class<? extends LifecycleComponent> plugin : injector.getInstance(PluginsService.class).nodeServices()) {
injector.getInstance(plugin).close(); injector.getInstance(plugin).close();
} }
try { try {

View File

@ -230,7 +230,7 @@ public class Node implements Releasable {
// hack around dependency injection problem (for now...) // hack around dependency injection problem (for now...)
injector.getInstance(Discovery.class).setRoutingService(injector.getInstance(RoutingService.class)); injector.getInstance(Discovery.class).setRoutingService(injector.getInstance(RoutingService.class));
for (Class<? extends LifecycleComponent> plugin : pluginsService.services()) { for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) {
injector.getInstance(plugin).start(); injector.getInstance(plugin).start();
} }
@ -297,7 +297,7 @@ public class Node implements Releasable {
injector.getInstance(RestController.class).stop(); injector.getInstance(RestController.class).stop();
injector.getInstance(TransportService.class).stop(); injector.getInstance(TransportService.class).stop();
for (Class<? extends LifecycleComponent> plugin : pluginsService.services()) { for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) {
injector.getInstance(plugin).stop(); injector.getInstance(plugin).stop();
} }
// we should stop this last since it waits for resources to get released // 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"); stopWatch.stop().start("percolator_service");
injector.getInstance(PercolatorService.class).close(); injector.getInstance(PercolatorService.class).close();
for (Class<? extends LifecycleComponent> plugin : pluginsService.services()) { for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) {
stopWatch.stop().start("plugin(" + plugin.getName() + ")"); stopWatch.stop().start("plugin(" + plugin.getName() + ")");
injector.getInstance(plugin).close(); injector.getInstance(plugin).close();
} }

View File

@ -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.
* <p/>
* A plugin can be dynamically injected with {@link Module} by implementing <tt>onModule(AnyModule)</tt> 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<Class<? extends Module>> modules() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Module> modules(Settings settings) {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Class<? extends LifecycleComponent>> services() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Class<? extends Module>> indexModules() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Module> indexModules(Settings settings) {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Class<? extends Closeable>> indexServices() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Class<? extends Module>> shardModules() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Module> shardModules(Settings settings) {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override
public Collection<Class<? extends Closeable>> shardServices() {
return ImmutableList.of();
}
@Override
public void processModule(Module module) {
// nothing to do here
}
@Override
public Settings additionalSettings() {
return Settings.Builder.EMPTY_SETTINGS;
}
}

View File

@ -19,18 +19,12 @@
package org.elasticsearch.plugins; package org.elasticsearch.plugins;
import com.google.common.collect.Lists;
import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.inject.PreProcessModule; import org.elasticsearch.common.inject.PreProcessModule;
import org.elasticsearch.common.inject.SpawnModules; import org.elasticsearch.common.inject.SpawnModules;
import org.elasticsearch.common.settings.Settings; 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 @Override
public Iterable<? extends Module> spawnModules() { public Iterable<? extends Module> spawnModules() {
List<Module> modules = Lists.newArrayList(); return pluginsService.indexModules(settings);
Collection<Class<? extends Module>> modulesClasses = pluginsService.indexModules();
for (Class<? extends Module> moduleClass : modulesClasses) {
modules.add(createModule(moduleClass, settings));
}
modules.addAll(pluginsService.indexModules(settings));
return modules;
} }
@Override @Override

View File

@ -25,82 +25,73 @@ import org.elasticsearch.common.settings.Settings;
import java.io.Closeable; import java.io.Closeable;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
/** /**
* An extension point allowing to plug in custom functionality. * An extension point allowing to plug in custom functionality.
* <p/> * <p/>
* A plugin can be dynamically injected with {@link Module} by implementing <tt>onModule(AnyModule)</tt> method * A plugin can be register custom extensions to builtin behavior by implementing <tt>onModule(AnyModule)</tt>,
* removing the need to override {@link #processModule(org.elasticsearch.common.inject.Module)} and check using * and registering the extension with the given module.
* instanceof.
*/ */
public interface Plugin { public abstract class Plugin {
/** /**
* The name of the plugin. * The name of the plugin.
*/ */
String name(); public abstract String name();
/** /**
* The description of the plugin. * The description of the plugin.
*/ */
String description(); public abstract String description();
/** /**
* Node level modules (classes, will automatically be created). * Node level modules.
*/ */
Collection<Class<? extends Module>> modules(); public Collection<Module> nodeModules() {
return Collections.emptyList();
/** }
* Node level modules (instances)
*
* @param settings The node level settings.
*/
Collection<? extends Module> modules(Settings settings);
/** /**
* Node level services that will be automatically started/stopped/closed. * Node level services that will be automatically started/stopped/closed.
*/ */
Collection<Class<? extends LifecycleComponent>> services(); public Collection<Class<? extends LifecycleComponent>> nodeServices() {
return Collections.emptyList();
}
/** /**
* Per index modules. * Per index modules.
*/ */
Collection<Class<? extends Module>> indexModules(); public Collection<Module> indexModules(Settings indexSettings) {
return Collections.emptyList();
/** }
* Per index modules.
*/
Collection<? extends Module> indexModules(Settings settings);
/** /**
* Per index services that will be automatically closed. * Per index services that will be automatically closed.
*/ */
Collection<Class<? extends Closeable>> indexServices(); public Collection<Class<? extends Closeable>> indexServices() {
return Collections.emptyList();
}
/** /**
* Per index shard module. * Per index shard module.
*/ */
Collection<Class<? extends Module>> shardModules(); public Collection<Module> shardModules(Settings indexSettings) {
return Collections.emptyList();
/** }
* Per index shard module.
*/
Collection<? extends Module> shardModules(Settings settings);
/** /**
* Per index shard service that will be automatically closed. * Per index shard service that will be automatically closed.
*/ */
Collection<Class<? extends Closeable>> shardServices(); public Collection<Class<? extends Closeable>> shardServices() {
return Collections.emptyList();
/** }
* Process a specific module. Note, its simpler to implement a custom <tt>onModule(AnyModule module)</tt>
* method, which will be automatically be called by the relevant type.
*/
void processModule(Module module);
/** /**
* Additional node settings loaded by the plugin. Note that settings that are explicit in the nodes settings can't be * 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. * overwritten with the additional settings. These settings added if they don't exist.
*/ */
Settings additionalSettings(); public Settings additionalSettings() {
return Settings.Builder.EMPTY_SETTINGS;
}
} }

View File

@ -19,18 +19,12 @@
package org.elasticsearch.plugins; package org.elasticsearch.plugins;
import com.google.common.collect.Lists;
import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.inject.PreProcessModule; import org.elasticsearch.common.inject.PreProcessModule;
import org.elasticsearch.common.inject.SpawnModules; import org.elasticsearch.common.inject.SpawnModules;
import org.elasticsearch.common.settings.Settings; 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 @Override
public Iterable<? extends Module> spawnModules() { public Iterable<? extends Module> spawnModules() {
List<Module> modules = Lists.newArrayList(); return pluginsService.nodeModules();
Collection<Class<? extends Module>> modulesClasses = pluginsService.modules();
for (Class<? extends Module> moduleClass : modulesClasses) {
modules.add(createModule(moduleClass, settings));
}
modules.addAll(pluginsService.modules(settings));
return modules;
} }
@Override @Override

View File

@ -47,7 +47,6 @@ import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -184,7 +183,6 @@ public class PluginsService extends AbstractComponent {
public void processModule(Module module) { public void processModule(Module module) {
for (Tuple<PluginInfo, Plugin> plugin : plugins()) { for (Tuple<PluginInfo, Plugin> plugin : plugins()) {
plugin.v2().processModule(module);
// see if there are onModule references // see if there are onModule references
List<OnModuleReference> references = onModuleReferences.get(plugin.v2()); List<OnModuleReference> references = onModuleReferences.get(plugin.v2());
if (references != null) { if (references != null) {
@ -218,42 +216,26 @@ public class PluginsService extends AbstractComponent {
return builder.put(this.settings).build(); return builder.put(this.settings).build();
} }
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
List<Class<? extends Module>> modules = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
modules.addAll(plugin.v2().modules());
}
return modules;
}
public Collection<Module> modules(Settings settings) {
List<Module> modules = new ArrayList<>(); List<Module> modules = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) { for (Tuple<PluginInfo, Plugin> plugin : plugins) {
modules.addAll(plugin.v2().modules(settings)); modules.addAll(plugin.v2().nodeModules());
} }
return modules; return modules;
} }
public Collection<Class<? extends LifecycleComponent>> services() { public Collection<Class<? extends LifecycleComponent>> nodeServices() {
List<Class<? extends LifecycleComponent>> services = new ArrayList<>(); List<Class<? extends LifecycleComponent>> services = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) { for (Tuple<PluginInfo, Plugin> plugin : plugins) {
services.addAll(plugin.v2().services()); services.addAll(plugin.v2().nodeServices());
} }
return services; return services;
} }
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings indexSettings) {
List<Class<? extends Module>> modules = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
modules.addAll(plugin.v2().indexModules());
}
return modules;
}
public Collection<Module> indexModules(Settings settings) {
List<Module> modules = new ArrayList<>(); List<Module> modules = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) { for (Tuple<PluginInfo, Plugin> plugin : plugins) {
modules.addAll(plugin.v2().indexModules(settings)); modules.addAll(plugin.v2().indexModules(indexSettings));
} }
return modules; return modules;
} }
@ -266,18 +248,10 @@ public class PluginsService extends AbstractComponent {
return services; return services;
} }
public Collection<Class<? extends Module>> shardModules() { public Collection<Module> shardModules(Settings indexSettings) {
List<Class<? extends Module>> modules = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
modules.addAll(plugin.v2().shardModules());
}
return modules;
}
public Collection<Module> shardModules(Settings settings) {
List<Module> modules = new ArrayList<>(); List<Module> modules = new ArrayList<>();
for (Tuple<PluginInfo, Plugin> plugin : plugins) { for (Tuple<PluginInfo, Plugin> plugin : plugins) {
modules.addAll(plugin.v2().shardModules(settings)); modules.addAll(plugin.v2().shardModules(indexSettings));
} }
return modules; return modules;
} }

View File

@ -19,18 +19,12 @@
package org.elasticsearch.plugins; package org.elasticsearch.plugins;
import com.google.common.collect.Lists;
import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.inject.PreProcessModule; import org.elasticsearch.common.inject.PreProcessModule;
import org.elasticsearch.common.inject.SpawnModules; import org.elasticsearch.common.inject.SpawnModules;
import org.elasticsearch.common.settings.Settings; 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 @Override
public Iterable<? extends Module> spawnModules() { public Iterable<? extends Module> spawnModules() {
List<Module> modules = Lists.newArrayList(); return pluginsService.shardModules(settings);
Collection<Class<? extends Module>> modulesClasses = pluginsService.shardModules();
for (Class<? extends Module> moduleClass : modulesClasses) {
modules.add(createModule(moduleClass, settings));
}
modules.addAll(pluginsService.shardModules(settings));
return modules;
} }
@Override @Override

View File

@ -19,16 +19,8 @@
package org.elasticsearch.plugins; 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 */ /** A site-only plugin, just serves resources */
final class SitePlugin implements Plugin { final class SitePlugin extends Plugin {
final String name; final String name;
final String description; final String description;
@ -46,58 +38,4 @@ final class SitePlugin implements Plugin {
public String description() { public String description() {
return description; return description;
} }
@Override
public Collection<Class<? extends Module>> modules() {
return Collections.emptyList();
}
@Override
public Collection<? extends Module> modules(Settings settings) {
return Collections.emptyList();
}
@Override
public Collection<Class<? extends LifecycleComponent>> services() {
return Collections.emptyList();
}
@Override
public Collection<Class<? extends Module>> indexModules() {
return Collections.emptyList();
}
@Override
public Collection<? extends Module> indexModules(Settings settings) {
return Collections.emptyList();
}
@Override
public Collection<Class<? extends Closeable>> indexServices() {
return Collections.emptyList();
}
@Override
public Collection<Class<? extends Module>> shardModules() {
return Collections.emptyList();
}
@Override
public Collection<? extends Module> shardModules(Settings settings) {
return Collections.emptyList();
}
@Override
public Collection<Class<? extends Closeable>> shardServices() {
return Collections.emptyList();
}
@Override
public void processModule(Module module) {
}
@Override
public Settings additionalSettings() {
return Settings.EMPTY;
}
} }

View File

@ -89,7 +89,7 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.Script; import org.elasticsearch.script.Script;
import org.elasticsearch.search.action.SearchServiceTransportAction; import org.elasticsearch.search.action.SearchServiceTransportAction;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
@ -144,7 +144,7 @@ public class IndicesRequestIT extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return Settings.settingsBuilder() return Settings.settingsBuilder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.extendArray("plugin.types", InterceptingTransportService.Plugin.class.getName()) .extendArray("plugin.types", InterceptingTransportService.TestPlugin.class.getName())
.build(); .build();
} }
@ -844,7 +844,7 @@ public class IndicesRequestIT extends ESIntegTestCase {
public static class InterceptingTransportService extends TransportService { public static class InterceptingTransportService extends TransportService {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "intercepting-transport-service"; return "intercepting-transport-service";

View File

@ -19,10 +19,10 @@
package org.elasticsearch.benchmark.scripts.expression; package org.elasticsearch.benchmark.scripts.expression;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptModule;
public class NativeScriptPlugin extends AbstractPlugin { public class NativeScriptPlugin extends Plugin {
@Override @Override
public String name() { public String name() {

View File

@ -18,11 +18,15 @@
*/ */
package org.elasticsearch.benchmark.scripts.score.plugin; package org.elasticsearch.benchmark.scripts.score.plugin;
import org.elasticsearch.benchmark.scripts.score.script.*; import org.elasticsearch.benchmark.scripts.score.script.NativeConstantForLoopScoreScript;
import org.elasticsearch.plugins.AbstractPlugin; 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; import org.elasticsearch.script.ScriptModule;
public class NativeScriptExamplesPlugin extends AbstractPlugin { public class NativeScriptExamplesPlugin extends Plugin {
@Override @Override

View File

@ -25,8 +25,6 @@ import com.google.common.collect.Sets;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.recycler.Recycler.V; import org.elasticsearch.common.recycler.Recycler.V;
import org.elasticsearch.common.settings.Settings; 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.ESTestCase;
import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;

View File

@ -35,9 +35,17 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.LocalTransportAddress; import org.elasticsearch.common.transport.LocalTransportAddress;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.threadpool.ThreadPool; 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 org.junit.Test;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -58,7 +66,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests {
TransportClient client = TransportClient.builder().settings(Settings.builder() TransportClient client = TransportClient.builder().settings(Settings.builder()
.put("client.transport.sniff", false) .put("client.transport.sniff", false)
.put("node.name", "transport_client_" + this.getTestName()) .put("node.name", "transport_client_" + this.getTestName())
.put("plugin.types", InternalTransportService.Plugin.class.getName()) .put("plugin.types", InternalTransportService.TestPlugin.class.getName())
.put(headersSettings) .put(headersSettings)
.build()).build(); .build()).build();
@ -73,7 +81,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests {
.put("cluster.name", "cluster1") .put("cluster.name", "cluster1")
.put("node.name", "transport_client_" + this.getTestName() + "_1") .put("node.name", "transport_client_" + this.getTestName() + "_1")
.put("client.transport.nodes_sampler_interval", "1s") .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(HEADER_SETTINGS)
.put("path.home", createTempDir().toString()) .put("path.home", createTempDir().toString())
.build()).build(); .build()).build();
@ -96,7 +104,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests {
public static class InternalTransportService extends TransportService { public static class InternalTransportService extends TransportService {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-transport-service"; return "mock-transport-service";

View File

@ -35,11 +35,14 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.store.Store; 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.ESIntegTestCase;
import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.transport.MockTransportService; 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.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
@ -64,7 +67,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo;
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0) @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0)
public class ClusterInfoServiceIT extends ESIntegTestCase { public class ClusterInfoServiceIT extends ESIntegTestCase {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -143,7 +146,7 @@ public class ClusterInfoServiceIT extends ESIntegTestCase {
return Settings.builder() return Settings.builder()
// manual collection or upon cluster forming. // manual collection or upon cluster forming.
.put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT, "1s") .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(); .build();
} }

View File

@ -20,7 +20,6 @@ package org.elasticsearch.cluster;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; 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.inject.Singleton;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue; 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;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.MockLogAppender; import org.elasticsearch.test.MockLogAppender;
@ -44,7 +43,12 @@ import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.junit.Test; 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.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; 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.common.settings.Settings.settingsBuilder;
import static org.elasticsearch.test.ESIntegTestCase.Scope; import static org.elasticsearch.test.ESIntegTestCase.Scope;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; 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 @Override
public String name() { public String name() {
@ -1005,7 +1013,7 @@ public class ClusterServiceIT extends ESIntegTestCase {
} }
@Override @Override
public Collection<Class<? extends LifecycleComponent>> services() { public Collection<Class<? extends LifecycleComponent>> nodeServices() {
List<Class<? extends LifecycleComponent>> services = new ArrayList<>(1); List<Class<? extends LifecycleComponent>> services = new ArrayList<>(1);
services.add(MasterAwareService.class); services.add(MasterAwareService.class);
return services; return services;

View File

@ -28,7 +28,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.MockDiskUsagesIT;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.settings.NodeSettingsService; import org.elasticsearch.node.settings.NodeSettingsService;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -39,7 +39,7 @@ import java.util.concurrent.CountDownLatch;
*/ */
public class MockInternalClusterInfoService extends InternalClusterInfoService { public class MockInternalClusterInfoService extends InternalClusterInfoService {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-cluster-info-service"; return "mock-cluster-info-service";

View File

@ -51,7 +51,7 @@ public class MockDiskUsagesIT extends ESIntegTestCase {
return Settings.builder() return Settings.builder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
// Use the mock internal cluster info service, which has fake-able disk usages // 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 // Update more frequently
.put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, "1s") .put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, "1s")
.build(); .build();

View File

@ -25,12 +25,13 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter; 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;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.junit.Test; import org.junit.Test;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
@ -49,7 +50,7 @@ public class SettingsFilteringIT extends ESIntegTestCase {
.build(); .build();
} }
public static class SettingsFilteringPlugin extends AbstractPlugin { public static class SettingsFilteringPlugin extends Plugin {
/** /**
* The name of the plugin. * The name of the plugin.
*/ */
@ -67,10 +68,8 @@ public class SettingsFilteringIT extends ESIntegTestCase {
} }
@Override @Override
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings indexSettings) {
Collection<Class<? extends Module>> modules = newArrayList(); return Collections.<Module>singletonList(new SettingsFilteringModule());
modules.add(SettingsFilteringModule.class);
return modules;
} }
} }

View File

@ -24,14 +24,12 @@ import com.carrotsearch.randomizedtesting.SeedUtils;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.lucene.util.Accountable; import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.Accountables; import org.apache.lucene.util.Accountables;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.cache.recycler.PageCacheRecycler;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
import java.util.Collection; import java.util.Collection;

View File

@ -143,7 +143,7 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
.put(DiscoverySettings.PUBLISH_TIMEOUT, "1s") // <-- for hitting simulated network failures quickly .put(DiscoverySettings.PUBLISH_TIMEOUT, "1s") // <-- for hitting simulated network failures quickly
.put("http.enabled", false) // just to make test quicker .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("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(); .build();
private void configureCluster(int numberOfNodes, int minimumMasterNode) throws ExecutionException, InterruptedException { private void configureCluster(int numberOfNodes, int minimumMasterNode) throws ExecutionException, InterruptedException {

View File

@ -416,7 +416,7 @@ public class IndexWithShadowReplicasIT extends ESIntegTestCase {
Path dataPath = createTempDir(); Path dataPath = createTempDir();
Settings nodeSettings = Settings.builder() Settings nodeSettings = Settings.builder()
.put("node.add_id_to_custom_path", false) .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) .put("path.shared_data", dataPath)
.build(); .build();

View File

@ -56,7 +56,7 @@ public class TransportIndexFailuresIT extends ESIntegTestCase {
.put(FaultDetection.SETTING_PING_RETRIES, "1") // <-- for hitting simulated network failures quickly .put(FaultDetection.SETTING_PING_RETRIES, "1") // <-- for hitting simulated network failures quickly
.put(DiscoverySettings.PUBLISH_TIMEOUT, "1s") // <-- 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("discovery.zen.minimum_master_nodes", 1)
.put("plugin.types", MockTransportService.Plugin.class.getName()) .put("plugin.types", MockTransportService.TestPlugin.class.getName())
.build(); .build();
@Override @Override

View File

@ -20,33 +20,25 @@
package org.elasticsearch.index.mapper.externalvalues; package org.elasticsearch.index.mapper.externalvalues;
import org.elasticsearch.common.inject.Module; 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.Collection;
import java.util.Collections;
import static com.google.common.collect.Lists.newArrayList; public class ExternalMapperPlugin extends Plugin {
public class ExternalMapperPlugin extends AbstractPlugin {
/**
* The name of the plugin.
*/
@Override @Override
public String name() { public String name() {
return "external-mappers"; return "external-mappers";
} }
/**
* The description of the plugin.
*/
@Override @Override
public String description() { public String description() {
return "External Mappers Plugin"; return "External Mappers Plugin";
} }
@Override @Override
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings indexSettings) {
Collection<Class<? extends Module>> modules = newArrayList(); return Collections.<Module>singletonList(new ExternalIndexModule());
modules.add(ExternalIndexModule.class);
return modules;
} }
} }

View File

@ -30,11 +30,11 @@ import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.index.query.QueryParser; import org.elasticsearch.index.query.QueryParser;
import org.elasticsearch.index.query.QueryParsingException; import org.elasticsearch.index.query.QueryParsingException;
import org.elasticsearch.indices.IndicesModule; import org.elasticsearch.indices.IndicesModule;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import java.io.IOException; import java.io.IOException;
public class DummyQueryParserPlugin extends AbstractPlugin { public class DummyQueryParserPlugin extends Plugin {
@Override @Override
public String name() { public String name() {

View File

@ -19,16 +19,16 @@
package org.elasticsearch.index.shard; package org.elasticsearch.index.shard;
import org.elasticsearch.common.inject.Module; 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.MockEngineFactory;
import org.elasticsearch.test.engine.MockEngineSupportModule; import org.elasticsearch.test.engine.MockEngineSupportModule;
import java.util.ArrayList;
import java.util.Collection; 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 // 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 @Override
public String name() { public String name() {
return "mock-engine-factory"; return "mock-engine-factory";
@ -38,10 +38,8 @@ public class MockEngineFactoryPlugin extends AbstractPlugin {
return "a mock engine factory for testing"; return "a mock engine factory for testing";
} }
@Override @Override
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings indexSettings) {
List<Class<? extends Module>> modules = new ArrayList<>(); return Collections.<Module>singletonList(new MockEngineSupportModule());
modules.add(MockEngineSupportModule.class);
return modules;
} }
public void onModule(IndexShardModule module) { public void onModule(IndexShardModule module) {
module.engineFactoryImpl = MockEngineFactory.class; module.engineFactoryImpl = MockEngineFactory.class;

View File

@ -98,7 +98,7 @@ public class CorruptedFileIT extends ESIntegTestCase {
// we really need local GW here since this also checks for corruption etc. // 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 // and we need to make sure primaries are not just trashed if we don't have replicas
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.extendArray("plugin.types", MockTransportService.Plugin.class.getName()) .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName())
// speed up recoveries // speed up recoveries
.put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_STREAMS, 10) .put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_STREAMS, 10)
.put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_SMALL_FILE_STREAMS, 10) .put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_SMALL_FILE_STREAMS, 10)

View File

@ -66,7 +66,7 @@ public class CorruptedTranslogIT extends ESIntegTestCase {
// we really need local GW here since this also checks for corruption etc. // 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 // and we need to make sure primaries are not just trashed if we don't have replicas
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.extendArray("plugin.types", MockTransportService.Plugin.class.getName()).build(); .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName()).build();
} }
@Test @Test

View File

@ -54,7 +54,7 @@ public class ExceptionRetryIT extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder() return Settings.builder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.extendArray("plugin.types", MockTransportService.Plugin.class.getName()) .extendArray("plugin.types", MockTransportService.TestPlugin.class.getName())
.build(); .build();
} }

View File

@ -19,14 +19,14 @@
package org.elasticsearch.indices.analysis; package org.elasticsearch.indices.analysis;
import com.google.common.collect.ImmutableList;
import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Module;
import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.AnalysisModule;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
public class DummyAnalysisPlugin extends AbstractPlugin { public class DummyAnalysisPlugin extends Plugin {
/** /**
* The name of the plugin. * The name of the plugin.
*/ */
@ -44,8 +44,8 @@ public class DummyAnalysisPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
return ImmutableList.<Class<? extends Module>>of(DummyIndicesAnalysisModule.class); return Collections.<Module>singletonList(new DummyIndicesAnalysisModule());
} }
public void onModule(AnalysisModule module) { public void onModule(AnalysisModule module) {

View File

@ -35,7 +35,7 @@ import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache; 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.search.sort.SortOrder;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.engine.MockEngineSupport; import org.elasticsearch.test.engine.MockEngineSupport;
@ -107,7 +107,7 @@ public class RandomExceptionCircuitBreakerIT extends ESIntegTestCase {
Settings.Builder settings = settingsBuilder() Settings.Builder settings = settingsBuilder()
.put(indexSettings()) .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_TOP_LEVEL_RATIO_KEY, topLevelRate)
.put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate) .put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate)
.put(MockEngineSupport.WRAP_READER_RATIO, 1.0d); .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 // TODO: Generalize this class and add it as a utility
public static class RandomExceptionDirectoryReaderWrapper extends MockEngineSupport.DirectoryReaderWrapper { public static class RandomExceptionDirectoryReaderWrapper extends MockEngineSupport.DirectoryReaderWrapper {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "random-exception-reader-wrapper"; return "random-exception-reader-wrapper";

View File

@ -519,7 +519,7 @@ public class IndexRecoveryIT extends ESIntegTestCase {
final Settings nodeSettings = Settings.builder() final Settings nodeSettings = Settings.builder()
.put(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK, "100ms") .put(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK, "100ms")
.put(RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT, "1s") .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 .put(MockFSDirectoryService.RANDOM_PREVENT_DOUBLE_WRITE, false) // restarted recoveries will delete temp files and write them again
.build(); .build();
// start a master node // start a master node

View File

@ -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. // 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 // 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)) .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(); .build();
} }

View File

@ -27,7 +27,7 @@ import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.settings.Settings; 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;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope; 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 @Override
public String name() { public String name() {
return "test-plugin"; return "test-plugin";

View File

@ -20,9 +20,9 @@ package org.elasticsearch.node;
import org.elasticsearch.cache.recycler.MockPageCacheRecycler; import org.elasticsearch.cache.recycler.MockPageCacheRecycler;
import org.elasticsearch.common.util.MockBigArrays; 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 @Override
public String name() { public String name() {

View File

@ -19,9 +19,9 @@
package org.elasticsearch.nodesinfo.plugin.dummy1; 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 final public class Fields {
static public final String NAME = "test-plugin"; static public final String NAME = "test-plugin";

View File

@ -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;
}
}

View File

@ -73,7 +73,7 @@ public class PluggableTransportModuleIT extends ESIntegTestCase {
assertThat("Expected send request counter to be greather than zero", countAfterRequest, is(greaterThan(countBeforeRequest))); 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 @Override
public String name() { public String name() {
return "counting-pipelines-plugin"; return "counting-pipelines-plugin";

View File

@ -25,7 +25,7 @@ import org.elasticsearch.index.store.IndexStoreModule;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
public class PluginsServiceTests extends ESTestCase { public class PluginsServiceTests extends ESTestCase {
public static class AdditionalSettingsPlugin1 extends AbstractPlugin { public static class AdditionalSettingsPlugin1 extends Plugin {
@Override @Override
public String name() { public String name() {
return "additional-settings1"; 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(); 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 @Override
public String name() { public String name() {
return "additional-settings2"; return "additional-settings2";

View File

@ -19,9 +19,9 @@
package org.elasticsearch.plugins.loading.classpath; 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 @Override
public String name() { public String name() {

View File

@ -19,10 +19,10 @@
package org.elasticsearch.plugins.responseheader; package org.elasticsearch.plugins.responseheader;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestModule; import org.elasticsearch.rest.RestModule;
public class TestResponseHeaderPlugin extends AbstractPlugin { public class TestResponseHeaderPlugin extends Plugin {
@Override @Override
public String name() { public String name() {

View File

@ -102,7 +102,7 @@ public class RelocationIT extends ESIntegTestCase {
@Override @Override
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder() return Settings.builder()
.put("plugin.types", MockTransportService.Plugin.class.getName()).build(); .put("plugin.types", MockTransportService.TestPlugin.class.getName()).build();
} }

View File

@ -58,7 +58,7 @@ public class TruncatedRecoveryIT extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
Settings.Builder builder = Settings.builder() Settings.Builder builder = Settings.builder()
.put(super.nodeSettings(nodeOrdinal)) .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)); .put(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, new ByteSizeValue(randomIntBetween(50, 300), ByteSizeUnit.BYTES));
return builder.build(); return builder.build();
} }

View File

@ -20,10 +20,8 @@
package org.elasticsearch.script; package org.elasticsearch.script;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings; 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.expression.ExpressionScriptEngineService;
import org.elasticsearch.script.groovy.GroovyScriptEngineService; import org.elasticsearch.script.groovy.GroovyScriptEngineService;
import org.elasticsearch.script.mustache.MustacheScriptEngineService; 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 @Override
public String name() { public String name() {
return "custom_script_context_plugin"; return "custom_script_context_plugin";
@ -128,14 +126,10 @@ public class CustomScriptContextIT extends ESIntegTestCase {
return "Custom script context plugin"; return "Custom script context plugin";
} }
@Override public void onModule(ScriptModule scriptModule) {
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_op"));
scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_exp_disabled_op")); scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_exp_disabled_op"));
scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_globally_disabled_op")); scriptModule.registerScriptContext(new ScriptContext.Plugin(PLUGIN_NAME, "custom_globally_disabled_op"));
} }
} }
}
} }

View File

@ -21,7 +21,6 @@ package org.elasticsearch.script;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.Injector;
import org.elasticsearch.common.inject.ModulesBuilder; 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.common.settings.SettingsModule;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.env.EnvironmentModule; import org.elasticsearch.env.EnvironmentModule;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.script.ScriptService.ScriptType; import org.elasticsearch.script.ScriptService.ScriptType;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;

View File

@ -23,7 +23,7 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.query.QueryBuilders; 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.script.ScriptService.ScriptType;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.test.ESIntegTestCase; 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 @Override
public String name() { public String name() {

View File

@ -28,9 +28,8 @@ import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.indices.IndicesWarmer; import org.elasticsearch.indices.IndicesWarmer;
import org.elasticsearch.indices.cache.request.IndicesRequestCache; import org.elasticsearch.indices.cache.request.IndicesRequestCache;
import org.elasticsearch.node.settings.NodeSettingsService; import org.elasticsearch.node.settings.NodeSettingsService;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptService;
import org.elasticsearch.search.SearchService;
import org.elasticsearch.search.dfs.DfsPhase; import org.elasticsearch.search.dfs.DfsPhase;
import org.elasticsearch.search.fetch.FetchPhase; import org.elasticsearch.search.fetch.FetchPhase;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -43,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class MockSearchService extends SearchService { public class MockSearchService extends SearchService {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-search-service"; return "mock-search-service";

View File

@ -30,7 +30,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.QueryParsingException; 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.Script;
import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.script.ScriptService; 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.SignificantTerms;
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregatorFactory; import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregatorFactory;
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsBuilder; 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.StringTerms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder;
@ -53,7 +60,12 @@ import org.elasticsearch.test.ESIntegTestCase;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; 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 java.util.concurrent.ExecutionException;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; 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.common.settings.Settings.settingsBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; 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 @Override
public String name() { public String name() {

View File

@ -35,7 +35,7 @@ import org.elasticsearch.common.settings.Settings.Builder;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders; 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.SearchHit;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
@ -252,7 +252,7 @@ public class SearchWithRandomExceptionsIT extends ESIntegTestCase {
Builder settings = settingsBuilder() Builder settings = settingsBuilder()
.put(indexSettings()) .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_TOP_LEVEL_RATIO_KEY, topLevelRate)
.put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate) .put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate)
.put(MockEngineSupport.WRAP_READER_RATIO, 1.0d); .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 RandomExceptionDirectoryReaderWrapper extends MockEngineSupport.DirectoryReaderWrapper {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "random-exception-reader-wrapper"; return "random-exception-reader-wrapper";

View File

@ -29,7 +29,7 @@ import org.elasticsearch.action.termvectors.TermVectorsResponse;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentParser; 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.SearchHitField;
import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.SearchParseElement; import org.elasticsearch.search.SearchParseElement;
@ -99,7 +99,7 @@ public class FetchSubPhasePluginIT extends ESIntegTestCase {
assertThat(((Map<String, Integer>) response.getHits().getAt(0).field("term_vectors_fetch").getValues().get(0)).get("sam"), equalTo(1)); assertThat(((Map<String, Integer>) 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 @Override
public String name() { public String name() {

View File

@ -19,10 +19,10 @@
package org.elasticsearch.search.functionscore; package org.elasticsearch.search.functionscore;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptModule;
public class ExplainableScriptPlugin extends AbstractPlugin { public class ExplainableScriptPlugin extends Plugin {
public ExplainableScriptPlugin() {} public ExplainableScriptPlugin() {}
@Override @Override

View File

@ -28,7 +28,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.query.functionscore.DecayFunction; import org.elasticsearch.index.query.functionscore.DecayFunction;
import org.elasticsearch.index.query.functionscore.DecayFunctionBuilder; import org.elasticsearch.index.query.functionscore.DecayFunctionBuilder;
import org.elasticsearch.index.query.functionscore.DecayFunctionParser; 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.SearchHits;
import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchModule;
import org.elasticsearch.test.ESIntegTestCase; 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 @Override
public String name() { public String name() {

View File

@ -19,10 +19,10 @@
package org.elasticsearch.search.highlight; package org.elasticsearch.search.highlight;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchModule;
public class CustomHighlighterPlugin extends AbstractPlugin { public class CustomHighlighterPlugin extends Plugin {
@Override @Override
public String name() { public String name() {

View File

@ -18,13 +18,13 @@
*/ */
package org.elasticsearch.search.suggest; package org.elasticsearch.search.suggest;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchModule;
/** /**
* *
*/ */
public class CustomSuggesterPlugin extends AbstractPlugin { public class CustomSuggesterPlugin extends Plugin {
@Override @Override
public String name() { public String name() {

View File

@ -20,7 +20,6 @@
package org.elasticsearch.snapshots.mockstore; package org.elasticsearch.snapshots.mockstore;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.metadata.SnapshotId; import org.elasticsearch.cluster.metadata.SnapshotId;
@ -37,7 +36,6 @@ import org.elasticsearch.common.settings.SettingsFilter;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.index.snapshots.IndexShardRepository; import org.elasticsearch.index.snapshots.IndexShardRepository;
import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.repositories.RepositoriesModule; import org.elasticsearch.repositories.RepositoriesModule;
import org.elasticsearch.repositories.RepositoryName; import org.elasticsearch.repositories.RepositoryName;
import org.elasticsearch.repositories.RepositorySettings; import org.elasticsearch.repositories.RepositorySettings;
@ -50,8 +48,6 @@ import java.io.UnsupportedEncodingException;
import java.nio.file.Path; import java.nio.file.Path;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -64,7 +60,7 @@ import static org.elasticsearch.common.settings.Settings.settingsBuilder;
public class MockRepository extends FsRepository { public class MockRepository extends FsRepository {
public static class Plugin extends AbstractPlugin { public static class Plugin extends org.elasticsearch.plugins.Plugin {
@Override @Override
public String name() { public String name() {
@ -81,10 +77,8 @@ public class MockRepository extends FsRepository {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> modules = new ArrayList<>(); return Collections.<Module>singletonList(new SettingsFilteringModule());
modules.add(SettingsFilteringModule.class);
return modules;
} }
public static class SettingsFilteringModule extends AbstractModule { public static class SettingsFilteringModule extends AbstractModule {

View File

@ -384,14 +384,14 @@ public final class InternalTestCluster extends TestCluster {
.put(SETTING_CLUSTER_NODE_SEED, seed); .put(SETTING_CLUSTER_NODE_SEED, seed);
if (ENABLE_MOCK_MODULES && usually(random)) { if (ENABLE_MOCK_MODULES && usually(random)) {
builder.extendArray("plugin.types", builder.extendArray("plugin.types",
MockTransportService.Plugin.class.getName(), MockTransportService.TestPlugin.class.getName(),
MockFSIndexStore.Plugin.class.getName(), MockFSIndexStore.TestPlugin.class.getName(),
NodeMocksPlugin.class.getName(), NodeMocksPlugin.class.getName(),
MockEngineFactoryPlugin.class.getName(), MockEngineFactoryPlugin.class.getName(),
MockSearchService.Plugin.class.getName()); MockSearchService.TestPlugin.class.getName());
} }
if (isLocalTransportConfigured()) { if (isLocalTransportConfigured()) {
builder.extendArray("plugin.types", AssertingLocalTransport.Plugin.class.getName()); builder.extendArray("plugin.types", AssertingLocalTransport.TestPlugin.class.getName());
} else { } else {
builder.put(Transport.TransportSettings.TRANSPORT_TCP_COMPRESS, rarely(random)); builder.put(Transport.TransportSettings.TRANSPORT_TCP_COMPRESS, rarely(random));
} }

View File

@ -35,7 +35,7 @@ public class NetworkPartitionIT extends ESIntegTestCase {
@Override @Override
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder() return Settings.builder()
.put("plugin.types", MockTransportService.Plugin.class.getName()) .put("plugin.types", MockTransportService.TestPlugin.class.getName())
.build(); .build();
} }

View File

@ -28,11 +28,11 @@ import org.elasticsearch.index.store.DirectoryService;
import org.elasticsearch.index.store.IndexStore; import org.elasticsearch.index.store.IndexStore;
import org.elasticsearch.index.store.IndexStoreModule; import org.elasticsearch.index.store.IndexStoreModule;
import org.elasticsearch.indices.store.IndicesStore; import org.elasticsearch.indices.store.IndicesStore;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
public class MockFSIndexStore extends IndexStore { public class MockFSIndexStore extends IndexStore {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-index-store"; return "mock-index-store";

View File

@ -24,12 +24,17 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Settings; 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;
import org.elasticsearch.test.VersionUtils; import org.elasticsearch.test.VersionUtils;
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions; import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
import org.elasticsearch.threadpool.ThreadPool; 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 org.elasticsearch.transport.local.LocalTransport;
import java.io.IOException; import java.io.IOException;
@ -37,7 +42,7 @@ import java.util.Random;
public class AssertingLocalTransport extends LocalTransport { public class AssertingLocalTransport extends LocalTransport {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "asserting-local-transport"; return "asserting-local-transport";

View File

@ -32,12 +32,24 @@ import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.AbstractRunnable;
import org.elasticsearch.common.util.concurrent.ConcurrentCollections; 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.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.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.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -46,7 +58,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/ */
public class MockTransportService extends TransportService { public class MockTransportService extends TransportService {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-transport-service"; return "mock-transport-service";

View File

@ -21,7 +21,12 @@ package org.elasticsearch.transport;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; 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.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.index.IndexRequest; 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.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.http.HttpServerTransport; import org.elasticsearch.http.HttpServerTransport;
import org.elasticsearch.index.query.*; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.plugins.AbstractPlugin; 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.rest.RestController;
import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptService;
import org.elasticsearch.script.groovy.GroovyScriptEngineService; import org.elasticsearch.script.groovy.GroovyScriptEngineService;
@ -55,7 +64,13 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; 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 java.util.concurrent.CopyOnWriteArrayList;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; 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.node.Node.HTTP_ENABLED;
import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.RestStatus.OK;
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.*; 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) @ClusterScope(scope = SUITE)
public class ContextAndHeaderTransportIT extends ESIntegTestCase { public class ContextAndHeaderTransportIT extends ESIntegTestCase {
@ -365,7 +385,7 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase {
return filterClient; return filterClient;
} }
public static class ActionLoggingPlugin extends AbstractPlugin { public static class ActionLoggingPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -378,10 +398,8 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> classes = new ArrayList<>(); return Collections.<Module>singletonList(new ActionLoggingModule());
classes.add(ActionLoggingModule.class);
return classes;
} }
} }

View File

@ -33,7 +33,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.concurrent.AbstractRunnable; 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.test.ESIntegTestCase;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.ActionNotFoundTransportException; import org.elasticsearch.transport.ActionNotFoundTransportException;
@ -67,7 +67,7 @@ public class NettyTransportIT extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) return settingsBuilder().put(super.nodeSettings(nodeOrdinal))
.put("node.mode", "network") .put("node.mode", "network")
.extendArray("plugin.types", ExceptionThrowingNettyTransport.Plugin.class.getName()).build(); .extendArray("plugin.types", ExceptionThrowingNettyTransport.TestPlugin.class.getName()).build();
} }
@Test @Test
@ -87,7 +87,7 @@ public class NettyTransportIT extends ESIntegTestCase {
public static final class ExceptionThrowingNettyTransport extends NettyTransport { public static final class ExceptionThrowingNettyTransport extends NettyTransport {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "exception-throwing-netty-transport"; return "exception-throwing-netty-transport";

View File

@ -19,10 +19,9 @@
package org.elasticsearch.update; package org.elasticsearch.update;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.settings.Settings; 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.AbstractExecutableScript;
import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.ExecutableScript;
import org.elasticsearch.script.NativeScriptEngineService; import org.elasticsearch.script.NativeScriptEngineService;
@ -50,7 +49,7 @@ public class UpdateByNativeScriptIT extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
return Settings.settingsBuilder() return Settings.settingsBuilder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.extendArray("plugin.types", CustomNativeScriptFactory.Plugin.class.getName()) .extendArray("plugin.types", CustomNativeScriptFactory.TestPlugin.class.getName())
.build(); .build();
} }
@ -72,7 +71,7 @@ public class UpdateByNativeScriptIT extends ESIntegTestCase {
} }
public static class CustomNativeScriptFactory implements NativeScriptFactory { public static class CustomNativeScriptFactory implements NativeScriptFactory {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-native-script"; return "mock-native-script";

View File

@ -23,15 +23,15 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.AnalysisModule;
import org.elasticsearch.index.analysis.IcuAnalysisBinderProcessor; import org.elasticsearch.index.analysis.IcuAnalysisBinderProcessor;
import org.elasticsearch.indices.analysis.IcuIndicesAnalysisModule; 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.Collection;
import java.util.Collections;
/** /**
* *
*/ */
public class AnalysisICUPlugin extends AbstractPlugin { public class AnalysisICUPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -44,10 +44,8 @@ public class AnalysisICUPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> classes = new ArrayList<>(); return Collections.<Module>singletonList(new IcuIndicesAnalysisModule());
classes.add(IcuIndicesAnalysisModule.class);
return classes;
} }
/** /**

View File

@ -20,17 +20,25 @@
package org.elasticsearch.plugin.analysis.kuromoji; package org.elasticsearch.plugin.analysis.kuromoji;
import org.elasticsearch.common.inject.Module; 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.indices.analysis.KuromojiIndicesAnalysisModule;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
/** /**
* *
*/ */
public class AnalysisKuromojiPlugin extends AbstractPlugin { public class AnalysisKuromojiPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -43,10 +51,8 @@ public class AnalysisKuromojiPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> classes = new ArrayList<>(); return Collections.<Module>singletonList(new KuromojiIndicesAnalysisModule());
classes.add(KuromojiIndicesAnalysisModule.class);
return classes;
} }
public void onModule(AnalysisModule module) { public void onModule(AnalysisModule module) {

View File

@ -21,11 +21,11 @@ package org.elasticsearch.plugin.analysis;
import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.AnalysisModule;
import org.elasticsearch.index.analysis.PhoneticAnalysisBinderProcessor; 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 @Override
public String name() { public String name() {

View File

@ -23,15 +23,15 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.AnalysisModule;
import org.elasticsearch.index.analysis.SmartChineseAnalysisBinderProcessor; import org.elasticsearch.index.analysis.SmartChineseAnalysisBinderProcessor;
import org.elasticsearch.indices.analysis.smartcn.SmartChineseIndicesAnalysisModule; 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.Collection;
import java.util.Collections;
/** /**
* *
*/ */
public class AnalysisSmartChinesePlugin extends AbstractPlugin { public class AnalysisSmartChinesePlugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -44,10 +44,8 @@ public class AnalysisSmartChinesePlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> classes = new ArrayList<>(); return Collections.<Module>singletonList(new SmartChineseIndicesAnalysisModule());
classes.add(SmartChineseIndicesAnalysisModule.class);
return classes;
} }
public void onModule(AnalysisModule module) { public void onModule(AnalysisModule module) {

View File

@ -23,14 +23,15 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.index.analysis.AnalysisModule; import org.elasticsearch.index.analysis.AnalysisModule;
import org.elasticsearch.index.analysis.pl.PolishAnalysisBinderProcessor; import org.elasticsearch.index.analysis.pl.PolishAnalysisBinderProcessor;
import org.elasticsearch.indices.analysis.pl.PolishIndicesAnalysisModule; 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 @Override
public String name() { public String name() {
@ -43,10 +44,8 @@ public class AnalysisStempelPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> classes = new ArrayList<>(); return Collections.<Module>singletonList(new PolishIndicesAnalysisModule());
classes.add(PolishIndicesAnalysisModule.class);
return classes;
} }
public void onModule(AnalysisModule module) { public void onModule(AnalysisModule module) {

View File

@ -26,8 +26,8 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.DiscoveryModule; import org.elasticsearch.discovery.DiscoveryModule;
import org.elasticsearch.discovery.ec2.Ec2Discovery; import org.elasticsearch.discovery.ec2.Ec2Discovery;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.repositories.RepositoriesModule; import org.elasticsearch.repositories.RepositoriesModule;
import org.elasticsearch.repositories.s3.S3Repository; 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; private final Settings settings;
@ -56,7 +56,7 @@ public class CloudAwsPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Module> modules(Settings settings) { public Collection<Module> nodeModules() {
Collection<Module> modules = new ArrayList<>(); Collection<Module> modules = new ArrayList<>();
if (settings.getAsBoolean("cloud.enabled", true)) { if (settings.getAsBoolean("cloud.enabled", true)) {
modules.add(new AwsModule()); modules.add(new AwsModule());
@ -65,7 +65,7 @@ public class CloudAwsPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends LifecycleComponent>> services() { public Collection<Class<? extends LifecycleComponent>> nodeServices() {
Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>(); Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>();
if (settings.getAsBoolean("cloud.enabled", true)) { if (settings.getAsBoolean("cloud.enabled", true)) {
services.add(AwsModule.getS3ServiceImpl()); services.add(AwsModule.getS3ServiceImpl());

View File

@ -75,7 +75,7 @@ public abstract class AbstractAwsTest extends ESIntegTestCase {
Settings.Builder settings = Settings.builder() Settings.Builder settings = Settings.builder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.put("path.home", createTempDir()) .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.random", randomInt())
.put("cloud.aws.test.write_failures", 0.1) .put("cloud.aws.test.write_failures", 0.1)
.put("cloud.aws.test.read_failures", 0.1); .put("cloud.aws.test.read_failures", 0.1);

View File

@ -22,12 +22,12 @@ import com.amazonaws.services.s3.AmazonS3;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
public class TestAwsS3Service extends InternalAwsS3Service { public class TestAwsS3Service extends InternalAwsS3Service {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-s3-service"; return "mock-s3-service";

View File

@ -30,19 +30,20 @@ import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository
import org.elasticsearch.index.store.IndexStoreModule; import org.elasticsearch.index.store.IndexStoreModule;
import org.elasticsearch.index.store.smbmmapfs.SmbMmapFsIndexStore; import org.elasticsearch.index.store.smbmmapfs.SmbMmapFsIndexStore;
import org.elasticsearch.index.store.smbsimplefs.SmbSimpleFsIndexStore; 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.RepositoriesModule;
import org.elasticsearch.repositories.azure.AzureRepository; import org.elasticsearch.repositories.azure.AzureRepository;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import static org.elasticsearch.cloud.azure.AzureModule.isSnapshotReady; import static org.elasticsearch.cloud.azure.AzureModule.isSnapshotReady;
/** /**
* *
*/ */
public class CloudAzurePlugin extends AbstractPlugin { public class CloudAzurePlugin extends Plugin {
private final Settings settings; private final Settings settings;
protected final ESLogger logger = Loggers.getLogger(CloudAzurePlugin.class); protected final ESLogger logger = Loggers.getLogger(CloudAzurePlugin.class);
@ -63,10 +64,10 @@ public class CloudAzurePlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> modules = new ArrayList<>(); List<Module> modules = new ArrayList<>();
if (AzureModule.isCloudReady(settings)) { if (AzureModule.isCloudReady(settings)) {
modules.add(AzureModule.class); modules.add(new AzureModule(settings));
} }
return modules; return modules;
} }

View File

@ -20,14 +20,10 @@
package org.elasticsearch.cloud.azure; package org.elasticsearch.cloud.azure;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; 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.Discovery;
import org.elasticsearch.cloud.azure.management.AzureComputeService.Management; import org.elasticsearch.cloud.azure.management.AzureComputeService.Management;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugin.cloud.azure.CloudAzurePlugin; import org.elasticsearch.plugin.cloud.azure.CloudAzurePlugin;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
public abstract class AbstractAzureComputeServiceTest extends ESIntegTestCase { public abstract class AbstractAzureComputeServiceTest extends ESIntegTestCase {

View File

@ -26,7 +26,7 @@ import org.elasticsearch.cloud.azure.storage.AzureStorageServiceMock;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugin.cloud.azure.CloudAzurePlugin; 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.repositories.RepositoryMissingException;
import org.elasticsearch.test.store.MockFSDirectoryService; import org.elasticsearch.test.store.MockFSDirectoryService;
import org.junit.After; import org.junit.After;
@ -36,7 +36,7 @@ import java.net.URISyntaxException;
public abstract class AbstractAzureRepositoryServiceTest extends AbstractAzureTest { public abstract class AbstractAzureRepositoryServiceTest extends AbstractAzureTest {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-stoarge-service"; return "mock-stoarge-service";
@ -77,7 +77,7 @@ public abstract class AbstractAzureRepositoryServiceTest extends AbstractAzureTe
@Override @Override
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
Settings.Builder builder = Settings.settingsBuilder() 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.API_IMPLEMENTATION, mock)
.put(Storage.CONTAINER, "snapshots"); .put(Storage.CONTAINER, "snapshots");

View File

@ -19,12 +19,16 @@
package org.elasticsearch.cloud.azure; 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.cloud.azure.management.AzureComputeServiceAbstractMock;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import java.net.InetAddress; import java.net.InetAddress;
@ -33,7 +37,7 @@ import java.net.InetAddress;
*/ */
public class AzureComputeServiceSimpleMock extends AzureComputeServiceAbstractMock { public class AzureComputeServiceSimpleMock extends AzureComputeServiceAbstractMock {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-compute-service"; return "mock-compute-service";

View File

@ -20,13 +20,11 @@
package org.elasticsearch.cloud.azure; package org.elasticsearch.cloud.azure;
import com.microsoft.windowsazure.management.compute.models.*; import com.microsoft.windowsazure.management.compute.models.*;
import org.elasticsearch.cloud.azure.AzureModule;
import org.elasticsearch.cloud.azure.management.AzureComputeServiceAbstractMock; import org.elasticsearch.cloud.azure.management.AzureComputeServiceAbstractMock;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import java.net.InetAddress; import java.net.InetAddress;
@ -36,7 +34,7 @@ import java.net.InetAddress;
* Mock Azure API with two started nodes * Mock Azure API with two started nodes
*/ */
public class AzureComputeServiceTwoNodesMock extends AzureComputeServiceAbstractMock { public class AzureComputeServiceTwoNodesMock extends AzureComputeServiceAbstractMock {
public static class Plugin extends AbstractPlugin { public static class TestPlugin extends Plugin {
@Override @Override
public String name() { public String name() {
return "mock-compute-service"; return "mock-compute-service";

View File

@ -44,7 +44,7 @@ import static org.hamcrest.Matchers.nullValue;
public class AzureMinimumMasterNodesTest extends AbstractAzureComputeServiceTest { public class AzureMinimumMasterNodesTest extends AbstractAzureComputeServiceTest {
public AzureMinimumMasterNodesTest() { public AzureMinimumMasterNodesTest() {
super(AzureComputeServiceTwoNodesMock.Plugin.class.getName()); super(AzureComputeServiceTwoNodesMock.TestPlugin.class.getName());
} }
@Override @Override

View File

@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.notNullValue;
public class AzureSimpleTest extends AbstractAzureComputeServiceTest { public class AzureSimpleTest extends AbstractAzureComputeServiceTest {
public AzureSimpleTest() { public AzureSimpleTest() {
super(AzureComputeServiceSimpleMock.Plugin.class.getName()); super(AzureComputeServiceSimpleMock.TestPlugin.class.getName());
} }
@Test @Test

View File

@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.notNullValue;
public class AzureTwoStartedNodesTest extends AbstractAzureComputeServiceTest { public class AzureTwoStartedNodesTest extends AbstractAzureComputeServiceTest {
public AzureTwoStartedNodesTest() { public AzureTwoStartedNodesTest() {
super(AzureComputeServiceTwoNodesMock.Plugin.class.getName()); super(AzureComputeServiceTwoNodesMock.TestPlugin.class.getName());
} }
@Test @Test

View File

@ -25,15 +25,16 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.DiscoveryModule; import org.elasticsearch.discovery.DiscoveryModule;
import org.elasticsearch.discovery.gce.GceDiscovery; import org.elasticsearch.discovery.gce.GceDiscovery;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List;
/** /**
* *
*/ */
public class CloudGcePlugin extends AbstractPlugin { public class CloudGcePlugin extends Plugin {
private final Settings settings; private final Settings settings;
@ -52,16 +53,16 @@ public class CloudGcePlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> modules = new ArrayList<>(); List<Module> modules = new ArrayList<>();
if (settings.getAsBoolean("cloud.enabled", true)) { if (settings.getAsBoolean("cloud.enabled", true)) {
modules.add(GceModule.class); modules.add(new GceModule());
} }
return modules; return modules;
} }
@Override @Override
public Collection<Class<? extends LifecycleComponent>> services() { public Collection<Class<? extends LifecycleComponent>> nodeServices() {
Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>(); Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>();
if (settings.getAsBoolean("cloud.enabled", true)) { if (settings.getAsBoolean("cloud.enabled", true)) {
services.add(GceModule.getComputeServiceImpl()); services.add(GceModule.getComputeServiceImpl());

View File

@ -20,13 +20,12 @@
package org.elasticsearch.plugin.deletebyquery; package org.elasticsearch.plugin.deletebyquery;
import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.plugins.AbstractPlugin;
import java.util.Arrays;
import java.util.Collection; 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"; public static final String NAME = "delete-by-query";
@ -41,7 +40,7 @@ public class DeleteByQueryPlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Module> modules(Settings settings) { public Collection<Module> nodeModules() {
return Arrays.asList((Module) new DeleteByQueryModule()); return Collections.<Module>singletonList(new DeleteByQueryModule());
} }
} }

View File

@ -20,28 +20,17 @@
package org.elasticsearch.plugin.example; package org.elasticsearch.plugin.example;
import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Inject; 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.XContentParser;
import org.elasticsearch.common.xcontent.yaml.YamlXContent; 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.env.Environment;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.rest.action.cat.AbstractCatAction;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; 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.charset.StandardCharsets.UTF_8;
import static java.nio.file.Files.newBufferedReader; import static java.nio.file.Files.newBufferedReader;
import static org.elasticsearch.common.io.Streams.copyToString;
/** /**
* Example configuration. * Example configuration.

View File

@ -25,7 +25,6 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.inject.multibindings.Multibinder; import org.elasticsearch.common.inject.multibindings.Multibinder;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.repositories.RepositoriesModule; import org.elasticsearch.repositories.RepositoriesModule;
import org.elasticsearch.rest.action.cat.AbstractCatAction; import org.elasticsearch.rest.action.cat.AbstractCatAction;
@ -37,7 +36,7 @@ import java.util.Collections;
/** /**
* Example of a plugin. * Example of a plugin.
*/ */
public class JvmExamplePlugin implements Plugin { public class JvmExamplePlugin extends Plugin {
private final Settings settings; private final Settings settings;
@ -56,31 +55,18 @@ public class JvmExamplePlugin implements Plugin {
} }
@Override @Override
public Collection<Class<? extends Module>> modules() { public Collection<Module> nodeModules() {
Collection<Class<? extends Module>> modules = new ArrayList<>(); return Collections.<Module>singletonList(new ConfiguredExampleModule());
modules.add(ConfiguredExampleModule.class);
return modules;
} }
@Override @Override
public Collection<Module> modules(Settings settings) { public Collection<Class<? extends LifecycleComponent>> nodeServices() {
Collection<Module> modules = new ArrayList<>();
return modules;
}
@Override
public Collection<Class<? extends LifecycleComponent>> services() {
Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>(); Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>();
return services; return services;
} }
@Override @Override
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings indexSettings) {
return Collections.emptyList();
}
@Override
public Collection<? extends Module> indexModules(Settings settings) {
return Collections.emptyList(); return Collections.emptyList();
} }
@ -90,12 +76,7 @@ public class JvmExamplePlugin implements Plugin {
} }
@Override @Override
public Collection<Class<? extends Module>> shardModules() { public Collection<Module> shardModules(Settings indexSettings) {
return Collections.emptyList();
}
@Override
public Collection<? extends Module> shardModules(Settings settings) {
return Collections.emptyList(); return Collections.emptyList();
} }
@ -104,11 +85,6 @@ public class JvmExamplePlugin implements Plugin {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override
public void processModule(Module module) {
}
@Override @Override
public Settings additionalSettings() { public Settings additionalSettings() {
return Settings.EMPTY; return Settings.EMPTY;

View File

@ -19,14 +19,14 @@
package org.elasticsearch.plugin.javascript; package org.elasticsearch.plugin.javascript;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.script.javascript.JavaScriptScriptEngineService; import org.elasticsearch.script.javascript.JavaScriptScriptEngineService;
/** /**
* *
*/ */
public class JavaScriptPlugin extends AbstractPlugin { public class JavaScriptPlugin extends Plugin {
@Override @Override
public String name() { public String name() {

View File

@ -19,14 +19,14 @@
package org.elasticsearch.plugin.python; package org.elasticsearch.plugin.python;
import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.script.python.PythonScriptEngineService; import org.elasticsearch.script.python.PythonScriptEngineService;
/** /**
* *
*/ */
public class PythonPlugin extends AbstractPlugin { public class PythonPlugin extends Plugin {
@Override @Override
public String name() { public String name() {

View File

@ -20,12 +20,13 @@
package org.elasticsearch.plugin.mapper; package org.elasticsearch.plugin.mapper;
import org.elasticsearch.common.inject.Module; 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.Collection;
import java.util.Collections; import java.util.Collections;
public class MapperMurmur3Plugin extends AbstractPlugin { public class MapperMurmur3Plugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -38,8 +39,8 @@ public class MapperMurmur3Plugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings settings) {
return Collections.<Class<? extends Module>>singleton(MapperMurmur3IndexModule.class); return Collections.<Module>singletonList(new MapperMurmur3IndexModule());
} }
} }

View File

@ -20,12 +20,13 @@
package org.elasticsearch.plugin.mapper; package org.elasticsearch.plugin.mapper;
import org.elasticsearch.common.inject.Module; 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.Collection;
import java.util.Collections; import java.util.Collections;
public class MapperSizePlugin extends AbstractPlugin { public class MapperSizePlugin extends Plugin {
@Override @Override
public String name() { public String name() {
@ -38,8 +39,8 @@ public class MapperSizePlugin extends AbstractPlugin {
} }
@Override @Override
public Collection<Class<? extends Module>> indexModules() { public Collection<Module> indexModules(Settings indexSettings) {
return Collections.<Class<? extends Module>>singleton(MapperSizeIndexModule.class); return Collections.<Module>singletonList(new MapperSizeIndexModule());
} }
} }