public interface PluginDiscovery
Defines a strategy for discovering the Grails plugins that should participate in application bootstrap.
A PluginDiscovery implementation is initialized early in the application lifecycle, typically from
GrailsEnvironmentPostProcessor, and later reused by the plugin manager and other
bootstrap components. Implementations are expected to discover candidate plugins, apply filtering, resolve
ordering, and expose the resulting plugin metadata through the methods in this interface.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public PluginInfo |
findPlugin(java.lang.String pluginName)Finds a discovered plugin by name. |
|
public PluginInfo |
findPlugin(java.lang.String pluginName, java.lang.Object version)Finds a discovered plugin by name and required version. |
|
public java.util.Collection<PluginInfo> |
findPluginObservers(PluginInfo plugin)Finds plugins that observe the supplied plugin. |
|
public java.util.Collection<PluginInfo> |
getDynamicPlugins()Returns plugins supplied dynamically instead of being discovered from classpath descriptors. |
|
public PluginInfo |
getFailedPlugin(java.lang.String name)Returns a plugin that failed during discovery or dependency resolution. |
|
public java.util.Collection<PluginInfo> |
getFailedPlugins()Returns every plugin that failed during discovery or dependency resolution. |
|
public Resource[] |
getPluginResources()Returns the configured dynamic plugin resources. |
|
public java.util.List<PluginInfo> |
getPluginsInLoadOrder()Returns the discovered plugins in their effective load order. |
|
public java.util.List<PluginInfo> |
getPluginsInTopologicalOrder()Returns the discovered plugins in topological order. |
|
public boolean |
hasFailedPlugin(java.lang.String name)Determines whether a plugin failed during discovery or dependency resolution. |
|
public boolean |
hasPlugin(java.lang.String name)Determines whether a plugin with the given name has been discovered. |
|
public void |
init(Environment environment)Initializes plugin discovery for the supplied environment. |
|
public void |
reset()Resets the discovery state so plugins can be discovered again. |
|
public void |
setClasspathPluginsRequired(boolean requireClasspathPlugin)Controls whether at least one classpath plugin is required. |
|
public void |
setLoadPluginsFromClasspath(boolean loadClasspathPlugins)Enables or disables discovery of plugins from classpath descriptors. |
|
public void |
setPluginClasses(java.lang.Class<?>[] pluginClasses)Configures explicit plugin classes to be treated as dynamic plugins. |
|
public void |
setPluginFilter(PluginFilter filter)Overrides the plugin filter used during discovery. |
|
public void |
setPluginResources(Resource[] pluginResources)Configures Groovy plugin resources to be treated as dynamic plugins. |
|
public void |
setPluginResources(java.lang.String[] pluginResources)Configures resource locations to search for dynamically defined plugins. |
|
public void |
setPluginResources(java.lang.String resourcePath)Configures a single resource location to search for dynamically defined plugins. |
Finds a discovered plugin by name.
pluginName - a plugin name to search for; implementations may normalize the name before lookupnullFinds a discovered plugin by name and required version.
pluginName - a plugin name to search for; implementations may normalize the name before lookupversion - the required version of the pluginnullFinds plugins that observe the supplied plugin.
plugin - the plugin to get the observers forReturns plugins supplied dynamically instead of being discovered from classpath descriptors.
This is most commonly used by tests that configure plugin classes or resources directly.
Returns a plugin that failed during discovery or dependency resolution.
name - the name of the plugin; implementations may normalize the name before lookupnull if no matching failed plugin existsReturns every plugin that failed during discovery or dependency resolution.
Returns the configured dynamic plugin resources.
Returns the discovered plugins in their effective load order.
Returns the discovered plugins in topological order.
Determines whether a plugin failed during discovery or dependency resolution.
name - the name of the plugin; implementations may normalize the name before lookuptrue if the named plugin could not be loaded successfullyDetermines whether a plugin with the given name has been discovered.
name - the name of the plugin; implementations may normalize the name before lookuptrue if a plugin with the given name exists, otherwise falseInitializes plugin discovery for the supplied environment.
This method is typically invoked during GrailsEnvironmentPostProcessor so filtering and ordering are available before the main application context finishes bootstrapping.
environment - the environment used to determine plugin filtering and orderingResets the discovery state so plugins can be discovered again.
Warning: This should only be done in controlled environments, usually during testing.
Controls whether at least one classpath plugin is required.
requireClasspathPlugin - if true, classpath plugins will be required to be presentEnables or disables discovery of plugins from classpath descriptors.
loadClasspathPlugins - true if plugins should be loaded from the classpath,
otherwise no classpath plugins will be searchedConfigures explicit plugin classes to be treated as dynamic plugins.
pluginClasses - the dynamically supplied plugin classesOverrides the plugin filter used during discovery.
filter - an override to filter plugins that are found during the discovery processConfigures Groovy plugin resources to be treated as dynamic plugins.
pluginResources - the resources containing dynamically defined plugin classesConfigures resource locations to search for dynamically defined plugins.
pluginResources - the resource location patterns containing dynamically defined pluginsConfigures a single resource location to search for dynamically defined plugins.
resourcePath - the resource location containing dynamically defined plugins