Plugins: Add ScriptService to dependencies available for plugin components

This commit is contained in:
Ryan Ernst 2016-08-03 00:32:47 -07:00
parent 227463c356
commit fe823c857b
2 changed files with 5 additions and 2 deletions

View File

@ -333,7 +333,8 @@ public class Node implements Closeable {
modules.add(settingsModule);
client = new NodeClient(settings, threadPool);
Collection<Object> pluginComponents = pluginsService.filterPlugins(Plugin.class).stream()
.flatMap(p -> p.createComponents(client, clusterService, threadPool, resourceWatcherService).stream())
.flatMap(p -> p.createComponents(client, clusterService, threadPool, resourceWatcherService,
scriptModule.getScriptService()).stream())
.collect(Collectors.toList());
modules.add(b -> {
b.bind(PluginsService.class).toInstance(pluginsService);

View File

@ -34,6 +34,7 @@ import org.elasticsearch.common.settings.SettingsModule;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.indices.analysis.AnalysisModule;
import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.threadpool.ExecutorBuilder;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.watcher.ResourceWatcherService;
@ -78,9 +79,10 @@ public abstract class Plugin {
* @param clusterService A service to allow watching and updating cluster state
* @param threadPool A service to allow retrieving an executor to run an async action
* @param resourceWatcherService A service to watch for changes to node local files
* @param scriptService A service to allow running scripts on the local node
*/
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
ResourceWatcherService resourceWatcherService) {
ResourceWatcherService resourceWatcherService, ScriptService scriptService) {
return Collections.emptyList();
}