public interface GrailsPluginManager extends ApplicationContextAware, ApplicationStartupAware
Handles the loading and management of plug-ins in the Grails system. A plugin a just like a normal Grails application except that it contains a file ending in *Plugin.groovy in the root of the directory.
A Plugin class is a Groovy class that has a version and optionally closures called doWithSpring, doWithContext and doWithWebDescriptor
The doWithSpring closure uses the BeanBuilder syntax (
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
addUserPlugin(Class<?> pluginClass) Add User Plugin from Class |
|
public void |
checkForChanges() Checks all the plugins to see whether they have any changes |
|
public void |
doArtefactConfiguration() Called prior to the initialisation of the GrailsApplication object to allow registration of additional ArtefactHandler objects |
|
public void |
doDynamicMethods() Called on all plugins so that they can add new methods/properties/constructors etc. |
|
public void |
doDynamicModules() Called on all plugins so that they can register new modules. |
|
public void |
doPostProcessing(ApplicationContext applicationContext) Performs post initialization configuration for each plug-in, passing the built application context |
|
public void |
doRuntimeConfiguration(RuntimeSpringConfiguration springConfig) Executes the runtime configuration phase of plug-ins |
|
public void |
doRuntimeConfiguration(String pluginName, RuntimeSpringConfiguration springConfig) Executes the runtime configuration for a specific plugin AND all its dependencies |
|
public GrailsPlugin[] |
getAllPlugins() Returns an array of all the loaded plug-ins |
|
public GrailsApplication |
getApplication() Get the GrailsApplication used be this plugin manager |
|
public ApplicationStartup |
getApplicationStartup() Return the ApplicationStartup for this plugin manager. |
<D extends ModuleDescriptor<?>> |
public List<D> |
getEnabledModuleDescriptorsByClass(Class<D> descriptorClazz) Get all enabled module descriptors that have a specific descriptor class. |
|
public GrailsPlugin[] |
getFailedLoadPlugins()
|
|
public GrailsPlugin |
getFailedPlugin(String name) Retrieves a plug-in that failed to load, or null if it doesn't exist |
|
public GrailsPlugin |
getGrailsPlugin(String name) Retrieves a name Grails plugin instance |
|
public GrailsPlugin |
getGrailsPlugin(String name, Object version) Retrieves a plug-in for its name and version |
|
public GrailsPlugin |
getGrailsPluginForClassName(String name) Obtains a GrailsPlugin for the given classname |
|
public Collection<ModuleDescriptor<?>> |
getModuleDescriptors() Gets all module descriptors of installed modules. |
<M> |
public Collection<ModuleDescriptor<M>> |
getModuleDescriptors(Predicate<ModuleDescriptor<M>> moduleDescriptorPredicate) Gets all module descriptors of installed modules that match the given predicate. |
|
public GrailsPlugin |
getPluginForClass(Class<?> theClass) Obtains the GrailsPlugin for the given class |
|
public GrailsPlugin |
getPluginForInstance(Object instance) Looks up the plugin that defined the given instance. |
|
public List<GrailsPlugin> |
getPluginList() Returns the list of all the plug-ins, included failed and unenabled |
|
public Collection<GrailsPlugin> |
getPluginObservers(GrailsPlugin plugin) Retrieves a collection of plugins that are observing the specified plugin |
|
public String |
getPluginPath(String name) Returns the pluginContextPath for the given plugin |
|
public String |
getPluginPath(String name, boolean forceCamelCase) Returns the pluginContextPath for the given plugin and will force name to camel case instead of '-' lower case |
|
public String |
getPluginPathForClass(Class<?> theClass) Returns the plugin path for the given class |
|
public String |
getPluginPathForInstance(Object instance) Returns the pluginContextPath for the given instance |
|
public String |
getPluginViewsPathForClass(Class<?> theClass) Returns the plugin views directory path for the given class |
|
public String |
getPluginViewsPathForInstance(Object instance) Returns the plugin views directory for the given instance |
|
public GrailsPlugin[] |
getUserPlugins() Gets plugin installed by the user and not provided by the framework |
|
public boolean |
hasGrailsPlugin(String name)
|
|
public void |
informObservers(String pluginName, Map<String, Object> event) inform the specified plugins observers of the event specified by the passed Map instance |
|
public void |
informOfClassChange(Class<?> aClass) Method for handling changes to a class and triggering on change events etc. |
|
public void |
informOfClassChange(File file, Class<?> cls) |
|
public void |
informOfFileChange(File file) Fire to inform the PluginManager that a particular file changes |
|
public void |
informPluginsOfConfigChange() Inform of a change in configuration |
|
public boolean |
isInitialised()
|
|
public boolean |
isShutdown() Indicates whether the manager has been shutdown or not |
|
public void |
loadPlugins() Performs the initial load of plug-ins throwing an exception if any dependencies don't resolve |
|
public void |
onStartup(Map<String, Object> event) Executes the Plugin.onStartup hook for all plugins |
|
public void |
refreshPlugin(String name) Refreshes the specified plugin. |
|
public void |
registerProvidedArtefacts(GrailsApplication application) Registers pre-compiled artefacts with the GrailsApplication instance, only overriding if the application doesn't already provide an artefact of the same name. |
|
public void |
registerProvidedModules() Registers provided ModuleDescriptor by DynamicGrailsPlugin. |
|
public void |
setApplication(GrailsApplication application) Sets the GrailsApplication used be this plugin manager |
|
public void |
setApplicationStartup(ApplicationStartup applicationStartup) Set the ApplicationStartup for this plugin manager. |
|
public void |
setLoadCorePlugins(boolean shouldLoadCorePlugins) Set whether the core plugins should be loaded |
|
public void |
setPluginFilter(PluginFilter pluginFilter) Sets the filter to use to filter for plugins |
|
public void |
shutdown() Shuts down the PluginManager |
Methods inherited from class | Name |
---|---|
interface ApplicationContextAware |
setApplicationContext |
interface ApplicationStartupAware |
setApplicationStartup |
Add User Plugin from Class
pluginClass
- the class of PluginChecks all the plugins to see whether they have any changes
Called prior to the initialisation of the GrailsApplication object to allow registration of additional ArtefactHandler objects
Called on all plugins so that they can add new methods/properties/constructors etc.
Called on all plugins so that they can register new modules.
Performs post initialization configuration for each plug-in, passing the built application context
applicationContext
- The ApplicationContext instanceExecutes the runtime configuration phase of plug-ins
springConfig
- The RuntimeSpringConfiguration instanceExecutes the runtime configuration for a specific plugin AND all its dependencies
pluginName
- The name of he pluginspringConfig
- The runtime spring config instanceReturns an array of all the loaded plug-ins
Get the GrailsApplication used be this plugin manager
Return the ApplicationStartup for this plugin manager.
Get all enabled module descriptors that have a specific descriptor class.
descriptorClazz
- module descriptor class
Retrieves a plug-in that failed to load, or null if it doesn't exist
name
- The name of the pluginRetrieves a name Grails plugin instance
name
- The name of the pluginRetrieves a plug-in for its name and version
name
- The name of the pluginversion
- The version of the pluginObtains a GrailsPlugin for the given classname
name
- The name of the pluginGets all module descriptors of installed modules.
Gets all module descriptors of installed modules that match the given predicate.
moduleDescriptorPredicate
- describes which modules to matchObtains the GrailsPlugin for the given class
theClass
- The classLooks up the plugin that defined the given instance. If no plugin defined the instance then null is returned.
instance
- The instanceReturns the list of all the plug-ins, included failed and unenabled
Retrieves a collection of plugins that are observing the specified plugin
plugin
- The plugin to retrieve observers forReturns the pluginContextPath for the given plugin
name
- The plugin nameReturns the pluginContextPath for the given plugin and will force name to camel case instead of '-' lower case my-plug-web would resolve to myPlugWeb if forceCamelCase is true.
name
- The plugin nameforceCamelCase
- Force camel case for nameReturns the plugin path for the given class
theClass
- The classReturns the pluginContextPath for the given instance
instance
- The instanceReturns the plugin views directory path for the given class
theClass
- The classReturns the plugin views directory for the given instance
instance
- The instanceGets plugin installed by the user and not provided by the framework
name
- The name of the plugininform the specified plugins observers of the event specified by the passed Map instance
pluginName
- The name of the pluginevent
- The eventMethod for handling changes to a class and triggering on change events etc.
aClass
- The classFire to inform the PluginManager that a particular file changes
file
- The file that changedInform of a change in configuration
Indicates whether the manager has been shutdown or not
Performs the initial load of plug-ins throwing an exception if any dependencies don't resolve
Executes the Plugin.onStartup hook for all plugins
event
- the EventRefreshes the specified plugin. A refresh will force to plugin to "touch" each of its watched resources and fire modified events for each
name
- The name of the plugin to refreshRegisters pre-compiled artefacts with the GrailsApplication instance, only overriding if the application doesn't already provide an artefact of the same name.
application
- The GrailsApplication objectRegisters provided ModuleDescriptor by DynamicGrailsPlugin.
Sets the GrailsApplication used be this plugin manager
application
- The GrailsApplication instanceSet the ApplicationStartup for this plugin manager.
This allows the plugin manager to record metrics during startup.
applicationStartup
- the new context event factorySet whether the core plugins should be loaded
shouldLoadCorePlugins
- True if they shouldSets the filter to use to filter for plugins
pluginFilter
- The plugin filterShuts down the PluginManager