java.lang.Object
org.elasticsearch.plugins.PluginsService
- All Implemented Interfaces:
ReportingService<PluginsAndModules>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.node.ReportingService
ReportingService.Info
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPluginsService
(Settings settings, Path configPath, PluginsLoader pluginsLoader) Constructs a new PluginService -
Method Summary
Modifier and TypeMethodDescriptionfinal <T> Stream
<T> filterPlugins
(Class<T> type) final <T> Stream
<T> flatMap
(Function<Plugin, Collection<T>> function) FlatMap a function over all pluginsfinal void
Apply a consumer action to each plugininfo()
Get information about plugins and modules<T> List
<? extends T> loadServiceProviders
(Class<T> service) SPI convenience method that uses theServiceLoader
JDK class to load various SPI providers from plugins/modules.<T> T
loadSingletonServiceProvider
(Class<T> service, Supplier<T> fallback) Loads a single SPI extension.final <T> Stream
<T> Map a function over all pluginsSometimes we want the plugin name for error handling.protected List
<org.elasticsearch.plugins.PluginsService.LoadedPlugin> plugins()
-
Field Details
-
MANDATORY_SETTING
-
-
Constructor Details
-
PluginsService
Constructs a new PluginService- Parameters:
settings
- The settings for this nodeconfigPath
- The configuration path for this nodepluginsLoader
- the information required to complete loading of plugins
-
-
Method Details
-
getStablePluginRegistry
-
map
Map a function over all plugins- Type Parameters:
T
- The generic type of the result- Parameters:
function
- a function that takes a plugin and returns a result- Returns:
- A stream of results
-
flatMap
FlatMap a function over all plugins- Type Parameters:
T
- The generic type of the collection- Parameters:
function
- a function that takes a plugin and returns a collection- Returns:
- A stream of results
-
forEach
Apply a consumer action to each plugin- Parameters:
consumer
- An action that consumes a plugin
-
pluginMap
Sometimes we want the plugin name for error handling.- Returns:
- A map of plugin names to plugin instances.
-
info
Get information about plugins and modules- Specified by:
info
in interfaceReportingService<PluginsAndModules>
-
plugins
-
loadServiceProviders
SPI convenience method that uses theServiceLoader
JDK class to load various SPI providers from plugins/modules.For example:
var pluginHandlers = pluginsService.loadServiceProviders(OperatorHandlerProvider.class);
- Parameters:
service
- A templated service class to look for providers in plugins- Returns:
- an immutable
List
of discovered providers in the plugins/modules
-
loadSingletonServiceProvider
Loads a single SPI extension. There should be no more than one extension found. If no service providers are found, the supplied fallback is used.- Type Parameters:
T
- the SPI service type- Parameters:
service
- the SPI class that should be loadedfallback
- a supplier for an instance if no providers are found- Returns:
- an instance of the service
-
filterPlugins
-