@SuppressWarnings("rawtypes") public interface GrailsPlugin extends GrailsPluginInfo, ApplicationContextAware, Comparable, Ordered
Plugin interface that adds Spring BeanDefinitions
to a registry based on a GrailsApplication object. After all GrailsPlugin
classes
have been processed the BeanDefinitions in the registry are
loaded in a Spring ApplicationContext that's the singular
configuration unit of Grails applications.
It's up to implementation classes to determine where GrailsPlugin
instances are loaded
from.
Fields inherited from class | Fields |
---|---|
interface Ordered |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Type Params | Return Type | Name and description |
---|---|---|
|
public void |
addExclude(Environment env) Makes the plugin excluded for a particular Environment |
|
public void |
doArtefactConfiguration() Called prior to the initialisation of the GrailsApplication instance to allow the registration of additional ArtefactHandlers |
|
public void |
doWithApplicationContext(ApplicationContext applicationContext) |
|
public void |
doWithDynamicMethods(ApplicationContext applicationContext) Calls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime |
|
public void |
doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig) Executes the plugin code that performs runtime configuration as defined in the doWithSpring closure |
|
public void |
doc(String text) Write some documentation to the DocumentationContext |
|
public String[] |
getDependencyNames()
|
|
public String |
getDependentVersion(String name) The version of the specified dependency |
|
public String[] |
getEvictionNames()
|
|
public String |
getFileSystemName() Returns the name of the plugin as represented in the file system including the version. |
|
public String |
getFileSystemShortName() Returns the name of the plugin as represented on the file system without the version. |
|
public GroovyObject |
getInstance() Retrieves the wrapped plugin instance for this plugin |
|
public String[] |
getLoadAfterNames() Retrieves the names of plugins that this plugin should be loaded after. |
|
public String[] |
getLoadBeforeNames() Retrieves the names of plugins that this plugin should be loaded before. |
|
public GrailsPluginManager |
getManager() Retrieves the plugin manager if known, otherwise returns null |
|
public String[] |
getObservedPluginNames() Retrieve the plugin names that this plugin is observing for changes |
|
public Class<?> |
getPluginClass() Returns the underlying class that represents this plugin |
|
public List<String> |
getPluginExcludes() A list of resources that the plugin should exclude from the packaged distribution |
|
public String |
getPluginPath() Returns the path of the plug-in |
|
public String |
getPluginPathCamelCase() Returns the path of the plug-in using camel case |
|
public PropertySource<?> |
getPropertySource() |
|
public Class<?>[] |
getProvidedArtefacts() Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object but are overridable by the end-user |
|
public List<WatchPattern> |
getWatchedResourcePatterns() Resources that this plugin watches |
|
public boolean |
hasInterestInChange(String path) Whether the plugin is interested in a particular change |
|
public boolean |
isBasePlugin() Returns whether this plugin is loaded from the current plugin. |
|
public boolean |
isEnabled()
|
|
public boolean |
isEnabled(String[] activeProfiles) Check whether the plugin is enabled for the given profile |
|
public void |
notifyOfEvent(Map<String, Object> event) Notifies this plugin of the specified Event calling the onChange listener |
|
public Map<String, Object> |
notifyOfEvent(int eventKind, Object source) Notifies the plugin of a specific event for the given event id, which is one of ON_CHANGE, ON_CONFIG_CHANGE |
|
public void |
refresh() Refreshes this Grails plugin reloading any watched resources as necessary |
|
public void |
setApplication(GrailsApplication application) |
|
public void |
setBasePlugin(boolean isBase) Sets whether this plugin is the base plugin |
|
public void |
setDescriptor(Resource descriptor) Sets the plugin descriptor for this plugin |
|
public void |
setManager(GrailsPluginManager manager) Sets the plugin manager for this plugin |
|
public boolean |
supportsCurrentScopeAndEnvironment()
|
|
public boolean |
supportsEnvironment(Environment environment) Returns whether this plugin supports the given environment name |
Methods inherited from class | Name |
---|---|
interface GrailsPluginInfo |
getDescriptor, getFullName, getName, getPluginDir, getProperties, getVersion |
interface ApplicationContextAware |
setApplicationContext |
interface Comparable |
compareTo |
interface Ordered |
getOrder |
Makes the plugin excluded for a particular Environment
env
- The EnvironmentCalled prior to the initialisation of the GrailsApplication instance to allow the registration of additional ArtefactHandlers
This method is called to allow the plugin to add BeanDefinitions to the BeanDefinitionRegistry.
applicationContext
- The Spring ApplicationContext instanceCalls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime
applicationContext
- The Spring ApplicationContext instanceExecutes the plugin code that performs runtime configuration as defined in the doWithSpring closure
springConfig
- The RuntimeSpringConfiguration instanceWrite some documentation to the DocumentationContext
The version of the specified dependency
name
- the name of the dependency
Returns the name of the plugin as represented in the file system including the version. For example TagLibGrailsPlugin would result in "tag-lib-0.1"
Returns the name of the plugin as represented on the file system without the version. For example TagLibGrailsPlugin would result in "tag-lib"
Retrieves the wrapped plugin instance for this plugin
Retrieves the names of plugins that this plugin should be loaded after. This differs from dependencies in that if that plugin doesn't exist this plugin will still be loaded. It is a way of enforcing plugins are loaded before, but not necessarily needed
Retrieves the names of plugins that this plugin should be loaded before. As with getLoadAfterNames() it is not a requirement that the specified plugins exist
Retrieves the plugin manager if known, otherwise returns null
Retrieve the plugin names that this plugin is observing for changes
Returns the underlying class that represents this plugin
A list of resources that the plugin should exclude from the packaged distribution
Returns the path of the plug-in
Returns the path of the plug-in using camel case
Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object but are overridable by the end-user
Resources that this plugin watches
Whether the plugin is interested in a particular change
path
- The path to the resource that changedReturns whether this plugin is loaded from the current plugin. In other words when you execute grails run-app from a plugin project the plugin project's *GrailsPlugin.groovy file represents the base plugin and this method will return true for this plugin
Check whether the plugin is enabled for the given profile
Notifies this plugin of the specified Event calling the onChange listener
event
- The event to listen forNotifies the plugin of a specific event for the given event id, which is one of ON_CHANGE, ON_CONFIG_CHANGE
eventKind
- The event kindsource
- The source of the eventRefreshes this Grails plugin reloading any watched resources as necessary
Sets whether this plugin is the base plugin
isBase
- True if isSets the plugin descriptor for this plugin
descriptor
- The descriptorSets the plugin manager for this plugin
manager
- A GrailsPluginManager instance
Returns whether this plugin supports the given environment name
environment
- The environment name