This is an automated email from the ASF dual-hosted git repository. matrei pushed a commit to branch matrei/cleanup-do-with-web in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit a862264c55a86f6a48fc44c66c85bac7c0103661 Author: Mattias Reichel <[email protected]> AuthorDate: Thu Mar 12 13:40:29 2026 +0100 fix: remove remnants of `doWithWebDescriptor` Also, clean up the javadoc in some classes related to Grails plugins. --- .../grails/plugins/DefaultGrailsPluginManager.java | 38 +++++++------ .../main/groovy/grails/plugins/GrailsPlugin.java | 62 ++++++++++++---------- .../groovy/grails/plugins/GrailsPluginManager.java | 56 ++++++++++--------- grails-profiles/plugin/templates/Plugin.groovy | 4 -- 4 files changed, 82 insertions(+), 78 deletions(-) diff --git a/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java b/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java index 2bf823327d..1421bb1361 100644 --- a/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java +++ b/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java @@ -72,28 +72,32 @@ import org.grails.spring.DefaultRuntimeSpringConfiguration; import org.grails.spring.RuntimeSpringConfiguration; /** - * <p>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. - * <p>A Plugin class is a Groovy class that has a version and optionally closures - * called doWithSpring, doWithContext and doWithWebDescriptor - * <p>The doWithSpring closure uses the BeanBuilder syntax (@see grails.spring.BeanBuilder) to + * Handles the loading and management of plug-ins in the Grails framework. + * A plugin is just like a normal Grails application except that it contains + * a class with a name ending with *GrailsPlugin. + * <p> + * This plugin descriptor class is a Groovy class that has a version and optionally + * closures called doWithSpring and doWithApplicationContext. + * <p> + * The doWithSpring closure uses the BeanBuilder syntax (@see grails.spring.BeanBuilder) to * provide runtime configuration of Grails via Spring - * <p>The doWithContext closure is called after the Spring ApplicationContext is built and accepts - * a single argument (the ApplicationContext) - * <p>The doWithWebDescriptor uses mark-up building to provide additional functionality to the web.xml - * file - * <p> Example: + * <p> + * The doWithApplicationContext closure is called after the Spring ApplicationContext is built + * and accepts a single argument (the ApplicationContext) + * + * <p> + * Example: * <pre> * class ClassEditorGrailsPlugin { - * def version = '1.1' + * def version = 1.1 * def doWithSpring = { application -> * classEditor(org.springframework.beans.propertyeditors.ClassEditor, application.classLoader) * } * } * </pre> - * <p>A plugin can also define "dependsOn" and "evict" properties that specify what plugins the plugin - * depends on and which ones it is incompatible with and should evict + * <p> + * The plugin descriptor class can also define "dependsOn" and "evict" properties that specify + * what plugins the plugin depends on and which ones it is incompatible with and should evict * * @author Graeme Rocher * @since 0.4 @@ -400,7 +404,7 @@ public class DefaultGrailsPluginManager extends AbstractGrailsPluginManager { final String pluginGrailsVersion = getPluginGrailsVersion(plugin); if (pluginGrailsVersion == null || pluginGrailsVersion.contains("@")) { - LOG.debug("Plugin grails version is null or containing '@'. Compatibility check skipped."); + LOG.debug("Plugin grailsVersion is null or containing '@'. Compatibility check skipped."); return true; } @@ -430,9 +434,9 @@ public class DefaultGrailsPluginManager extends AbstractGrailsPluginManager { } } if (!pluginMaxGrailsVersion.equals("*")) { - // Case 1: max version not specified. Forward compatibility expected + // Case 1: a max version was not specified. Forward compatibility expected - // minimum version required by plugin cannot be greater than grails app version + // a minimum version required by plugin cannot be greater than grails app version if (comparator.compare(pluginMinGrailsVersion, appGrailsVersion) > 0) { LOG.warn("Plugin [" + plugin.getName() + ":" + plugin.getVersion() + "] may not be compatible with this application as the application Grails version is less" + diff --git a/grails-core/src/main/groovy/grails/plugins/GrailsPlugin.java b/grails-core/src/main/groovy/grails/plugins/GrailsPlugin.java index 71358025fa..fea257a449 100644 --- a/grails-core/src/main/groovy/grails/plugins/GrailsPlugin.java +++ b/grails-core/src/main/groovy/grails/plugins/GrailsPlugin.java @@ -36,14 +36,17 @@ import org.grails.plugins.support.WatchPattern; import org.grails.spring.RuntimeSpringConfiguration; /** - * <p>Plugin interface that adds Spring {@link org.springframework.beans.factory.config.BeanDefinition}s - * to a registry based on a {@link GrailsApplication} object. After all <code>GrailsPlugin</code> classes - * have been processed the {@link org.springframework.beans.factory.config.BeanDefinition}s in the registry are - * loaded in a Spring {@link org.springframework.context.ApplicationContext} that's the singular - * configuration unit of Grails applications.</p> - * - * <p>It's up to implementation classes to determine where <code>GrailsPlugin</code> instances are loaded - * from.</p> + * Plugin interface that adds Spring + * {@link org.springframework.beans.factory.config.BeanDefinition}s to a registry + * based on a {@link GrailsApplication} object. + * <p> + * After all <code>GrailsPlugin</code> classes have been processed, the + * {@link org.springframework.beans.factory.config.BeanDefinition}s in the registry are + * loaded in a Spring {@link org.springframework.context.ApplicationContext} + * that's the singular configuration unit of Grails applications. + * <p> + * It's up to implementation classes to determine where <code>GrailsPlugin</code> + * instances are loaded from. * * @author Steven Devijver * @author Graeme Rocher @@ -76,8 +79,8 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail String PLUGINS_PATH = "/plugins"; /** - * Defines the name of the property that specifies resources which this plugin monitors for changes - * in the format a Ant-style path + * Defines the name of the property that specifies resources which + * this plugin monitors for changes in the format of an Ant-style path */ String WATCHED_RESOURCES = "watchedResources"; @@ -115,23 +118,17 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail /** * Defines the name of the property that defines the closure that will be invoked - * when a the Grails configuration object changes + * when a Grails configuration object changes */ String ON_CONFIG_CHANGE = "onConfigChange"; - /** - * Defines the name of the property that defines the closure that will be invoked - * when the web.xml is being generated - */ - String DO_WITH_WEB_DESCRIPTOR = "doWithWebDescriptor"; - /** * Defines the name of the property that defines the closure that will be invoked during runtime spring configuration */ String DO_WITH_SPRING = "doWithSpring"; /** - * Defines the name of the property that defines a closure that will be invoked after intialisation + * Defines the name of the property that defines a closure that will be invoked after initialisation * and when the application context has been built */ String DO_WITH_APPLICATION_CONTEXT = "doWithApplicationContext"; @@ -229,7 +226,7 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail String getPluginPathCamelCase(); /** - * @return The names of the plugins this plugin is dependant on + * @return The names of the plugins this plugin depends on */ String[] getDependencyNames(); @@ -240,7 +237,7 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail /** * Retrieves the names of plugins that this plugin should be loaded after. This differs - * from dependencies in that if that plugin doesn't exist this plugin will still be loaded. + * from dependencies in that if that plugin doesn't exist, this plugin will still be loaded. * It is a way of enforcing plugins are loaded before, but not necessarily needed * * @return The names of the plugins that this plugin should be loaded after @@ -248,8 +245,9 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail String[] getLoadAfterNames(); /** - * Retrieves the names of plugins that this plugin should be loaded before. As with getLoadAfterNames() it - * is not a requirement that the specified plugins exist + * Retrieves the names of plugins that this plugin should be loaded before. + * As with getLoadAfterNames(), it is not a requirement that the specified + * plugins exist * * @return The names of the plugins that this plugin should load before */ @@ -333,8 +331,8 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail Map notifyOfEvent(int eventKind, Object source); /** - * Called prior to the initialisation of the GrailsApplication instance to allow the registration - * of additonal ArtefactHandlers + * Called prior to the initialisation of the GrailsApplication instance to + * allow the registration of additional ArtefactHandlers * * @see grails.core.ArtefactHandler * @@ -350,32 +348,40 @@ public interface GrailsPlugin extends ApplicationContextAware, Comparable, Grail Class<?>[] getProvidedArtefacts(); /** - * Returns the name of the plugin as represented in the file system including the version. For example TagLibGrailsPlugin would result in "tag-lib-0.1" + * Returns the name of the plugin as represented in the file system, including the version. + * For example, TagLibGrailsPlugin would result in "tag-lib-0.1" + * * @return The file system representation of the plugin name */ String getFileSystemName(); /** - * Returns the name of the plugin as represented on the file system without the version. For example TagLibGrailsPlugin would result in "tag-lib" + * Returns the name of the plugin as represented on the file system without the version. + * For example, TagLibGrailsPlugin would result in "tag-lib" + * * @return The file system name */ String getFileSystemShortName(); /** * Returns the underlying class that represents this plugin + * * @return The plugin class */ Class<?> getPluginClass(); /** * A list of resources that the plugin should exclude from the packaged distribution + * * @return a List of resources */ List<String> getPluginExcludes(); /** - * Returns whether this plugin is loaded from the current plugin. In other words when you execute grails run-app from a plugin project - * the plugin project's *GrailsPlugin.groovy file represents the base plugin and this method will return true for this plugin + * Returns whether this plugin is loaded from the current plugin. + * In other words, when you execute grails run-app from a plugin project, + * the plugin project's *GrailsPlugin.groovy file represents the base plugin + * and this method will return true for this plugin * * @return true if it is the base plugin */ diff --git a/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java b/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java index 8923df885e..863fc7ab0d 100644 --- a/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java +++ b/grails-core/src/main/groovy/grails/plugins/GrailsPluginManager.java @@ -32,23 +32,21 @@ import grails.plugins.exceptions.PluginException; import org.grails.spring.RuntimeSpringConfiguration; /** - * <p>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. - * - * <p>A Plugin class is a Groovy class that has a version and optionally closures - * called doWithSpring, doWithContext and doWithWebDescriptor - * - * <p>The doWithSpring closure uses the BeanBuilder syntax (@see grails.spring.BeanBuilder) to + * Handles the loading and management of plug-ins in the Grails framework. + * A plugin is just like a normal Grails application except that it contains + * a class with a name ending with *GrailsPlugin. + * <p> + * This plugin descriptor class is a Groovy class that has a version and optionally + * closures called doWithSpring and doWithApplicationContext. + * <p> + * The doWithSpring closure uses the BeanBuilder syntax (@see grails.spring.BeanBuilder) to * provide runtime configuration of Grails via Spring + * <p> + * The doWithApplicationContext closure is called after the Spring ApplicationContext is built + * and accepts a single argument (the ApplicationContext) * - * <p>The doWithContext closure is called after the Spring ApplicationContext is built and accepts - * a single argument (the ApplicationContext) - * - * <p>The doWithWebDescriptor uses mark-up building to provide additional functionality to the web.xml - * file - * - *<p> Example: + * <p> + * Example: * <pre> * class ClassEditorGrailsPlugin { * def version = 1.1 @@ -57,9 +55,9 @@ import org.grails.spring.RuntimeSpringConfiguration; * } * } * </pre> - * - * <p>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 + * <p> + * The plugin descriptor class can also define "dependsOn" and "evict" properties that specify + * what plugins the plugin depends on and which ones it is incompatible with and should evict * * @author Graeme Rocher * @since 0.4 @@ -101,7 +99,7 @@ public interface GrailsPluginManager extends ApplicationContextAware { void doRuntimeConfiguration(RuntimeSpringConfiguration springConfig); /** - * Performs post initialization configuration for each plug-in, passing + * Performs post-initialization configuration for each plug-in, passing * the built application context * * @param applicationContext The ApplicationContext instance @@ -138,7 +136,7 @@ public interface GrailsPluginManager extends ApplicationContextAware { /** * * @param name The name of the plugin - * @return true if the the manager has a loaded plugin with the given name + * @return true if the manager has a loaded plugin with the given name */ boolean hasGrailsPlugin(String name); @@ -162,13 +160,13 @@ public interface GrailsPluginManager extends ApplicationContextAware { /** * Executes the runtime configuration for a specific plugin AND all its dependencies * - * @param pluginName The name of he plugin + * @param pluginName The name of the plugin * @param springConfig The runtime spring config instance */ void doRuntimeConfiguration(String pluginName, RuntimeSpringConfiguration springConfig); /** - * Sets the GrailsApplication used be this plugin manager + * Sets the GrailsApplication used by this plugin manager * @param application The GrailsApplication instance */ void setApplication(GrailsApplication application); @@ -179,7 +177,7 @@ public interface GrailsPluginManager extends ApplicationContextAware { boolean isInitialised(); /** - * Refreshes the specified plugin. A refresh will force to plugin to "touch" each of its watched resources + * Refreshes the specified plugin. A refresh will force the plugin to "touch" each of its watched resources * and fire modified events for each * * @param name The name of the plugin to refresh @@ -196,7 +194,7 @@ public interface GrailsPluginManager extends ApplicationContextAware { Collection getPluginObservers(GrailsPlugin plugin); /** - * inform the specified plugins observers of the event specified by the passed Map instance + * Notify observers of the specified plugin of the event described by the given Map * * @param pluginName The name of the plugin * @param event The event @@ -237,7 +235,7 @@ public interface GrailsPluginManager extends ApplicationContextAware { void informOfClassChange(Class<?> aClass); /** - * Get all of the TypeFilter definitions defined by the plugins + * Get all the TypeFilter definitions defined by the plugins * @return A list of TypeFilter definitions */ List<TypeFilter> getTypeFilters(); @@ -251,8 +249,8 @@ public interface GrailsPluginManager extends ApplicationContextAware { String getPluginPath(String name); /** - * Returns the pluginContextPath for the given plugin and will force name to camel case instead of '-' lower case - * + * Returns the pluginContextPath for the given plugin and will force the name to camel case instead of '-' lower case + * <p> * my-plug-web would resolve to myPlugWeb if forceCamelCase is true. * * @param name The plugin name @@ -262,8 +260,8 @@ public interface GrailsPluginManager extends ApplicationContextAware { String getPluginPath(String name, boolean forceCamelCase); /** - * Looks up the plugin that defined the given instance. If no plugin - * defined the instance then null is returned. + * Looks up the plugin that defined the given instance. + * If no plugin is defined the instance, then null is returned. * * @param instance The instance * @return The plugin that defined the instance or null diff --git a/grails-profiles/plugin/templates/Plugin.groovy b/grails-profiles/plugin/templates/Plugin.groovy index 538e828c3f..c73fc6cc40 100644 --- a/grails-profiles/plugin/templates/Plugin.groovy +++ b/grails-profiles/plugin/templates/Plugin.groovy @@ -39,10 +39,6 @@ Brief summary/description of the plugin. // Online location of the plugin's browseable source code. // def scm = [ url: "http://svn.codehaus.org/grails-plugins/" ] - def doWithWebDescriptor = { xml -> - // TODO Implement additions to web.xml (optional), this event occurs before - } - def doWithSpring = { // TODO Implement runtime spring config (optional) }
