Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

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

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

    public class DefaultGrailsPlugin

extends AbstractGrailsPlugin
implements GrailsPlugin, ParentApplicationContextAware

Implementation of the GrailsPlugin interface that wraps a Groovy plugin class and provides the magic to invoke its various methods from Java

Since:
  0.4
Author:
  Graeme Rocher

Nested Class Summary

Nested classes/interfaces inherited from class org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin
`AbstractGrailsPlugin.GrailsPluginClass`

Field Summary
`protected BeanWrapper` | `pluginBean`

Fields inherited from class org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin
`application, applicationContext, dependencies, dependencyNames, evictionList, isBase, manager, pluginClass, 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, NAME, 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, TYPE_FILTERS, VERSION, WATCHED_RESOURCES`

Constructor Summary
`DefaultGrailsPlugin(Class pluginClass, GrailsApplication application)`
`DefaultGrailsPlugin(Class pluginClass, Resource resource, GrailsApplication application)`

Method Summary
`BeanBuilder` | `beans(groovy.lang.Closure closure)`
`boolean` | `checkForChanges()` Monitors the plugin resources defined in the watchResources property for changes and fires onChange events by calling an onChange closure defined in the plugin (if it exists)
`void` | `doArtefactConfiguration()` Called prior to the initialisation of the GrailsApplication instance to allow the registration of additonal ArtefactHandlers
`void` | `doc(String text)` Write some documentation to the DocumentationContext
`void` | `doWithApplicationContext(ApplicationContext applicationContext)` This method is called to allow the plugin to add `BeanDefinition`s to the `BeanDefinitionRegistry`.
`void` | `doWithDynamicMethods(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` | `doWithWebDescriptor(groovy.util.slurpersupport.GPathResult webXml)` Handles processing of web.xml.
`protected void` | `fireModifiedEvent(Resource resource, GrailsPlugin plugin)`
`String[]` | `getDependencyNames()`
`String` | `getDependentVersion(String name)` The version of the specified dependency
`groovy.lang.GroovyObject` | `getInstance()` Retrieves the wrapped plugin instance for this plugin
`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.
`org.apache.commons.logging.Log` | `getLog()`
`String` | `getName()`
`String[]` | `getObservedPluginNames()` Retrieve the plugin names that this plugin is observing for changes
`ApplicationContext` | `getParentCtx()`
`GrailsPlugin` | `getPlugin()`
`List<String>` | `getPluginExcludes()` A list of resources that the plugin should exclude from the packaged distribution
`Class[]` | `getProvidedArtefacts()` Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object but are overridable by the end-user
`PathMatchingResourcePatternResolver` | `getResolver()`
`Collection<? extends TypeFilter>` | `getTypeFilters()` Plugin can provide a list of Spring TypeFilters so that annotated components can be scanned into the ApplicationContext
`String` | `getVersion()`
`Resource[]` | `getWatchedResources()`
`boolean` | `isEnabled()`
`Map` | `notifyOfEvent(int eventKind, Object source)` Notifies the plugin of a specific event for the given event id, which is one of ON_CHANGE, ON_CONFIG_CHANGE
`void` | `notifyOfEvent(Map event)` Notifies this plugin of the specified Event calling the onChange listener
`void` | `refresh()` Refreshes this Grails plugin reloading any watched resources as necessary
`void` | `refresh(boolean fireEvent)`
`void` | `restartContainer()`
`void` | `setParentApplicationContext(ApplicationContext parent)`
`void` | `setWatchedResources(Resource[] watchedResources)`
`boolean` | `supportsCurrentScopeAndEnvironment()`
`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
`String` | `toString()`

Methods inherited from class org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin
`compareTo, equals, getEvictionNames, getFileSystemName, getFileSystemShortName, getManager, getPluginClass, getPluginPath, hashCode, isBasePlugin, setApplication, setApplicationContext, setBasePlugin, setManager`

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

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

Methods inherited from interface org.codehaus.groovy.grails.plugins.GrailsPlugin
`getEvictionNames, getFileSystemName, getFileSystemShortName, getManager, getPluginClass, getPluginPath, isBasePlugin, setApplication, setBasePlugin, setManager`

Methods inherited from interface org.springframework.context.ApplicationContextAware
`setApplicationContext`

Methods inherited from interface java.lang.Comparable
`compareTo`

Field Detail

### pluginBean

    protected BeanWrapper pluginBean

Constructor Detail

### DefaultGrailsPlugin

    public DefaultGrailsPlugin(Class pluginClass,
                               Resource resource,
                               GrailsApplication application)

### DefaultGrailsPlugin

    public DefaultGrailsPlugin(Class pluginClass,
                               GrailsApplication application)

Method Detail

### 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`
  Overrides:
    `getLoadAfterNames` in class `AbstractGrailsPlugin`
  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`
  Overrides:
    `getLoadBeforeNames` in class `AbstractGrailsPlugin`
  Returns:
    The names of the plugins that this plugin should load before

### getResolver

    public PathMatchingResourcePatternResolver getResolver()

  Returns:
    the resolver

### getParentCtx

    public ApplicationContext getParentCtx()

### beans

    public BeanBuilder beans(groovy.lang.Closure closure)

### doWithApplicationContext

    public 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`
  Specified by:
    `doWithApplicationContext` in class `AbstractGrailsPlugin`
  Parameters:
    `applicationContext` - The Spring ApplicationContext instance

### doWithRuntimeConfiguration

    public 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`
  Specified by:
    `doWithRuntimeConfiguration` in class `AbstractGrailsPlugin`
  Parameters:
    `springConfig` - The RuntimeSpringConfiguration instance

### getName

    public String getName()

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

### supportsScope

    public boolean supportsScope(BuildScope buildScope)

  Description copied from interface: `GrailsPlugin`
  Return whether this plugin supports the given PluginScope

  Specified by:
    `supportsScope` in interface `GrailsPlugin`
  Parameters:
    `buildScope` - The PluginScope
  Returns:
    True if it does

### supportsEnvironment

    public boolean supportsEnvironment(Environment environment)

  Description copied from interface: `GrailsPlugin`
  Returns whether this plugin supports the given environment name

  Specified by:
    `supportsEnvironment` in interface `GrailsPlugin`
  Parameters:
    `environment` - The environment name
  Returns:
    True if it does

### supportsCurrentScopeAndEnvironment

    public boolean supportsCurrentScopeAndEnvironment()

  Specified by:
    `supportsCurrentScopeAndEnvironment` in interface `GrailsPlugin`
  Returns:
    True if the current plugin supports the current BuildScope and Environment

### getVersion

    public String getVersion()

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

### doc

    public void doc(String text)

  Description copied from interface: `GrailsPlugin`
  Write some documentation to the DocumentationContext

  Specified by:
    `doc` in interface `GrailsPlugin`

### getDependencyNames

    public String[] getDependencyNames()

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

### getWatchedResources

    public Resource[] getWatchedResources()

  Returns:
    the watchedResources

### getDependentVersion

    public String getDependentVersion(String name)

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

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

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### 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`
  Overrides:
    `doWithWebDescriptor` in class `AbstractGrailsPlugin`
  Parameters:
    `webXml` - The GPathResult representing web.xml

### checkForChanges

    public boolean checkForChanges()

  Monitors the plugin resources defined in the watchResources property for changes and fires onChange events by calling an onChange closure defined in the plugin (if it exists)

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

### fireModifiedEvent

    protected void fireModifiedEvent(Resource resource,
                                     GrailsPlugin plugin)

### restartContainer

    public void restartContainer()

### setWatchedResources

    public void setWatchedResources(Resource[] watchedResources)
                             throws IOException

  Throws:
    `IOException`

### getLog

    public org.apache.commons.logging.Log getLog()

### getPlugin

    public GrailsPlugin getPlugin()

### setParentApplicationContext

    public void setParentApplicationContext(ApplicationContext parent)

  Specified by:
    `setParentApplicationContext` in interface `ParentApplicationContextAware`

### 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`
  Overrides:
    `refresh` in class `AbstractGrailsPlugin`

### refresh

    public void refresh(boolean fireEvent)

### getInstance

    public groovy.lang.GroovyObject getInstance()

  Description copied from interface: `GrailsPlugin`
  Retrieves the wrapped plugin instance for this plugin

  Specified by:
    `getInstance` in interface `GrailsPlugin`
  Returns:
    The plugin instance

### doWithDynamicMethods

    public void doWithDynamicMethods(ApplicationContext applicationContext)

  Description copied from interface: `GrailsPlugin`
  Calls a "doWithDynamicMethods" closure that allows a plugin to register dynamic methods at runtime

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

### isEnabled

    public boolean isEnabled()

  Specified by:
    `isEnabled` in interface `GrailsPlugin`
  Returns:
    Whether the plugin is enabled or not

### getObservedPluginNames

    public String[] getObservedPluginNames()

  Description copied from interface: `GrailsPlugin`
  Retrieve the plugin names that this plugin is observing for changes

  Specified by:
    `getObservedPluginNames` in interface `GrailsPlugin`
  Returns:
    The names of the observed plugins

### notifyOfEvent

    public void notifyOfEvent(Map event)

  Description copied from interface: `GrailsPlugin`
  Notifies this plugin of the specified Event calling the onChange listener

  Specified by:
    `notifyOfEvent` in interface `GrailsPlugin`
  Parameters:
    `event` - The event to listen for

### notifyOfEvent

    public Map notifyOfEvent(int eventKind,
                             Object source)

  Description copied from interface: `GrailsPlugin`
  Notifies the plugin of a specific event for the given event id, which is one of ON_CHANGE, ON_CONFIG_CHANGE

  Specified by:
    `notifyOfEvent` in interface `GrailsPlugin`
  Parameters:
    `eventKind` - The event kind
    `source` - The source of the event
  Returns:
    a Map that represents the event

### doArtefactConfiguration

    public 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`
  Specified by:
    `doArtefactConfiguration` in class `AbstractGrailsPlugin`
  See Also:
    `ArtefactHandler`

### getProvidedArtefacts

    public Class[] getProvidedArtefacts()

  Description copied from interface: `GrailsPlugin`
  Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object but are overridable by the end-user

  Specified by:
    `getProvidedArtefacts` in interface `GrailsPlugin`
  Returns:
    A list of provided artefacts

### getPluginExcludes

    public List<String> getPluginExcludes()

  Description copied from interface: `GrailsPlugin`
  A list of resources that the plugin should exclude from the packaged distribution

  Specified by:
    `getPluginExcludes` in interface `GrailsPlugin`
  Returns:
    a List of resources

### getTypeFilters

    public Collection<? extends TypeFilter> getTypeFilters()

  Description copied from interface: `GrailsPlugin`
  Plugin can provide a list of Spring TypeFilters so that annotated components can be scanned into the ApplicationContext

  Specified by:
    `getTypeFilters` in interface `GrailsPlugin`
  Returns:
    A collection of TypeFilter instance

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2009 The Grails project