public interface GrailsPlugin
extends java.lang.Comparable
Plugin interface that adds Spring org.springframework.beans.factory.config.BeanDefinition
s
to a registry based on a GrailsApplication
object. After all GrailsPlugin
classes
have been processed the org.springframework.beans.factory.config.BeanDefinition
s in the registry are
loaded in a Spring org.springframework.context.ApplicationContext
that's the singular
configuration unit of Grails applications.
It's up to implementation classes to determine where GrailsPlugin
instances are loaded
from.
org.springframework.beans.factory.support.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 |
INFLUENCES
Defines the name of the property that defines a list of plugin names that this plugin influences.
|
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 reperesents 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 artefactssw
|
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 reperesents 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(BuildScope buildScope)
Makes the plugin excluded for a particular BuildScope
|
void |
addExclude(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(ApplicationContext applicationContext)
This method is called to allow the plugin to add
org.springframework.beans.factory.config.BeanDefinition s
to the org.springframework.beans.factory.support.BeanDefinitionRegistry . |
void |
doWithDynamicMethods(ApplicationContext applicationContext)
Calls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime
|
void |
doWithRuntimeConfiguration(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.
|
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 TypeFilter> |
getTypeFilters()
Plugin can provide a list of Spring TypeFilters so that annotated components can
be scanned into the ApplicationContext
|
java.util.List<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(Resource descriptor)
Sets the plugin descriptor for this plugin
|
void |
setManager(GrailsPluginManager manager)
Sets the plugin manager for this plugin
|
boolean |
supportsCurrentScopeAndEnvironment() |
boolean |
supportsEnvironment(Environment environment)
Returns whether this plugin supports the given environment name
|
boolean |
supportsScope(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 INFLUENCES
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
void doWithApplicationContext(ApplicationContext applicationContext)
This method is called to allow the plugin to add org.springframework.beans.factory.config.BeanDefinition
s
to the org.springframework.beans.factory.support.BeanDefinitionRegistry
.
applicationContext
- The Spring ApplicationContext instancevoid doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)
springConfig
- The RuntimeSpringConfiguration instancevoid doWithWebDescriptor(org.w3c.dom.Element webXml)
webXml
- The GPathResult representing web.xmlvoid addExclude(BuildScope buildScope)
buildScope
- The BuildScopevoid addExclude(Environment env)
env
- The Environmentboolean supportsScope(BuildScope buildScope)
buildScope
- The PluginScopeboolean supportsEnvironment(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()
GroovyObject getInstance()
void setManager(GrailsPluginManager manager)
manager
- A GrailsPluginManager instancevoid setApplication(GrailsApplication application)
void doWithDynamicMethods(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()
ArtefactHandler
java.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 TypeFilter> getTypeFilters()
java.util.List<WatchPattern> getWatchedResourcePatterns()
boolean hasInterestInChange(java.lang.String path)
path
- The path to the resource that changedvoid setDescriptor(Resource descriptor)
descriptor
- The descriptor