public class DefaultGrailsPluginManager extends AbstractGrailsPluginManager
Handles the loading and management of plug-ins in the Grails system. A plugin is 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 (
Modifiers | Name | Description |
---|---|---|
protected static java.lang.Class<?>[] |
COMMON_CLASSES |
|
private static java.lang.String |
GRAILS_PLUGIN_SUFFIX |
|
private static java.lang.String |
GRAILS_VERSION |
|
private static org.apache.commons.logging.Log |
LOG |
|
private java.util.Map<GrailsPlugin, java.lang.String> |
delayedEvictions |
|
private java.util.List<GrailsPlugin> |
delayedLoadPlugins |
|
private org.springframework.context.ApplicationContext |
parentCtx |
|
private PluginFilter |
pluginFilter |
|
private java.util.Map<java.lang.String, java.util.Set<GrailsPlugin>> |
pluginToObserverMap |
|
private org.springframework.core.io.support.PathMatchingResourcePatternResolver |
resolver |
|
private java.util.List<GrailsPlugin> |
userPlugins |
Fields inherited from class | Fields |
---|---|
class AbstractGrailsPluginManager |
BLANK, CONFIG_BINDING_APP_NAME, CONFIG_BINDING_APP_VERSION, CONFIG_BINDING_GRAILS_HOME, CONFIG_BINDING_USER_HOME, CONFIG_FILE, LOG, application, applicationContext, classNameToPluginMap, failedPlugins, initialised, loadCorePlugins, pluginClasses, pluginList, pluginResources, plugins, shutdown |
Constructor and description |
---|
DefaultGrailsPluginManager
(java.lang.String resourcePath, GrailsApplication application) |
DefaultGrailsPluginManager
(java.lang.String[] pluginResources, GrailsApplication application) |
DefaultGrailsPluginManager
(java.lang.Class<?>[] plugins, GrailsApplication application) |
DefaultGrailsPluginManager
(org.springframework.core.io.Resource[] pluginFiles, GrailsApplication application) |
DefaultGrailsPluginManager
(GrailsApplication application) |
Type Params | Return Type | Name and description |
---|---|---|
|
private boolean |
areDependenciesResolved(GrailsPlugin plugin) |
|
private boolean |
areNoneToLoadBefore(GrailsPlugin plugin) Returns true if there are no plugins left that should, if possible, be loaded before this plugin. |
|
private void |
attemptLoadPlugins(java.lang.ClassLoader gcl) |
|
private void |
attemptPluginLoad(GrailsPlugin plugin) Attempts to load a plugin based on its dependencies. |
|
protected boolean |
canRegisterPlugin(GrailsPlugin plugin) |
|
public void |
checkForChanges()
|
|
private GrailsPlugin |
createBinaryGrailsPlugin(java.lang.Class<?> pluginClass, BinaryGrailsPluginDescriptor binaryDescriptor) |
|
protected GrailsPlugin |
createGrailsPlugin(java.lang.Class<?> pluginClass) |
|
protected GrailsPlugin |
createGrailsPlugin(java.lang.Class<?> pluginClass, org.springframework.core.io.Resource resource) |
|
public void |
doDynamicMethods() |
|
protected void |
evictPlugin(GrailsPlugin evictor, java.lang.String evicteeName) |
|
private java.util.List<GrailsPlugin> |
findCorePlugins() |
|
private java.util.List<GrailsPlugin> |
findUserPlugins(java.lang.ClassLoader gcl) |
|
private PluginFilter |
getPluginFilter() |
|
private java.lang.String |
getPluginGrailsVersion(GrailsPlugin plugin) |
|
java.util.List<GrailsPlugin> |
getPluginList() |
|
public java.util.Collection<GrailsPlugin> |
getPluginObservers(GrailsPlugin plugin) |
|
public GrailsPlugin[] |
getUserPlugins() |
|
private boolean |
hasDelayedDependencies(GrailsPlugin other) |
|
private boolean |
hasGrailsPlugin(java.lang.String name, java.lang.String version) |
|
private boolean |
hasValidPluginsToLoadBefore(GrailsPlugin plugin) |
|
public void |
informObservers(java.lang.String pluginName, java.util.Map event) |
|
private void |
initializePlugins() |
|
private boolean |
isCompatiblePlugin(GrailsPlugin plugin) Checks plugin compatibility against used Grails version |
|
private boolean |
isDependentOn(GrailsPlugin plugin, GrailsPlugin dependency) Checks whether the first plugin is dependant on the second plugin. |
|
private boolean |
isGrailsPlugin(java.lang.Class<?> pluginClass) |
|
private void |
loadDelayedPlugins() This method will attempt to load that plug-ins not loaded in the first pass |
|
private java.lang.Class<?> |
loadPluginClass(java.lang.ClassLoader cl, org.springframework.core.io.Resource r) |
|
public void |
loadPlugins() |
|
private void |
processDelayedEvictions() |
|
public void |
refreshPlugin(java.lang.String name) |
|
private void |
registerPlugin(GrailsPlugin plugin) |
|
public void |
reloadPlugin(GrailsPlugin plugin) |
|
protected java.util.Map<GrailsPlugin, java.util.List<GrailsPlugin>> |
resolveLoadDependencies(java.util.List<GrailsPlugin> plugins) |
|
public void |
setApplication(GrailsApplication application) |
|
public void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
|
public void |
setParentApplicationContext(org.springframework.context.ApplicationContext parent) |
|
private void |
setPluginFilter() |
|
public void |
setPluginFilter(PluginFilter pluginFilter) |
|
protected java.util.List<GrailsPlugin> |
sortPlugins(java.util.List<GrailsPlugin> toSort) |
|
private void |
visitTopologicalSort(GrailsPlugin plugin, java.util.List<GrailsPlugin> sortedPlugins, java.util.Set<GrailsPlugin> visitedPlugins, java.util.Map<GrailsPlugin, java.util.List<GrailsPlugin>> loadOrderDependencies) |
Returns true if there are no plugins left that should, if possible, be loaded before this plugin.
plugin
- The pluginAttempts to load a plugin based on its dependencies. If a plugin's dependencies cannot be resolved it will add it to the list of dependencies to be resolved later.
plugin
- The pluginChecks plugin compatibility against used Grails version
plugin
- the plugin to checkChecks whether the first plugin is dependant on the second plugin.
plugin
- The plugin to checkdependency
- The plugin which the first argument may be dependant onThis method will attempt to load that plug-ins not loaded in the first pass