|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager
org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager
public class DefaultGrailsPluginManager
A class that 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 (@see grails.spring.BeanBuilder) to provide runtime configuration of Grails via Spring
The doWithContext closure is called after the Spring ApplicationContext is built and accepts a single argument (the ApplicationContext)
The doWithWebDescriptor uses mark-up building to provide additional functionality to the web.xml file
Example:
class ClassEditorGrailsPlugin { def version = 1.1 def doWithSpring = { application -> classEditor(org.springframework.beans.propertyeditors.ClassEditor, application.classLoader) } }
A plugin can also define "dependsOn" and "evict" properties that specify what plugins the plugin depends on and which ones it is incompatable with and should evict
Field Summary |
---|
Fields inherited from class org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager |
---|
application, applicationContext, failedPlugins, initialised, pluginClasses, pluginList, pluginResources, plugins |
Fields inherited from interface org.codehaus.groovy.grails.plugins.GrailsPluginManager |
---|
BEAN_NAME |
Constructor Summary | |
---|---|
DefaultGrailsPluginManager(java.lang.Class[] plugins,
GrailsApplication application)
|
|
DefaultGrailsPluginManager(org.springframework.core.io.Resource[] pluginFiles,
GrailsApplication application)
|
|
DefaultGrailsPluginManager(java.lang.String[] pluginResources,
GrailsApplication application)
|
|
DefaultGrailsPluginManager(java.lang.String resourcePath,
GrailsApplication application)
|
Method Summary | |
---|---|
void |
checkForChanges()
Checks all the plugins to see whether they have any changes |
void |
doDynamicMethods()
This is called on all plugins so that they can add new methods/properties/constructors etc. |
void |
doWebDescriptor(java.io.File descriptor,
java.io.Writer target)
|
void |
doWebDescriptor(org.springframework.core.io.Resource descriptor,
java.io.Writer target)
Takes the specified web descriptor reference and configures it with all the plugins outputting the result to the target Writer instance |
protected void |
evictPlugin(GrailsPlugin evictor,
java.lang.String evicteeName)
|
(package private) java.util.List |
getPluginList()
|
java.util.Collection |
getPluginObservers(GrailsPlugin plugin)
Retrieves a collection of plugins that are observing the specified plugin |
javax.servlet.ServletContext |
getServletContext()
|
static java.lang.String |
getWeb23DTD()
|
void |
informObservers(java.lang.String pluginName,
java.util.Map event)
inform the specified plugins observers of the event specified by the passsed Map instance |
void |
loadPlugins()
Performs the initial load of plug-ins throwing an exception if any dependencies don't resolve |
void |
refreshPlugin(java.lang.String name)
Refreshes the specified plugin. |
void |
setApplication(GrailsApplication application)
Sets the GrailsApplication used be this plugin manager |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
|
void |
setParentApplicationContext(org.springframework.context.ApplicationContext parent)
|
(package private) void |
setPluginFilter(PluginFilter pluginFilter)
|
void |
setServletContext(javax.servlet.ServletContext servletContext)
|
Methods inherited from class org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager |
---|
checkInitialised, doArtefactConfiguration, doPostProcessing, doRuntimeConfiguration, doRuntimeConfiguration, getAllPlugins, getFailedPlugin, getGrailsPlugin, getGrailsPlugin, getPluginResources, hasGrailsPlugin, isInitialised, registerProvidedArtefacts, shutdown |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.codehaus.groovy.grails.plugins.GrailsPluginManager |
---|
doArtefactConfiguration, doPostProcessing, doRuntimeConfiguration, doRuntimeConfiguration, getAllPlugins, getFailedPlugin, getGrailsPlugin, getGrailsPlugin, hasGrailsPlugin, isInitialised, registerProvidedArtefacts, shutdown |
Constructor Detail |
---|
public DefaultGrailsPluginManager(java.lang.String resourcePath, GrailsApplication application) throws java.io.IOException
java.io.IOException
public DefaultGrailsPluginManager(java.lang.String[] pluginResources, GrailsApplication application)
public DefaultGrailsPluginManager(java.lang.Class[] plugins, GrailsApplication application) throws java.io.IOException
java.io.IOException
public DefaultGrailsPluginManager(org.springframework.core.io.Resource[] pluginFiles, GrailsApplication application)
Method Detail |
---|
public void refreshPlugin(java.lang.String name)
GrailsPluginManager
refreshPlugin
in interface GrailsPluginManager
name
- The name of the plugin to refreshpublic java.util.Collection getPluginObservers(GrailsPlugin plugin)
GrailsPluginManager
getPluginObservers
in interface GrailsPluginManager
plugin
- The plugin to retrieve observers for
public void informObservers(java.lang.String pluginName, java.util.Map event)
GrailsPluginManager
informObservers
in interface GrailsPluginManager
pluginName
- The name of the pluginevent
- The eventpublic void loadPlugins() throws PluginException
GrailsPluginManager
loadPlugins
in interface GrailsPluginManager
PluginException
- Thrown when an error occurs loading the pluginsprotected void evictPlugin(GrailsPlugin evictor, java.lang.String evicteeName)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
setApplicationContext
in class AbstractGrailsPluginManager
org.springframework.beans.BeansException
public void setParentApplicationContext(org.springframework.context.ApplicationContext parent)
public void checkForChanges()
GrailsPluginManager
checkForChanges
in interface GrailsPluginManager
public void doWebDescriptor(org.springframework.core.io.Resource descriptor, java.io.Writer target)
GrailsPluginManager
doWebDescriptor
in interface GrailsPluginManager
descriptor
- The Resource of the descriptortarget
- The Writer to write the result topublic void doWebDescriptor(java.io.File descriptor, java.io.Writer target)
doWebDescriptor
in interface GrailsPluginManager
descriptor
- The File of the descriptortarget
- The target to write the changes toGrailsPluginManager.doWebDescriptor(Resource, Writer)
public void setApplication(GrailsApplication application)
GrailsPluginManager
setApplication
in interface GrailsPluginManager
setApplication
in class AbstractGrailsPluginManager
application
- The GrailsApplication instancepublic void doDynamicMethods()
GrailsPluginManager
doDynamicMethods
in interface GrailsPluginManager
doDynamicMethods
in class AbstractGrailsPluginManager
public void setServletContext(javax.servlet.ServletContext servletContext)
setServletContext
in interface org.springframework.web.context.ServletContextAware
public javax.servlet.ServletContext getServletContext()
void setPluginFilter(PluginFilter pluginFilter)
java.util.List getPluginList()
public static java.lang.String getWeb23DTD()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |