Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Plugin.createComponents method that specifies individual services #101457

Merged
merged 4 commits into from Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions 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 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+"
notable: false
61 changes: 0 additions & 61 deletions server/src/main/java/org/elasticsearch/plugins/Plugin.java
Expand Up @@ -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.
* <p>
* 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<Object> createComponents(
Client client,
ClusterService clusterService,
ThreadPool threadPool,
ResourceWatcherService resourceWatcherService,
ScriptService scriptService,
NamedXContentRegistry xContentRegistry,
Environment environment,
NodeEnvironment nodeEnvironment,
NamedWriteableRegistry namedWriteableRegistry,
IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<RepositoriesService> repositoriesServiceSupplier,
TelemetryProvider telemetryProvider,
AllocationService allocationService,
IndicesService indicesService
) {
return Collections.emptyList();
}

Expand Down