|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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(Class[] plugins,
GrailsApplication application)
|
|
DefaultGrailsPluginManager(Resource[] pluginFiles,
GrailsApplication application)
|
|
DefaultGrailsPluginManager(String[] pluginResources,
GrailsApplication application)
|
|
DefaultGrailsPluginManager(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(File descriptor,
Writer target)
|
void |
doWebDescriptor(Resource descriptor,
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,
String evicteeName)
|
(package private) List |
getPluginList()
|
Collection |
getPluginObservers(GrailsPlugin plugin)
Retrieves a collection of plugins that are observing the specified plugin |
ServletContext |
getServletContext()
|
static String |
getWeb23DTD()
|
void |
informObservers(String pluginName,
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(String name)
Refreshes the specified plugin. |
void |
setApplication(GrailsApplication application)
Sets the GrailsApplication used be this plugin manager |
void |
setApplicationContext(ApplicationContext applicationContext)
|
void |
setParentApplicationContext(ApplicationContext parent)
|
(package private) void |
setPluginFilter(PluginFilter pluginFilter)
|
void |
setServletContext(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 |
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 |
Constructor Detail |
---|
public DefaultGrailsPluginManager(String resourcePath, GrailsApplication application) throws IOException
IOException
public DefaultGrailsPluginManager(String[] pluginResources, GrailsApplication application)
public DefaultGrailsPluginManager(Class[] plugins, GrailsApplication application) throws IOException
IOException
public DefaultGrailsPluginManager(Resource[] pluginFiles, GrailsApplication application)
Method Detail |
---|
public void refreshPlugin(String name)
GrailsPluginManager
refreshPlugin
in interface GrailsPluginManager
name
- The name of the plugin to refreshpublic Collection getPluginObservers(GrailsPlugin plugin)
GrailsPluginManager
getPluginObservers
in interface GrailsPluginManager
plugin
- The plugin to retrieve observers for
public void informObservers(String pluginName, 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, String evicteeName)
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
setApplicationContext
in class AbstractGrailsPluginManager
BeansException
public void setParentApplicationContext(ApplicationContext parent)
public void checkForChanges()
GrailsPluginManager
checkForChanges
in interface GrailsPluginManager
public void doWebDescriptor(Resource descriptor, Writer target)
GrailsPluginManager
doWebDescriptor
in interface GrailsPluginManager
descriptor
- The Resource of the descriptortarget
- The Writer to write the result topublic void doWebDescriptor(File descriptor, 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(ServletContext servletContext)
setServletContext
in interface ServletContextAware
public ServletContext getServletContext()
void setPluginFilter(PluginFilter pluginFilter)
List getPluginList()
public static String getWeb23DTD()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |