org.codehaus.groovy.grails.plugins
Class AbstractGrailsPluginManager

java.lang.Object
  extended by org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager
All Implemented Interfaces:
GrailsPluginManager, ApplicationContextAware, ServletContextAware
Direct Known Subclasses:
DefaultGrailsPluginManager

public abstract class AbstractGrailsPluginManager
extends Object
implements GrailsPluginManager

Abstract implementation of the GrailsPluginManager interface

Since:
0.4
Author:
Graeme Rocher

Field Summary
protected  GrailsApplication application
           
protected  ApplicationContext applicationContext
           
protected  Map failedPlugins
           
protected  boolean initialised
           
protected  Class[] pluginClasses
           
protected  List pluginList
           
protected  Resource[] pluginResources
           
protected  Map plugins
           
 
Fields inherited from interface org.codehaus.groovy.grails.plugins.GrailsPluginManager
BEAN_NAME
 
Constructor Summary
AbstractGrailsPluginManager(GrailsApplication application)
           
 
Method Summary
protected  void checkInitialised()
           
 void doArtefactConfiguration()
          Called prior to the initialisation of the GrailsApplication object to allow registration of additional ArtefactHandler objects
 void doDynamicMethods()
          This is called on all plugins so that they can add new methods/properties/constructors etc.
 void doPostProcessing(ApplicationContext applicationContext)
          Base implementation that will simply go through each plugin and call doWithApplicationContext on each
 void doRuntimeConfiguration(RuntimeSpringConfiguration springConfig)
          Base implementation that simply goes through the list of plugins and calls doWithRuntimeConfiguration on each
 void doRuntimeConfiguration(String pluginName, RuntimeSpringConfiguration springConfig)
          Base implementation that will perform runtime configuration for the specified plugin name
 GrailsPlugin[] getAllPlugins()
          Returns an array of all the loaded plug-ins
 GrailsPlugin getFailedPlugin(String name)
          Retrieves a plug-in that failed to load, or null if it doesn't exist
 GrailsPlugin getGrailsPlugin(String name)
          Retrieves a name Grails plugin instance
 GrailsPlugin getGrailsPlugin(String name, Object version)
          Retrieves a plug-in for its name and version
 Resource[] getPluginResources()
           
 boolean hasGrailsPlugin(String name)
           
 boolean isInitialised()
           
 void registerProvidedArtefacts(GrailsApplication application)
          Registers pre-compiled artefacts with the GrailsApplication instance, only overriding if the application doesn't already provide an artefact of the same name
 void setApplication(GrailsApplication application)
          Sets the GrailsApplication used be this plugin manager
 void setApplicationContext(ApplicationContext applicationContext)
           
 
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
checkForChanges, doWebDescriptor, doWebDescriptor, getPluginObservers, informObservers, loadPlugins, refreshPlugin
 
Methods inherited from interface org.springframework.web.context.ServletContextAware
setServletContext
 

Field Detail

pluginList

protected List pluginList

application

protected GrailsApplication application

pluginResources

protected Resource[] pluginResources

plugins

protected Map plugins

pluginClasses

protected Class[] pluginClasses

initialised

protected boolean initialised

applicationContext

protected ApplicationContext applicationContext

failedPlugins

protected Map failedPlugins
Constructor Detail

AbstractGrailsPluginManager

public AbstractGrailsPluginManager(GrailsApplication application)
Method Detail

getAllPlugins

public GrailsPlugin[] getAllPlugins()
Description copied from interface: GrailsPluginManager
Returns an array of all the loaded plug-ins

Specified by:
getAllPlugins in interface GrailsPluginManager
Returns:
An array of plug-ins

isInitialised

public boolean isInitialised()
Specified by:
isInitialised in interface GrailsPluginManager
Returns:
the initialised

checkInitialised

protected void checkInitialised()

getFailedPlugin

public GrailsPlugin getFailedPlugin(String name)
Description copied from interface: GrailsPluginManager
Retrieves a plug-in that failed to load, or null if it doesn't exist

Specified by:
getFailedPlugin in interface GrailsPluginManager
Parameters:
name - The name of the plugin
Returns:
A GrailsPlugin or null

doRuntimeConfiguration

public void doRuntimeConfiguration(RuntimeSpringConfiguration springConfig)
Base implementation that simply goes through the list of plugins and calls doWithRuntimeConfiguration on each

Specified by:
doRuntimeConfiguration in interface GrailsPluginManager
Parameters:
springConfig - The RuntimeSpringConfiguration instance

doRuntimeConfiguration

public void doRuntimeConfiguration(String pluginName,
                                   RuntimeSpringConfiguration springConfig)
Base implementation that will perform runtime configuration for the specified plugin name

Specified by:
doRuntimeConfiguration in interface GrailsPluginManager
Parameters:
pluginName - The name of he plugin
springConfig - The runtime spring config instance

doPostProcessing

public void doPostProcessing(ApplicationContext applicationContext)
Base implementation that will simply go through each plugin and call doWithApplicationContext on each

Specified by:
doPostProcessing in interface GrailsPluginManager
Parameters:
applicationContext - The ApplicationContext instance

getPluginResources

public Resource[] getPluginResources()

getGrailsPlugin

public GrailsPlugin getGrailsPlugin(String name)
Description copied from interface: GrailsPluginManager
Retrieves a name Grails plugin instance

Specified by:
getGrailsPlugin in interface GrailsPluginManager
Parameters:
name - The name of the plugin
Returns:
The GrailsPlugin instance or null if it doesn't exist

getGrailsPlugin

public GrailsPlugin getGrailsPlugin(String name,
                                    Object version)
Description copied from interface: GrailsPluginManager
Retrieves a plug-in for its name and version

Specified by:
getGrailsPlugin in interface GrailsPluginManager
Parameters:
name - The name of the plugin
version - The version of the plugin
Returns:
The GrailsPlugin instance or null if it doesn't exist

hasGrailsPlugin

public boolean hasGrailsPlugin(String name)
Specified by:
hasGrailsPlugin in interface GrailsPluginManager
Parameters:
name - The name of the plugin
Returns:
True if the the manager has a loaded plugin with the given name

doDynamicMethods

public void doDynamicMethods()
Description copied from interface: GrailsPluginManager
This is called on all plugins so that they can add new methods/properties/constructors etc.

Specified by:
doDynamicMethods in interface GrailsPluginManager

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

setApplication

public void setApplication(GrailsApplication application)
Description copied from interface: GrailsPluginManager
Sets the GrailsApplication used be this plugin manager

Specified by:
setApplication in interface GrailsPluginManager
Parameters:
application - The GrailsApplication instance

registerProvidedArtefacts

public void registerProvidedArtefacts(GrailsApplication application)
Description copied from interface: GrailsPluginManager
Registers pre-compiled artefacts with the GrailsApplication instance, only overriding if the application doesn't already provide an artefact of the same name

Specified by:
registerProvidedArtefacts in interface GrailsPluginManager
Parameters:
application - The GrailsApplication object

doArtefactConfiguration

public void doArtefactConfiguration()
Description copied from interface: GrailsPluginManager
Called prior to the initialisation of the GrailsApplication object to allow registration of additional ArtefactHandler objects

Specified by:
doArtefactConfiguration in interface GrailsPluginManager
See Also:
ArtefactHandler


Copyright (c) 2005-2006 The Grails project