org.codehaus.groovy.grails.plugins.support.aware
Class AwarePlugin

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin
          extended by org.codehaus.groovy.grails.plugins.support.aware.AwarePlugin
All Implemented Interfaces:
groovy.lang.GroovyObject, GrailsPlugin, ApplicationContextAware

public class AwarePlugin
extends AbstractGrailsPlugin

Grails plugin that registers *Aware BeanPostProcessors.

Since:
0.2
Author:
Steven Devijver

Field Summary
 
Fields inherited from class org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin
application, applicationContext, dependencies, dependencyNames, evictionList, 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, EVENT_ON_CHANGE, EVENT_ON_CONFIG_CHANGE, EVICT, INFLUENCES, ON_CHANGE, ON_CONFIG_CHANGE, PROVIDED_ARTEFACTS, STATUS, STATUS_DISABLED, STATUS_ENABLED, TRAILING_NAME, VERSION, WATCHED_RESOURCES
 
Constructor Summary
AwarePlugin(Class pluginClass, GrailsApplication application)
           
 
Method Summary
 void doArtefactConfiguration()
          Called prior to the initialisation of the GrailsApplication instance to allow the registration of additonal ArtefactHandlers
 void doWithApplicationContext(ApplicationContext applicationContext)
          This method is called to allow the plugin to add BeanDefinitions 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
 groovy.lang.GroovyObject getInstance()
          Retrieves the wrapped plugin instance for this plugin
 String[] getObservedPluginNames()
          Retrieve the plugin names that this plugin is observing for changes
 Class[] getProvidedArtefacts()
          Retrieves an array of provided Artefacts that are pre-compiled additions to the GrailsApplication object but are overridable by the end-user
 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
protected  void registerClassLoaderAwareBeanPostProcessor(ApplicationContext applicationContext, ClassLoader classLoader)
           
protected  void registerGrailsApplicationAwareBeanPostProcessor(ApplicationContext applicationContext, GrailsApplication grailsApplication)
           
 
Methods inherited from class org.codehaus.groovy.grails.plugins.AbstractGrailsPlugin
checkForChanges, doWithWebDescriptor, getDependencyNames, getDependentVersion, getEvictionNames, getLoadAfterNames, getManager, getName, getVersion, refresh, setApplication, setApplicationContext, setManager
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AwarePlugin

public AwarePlugin(Class pluginClass,
                   GrailsApplication application)
Method Detail

doWithApplicationContext

public void doWithApplicationContext(ApplicationContext applicationContext)
Description copied from interface: GrailsPlugin

This method is called to allow the plugin to add BeanDefinitions to the BeanDefinitionRegistry.

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

registerGrailsApplicationAwareBeanPostProcessor

protected void registerGrailsApplicationAwareBeanPostProcessor(ApplicationContext applicationContext,
                                                               GrailsApplication grailsApplication)

registerClassLoaderAwareBeanPostProcessor

protected void registerClassLoaderAwareBeanPostProcessor(ApplicationContext applicationContext,
                                                         ClassLoader classLoader)

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

getInstance

public groovy.lang.GroovyObject getInstance()
Description copied from interface: GrailsPlugin
Retrieves the wrapped plugin instance for this plugin

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

Parameters:
applicationContext - The Spring ApplicationContext instance

isEnabled

public boolean isEnabled()
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

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

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

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

Returns:
A list of provided artefacts


Copyright (c) 2005-2006 The Grails project