## org.codehaus.groovy.grails.plugins
Class AbstractGrailsPlugin

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin

All Implemented Interfaces:
  groovy.lang.GroovyObject, Comparable, GrailsPlugin, ApplicationContextAware

Direct Known Subclasses:
  DefaultGrailsPlugin

    public abstract class AbstractGrailsPlugin

extends groovy.lang.GroovyObjectSupport
implements GrailsPlugin, Comparable

Abstract implementation that provides some default behaviours

Author:
  Graeme Rocher

Nested Class Summary
`(package private) class` `AbstractGrailsPlugin.GrailsPluginClass` Wrapper Grails class for plugins

Field Summary
`protected GrailsApplication` `application`
`protected ApplicationContext` `applicationContext`
`protected Map` `dependencies`
`protected String[]` `dependencyNames`
`protected String[]` `evictionList`
`protected boolean` `isBase`
`protected GrailsPluginManager` `manager`
`protected Class` `pluginClass`
`protected String` `version`

Fields inherited from interface org.codehaus.groovy.grails.plugins.GrailsPlugin

`ARTEFACTS, DEPENDS_ON, DO_WITH_APPLICATION_CONTEXT, DO_WITH_DYNAMIC_METHODS, DO_WITH_SPRING, DO_WITH_WEB_DESCRIPTOR, ENVIRONMENTS, EVENT_ON_CHANGE, EVENT_ON_CONFIG_CHANGE, EVENT_ON_SHUTDOWN, EVICT, INFLUENCES, ON_CHANGE, ON_CONFIG_CHANGE, ON_SHUTDOWN, PLUGIN_EXCLUDES, PLUGIN_LOAD_AFTER_NAMES, PLUGIN_LOAD_BEFORE_NAMES, PLUGINS_PATH, PROVIDED_ARTEFACTS, SCOPES, STATUS, STATUS_DISABLED, STATUS_ENABLED, TRAILING_NAME, VERSION, WATCHED_RESOURCES`

Constructor Summary
`AbstractGrailsPlugin(Class pluginClass, GrailsApplication application)`

Method Summary
`boolean` `checkForChanges()` When called this method checks for any changes to the plug-ins watched resources and reloads appropriately
`int` `compareTo(Object o)`
`abstract void` `doArtefactConfiguration()` Called prior to the initialisation of the GrailsApplication instance to allow the registration of additonal ArtefactHandlers
`abstract void` `doWithApplicationContext(ApplicationContext applicationContext)` This method is called to allow the plugin to add `BeanDefinition`s to the `BeanDefinitionRegistry`.
`abstract void` `doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)` Executes the plugin code that performs runtime configuration as defined in the doWithSpring closure
`void` `doWithWebDescriptor(groovy.util.slurpersupport.GPathResult webXml)` Handles processing of web.xml.
`boolean` `equals(Object o)`
`String[]` `getDependencyNames()`
`String` `getDependentVersion(String name)` The version of the specified dependency
`String[]` `getEvictionNames()`
`String` `getFileSystemName()` Returns the name of the plugin as represented in the file system including the version.
`String[]` `getLoadAfterNames()` Retrieves the names of plugins that this plugin should be loaded after.
`String[]` `getLoadBeforeNames()` Retrieves the names of plugins that this plugin should be loaded before.
`GrailsPluginManager` `getManager()` Retrieves the plugin manager if known, otherwise returns null
`String` `getName()`
`Class` `getPluginClass()` Returns the underlying class that represents this plugin
`String` `getPluginPath()` Returns the path of the plug-in
`String` `getVersion()`
`int` `hashCode()`
`boolean` `isBasePlugin()` Returns whether this plugin is loaded from the current plugin.
`void` `refresh()` Refreshes this Grails plugin reloading any watched resources as necessary
`void` `setApplication(GrailsApplication application)`
`void` `setApplicationContext(ApplicationContext applicationContext)`
`void` `setBasePlugin(boolean isBase)` Sets whether this plugin is the base plugin
`void` `setManager(GrailsPluginManager manager)` Sets the plugin manager for this plugin

Methods inherited from class groovy.lang.GroovyObjectSupport
`getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.codehaus.groovy.grails.plugins.GrailsPlugin
`doWithDynamicMethods, getInstance, getObservedPluginNames, getPluginExcludes, getProvidedArtefacts, isEnabled, notifyOfEvent, notifyOfEvent, supportsCurrentScopeAndEnvironment, supportsEnvironment, supportsScope`

Field Detail

### application

    protected GrailsApplication application

### isBase

    protected boolean isBase

### version

    protected String version

### dependencies

    protected Map dependencies

### dependencyNames

    protected String[] dependencyNames

### pluginClass

    protected Class pluginClass

### applicationContext

    protected ApplicationContext applicationContext

### manager

    protected GrailsPluginManager manager

### evictionList

    protected String[] evictionList

Constructor Detail

### AbstractGrailsPlugin

    public AbstractGrailsPlugin(Class pluginClass,
                                GrailsApplication application)

Method Detail

### refresh

    public void refresh()

  Description copied from interface: `GrailsPlugin`
  Refreshes this Grails plugin reloading any watched resources as necessary

  Specified by:
    `refresh` in interface `GrailsPlugin`

### doWithApplicationContext

    public abstract void doWithApplicationContext(ApplicationContext applicationContext)

  Description copied from interface: `GrailsPlugin`

  This method is called to allow the plugin to add `BeanDefinition`s to the `BeanDefinitionRegistry`.

  Specified by:
    `doWithApplicationContext` in interface `GrailsPlugin`
  Parameters:
    `applicationContext` - The Spring ApplicationContext instance

### doWithRuntimeConfiguration

    public abstract void doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)

  Description copied from interface: `GrailsPlugin`
  Executes the plugin code that performs runtime configuration as defined in the doWithSpring closure

  Specified by:
    `doWithRuntimeConfiguration` in interface `GrailsPlugin`
  Parameters:
    `springConfig` - The RuntimeSpringConfiguration instance

### doArtefactConfiguration

    public abstract void doArtefactConfiguration()

  Description copied from interface: `GrailsPlugin`
  Called prior to the initialisation of the GrailsApplication instance to allow the registration of additonal ArtefactHandlers

  Specified by:
    `doArtefactConfiguration` in interface `GrailsPlugin`
  See Also:
    `ArtefactHandler`

### getFileSystemName

    public String getFileSystemName()

  Description copied from interface: `GrailsPlugin`
  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"

  Specified by:
    `getFileSystemName` in interface `GrailsPlugin`
  Returns:
    The file system representation of the plugin name

### getPluginClass

    public Class getPluginClass()

  Description copied from interface: `GrailsPlugin`
  Returns the underlying class that represents this plugin

  Specified by:
    `getPluginClass` in interface `GrailsPlugin`
  Returns:
    The plugin class

### isBasePlugin

    public boolean isBasePlugin()

  Description copied from interface: `GrailsPlugin`
  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

  Specified by:
    `isBasePlugin` in interface `GrailsPlugin`
  Returns:
    True if it is the base plugin

### setBasePlugin

    public void setBasePlugin(boolean isBase)

  Description copied from interface: `GrailsPlugin`
  Sets whether this plugin is the base plugin

  Specified by:
    `setBasePlugin` in interface `GrailsPlugin`
  Parameters:
    `isBase` - True if is
  See Also:
    `GrailsPlugin.isBasePlugin()`

### checkForChanges

    public boolean checkForChanges()

  Description copied from interface: `GrailsPlugin`
  When called this method checks for any changes to the plug-ins watched resources and reloads appropriately

  Specified by:
    `checkForChanges` in interface `GrailsPlugin`
  Returns:
    Returns true when the plug-in itself changes in some way, as oppose to plug-in resources

### doWithWebDescriptor

    public void doWithWebDescriptor(groovy.util.slurpersupport.GPathResult webXml)

  Description copied from interface: `GrailsPlugin`
  Handles processing of web.xml. The method is passed a GPathResult which is parsed by groovy.util.XmlSlurper. A plug-in can then manipulate the in-memory XML however it chooses Once all plug-ins have been processed the web.xml is then written to disk based on its in-memory form

  Specified by:
    `doWithWebDescriptor` in interface `GrailsPlugin`
  Parameters:
    `webXml` - The GPathResult representing web.xml

### getDependencyNames

    public String[] getDependencyNames()

  Specified by:
    `getDependencyNames` in interface `GrailsPlugin`
  Returns:
    The names of the plugins this plugin is dependant on

### getDependentVersion

    public String getDependentVersion(String name)

  Description copied from interface: `GrailsPlugin`
  The version of the specified dependency

  Specified by:
    `getDependentVersion` in interface `GrailsPlugin`
  Parameters:
    `name` - the name of the dependency
  Returns:
    The version

### getName

    public String getName()

  Specified by:
    `getName` in interface `GrailsPlugin`
  Returns:
    The name of the plug-in

### getVersion

    public String getVersion()

  Specified by:
    `getVersion` in interface `GrailsPlugin`
  Returns:
    The version of the plug-in

### getPluginPath

    public String getPluginPath()

  Description copied from interface: `GrailsPlugin`
  Returns the path of the plug-in

  Specified by:
    `getPluginPath` in interface `GrailsPlugin`
  Returns:
    A String that makes up the path to the plug-in in the format /plugins/PLUGIN_NAME-PLUGIN_VERSION

### getManager

    public GrailsPluginManager getManager()

  Description copied from interface: `GrailsPlugin`
  Retrieves the plugin manager if known, otherwise returns null

  Specified by:
    `getManager` in interface `GrailsPlugin`
  Returns:
    The PluginManager or null

### getLoadAfterNames

    public String[] getLoadAfterNames()

  Description copied from interface: `GrailsPlugin`
  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. It is a way of enforcing plugins are loaded before, but not necessarily needed

  Specified by:
    `getLoadAfterNames` in interface `GrailsPlugin`
  Returns:
    The names of the plugins that this plugin should be loaded after

### getLoadBeforeNames

    public String[] getLoadBeforeNames()

  Description copied from interface: `GrailsPlugin`
  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

  Specified by:
    `getLoadBeforeNames` in interface `GrailsPlugin`
  Returns:
    The names of the plugins that this plugin should load before

### setApplicationContext

    public void setApplicationContext(ApplicationContext applicationContext)
                               throws BeansException

  Specified by:
    `setApplicationContext` in interface `ApplicationContextAware`
  Throws:
    `BeansException`

### setManager

    public void setManager(GrailsPluginManager manager)

  Description copied from interface: `GrailsPlugin`
  Sets the plugin manager for this plugin

  Specified by:
    `setManager` in interface `GrailsPlugin`
  Parameters:
    `manager` - A GrailsPluginManager instance

### setApplication

    public void setApplication(GrailsApplication application)

  Specified by:
    `setApplication` in interface `GrailsPlugin`

### getEvictionNames

    public String[] getEvictionNames()

  Specified by:
    `getEvictionNames` in interface `GrailsPlugin`
  Returns:
    The names of the plugins this plugin should evict onload

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### compareTo

    public int compareTo(Object o)

  Specified by:
    `compareTo` in interface `Comparable`

Copyright (c) 2005-2009 The Grails project