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
-
Constructor Summary
ConstructorDescriptionPluginsService
(Settings settings, Path configPath, Path modulesDirectory, Path pluginsDirectory) Constructs a new PluginService -
Method Summary
Modifier and TypeMethodDescriptionfinal <T> List<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 pluginstatic Function<Settings,
PluginsService> getPluginsServiceCtor
(Environment environment) Get a function that will take aSettings
object and return aPluginsService
.info()
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.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
public PluginsService(Settings settings, Path configPath, Path modulesDirectory, Path pluginsDirectory) Constructs a new PluginService- Parameters:
settings
- The settings of the systemmodulesDirectory
- The directory modules exist in, or null if modules should not be loaded from the filesystempluginsDirectory
- The directory plugins exist in, or null if plugins should not be loaded from the filesystem
-
-
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
-
filterPlugins
-
getPluginsServiceCtor
Get a function that will take aSettings
object and return aPluginsService
. This function passes in an empty list of classpath plugins.- Parameters:
environment
- The environment for the plugins service.- Returns:
- A function for creating a plugins service.
-