GrailsPlugin (Grails 3.1.4)
Date: 2016-03-16

Package: org.codehaus.groovy.grails.plugins

## [Groovy] Interface GrailsPlugin

- deprecated:
    Use GrailsPlugin instead
  Authors:
    Graeme Rocher

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `java.lang.String` | `ARTEFACTS` Define the list of ArtefactHandlers supporting by the plugin
    `java.lang.String` | `DEPENDS_ON` Defines the name of the property that specifies which plugins this plugin depends on
    `java.lang.String` | `DO_WITH_APPLICATION_CONTEXT` Defines the name of the property that defines a closure that will be invoked after intialisation and when the application context has been built
    `java.lang.String` | `DO_WITH_DYNAMIC_METHODS`
    `java.lang.String` | `DO_WITH_SPRING` Defines the name of the property that defines the closure that will be invoked during runtime spring configuration
    `java.lang.String` | `DO_WITH_WEB_DESCRIPTOR` Defines the name of the property that defines the closure that will be invoked when the web.xml is being generated
    `java.lang.String` | `ENVIRONMENTS` The environments to which this plugin applies
    `int` | `EVENT_ON_CHANGE`
    `int` | `EVENT_ON_CONFIG_CHANGE`
    `int` | `EVENT_ON_SHUTDOWN`
    `java.lang.String` | `EVICT` Defines the name of the property that specifies a List or plugins that this plugin evicts Eviction occurs when the PluginManager loads
    `java.lang.String` | `OBSERVE` The field that represents the plugin names that this plugin is observing for changes.
    `java.lang.String` | `ON_CHANGE` Defines the name of the property that defines the closure that will be invoked when a watched resource changes
    `java.lang.String` | `ON_CONFIG_CHANGE` Defines the name of the property that defines the closure that will be invoked when a the Grails configuration object changes
    `java.lang.String` | `ON_SHUTDOWN` Defines the name of the property that holds a closure to be invoked when shutdown is called
    `java.lang.String` | `PLUGINS_PATH` The prefix used in plug-ins paths
    `java.lang.String` | `PLUGIN_EXCLUDES` The field that represents the list of resources to exclude from plugin packaging
    `java.lang.String` | `PLUGIN_LOAD_AFTER_NAMES` The name of the property that provides a list of plugins this plugin should after before
    `java.lang.String` | `PLUGIN_LOAD_BEFORE_NAMES` The name of the property that provides a list of plugins this plugin should load before
    `java.lang.String` | `PROVIDED_ARTEFACTS` The name of the property that provides a list of shipped, but overridable artefacts
    `java.lang.String` | `SCOPES` The scopes to which this plugin applies
    `java.lang.String` | `STATUS` The status of the plugin.
    `java.lang.String` | `STATUS_DISABLED` When a plugin is "disabled" it will not be loaded
    `java.lang.String` | `STATUS_ENABLED` When a plugin is "enabled" it will be loaded as usual.
    `java.lang.String` | `TYPE_FILTERS` The field that represents the list of type filters a plugin provides
    `java.lang.String` | `WATCHED_RESOURCES` Defines the name of the property that specifies resources which this plugin monitors for changes in the format a Ant-style path

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `addExclude(BuildScope buildScope)` Makes the plugin excluded for a particular BuildScope
    `void` | `addExclude(Environment env)` Makes the plugin excluded for a particular Environment
    `boolean` | `checkForChanges()` When called this method checks for any changes to the plug-ins watched resources and reloads appropriately
    `void` | `doArtefactConfiguration()` Called prior to the initialisation of the GrailsApplication instance to allow the registration of additonal ArtefactHandlers
    `void` | `doWithApplicationContext(org.springframework.context.ApplicationContext applicationContext)`
    `void` | `doWithDynamicMethods(org.springframework.context.ApplicationContext applicationContext)` Calls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime
    `void` | `doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)` Executes the plugin code that performs runtime configuration as defined in the doWithSpring closure
    `void` | `doc(java.lang.String text)` Write some documentation to the DocumentationContext
    `java.lang.String[]` | `getDependencyNames()` @return The names of the plugins this plugin is dependant on
    `java.lang.String` | `getDependentVersion(java.lang.String name)` The version of the specified dependency
    `java.lang.String[]` | `getEvictionNames()` @return The names of the plugins this plugin should evict onload
    `java.lang.String` | `getFileSystemName()` Returns the name of the plugin as represented in the file system including the version.
    `java.lang.String` | `getFileSystemShortName()` Returns the name of the plugin as represented on the file system without the version.
    `groovy.lang.GroovyObject` | `getInstance()` Retrieves the wrapped plugin instance for this plugin
    `java.lang.String[]` | `getLoadAfterNames()` Retrieves the names of plugins that this plugin should be loaded after.
    `java.lang.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
    `java.lang.String[]` | `getObservedPluginNames()` Retrieve the plugin names that this plugin is observing for changes
    `java.lang.Class<?>` | `getPluginClass()` Returns the underlying class that represents this plugin
    `java.util.List<java.lang.String>` | `getPluginExcludes()` A list of resources that the plugin should exclude from the packaged distribution
    `java.lang.String` | `getPluginPath()` Returns the path of the plug-in
    `java.lang.Class<?>[]` | `getProvidedArtefacts()` Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object but are overridable by the end-user
    `java.util.Collection<? extends org.springframework.core.type.filter.TypeFilter>` | `getTypeFilters()` Plugin can provide a list of Spring TypeFilters so that annotated components can be scanned into the ApplicationContext
    `java.util.List<WatchPattern>` | `getWatchedResourcePatterns()` Resources that this plugin watches
    `boolean` | `hasInterestInChange(java.lang.String path)` Whether the plugin is interested in a particular change
    `boolean` | `isBasePlugin()` Returns whether this plugin is loaded from the current plugin.
    `boolean` | `isEnabled()` @return Whether the plugin is enabled or not
    `void` | `notifyOfEvent(java.util.Map event)` Notifies this plugin of the specified Event calling the onChange listener
    `java.util.Map` | `notifyOfEvent(int eventKind, java.lang.Object source)` Notifies the plugin of a specific event for the given event id, which is one of ON_CHANGE, ON_CONFIG_CHANGE
    `void` | `refresh()` Refreshes this Grails plugin reloading any watched resources as necessary
    `void` | `setApplication(GrailsApplication application)`
    `void` | `setBasePlugin(boolean isBase)` Sets whether this plugin is the base plugin
    `void` | `setDescriptor(org.springframework.core.io.Resource descriptor)` Sets the plugin descriptor for this plugin
    `void` | `setManager(GrailsPluginManager manager)` Sets the plugin manager for this plugin
    `boolean` | `supportsCurrentScopeAndEnvironment()` @return true if the current plugin supports the current BuildScope and Environment
    `boolean` | `supportsEnvironment(Environment environment)` Returns whether this plugin supports the given environment name
    `boolean` | `supportsScope(BuildScope buildScope)` Return whether this plugin supports the given PluginScope

- - ### Property Detail

    - #### java.lang.String ARTEFACTS

      Define the list of ArtefactHandlers supporting by the plugin

    - #### java.lang.String DEPENDS_ON

      Defines the name of the property that specifies which plugins this plugin depends on

    - #### java.lang.String DO_WITH_APPLICATION_CONTEXT

      Defines the name of the property that defines a closure that will be invoked after intialisation and when the application context has been built

    - #### java.lang.String DO_WITH_DYNAMIC_METHODS

    - #### java.lang.String DO_WITH_SPRING

      Defines the name of the property that defines the closure that will be invoked during runtime spring configuration

    - #### java.lang.String DO_WITH_WEB_DESCRIPTOR

      Defines the name of the property that defines the closure that will be invoked when the web.xml is being generated

    - #### java.lang.String ENVIRONMENTS

      The environments to which this plugin applies

    - #### int EVENT_ON_CHANGE

    - #### int EVENT_ON_CONFIG_CHANGE

    - #### int EVENT_ON_SHUTDOWN

    - #### java.lang.String EVICT

      Defines the name of the property that specifies a List or plugins that this plugin evicts Eviction occurs when the PluginManager loads

    - #### java.lang.String OBSERVE

      The field that represents the plugin names that this plugin is observing for changes.

    - #### java.lang.String ON_CHANGE

      Defines the name of the property that defines the closure that will be invoked when a watched resource changes

    - #### java.lang.String ON_CONFIG_CHANGE

      Defines the name of the property that defines the closure that will be invoked when a the Grails configuration object changes

    - #### java.lang.String ON_SHUTDOWN

      Defines the name of the property that holds a closure to be invoked when shutdown is called

    - #### java.lang.String PLUGINS_PATH

      The prefix used in plug-ins paths

    - #### java.lang.String PLUGIN_EXCLUDES

      The field that represents the list of resources to exclude from plugin packaging

    - #### java.lang.String PLUGIN_LOAD_AFTER_NAMES

      The name of the property that provides a list of plugins this plugin should after before

    - #### java.lang.String PLUGIN_LOAD_BEFORE_NAMES

      The name of the property that provides a list of plugins this plugin should load before

    - #### java.lang.String PROVIDED_ARTEFACTS

      The name of the property that provides a list of shipped, but overridable artefacts

    - #### java.lang.String SCOPES

      The scopes to which this plugin applies

    - #### java.lang.String STATUS

      The status of the plugin.

    - #### java.lang.String STATUS_DISABLED

      When a plugin is "disabled" it will not be loaded

    - #### java.lang.String STATUS_ENABLED

      When a plugin is "enabled" it will be loaded as usual.

    - #### java.lang.String TYPE_FILTERS

      The field that represents the list of type filters a plugin provides

    - #### java.lang.String WATCHED_RESOURCES

      Defines the name of the property that specifies resources which this plugin monitors for changes in the format a Ant-style path

  - ### Method Detail

    - #### void addExclude(BuildScope buildScope)

      Makes the plugin excluded for a particular BuildScope

      Parameters:
        `buildScope` - The BuildScope

    - #### void addExclude(Environment env)

      Makes the plugin excluded for a particular Environment

      Parameters:
        `env` - The Environment

    - #### @java.lang.Deprecated boolean checkForChanges()

      When called this method checks for any changes to the plug-ins watched resources and reloads appropriately

      deprecated:
        Plugins themselves no longer check for changes
      Returns:
        Returns true when the plug-in itself changes in some way, as oppose to plug-in resources

    - #### void doArtefactConfiguration()

      Called prior to the initialisation of the GrailsApplication instance to allow the registration of additonal ArtefactHandlers

      See Also:
        ArtefactHandler

    - #### void doWithApplicationContext(org.springframework.context.ApplicationContext applicationContext)

      This method is called to allow the plugin to add org.springframework.beans.factory.config.BeanDefinitions to the org.springframework.beans.factory.support.BeanDefinitionRegistry.

      Parameters:
        `applicationContext` - The Spring ApplicationContext instance

    - #### void doWithDynamicMethods(org.springframework.context.ApplicationContext applicationContext)

      Calls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime

      Parameters:
        `applicationContext` - The Spring ApplicationContext instance

    - #### void doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)

      Executes the plugin code that performs runtime configuration as defined in the doWithSpring closure

      Parameters:
        `springConfig` - The RuntimeSpringConfiguration instance

    - #### void doc(java.lang.String text)

      Write some documentation to the DocumentationContext

    - #### java.lang.String[] getDependencyNames()

      Returns:
        The names of the plugins this plugin is dependant on

    - #### java.lang.String getDependentVersion(java.lang.String name)

      The version of the specified dependency

      Parameters:
        `name` - the name of the dependency
      Returns:
        The version

    - #### java.lang.String[] getEvictionNames()

      Returns:
        The names of the plugins this plugin should evict onload

    - #### java.lang.String getFileSystemName()

      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 file system representation of the plugin name

    - #### java.lang.String getFileSystemShortName()

      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 file system name

    - #### groovy.lang.GroovyObject getInstance()

      Retrieves the wrapped plugin instance for this plugin

      Returns:
        The plugin instance

    - #### java.lang.String[] getLoadAfterNames()

      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

      Returns:
        The names of the plugins that this plugin should be loaded after

    - #### java.lang.String[] getLoadBeforeNames()

      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

      Returns:
        The names of the plugins that this plugin should load before

    - #### GrailsPluginManager getManager()

      Retrieves the plugin manager if known, otherwise returns null

      Returns:
        The PluginManager or null

    - #### java.lang.String[] getObservedPluginNames()

      Retrieve the plugin names that this plugin is observing for changes

      Returns:
        The names of the observed plugins

    - #### java.lang.Class<?> getPluginClass()

      Returns the underlying class that represents this plugin

      Returns:
        The plugin class

    - #### java.util.List<java.lang.String> getPluginExcludes()

      A list of resources that the plugin should exclude from the packaged distribution

      Returns:
        a List of resources

    - #### java.lang.String getPluginPath()

      Returns the path of the plug-in

      Returns:
        A String that makes up the path to the plug-in in the format /plugins/PLUGIN_NAME-PLUGIN_VERSION

    - #### java.lang.Class<?>[] getProvidedArtefacts()

      Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object but are overridable by the end-user

      Returns:
        A list of provided artefacts

    - #### java.util.Collection<? extends org.springframework.core.type.filter.TypeFilter> getTypeFilters()

      Plugin can provide a list of Spring TypeFilters so that annotated components can be scanned into the ApplicationContext

      Returns:
        A collection of TypeFilter instance

    - #### java.util.List<WatchPattern> getWatchedResourcePatterns()

      Resources that this plugin watches

      Returns:
        The watch resource patterns

    - #### boolean hasInterestInChange(java.lang.String path)

      Whether the plugin is interested in a particular change

      Parameters:
        `path` - The path to the resource that changed
      Returns:
        true if it is

    - #### boolean isBasePlugin()

      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:
        true if it is the base plugin

    - #### boolean isEnabled()

      Returns:
        Whether the plugin is enabled or not

    - #### void notifyOfEvent(java.util.Map event)

      Notifies this plugin of the specified Event calling the onChange listener

      Parameters:
        `event` - The event to listen for

    - #### java.util.Map notifyOfEvent(int eventKind, java.lang.Object source)

      Notifies the plugin of a specific event for the given event id, which is one of ON_CHANGE, ON_CONFIG_CHANGE

      Parameters:
        `eventKind` - The event kind
        `source` - The source of the event
      Returns:
        a Map that represents the event

    - #### void refresh()

      Refreshes this Grails plugin reloading any watched resources as necessary

    - #### void setApplication(GrailsApplication application)

    - #### void setBasePlugin(boolean isBase)

      Sets whether this plugin is the base plugin

      Parameters:
        `isBase` - True if is
      See Also:
        isBasePlugin()

    - #### void setDescriptor(org.springframework.core.io.Resource descriptor)

      Sets the plugin descriptor for this plugin

      Parameters:
        `descriptor` - The descriptor

    - #### void setManager(GrailsPluginManager manager)

      Sets the plugin manager for this plugin

      Parameters:
        `manager` - A GrailsPluginManager instance

    - #### boolean supportsCurrentScopeAndEnvironment()

      Returns:
        true if the current plugin supports the current BuildScope and Environment

    - #### boolean supportsEnvironment(Environment environment)

      Returns whether this plugin supports the given environment name

      Parameters:
        `environment` - The environment name
      Returns:
        true if it does

    - #### boolean supportsScope(BuildScope buildScope)

      Return whether this plugin supports the given PluginScope

      Parameters:
        `buildScope` - The PluginScope
      Returns:
        true if it does