Package org.grails.plugins
Class AbstractGrailsPluginManager
java.lang.Object
org.grails.plugins.AbstractGrailsPluginManager
- All Implemented Interfaces:
GrailsPluginManager,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
DefaultGrailsPluginManager,MockGrailsPluginManager
Abstract implementation of the GrailsPluginManager interface
- Since:
- 0.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GrailsApplicationprotected org.springframework.context.ApplicationContextprotected Map<String,GrailsPlugin> static final Stringprotected Map<String,GrailsPlugin> protected booleanprotected booleanprotected Class<?>[]protected List<GrailsPlugin>protected org.springframework.core.io.Resource[]protected Map<String,GrailsPlugin> protected booleanFields inherited from interface grails.plugins.GrailsPluginManager
BEAN_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidCalled prior to the initialisation of the GrailsApplication object to allow registration of additional ArtefactHandler objectsvoidCalled on all plugins so that they can add new methods/properties/constructors etc.voiddoPostProcessing(org.springframework.context.ApplicationContext ctx) Base implementation that will simply go through each plugin and call doWithApplicationContext on each.voiddoRuntimeConfiguration(String pluginName, org.grails.spring.RuntimeSpringConfiguration springConfig) Base implementation that will perform runtime configuration for the specified plugin name.voiddoRuntimeConfiguration(org.grails.spring.RuntimeSpringConfiguration springConfig) Base implementation that simply goes through the list of plugins and calls doWithRuntimeConfiguration on eachReturns an array of all the loaded plug-insgetFailedPlugin(String name) Retrieves a plug-in that failed to load, or null if it doesn't existgetGrailsPlugin(String name) Retrieves a name Grails plugin instancegetGrailsPlugin(String name, Object version) Retrieves a plug-in for its name and versionObtains a GrailsPlugin for the given classnamegetPluginForClass(Class<?> theClass) Obtains the GrailsPlugin for the given classgetPluginForInstance(Object instance) Looks up the plugin that defined the given instance.getPluginPath(String name) Returns the pluginContextPath for the given plugingetPluginPath(String name, boolean forceCamelCase) Returns the pluginContextPath for the given plugin and will force name to camel case instead of '-' lower case my-plug-web would resolve to myPlugWeb if forceCamelCase is true.getPluginPathForClass(Class<?> theClass) Returns the plugin path for the given classgetPluginPathForInstance(Object instance) Returns the pluginContextPath for the given instanceorg.springframework.core.io.Resource[]getPluginViewsPathForClass(Class<?> theClass) Returns the plugin views directory path for the given classgetPluginViewsPathForInstance(Object instance) Returns the plugin views directory for the given instanceList<org.springframework.core.type.filter.TypeFilter>Get all of the TypeFilter definitions defined by the pluginsbooleanhasGrailsPlugin(String name) voidinformOfClassChange(File file, Class cls) voidinformOfClassChange(Class<?> aClass) Method for handling changes to a class and triggering on change events etc.voidinformOfFileChange(File file) Fire to inform the PluginManager that a particular file changesvoidInform of a change in configurationbooleanprotected booleanbooleanIndicates whether the manager has been shutdown or notvoidExecutes thePlugin.onStartup(Map)hook for all pluginsvoidRegisters pre-compiled artefacts with the GrailsApplication instance, only overriding if the application doesn't already provide an artefact of the same name.voidsetApplication(GrailsApplication application) Sets the GrailsApplication used be this plugin managervoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetLoadCorePlugins(boolean shouldLoadCorePlugins) Set whether the core plugins should be loadedvoidsetPluginFilter(PluginFilter pluginFilter) Sets the filter to use to filter for pluginsvoidshutdown()Shuts down the PluginManagerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface grails.plugins.GrailsPluginManager
checkForChanges, getPluginObservers, getUserPlugins, informObservers, loadPlugins, refreshPlugin
-
Field Details
-
CONFIG_FILE
- See Also:
-
pluginList
-
application
-
pluginResources
protected org.springframework.core.io.Resource[] pluginResources -
plugins
-
classNameToPluginMap
-
pluginClasses
-
initialised
protected boolean initialised -
shutdown
protected boolean shutdown -
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
failedPlugins
-
loadCorePlugins
protected boolean loadCorePlugins
-
-
Constructor Details
-
AbstractGrailsPluginManager
-
-
Method Details
-
getTypeFilters
Description copied from interface:GrailsPluginManagerGet all of the TypeFilter definitions defined by the plugins- Specified by:
getTypeFiltersin interfaceGrailsPluginManager- Returns:
- A list of TypeFilter definitions
-
getAllPlugins
Description copied from interface:GrailsPluginManagerReturns an array of all the loaded plug-ins- Specified by:
getAllPluginsin interfaceGrailsPluginManager- Returns:
- An array of plug-ins
-
getFailedLoadPlugins
- Specified by:
getFailedLoadPluginsin interfaceGrailsPluginManager- Returns:
- An array of plugins that failed to load due to dependency resolution errors
-
isInitialised
public boolean isInitialised()- Specified by:
isInitialisedin interfaceGrailsPluginManager- Returns:
- the initialised
-
checkInitialised
protected void checkInitialised() -
getFailedPlugin
Description copied from interface:GrailsPluginManagerRetrieves a plug-in that failed to load, or null if it doesn't exist- Specified by:
getFailedPluginin interfaceGrailsPluginManager- Parameters:
name- The name of the plugin- Returns:
- A GrailsPlugin or null
-
doRuntimeConfiguration
public void doRuntimeConfiguration(org.grails.spring.RuntimeSpringConfiguration springConfig) Base implementation that simply goes through the list of plugins and calls doWithRuntimeConfiguration on each- Specified by:
doRuntimeConfigurationin interfaceGrailsPluginManager- Parameters:
springConfig- The RuntimeSpringConfiguration instance
-
doRuntimeConfiguration
public void doRuntimeConfiguration(String pluginName, org.grails.spring.RuntimeSpringConfiguration springConfig) Base implementation that will perform runtime configuration for the specified plugin name.- Specified by:
doRuntimeConfigurationin interfaceGrailsPluginManager- Parameters:
pluginName- The name of he pluginspringConfig- The runtime spring config instance
-
doPostProcessing
public void doPostProcessing(org.springframework.context.ApplicationContext ctx) Base implementation that will simply go through each plugin and call doWithApplicationContext on each.- Specified by:
doPostProcessingin interfaceGrailsPluginManager- Parameters:
ctx- The ApplicationContext instance
-
getPluginResources
public org.springframework.core.io.Resource[] getPluginResources() -
getGrailsPlugin
Description copied from interface:GrailsPluginManagerRetrieves a name Grails plugin instance- Specified by:
getGrailsPluginin interfaceGrailsPluginManager- Parameters:
name- The name of the plugin- Returns:
- The GrailsPlugin instance or null if it doesn't exist
-
getGrailsPluginForClassName
Description copied from interface:GrailsPluginManagerObtains a GrailsPlugin for the given classname- Specified by:
getGrailsPluginForClassNamein interfaceGrailsPluginManager- Parameters:
name- The name of the plugin- Returns:
- The instance
-
getGrailsPlugin
Description copied from interface:GrailsPluginManagerRetrieves a plug-in for its name and version- Specified by:
getGrailsPluginin interfaceGrailsPluginManager- Parameters:
name- The name of the pluginversion- The version of the plugin- Returns:
- The GrailsPlugin instance or null if it doesn't exist
-
hasGrailsPlugin
- Specified by:
hasGrailsPluginin interfaceGrailsPluginManager- 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:GrailsPluginManagerCalled on all plugins so that they can add new methods/properties/constructors etc.- Specified by:
doDynamicMethodsin interfaceGrailsPluginManager
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
setApplication
Description copied from interface:GrailsPluginManagerSets the GrailsApplication used be this plugin manager- Specified by:
setApplicationin interfaceGrailsPluginManager- Parameters:
application- The GrailsApplication instance
-
registerProvidedArtefacts
Description copied from interface:GrailsPluginManagerRegisters pre-compiled artefacts with the GrailsApplication instance, only overriding if the application doesn't already provide an artefact of the same name.- Specified by:
registerProvidedArtefactsin interfaceGrailsPluginManager- Parameters:
app- The GrailsApplication object
-
doArtefactConfiguration
public void doArtefactConfiguration()Description copied from interface:GrailsPluginManagerCalled prior to the initialisation of the GrailsApplication object to allow registration of additional ArtefactHandler objects- Specified by:
doArtefactConfigurationin interfaceGrailsPluginManager- See Also:
-
isPluginDisabledForProfile
-
onStartup
Description copied from interface:GrailsPluginManagerExecutes thePlugin.onStartup(Map)hook for all plugins- Specified by:
onStartupin interfaceGrailsPluginManager- Parameters:
event- the Event
-
shutdown
public void shutdown()Description copied from interface:GrailsPluginManagerShuts down the PluginManager- Specified by:
shutdownin interfaceGrailsPluginManager
-
isShutdown
public boolean isShutdown()Description copied from interface:GrailsPluginManagerIndicates whether the manager has been shutdown or not- Specified by:
isShutdownin interfaceGrailsPluginManager- Returns:
- True if it was shutdown
-
setPluginFilter
Description copied from interface:GrailsPluginManagerSets the filter to use to filter for plugins- Specified by:
setPluginFilterin interfaceGrailsPluginManager- Parameters:
pluginFilter- The plugin filter
-
setLoadCorePlugins
public void setLoadCorePlugins(boolean shouldLoadCorePlugins) Description copied from interface:GrailsPluginManagerSet whether the core plugins should be loaded- Specified by:
setLoadCorePluginsin interfaceGrailsPluginManager- Parameters:
shouldLoadCorePlugins- True if they should
-
informOfClassChange
Description copied from interface:GrailsPluginManagerMethod for handling changes to a class and triggering on change events etc.- Specified by:
informOfClassChangein interfaceGrailsPluginManager- Parameters:
aClass- The class
-
getPluginPath
Description copied from interface:GrailsPluginManagerReturns the pluginContextPath for the given plugin- Specified by:
getPluginPathin interfaceGrailsPluginManager- Parameters:
name- The plugin name- Returns:
- the context path
-
getPluginPath
Description copied from interface:GrailsPluginManagerReturns the pluginContextPath for the given plugin and will force name to camel case instead of '-' lower case my-plug-web would resolve to myPlugWeb if forceCamelCase is true.- Specified by:
getPluginPathin interfaceGrailsPluginManager- Parameters:
name- The plugin nameforceCamelCase- Force camel case for name- Returns:
- the context path
-
getPluginPathForInstance
Description copied from interface:GrailsPluginManagerReturns the pluginContextPath for the given instance- Specified by:
getPluginPathForInstancein interfaceGrailsPluginManager- Parameters:
instance- The instance- Returns:
- The pluginContextPath
-
getPluginForInstance
Description copied from interface:GrailsPluginManagerLooks up the plugin that defined the given instance. If no plugin defined the instance then null is returned.- Specified by:
getPluginForInstancein interfaceGrailsPluginManager- Parameters:
instance- The instance- Returns:
- The plugin that defined the instance or null
-
getPluginForClass
Description copied from interface:GrailsPluginManagerObtains the GrailsPlugin for the given class- Specified by:
getPluginForClassin interfaceGrailsPluginManager- Parameters:
theClass- The class- Returns:
- The GrailsPlugin for the given class or null if not related to any plugin
-
informPluginsOfConfigChange
public void informPluginsOfConfigChange()Description copied from interface:GrailsPluginManagerInform of a change in configuration- Specified by:
informPluginsOfConfigChangein interfaceGrailsPluginManager
-
informOfFileChange
Description copied from interface:GrailsPluginManagerFire to inform the PluginManager that a particular file changes- Specified by:
informOfFileChangein interfaceGrailsPluginManager- Parameters:
file- The file that changed
-
informOfClassChange
- Specified by:
informOfClassChangein interfaceGrailsPluginManager
-
getPluginPathForClass
Description copied from interface:GrailsPluginManagerReturns the plugin path for the given class- Specified by:
getPluginPathForClassin interfaceGrailsPluginManager- Parameters:
theClass- The class- Returns:
- The pluginContextPath
-
getPluginViewsPathForInstance
Description copied from interface:GrailsPluginManagerReturns the plugin views directory for the given instance- Specified by:
getPluginViewsPathForInstancein interfaceGrailsPluginManager- Parameters:
instance- The instance- Returns:
- The pluginContextPath
-
getPluginViewsPathForClass
Description copied from interface:GrailsPluginManagerReturns the plugin views directory path for the given class- Specified by:
getPluginViewsPathForClassin interfaceGrailsPluginManager- Parameters:
theClass- The class- Returns:
- The pluginContextPath
-