diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/PipelineStoreBootstrapper.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestBootstrapper.java similarity index 86% rename from plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/PipelineStoreBootstrapper.java rename to plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestBootstrapper.java index 4432fffcf2d..2a836d1ef2e 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/PipelineStoreBootstrapper.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestBootstrapper.java @@ -38,7 +38,11 @@ import org.elasticsearch.transport.TransportService; import java.io.IOException; import java.util.Map; -public class PipelineStoreBootstrapper extends AbstractLifecycleComponent implements ClusterStateListener { +/** + * Instantiates and wires all the services that the ingest plugin will be needing. + * Also the bootstrapper is in charge of starting and stopping the ingest plugin based on the cluster state. + */ +public class IngestBootstrapper extends AbstractLifecycleComponent implements ClusterStateListener { private final ThreadPool threadPool; private final Environment environment; @@ -47,9 +51,9 @@ public class PipelineStoreBootstrapper extends AbstractLifecycleComponent implem private final Map processorFactoryProvider; @Inject - public PipelineStoreBootstrapper(Settings settings, ThreadPool threadPool, Environment environment, - ClusterService clusterService, TransportService transportService, - Map processorFactoryProvider) { + public IngestBootstrapper(Settings settings, ThreadPool threadPool, Environment environment, + ClusterService clusterService, TransportService transportService, + Map processorFactoryProvider) { super(settings); this.threadPool = threadPool; this.environment = environment; @@ -61,8 +65,8 @@ public class PipelineStoreBootstrapper extends AbstractLifecycleComponent implem } // for testing: - PipelineStoreBootstrapper(Settings settings, ThreadPool threadPool, ClusterService clusterService, - PipelineStore pipelineStore, PipelineExecutionService pipelineExecutionService) { + IngestBootstrapper(Settings settings, ThreadPool threadPool, ClusterService clusterService, + PipelineStore pipelineStore, PipelineExecutionService pipelineExecutionService) { super(settings); this.threadPool = threadPool; this.environment = null; diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestModule.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestModule.java index fa013024db3..fec0f3877ee 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestModule.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestModule.java @@ -46,7 +46,7 @@ public class IngestModule extends AbstractModule { @Override protected void configure() { binder().bind(IngestRestFilter.class).asEagerSingleton(); - binder().bind(PipelineStoreBootstrapper.class).asEagerSingleton(); + binder().bind(IngestBootstrapper.class).asEagerSingleton(); addProcessor(GeoIpProcessor.TYPE, (environment, templateService) -> new GeoIpProcessor.Factory(environment.configFile())); addProcessor(GrokProcessor.TYPE, (environment, templateService) -> new GrokProcessor.Factory(environment.configFile())); diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestPlugin.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestPlugin.java index d9772eaefc7..2db3c9ec69d 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestPlugin.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/IngestPlugin.java @@ -87,7 +87,7 @@ public class IngestPlugin extends Plugin { if (transportClient) { return Collections.emptyList(); } else { - return Collections.singletonList(PipelineStoreBootstrapper.class); + return Collections.singletonList(IngestBootstrapper.class); } } diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/IngestActionFilter.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/IngestActionFilter.java index 15cf21b17fb..62249552367 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/IngestActionFilter.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/IngestActionFilter.java @@ -33,7 +33,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugin.ingest.IngestPlugin; import org.elasticsearch.plugin.ingest.PipelineExecutionService; -import org.elasticsearch.plugin.ingest.PipelineStoreBootstrapper; +import org.elasticsearch.plugin.ingest.IngestBootstrapper; import java.util.*; @@ -42,7 +42,7 @@ public final class IngestActionFilter extends AbstractComponent implements Actio private final PipelineExecutionService executionService; @Inject - public IngestActionFilter(Settings settings, PipelineStoreBootstrapper bootstrapper) { + public IngestActionFilter(Settings settings, IngestBootstrapper bootstrapper) { super(settings); this.executionService = bootstrapper.getPipelineExecutionService(); } diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/delete/DeletePipelineTransportAction.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/delete/DeletePipelineTransportAction.java index ce8615a6bfb..b5e899ef519 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/delete/DeletePipelineTransportAction.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/delete/DeletePipelineTransportAction.java @@ -27,7 +27,7 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugin.ingest.PipelineStore; -import org.elasticsearch.plugin.ingest.PipelineStoreBootstrapper; +import org.elasticsearch.plugin.ingest.IngestBootstrapper; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -36,7 +36,7 @@ public class DeletePipelineTransportAction extends HandledTransportAction { private final PipelineStore pipelineStore; @Inject - public GetPipelineTransportAction(Settings settings, ThreadPool threadPool, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, PipelineStoreBootstrapper bootstrapper) { + public GetPipelineTransportAction(Settings settings, ThreadPool threadPool, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, IngestBootstrapper bootstrapper) { super(settings, GetPipelineAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, GetPipelineRequest::new); this.pipelineStore = bootstrapper.getPipelineStore(); } diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/put/PutPipelineTransportAction.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/put/PutPipelineTransportAction.java index 7432e4c76e3..646244f95d5 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/put/PutPipelineTransportAction.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/put/PutPipelineTransportAction.java @@ -20,29 +20,23 @@ package org.elasticsearch.plugin.ingest.transport.put; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.index.TransportIndexAction; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.plugin.ingest.PipelineStore; -import org.elasticsearch.plugin.ingest.PipelineStoreBootstrapper; +import org.elasticsearch.plugin.ingest.IngestBootstrapper; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import java.io.IOException; -import java.util.Map; - public class PutPipelineTransportAction extends HandledTransportAction { private final PipelineStore pipelineStore; @Inject - public PutPipelineTransportAction(Settings settings, ThreadPool threadPool, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, PipelineStoreBootstrapper bootstrapper) { + public PutPipelineTransportAction(Settings settings, ThreadPool threadPool, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, IngestBootstrapper bootstrapper) { super(settings, PutPipelineAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, PutPipelineRequest::new); this.pipelineStore = bootstrapper.getPipelineStore(); } diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineTransportAction.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineTransportAction.java index 4d6fa5f375a..682a03f21e7 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineTransportAction.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/SimulatePipelineTransportAction.java @@ -27,11 +27,10 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.plugin.ingest.PipelineStore; -import org.elasticsearch.plugin.ingest.PipelineStoreBootstrapper; +import org.elasticsearch.plugin.ingest.IngestBootstrapper; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import java.io.IOException; import java.util.Map; public class SimulatePipelineTransportAction extends HandledTransportAction { @@ -40,7 +39,7 @@ public class SimulatePipelineTransportAction extends HandledTransportAction