public class DefaultGrailsPlugin extends AbstractGrailsPlugin implements ParentApplicationContextAware
ARTEFACTS, DEPENDS_ON, DO_WITH_APPLICATION_CONTEXT, DO_WITH_DYNAMIC_METHODS, DO_WITH_SPRING, DO_WITH_WEB_DESCRIPTOR, ENVIRONMENTS, EVENT_ON_CHANGE, EVENT_ON_CONFIG_CHANGE, EVENT_ON_SHUTDOWN, EVICT, INFLUENCES, ON_CHANGE, ON_CONFIG_CHANGE, ON_SHUTDOWN, PLUGIN_EXCLUDES, PLUGIN_LOAD_AFTER_NAMES, PLUGIN_LOAD_BEFORE_NAMES, PLUGINS_PATH, PROVIDED_ARTEFACTS, SCOPES, STATUS, STATUS_DISABLED, STATUS_ENABLED, TYPE_FILTERS, WATCHED_RESOURCES
Constructor and Description |
---|
DefaultGrailsPlugin(java.lang.Class<?> pluginClass,
GrailsApplication application) |
DefaultGrailsPlugin(java.lang.Class<?> pluginClass,
Resource resource,
GrailsApplication application) |
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 BuildScope
|
BeanBuilder |
beans(Closure closure) |
boolean |
checkForChanges()
Deprecated.
|
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 ctx)
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 ctx)
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
|
Resource |
getDescriptor() |
java.lang.String |
getFullName() |
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.
|
Log |
getLog() |
java.lang.String |
getName() |
java.lang.String[] |
getObservedPluginNames()
Retrieve the plugin names that this plugin is observing for changes
|
ApplicationContext |
getParentCtx() |
GrailsPlugin |
getPlugin() |
Resource |
getPluginDir() |
java.util.List<java.lang.String> |
getPluginExcludes()
A list of resources that the plugin should exclude from the packaged distribution
|
java.util.Map |
getProperties() |
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
|
PathMatchingResourcePatternResolver |
getResolver() |
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
|
Resource[] |
getWatchedResources() |
boolean |
hasInterestInChange(java.lang.String path)
Whether the plugin is interested in a particular change
|
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 |
restartContainer()
Deprecated.
Not needed any more due to the reload agent
|
void |
setDescriptor(Resource descriptor)
Sets the plugin descriptor for this plugin
|
void |
setParentApplicationContext(ApplicationContext parent) |
void |
setWatchedResources(Resource[] watchedResources) |
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
|
java.lang.String |
toString() |
compareTo, equals, getEvictionNames, getFileSystemName, getFileSystemShortName, getManager, getPluginClass, getPluginPath, getVersion, hashCode, isBasePlugin, setApplication, setApplicationContext, setBasePlugin, setManager
public DefaultGrailsPlugin(java.lang.Class<?> pluginClass, Resource resource, GrailsApplication application)
public DefaultGrailsPlugin(java.lang.Class<?> pluginClass, GrailsApplication application)
public java.util.List<WatchPattern> getWatchedResourcePatterns()
GrailsPlugin
getWatchedResourcePatterns
in interface GrailsPlugin
getWatchedResourcePatterns
in class AbstractGrailsPlugin
public boolean hasInterestInChange(java.lang.String path)
GrailsPlugin
hasInterestInChange
in interface GrailsPlugin
hasInterestInChange
in class AbstractGrailsPlugin
path
- The path to the resource that changedpublic java.lang.String[] getLoadAfterNames()
GrailsPlugin
getLoadAfterNames
in interface GrailsPlugin
getLoadAfterNames
in class AbstractGrailsPlugin
public java.lang.String[] getLoadBeforeNames()
GrailsPlugin
getLoadBeforeNames
in interface GrailsPlugin
getLoadBeforeNames
in class AbstractGrailsPlugin
public PathMatchingResourcePatternResolver getResolver()
public ApplicationContext getParentCtx()
public BeanBuilder beans(Closure closure)
public void doWithApplicationContext(ApplicationContext ctx)
GrailsPlugin
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
.
doWithApplicationContext
in interface GrailsPlugin
ctx
- The Spring ApplicationContext instancepublic void doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)
GrailsPlugin
doWithRuntimeConfiguration
in interface GrailsPlugin
springConfig
- The RuntimeSpringConfiguration instancepublic java.lang.String getName()
getName
in class AbstractGrailsPlugin
public void addExclude(BuildScope buildScope)
GrailsPlugin
addExclude
in interface GrailsPlugin
buildScope
- The BuildScopepublic void addExclude(Environment env)
GrailsPlugin
addExclude
in interface GrailsPlugin
env
- The BuildScopepublic boolean supportsScope(BuildScope buildScope)
GrailsPlugin
supportsScope
in interface GrailsPlugin
buildScope
- The PluginScopepublic boolean supportsEnvironment(Environment environment)
GrailsPlugin
supportsEnvironment
in interface GrailsPlugin
environment
- The environment namepublic boolean supportsCurrentScopeAndEnvironment()
supportsCurrentScopeAndEnvironment
in interface GrailsPlugin
public void doc(java.lang.String text)
GrailsPlugin
doc
in interface GrailsPlugin
public java.lang.String[] getDependencyNames()
getDependencyNames
in interface GrailsPlugin
getDependencyNames
in class AbstractGrailsPlugin
public Resource[] getWatchedResources()
public java.lang.String getDependentVersion(java.lang.String name)
GrailsPlugin
getDependentVersion
in interface GrailsPlugin
getDependentVersion
in class AbstractGrailsPlugin
name
- the name of the dependencypublic java.lang.String toString()
public void doWithWebDescriptor(org.w3c.dom.Element webXml)
GrailsPlugin
doWithWebDescriptor
in interface GrailsPlugin
doWithWebDescriptor
in class AbstractGrailsPlugin
webXml
- The GPathResult representing web.xml@Deprecated public boolean checkForChanges()
checkForChanges
in interface GrailsPlugin
checkForChanges
in class AbstractGrailsPlugin
@Deprecated public void restartContainer()
public void setWatchedResources(Resource[] watchedResources) throws java.io.IOException
java.io.IOException
public Log getLog()
public GrailsPlugin getPlugin()
public void setParentApplicationContext(ApplicationContext parent)
setParentApplicationContext
in interface ParentApplicationContextAware
public void refresh()
GrailsPlugin
refresh
in interface GrailsPlugin
refresh
in class AbstractGrailsPlugin
public GroovyObject getInstance()
GrailsPlugin
getInstance
in interface GrailsPlugin
public void doWithDynamicMethods(ApplicationContext ctx)
GrailsPlugin
doWithDynamicMethods
in interface GrailsPlugin
ctx
- The Spring ApplicationContext instancepublic boolean isEnabled()
isEnabled
in interface GrailsPlugin
public java.lang.String[] getObservedPluginNames()
GrailsPlugin
getObservedPluginNames
in interface GrailsPlugin
public void notifyOfEvent(java.util.Map event)
GrailsPlugin
notifyOfEvent
in interface GrailsPlugin
event
- The event to listen forpublic java.util.Map notifyOfEvent(int eventKind, java.lang.Object source)
GrailsPlugin
notifyOfEvent
in interface GrailsPlugin
eventKind
- The event kindsource
- The source of the eventpublic void doArtefactConfiguration()
GrailsPlugin
doArtefactConfiguration
in interface GrailsPlugin
ArtefactHandler
public java.lang.Class<?>[] getProvidedArtefacts()
GrailsPlugin
getProvidedArtefacts
in interface GrailsPlugin
public java.util.List<java.lang.String> getPluginExcludes()
GrailsPlugin
getPluginExcludes
in interface GrailsPlugin
public java.util.Collection<? extends TypeFilter> getTypeFilters()
GrailsPlugin
getTypeFilters
in interface GrailsPlugin
public java.lang.String getFullName()
public Resource getDescriptor()
public void setDescriptor(Resource descriptor)
GrailsPlugin
setDescriptor
in interface GrailsPlugin
descriptor
- The descriptorpublic Resource getPluginDir()
public java.util.Map getProperties()