From 9b5ac4f68ee913ee944cd3b8d9727c15f25e4063 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Tue, 12 Jul 2016 14:44:54 -0700 Subject: [PATCH] Plugins: Add resource watcher to services available for plugin components --- core/src/main/java/org/elasticsearch/node/Node.java | 2 +- core/src/main/java/org/elasticsearch/plugins/Plugin.java | 5 ++++- 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 a528de6d082..22c6092471e 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -304,7 +304,7 @@ 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).stream()) + .flatMap(p -> p.createComponents(client, clusterService, threadPool, resourceWatcherService).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 57ccd876eef..03eb96a4397 100644 --- a/core/src/main/java/org/elasticsearch/plugins/Plugin.java +++ b/core/src/main/java/org/elasticsearch/plugins/Plugin.java @@ -36,6 +36,7 @@ import org.elasticsearch.indices.analysis.AnalysisModule; import org.elasticsearch.script.ScriptModule; import org.elasticsearch.threadpool.ExecutorBuilder; import org.elasticsearch.threadpool.ThreadPool; +import org.elasticsearch.watcher.ResourceWatcherService; /** * An extension point allowing to plug in custom functionality. @@ -76,8 +77,10 @@ public abstract class Plugin { * @param client A client to make requests to the system * @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 */ - public Collection createComponents(Client client, ClusterService clusterService, ThreadPool threadPool) { + public Collection createComponents(Client client, ClusterService clusterService, ThreadPool threadPool, + ResourceWatcherService resourceWatcherService) { return Collections.emptyList(); }