From 21513c525eb1743546916c3f629fca76ba95ecab Mon Sep 17 00:00:00 2001 From: Simon Cooper Date: Fri, 27 Oct 2023 14:38:59 +0100 Subject: [PATCH 1/4] Remove Plugin.createComponents method that specifies individual services --- .../org/elasticsearch/plugins/Plugin.java | 61 ------------------- 1 file changed, 61 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/plugins/Plugin.java b/server/src/main/java/org/elasticsearch/plugins/Plugin.java index b0e1946a4e5dd..93ecbceed7e14 100644 --- a/server/src/main/java/org/elasticsearch/plugins/Plugin.java +++ b/server/src/main/java/org/elasticsearch/plugins/Plugin.java @@ -149,67 +149,6 @@ public interface PluginServices { * @param services Provides access to various Elasticsearch services */ public Collection createComponents(PluginServices services) { - return createComponents( - services.client(), - services.clusterService(), - services.threadPool(), - services.resourceWatcherService(), - services.scriptService(), - services.xContentRegistry(), - services.environment(), - services.nodeEnvironment(), - services.namedWriteableRegistry(), - services.indexNameExpressionResolver(), - services.repositoriesServiceSupplier(), - services.telemetryProvider(), - services.allocationService(), - services.indicesService() - ); - } - - /** - * Returns components added by this plugin. Either this method or {@link #createComponents(PluginServices)} - * should be implemented. - *

- * Any components returned that implement {@link LifecycleComponent} will have their lifecycle managed. - * Note: To aid in the migration away from guice, all objects returned as components will be bound in guice - * to themselves. - * - * @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 - * @param scriptService A service to allow running scripts on the local node - * @param xContentRegistry The registry for extensible xContent parsing - * @param environment The environment for path and setting configurations - * @param nodeEnvironment The node environment used coordinate access to the data paths - * @param namedWriteableRegistry The registry for {@link NamedWriteable} object parsing - * @param indexNameExpressionResolver A service that resolves expression to index and alias names - * @param repositoriesServiceSupplier A supplier for the service that manages snapshot repositories; will return null when this method - * is called, but will return the repositories service once the node is initialized. - * @param telemetryProvider An interface for distributed tracing - * @param allocationService A service to manage shard allocation in the cluster - * @param indicesService A service to manage indices in the cluster - * - * @deprecated New services will only be added to {@link PluginServices}; this method is maintained for compatibility. - */ - @Deprecated - public Collection createComponents( - Client client, - ClusterService clusterService, - ThreadPool threadPool, - ResourceWatcherService resourceWatcherService, - ScriptService scriptService, - NamedXContentRegistry xContentRegistry, - Environment environment, - NodeEnvironment nodeEnvironment, - NamedWriteableRegistry namedWriteableRegistry, - IndexNameExpressionResolver indexNameExpressionResolver, - Supplier repositoriesServiceSupplier, - TelemetryProvider telemetryProvider, - AllocationService allocationService, - IndicesService indicesService - ) { return Collections.emptyList(); } From 1db821a20ade4a1e4fb48b1867d17cf91b7a9ce4 Mon Sep 17 00:00:00 2001 From: Simon Cooper Date: Fri, 27 Oct 2023 15:22:48 +0100 Subject: [PATCH 2/4] Add changelog --- docs/changelog/101457.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docs/changelog/101457.yaml diff --git a/docs/changelog/101457.yaml b/docs/changelog/101457.yaml new file mode 100644 index 0000000000000..f4c0eeef3717f --- /dev/null +++ b/docs/changelog/101457.yaml @@ -0,0 +1,14 @@ +pr: 101457 +summary: "Remove Plugin.createComponents method in favour of overload with a PluginServices object" +area: Infra/Plugins +type: breaking-java +breaking: + area: "Java API" + title: "Plugin.createComponents method has been refactored to take a single PluginServices object" + details: > + Plugin.createComponents currently takes a set of different objects. This signature changes + every time a new service is added. This changes the method to take a single PluginServices object + that new services are added to. This will reduce API incompatibility issues when a new service + is introduced in the future. + impact: "All plugins will need to be refactored to override the new method to work on ES 8.12+" + notable: false From 69f77e672b445db846d90169e64363f30a0042cd Mon Sep 17 00:00:00 2001 From: Simon Cooper Date: Fri, 27 Oct 2023 16:51:34 +0100 Subject: [PATCH 3/4] tweak changelog wording --- docs/changelog/101457.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/101457.yaml b/docs/changelog/101457.yaml index f4c0eeef3717f..dcbd182795893 100644 --- a/docs/changelog/101457.yaml +++ b/docs/changelog/101457.yaml @@ -10,5 +10,5 @@ breaking: every time a new service is added. This changes the method to take a single PluginServices object that new services are added to. This will reduce API incompatibility issues when a new service is introduced in the future. - impact: "All plugins will need to be refactored to override the new method to work on ES 8.12+" + impact: "Plugins that override createComponents will need to be refactored to override the new method on ES 8.12+" notable: false From c5fe0acfb1bdbca547e3f6273a389896036d5cba Mon Sep 17 00:00:00 2001 From: Simon Cooper Date: Fri, 27 Oct 2023 17:09:12 +0100 Subject: [PATCH 4/4] More wording tweaks --- docs/changelog/101457.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog/101457.yaml b/docs/changelog/101457.yaml index dcbd182795893..03bdbe39b5b8e 100644 --- a/docs/changelog/101457.yaml +++ b/docs/changelog/101457.yaml @@ -6,8 +6,8 @@ breaking: area: "Java API" title: "Plugin.createComponents method has been refactored to take a single PluginServices object" details: > - Plugin.createComponents currently takes a set of different objects. This signature changes - every time a new service is added. This changes the method to take a single PluginServices object + Plugin.createComponents currently takes several different service arguments. The signature of this method changes + every time a new service is added. The method has now been modified to take a single interface object that new services are added to. This will reduce API incompatibility issues when a new service is introduced in the future. impact: "Plugins that override createComponents will need to be refactored to override the new method on ES 8.12+"