public interface GrailsPlugin
extends org.springframework.context.ApplicationContextAware, java.lang.Comparable, org.codehaus.groovy.grails.plugins.GrailsPluginInfo
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.
BeanDefinitionRegistry| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ARTEFACTS
Define the list of ArtefactHandlers supporting by the plugin
|
static java.lang.String |
DEPENDS_ON
Defines the name of the property that specifies which plugins this plugin depends on
|
static java.lang.String |
DO_WITH_APPLICATION_CONTEXT
Defines the name of the property that defines a closure that will be invoked after intialisation
and when the application context has been built
|
static java.lang.String |
DO_WITH_DYNAMIC_METHODS |
static java.lang.String |
DO_WITH_SPRING
Defines the name of the property that defines the closure that will be invoked during runtime spring configuration
|
static java.lang.String |
DO_WITH_WEB_DESCRIPTOR
Defines the name of the property that defines the closure that will be invoked
when the web.xml is being generated
|
static java.lang.String |
ENVIRONMENTS
The environments to which this plugin applies
|
static int |
EVENT_ON_CHANGE |
static int |
EVENT_ON_CONFIG_CHANGE |
static int |
EVENT_ON_SHUTDOWN |
static java.lang.String |
EVICT
Defines the name of the property that specifies a List or plugins that this plugin evicts
Eviction occurs when the PluginManager loads
|
static java.lang.String |
OBSERVE
The field that represents the plugin names that this plugin is observing for changes.
|
static java.lang.String |
ON_CHANGE
Defines the name of the property that defines the closure that will be invoked
when a watched resource changes
|
static java.lang.String |
ON_CONFIG_CHANGE
Defines the name of the property that defines the closure that will be invoked
when a the Grails configuration object changes
|
static java.lang.String |
ON_SHUTDOWN
Defines the name of the property that holds a closure to be invoked when shutdown is called
|
static java.lang.String |
PLUGIN_EXCLUDES
The field that represents the list of resources to exclude from plugin packaging
|
static java.lang.String |
PLUGIN_LOAD_AFTER_NAMES
The name of the property that provides a list of plugins this plugin should after before
|
static java.lang.String |
PLUGIN_LOAD_BEFORE_NAMES
The name of the property that provides a list of plugins this plugin should load before
|
static java.lang.String |
PLUGINS_PATH
The prefix used in plug-ins paths
|
static java.lang.String |
PROVIDED_ARTEFACTS
The name of the property that provides a list of shipped, but overridable artefacts
|
static java.lang.String |
SCOPES
The scopes to which this plugin applies
|
static java.lang.String |
STATUS
The status of the plugin.
|
static java.lang.String |
STATUS_DISABLED
When a plugin is "disabled" it will not be loaded
|
static java.lang.String |
STATUS_ENABLED
When a plugin is "enabled" it will be loaded as usual.
|
static java.lang.String |
TYPE_FILTERS
The field that represents the list of type filters a plugin provides
|
static java.lang.String |
WATCHED_RESOURCES
Defines the name of the property that specifies resources which this plugin monitors for changes
in the format a Ant-style path
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExclude(grails.util.BuildScope buildScope)
Makes the plugin excluded for a particular BuildScope
|
void |
addExclude(grails.util.Environment env)
Makes the plugin excluded for a particular Environment
|
boolean |
checkForChanges()
Deprecated.
Plugins themselves no longer check for changes
|
void |
doArtefactConfiguration()
Called prior to the initialisation of the GrailsApplication instance to allow the registration
of additonal ArtefactHandlers
|
void |
doc(java.lang.String text)
Write some documentation to the DocumentationContext
|
void |
doWithApplicationContext(org.springframework.context.ApplicationContext applicationContext)
This method is called to allow the plugin to add
BeanDefinitions
to the BeanDefinitionRegistry. |
void |
doWithDynamicMethods(org.springframework.context.ApplicationContext applicationContext)
Calls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime
|
void |
doWithRuntimeConfiguration(org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration springConfig)
Executes the plugin code that performs runtime configuration as defined in the doWithSpring closure
|
void |
doWithWebDescriptor(org.w3c.dom.Element webXml)
Handles processing of web.xml.
|
java.lang.String[] |
getDependencyNames() |
java.lang.String |
getDependentVersion(java.lang.String name)
The version of the specified dependency
|
java.lang.String[] |
getEvictionNames() |
java.lang.String |
getFileSystemName()
Returns the name of the plugin as represented in the file system including the version.
|
java.lang.String |
getFileSystemShortName()
Returns the name of the plugin as represented on the file system without the version.
|
groovy.lang.GroovyObject |
getInstance()
Retrieves the wrapped plugin instance for this plugin
|
java.lang.String[] |
getLoadAfterNames()
Retrieves the names of plugins that this plugin should be loaded after.
|
java.lang.String[] |
getLoadBeforeNames()
Retrieves the names of plugins that this plugin should be loaded before.
|
GrailsPluginManager |
getManager()
Retrieves the plugin manager if known, otherwise returns null
|
java.lang.String[] |
getObservedPluginNames()
Retrieve the plugin names that this plugin is observing for changes
|
java.lang.Class<?> |
getPluginClass()
Returns the underlying class that represents this plugin
|
java.util.List<java.lang.String> |
getPluginExcludes()
A list of resources that the plugin should exclude from the packaged distribution
|
java.lang.String |
getPluginPath()
Returns the path of the plug-in
|
java.lang.Class<?>[] |
getProvidedArtefacts()
Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object
but are overridable by the end-user
|
java.util.Collection<? extends org.springframework.core.type.filter.TypeFilter> |
getTypeFilters()
Plugin can provide a list of Spring TypeFilters so that annotated components can
be scanned into the ApplicationContext
|
java.util.List<org.codehaus.groovy.grails.plugins.support.WatchPattern> |
getWatchedResourcePatterns()
Resources that this plugin watches
|
boolean |
hasInterestInChange(java.lang.String path)
Whether the plugin is interested in a particular change
|
boolean |
isBasePlugin()
Returns whether this plugin is loaded from the current plugin.
|
boolean |
isEnabled() |
java.util.Map |
notifyOfEvent(int eventKind,
java.lang.Object source)
Notifies the plugin of a specific event for the given event id, which is one of ON_CHANGE, ON_CONFIG_CHANGE
|
void |
notifyOfEvent(java.util.Map event)
Notifies this plugin of the specified Event calling the onChange listener
|
void |
refresh()
Refreshes this Grails plugin reloading any watched resources as necessary
|
void |
setApplication(GrailsApplication application) |
void |
setBasePlugin(boolean isBase)
Sets whether this plugin is the base plugin
|
void |
setDescriptor(org.springframework.core.io.Resource descriptor)
Sets the plugin descriptor for this plugin
|
void |
setManager(GrailsPluginManager manager)
Sets the plugin manager for this plugin
|
boolean |
supportsCurrentScopeAndEnvironment() |
boolean |
supportsEnvironment(grails.util.Environment environment)
Returns whether this plugin supports the given environment name
|
boolean |
supportsScope(grails.util.BuildScope buildScope)
Return whether this plugin supports the given PluginScope
|
static final int EVENT_ON_CHANGE
static final int EVENT_ON_CONFIG_CHANGE
static final int EVENT_ON_SHUTDOWN
static final java.lang.String DO_WITH_DYNAMIC_METHODS
static final java.lang.String SCOPES
static final java.lang.String ENVIRONMENTS
static final java.lang.String PLUGINS_PATH
static final java.lang.String WATCHED_RESOURCES
static final java.lang.String EVICT
static final java.lang.String STATUS
static final java.lang.String STATUS_ENABLED
static final java.lang.String STATUS_DISABLED
static final java.lang.String ON_CHANGE
static final java.lang.String ON_SHUTDOWN
static final java.lang.String ON_CONFIG_CHANGE
static final java.lang.String DO_WITH_WEB_DESCRIPTOR
static final java.lang.String DO_WITH_SPRING
static final java.lang.String DO_WITH_APPLICATION_CONTEXT
static final java.lang.String DEPENDS_ON
static final java.lang.String ARTEFACTS
static final java.lang.String PROVIDED_ARTEFACTS
static final java.lang.String PLUGIN_LOAD_BEFORE_NAMES
static final java.lang.String PLUGIN_LOAD_AFTER_NAMES
static final java.lang.String PLUGIN_EXCLUDES
static final java.lang.String TYPE_FILTERS
static final java.lang.String OBSERVE
void doWithApplicationContext(org.springframework.context.ApplicationContext applicationContext)
This method is called to allow the plugin to add BeanDefinitions
to the BeanDefinitionRegistry.
applicationContext - The Spring ApplicationContext instancevoid doWithRuntimeConfiguration(org.codehaus.groovy.grails.commons.spring.RuntimeSpringConfiguration springConfig)
springConfig - The RuntimeSpringConfiguration instancevoid doWithWebDescriptor(org.w3c.dom.Element webXml)
webXml - The GPathResult representing web.xmlvoid addExclude(grails.util.BuildScope buildScope)
buildScope - The BuildScopevoid addExclude(grails.util.Environment env)
env - The Environmentboolean supportsScope(grails.util.BuildScope buildScope)
buildScope - The PluginScopeboolean supportsEnvironment(grails.util.Environment environment)
environment - The environment nameboolean supportsCurrentScopeAndEnvironment()
void doc(java.lang.String text)
java.lang.String getPluginPath()
java.lang.String[] getDependencyNames()
java.lang.String[] getEvictionNames()
java.lang.String[] getLoadAfterNames()
java.lang.String[] getLoadBeforeNames()
java.lang.String getDependentVersion(java.lang.String name)
name - the name of the dependency@Deprecated boolean checkForChanges()
void refresh()
GrailsPluginManager getManager()
groovy.lang.GroovyObject getInstance()
void setManager(GrailsPluginManager manager)
manager - A GrailsPluginManager instancevoid setApplication(GrailsApplication application)
void doWithDynamicMethods(org.springframework.context.ApplicationContext applicationContext)
applicationContext - The Spring ApplicationContext instanceboolean isEnabled()
java.lang.String[] getObservedPluginNames()
void notifyOfEvent(java.util.Map event)
event - The event to listen forjava.util.Map notifyOfEvent(int eventKind,
java.lang.Object source)
eventKind - The event kindsource - The source of the eventvoid doArtefactConfiguration()
ArtefactHandlerjava.lang.Class<?>[] getProvidedArtefacts()
java.lang.String getFileSystemName()
java.lang.String getFileSystemShortName()
java.lang.Class<?> getPluginClass()
java.util.List<java.lang.String> getPluginExcludes()
boolean isBasePlugin()
void setBasePlugin(boolean isBase)
isBase - True if isisBasePlugin()java.util.Collection<? extends org.springframework.core.type.filter.TypeFilter> getTypeFilters()
java.util.List<org.codehaus.groovy.grails.plugins.support.WatchPattern> getWatchedResourcePatterns()
boolean hasInterestInChange(java.lang.String path)
path - The path to the resource that changedvoid setDescriptor(org.springframework.core.io.Resource descriptor)
descriptor - The descriptor