From fe823c857b71fe41bcd1cba17c6c73eb15ed9b50 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 3 Aug 2016 00:32:47 -0700 Subject: [PATCH] Plugins: Add ScriptService to dependencies available for plugin components --- core/src/main/java/org/elasticsearch/node/Node.java | 3 ++- core/src/main/java/org/elasticsearch/plugins/Plugin.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 56bcdcf9c8d..54c0c344953 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -333,7 +333,8 @@ public class Node implements Closeable { modules.add(settingsModule); client = new NodeClient(settings, threadPool); Collection 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); diff --git a/core/src/main/java/org/elasticsearch/plugins/Plugin.java b/core/src/main/java/org/elasticsearch/plugins/Plugin.java index 03eb96a4397..9f468a3d195 100644 --- a/core/src/main/java/org/elasticsearch/plugins/Plugin.java +++ b/core/src/main/java/org/elasticsearch/plugins/Plugin.java @@ -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 createComponents(Client client, ClusterService clusterService, ThreadPool threadPool, - ResourceWatcherService resourceWatcherService) { + ResourceWatcherService resourceWatcherService, ScriptService scriptService) { return Collections.emptyList(); }