GrailsPlugin (Grails 5.2.4)

Package: grails.plugins

## [Java] Interface GrailsPlugin

- grails.plugins.GrailsPluginInfo

- All Superinterfaces:
    GrailsPluginInfo

      @java.lang.SuppressWarnings("rawtypes")
      public interface GrailsPlugin
      extends org.springframework.context.ApplicationContextAware, java.lang.Comparable, GrailsPluginInfo

  Plugin interface that adds Spring org.springframework.beans.factory.config.BeanDefinitions to a registry based on a GrailsApplication object. After all `GrailsPlugin` classes have been processed the org.springframework.beans.factory.config.BeanDefinitions in the registry are loaded in a Spring org.springframework.context.ApplicationContext that's the singular configuration unit of Grails applications.

  It's up to implementation classes to determine where `GrailsPlugin` instances are loaded from.

  Authors:
    Steven Devijver
    Graeme Rocher
  Since:
    0.2
  See Also:
    org.springframework.beans.factory.support.BeanDefinitionRegistry

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `addExclude(Environment env)` Makes the plugin excluded for a particular Environment
    `` | `public void` | `doArtefactConfiguration()` Called prior to the initialisation of the GrailsApplication instance to allow the registration of additonal ArtefactHandlers
    `` | `public void` | `doWithApplicationContext(org.springframework.context.ApplicationContext applicationContext)`
    `` | `public void` | `doWithDynamicMethods(org.springframework.context.ApplicationContext applicationContext)` Calls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime
    `` | `public void` | `doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)` Executes the plugin code that performs runtime configuration as defined in the doWithSpring closure
    `` | `public void` | `doc(java.lang.String text)` Write some documentation to the DocumentationContext
    `` | `public java.lang.String[]` | `getDependencyNames()` Returns: The names of the plugins this plugin is dependant on
    `` | `public java.lang.String` | `getDependentVersion(java.lang.String name)` The version of the specified dependency
    `` | `public java.lang.String[]` | `getEvictionNames()` Returns: The names of the plugins this plugin should evict onload
    `` | `public java.lang.String` | `getFileSystemName()` Returns the name of the plugin as represented in the file system including the version.
    `` | `public java.lang.String` | `getFileSystemShortName()` Returns the name of the plugin as represented on the file system without the version.
    `` | `public groovy.lang.GroovyObject` | `getInstance()` Retrieves the wrapped plugin instance for this plugin
    `` | `public java.lang.String[]` | `getLoadAfterNames()` Retrieves the names of plugins that this plugin should be loaded after.
    `` | `public java.lang.String[]` | `getLoadBeforeNames()` Retrieves the names of plugins that this plugin should be loaded before.
    `` | `public GrailsPluginManager` | `getManager()` Retrieves the plugin manager if known, otherwise returns null
    `` | `public java.lang.String[]` | `getObservedPluginNames()` Retrieve the plugin names that this plugin is observing for changes
    `` | `public java.lang.Class<?>` | `getPluginClass()` Returns the underlying class that represents this plugin
    `` | `public java.util.List<java.lang.String>` | `getPluginExcludes()` A list of resources that the plugin should exclude from the packaged distribution
    `` | `public java.lang.String` | `getPluginPath()` Returns the path of the plug-in
    `` | `public java.lang.String` | `getPluginPathCamelCase()` Returns the path of the plug-in using camel case
    `` | `public org.springframework.core.env.PropertySource<?>` | `getPropertySource()`
    `` | `public 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
    `` | `public 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
    `` | `public java.util.List<WatchPattern>` | `getWatchedResourcePatterns()` Resources that this plugin watches
    `` | `public boolean` | `hasInterestInChange(java.lang.String path)` Whether the plugin is interested in a particular change
    `` | `public boolean` | `isBasePlugin()` Returns whether this plugin is loaded from the current plugin.
    `` | `public boolean` | `isEnabled()` Returns: Whether the plugin is enabled or not
    `` | `public boolean` | `isEnabled(java.lang.String[] activeProfiles)` Check whether the plugin is enabled for the given profile
    `` | `public void` | `notifyOfEvent(java.util.Map event)` Notifies this plugin of the specified Event calling the onChange listener
    `` | `public 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
    `` | `public void` | `refresh()` Refreshes this Grails plugin reloading any watched resources as necessary
    `` | `public void` | `setApplication(GrailsApplication application)`
    `` | `public void` | `setBasePlugin(boolean isBase)` Sets whether this plugin is the base plugin
    `` | `public void` | `setDescriptor(org.springframework.core.io.Resource descriptor)` Sets the plugin descriptor for this plugin
    `` | `public void` | `setManager(GrailsPluginManager manager)` Sets the plugin manager for this plugin
    `` | `public boolean` | `supportsCurrentScopeAndEnvironment()` Returns: true if the current plugin supports the current BuildScope and Environment
    `` | `public boolean` | `supportsEnvironment(Environment environment)` Returns whether this plugin supports the given environment name

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface org.springframework.context.ApplicationContextAware` | `org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)`
    `interface java.lang.Comparable` | `java.lang.Comparable#compareTo(java.lang.Object)`
    `interface GrailsPluginInfo` | `getDescriptor, getFullName, getName, getPluginDir, getProperties, getVersion`

- - ### Method Detail

    - #### public void addExclude(Environment env)

      Makes the plugin excluded for a particular Environment

      Parameters:
        `env` - The Environment

    - #### public void doArtefactConfiguration()

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

      See Also:
        ArtefactHandler

    - #### public 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

    - #### public 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

    - #### public void doWithRuntimeConfiguration(RuntimeSpringConfiguration springConfig)

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

      Parameters:
        `springConfig` - The RuntimeSpringConfiguration instance

    - #### @java.lang.Deprecated public void doc(java.lang.String text)

      Write some documentation to the DocumentationContext

      deprecated:
        Dynamic document generation no longer supported
      Parameters:
        text

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

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

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

      The version of the specified dependency

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

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

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

    - #### public 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

    - #### public 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

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

      Retrieves the wrapped plugin instance for this plugin

      Returns:
        The plugin instance

    - #### public 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

    - #### public 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

    - #### public GrailsPluginManager getManager()

      Retrieves the plugin manager if known, otherwise returns null

      Returns:
        The PluginManager or null

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

      Retrieve the plugin names that this plugin is observing for changes

      Returns:
        The names of the observed plugins

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

      Returns the underlying class that represents this plugin

      Returns:
        The plugin class

    - #### public 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

    - #### public 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

    - #### public java.lang.String getPluginPathCamelCase()

      Returns the path of the plug-in using camel case

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

    - #### public org.springframework.core.env.PropertySource<?> getPropertySource()

    - #### public 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

    - #### public 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

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

      Resources that this plugin watches

      Returns:
        The watch resource patterns

    - #### public 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

    - #### public 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

    - #### public boolean isEnabled()

      Returns:
        Whether the plugin is enabled or not

    - #### public boolean isEnabled(java.lang.String[] activeProfiles)

      Check whether the plugin is enabled for the given profile

      Parameters:
        activeProfiles
      Returns:
        True if it is

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

      Notifies this plugin of the specified Event calling the onChange listener

      Parameters:
        `event` - The event to listen for

    - #### public 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

    - #### public void refresh()

      Refreshes this Grails plugin reloading any watched resources as necessary

    - #### public void setApplication(GrailsApplication application)

    - #### public void setBasePlugin(boolean isBase)

      Sets whether this plugin is the base plugin

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

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

      Sets the plugin descriptor for this plugin

      Parameters:
        `descriptor` - The descriptor

    - #### public void setManager(GrailsPluginManager manager)

      Sets the plugin manager for this plugin

      Parameters:
        `manager` - A GrailsPluginManager instance

    - #### public boolean supportsCurrentScopeAndEnvironment()

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

    - #### public boolean supportsEnvironment(Environment environment)

      Returns whether this plugin supports the given environment name

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