Package org.grails.core
Class AbstractGrailsApplication
- java.lang.Object
-
- groovy.lang.GroovyObjectSupport
-
- org.grails.core.AbstractGrailsApplication
-
- All Implemented Interfaces:
GrailsApplication,groovy.lang.GroovyObject,java.util.EventListener,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>,org.springframework.context.event.SmartApplicationListener,org.springframework.core.Ordered
- Direct Known Subclasses:
DefaultGrailsApplication
public abstract class AbstractGrailsApplication extends groovy.lang.GroovyObjectSupport implements GrailsApplication, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.context.event.SmartApplicationListener
-
-
Field Summary
Fields Modifier and Type Field Description protected grails.util.MetadataapplicationMetaprotected java.lang.ClassLoaderclassLoaderprotected grails.config.Configconfigprotected booleancontextInitializedprotected org.springframework.context.ApplicationContextparentContext-
Fields inherited from interface grails.core.GrailsApplication
APPLICATION_ID, CLASS_LOADER_BEAN, CONFIG_CLASS, DATA_SOURCE_BEAN, DATA_SOURCE_CLASS, DIALECT_DETECTOR_BEAN, EXCEPTION_HANDLER_BEAN, MESSAGE_SOURCE_BEAN, MULTIPART_RESOLVER_BEAN, OPEN_SESSION_IN_VIEW_INTERCEPTOR_BEAN, PROJECT_META_FILE, SESSION_FACTORY_BEAN, TRANSACTION_MANAGER_BEAN
-
-
Constructor Summary
Constructors Constructor Description AbstractGrailsApplication()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigChanged()Fired to inform the application when the Config.groovy file changes.java.lang.ClassgetClassForName(java.lang.String className)Retrieves a class for the given name within the GrailsApplication or returns nulljava.lang.ClassLoadergetClassLoader()Returns the class loader instance for the Grails application.grails.config.ConfiggetConfig()Returns the ConfigObject instance.org.springframework.context.ApplicationContextgetMainContext()Returns the Spring context for this application.grails.util.MetadatagetMetadata()Get access to the project's metadata, specified in application.yml and grails.build.info if it is presentintgetOrder()org.springframework.context.ApplicationContextgetParentContext()Returns the Spring application context that contains this application instance.booleanisWarDeployed()Returns true if this application has been deployed as a WAR filevoidonApplicationEvent(org.springframework.context.ApplicationEvent event)voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidsetBeanClassLoader(java.lang.ClassLoader classLoader)voidsetConfig(grails.config.Config config)voidsetConfig(groovy.util.ConfigObject config)voidsetMainContext(org.springframework.context.ApplicationContext context)Sets the main Spring context for this application.booleansupportsEventType(java.lang.Class<? extends org.springframework.context.ApplicationEvent> eventType)booleansupportsSourceType(java.lang.Class<?> sourceType)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface grails.core.GrailsApplication
addArtefact, addArtefact, addArtefact, addOverridableArtefact, getAllArtefacts, getAllClasses, getArtefact, getArtefactByLogicalPropertyName, getArtefactForFeature, getArtefactHandler, getArtefactHandlers, getArtefactInfo, getArtefacts, getArtefactType, getMappingContext, getResourceForClass, hasArtefactHandler, initialise, isArtefact, isArtefactOfType, isArtefactOfType, isInitialised, rebuild, refresh, registerArtefactHandler, setMappingContext
-
-
-
-
Field Detail
-
classLoader
protected java.lang.ClassLoader classLoader
-
config
protected grails.config.Config config
-
parentContext
protected org.springframework.context.ApplicationContext parentContext
-
applicationMeta
protected grails.util.Metadata applicationMeta
-
contextInitialized
protected boolean contextInitialized
-
-
Method Detail
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
getMetadata
public grails.util.Metadata getMetadata()
Description copied from interface:GrailsApplicationGet access to the project's metadata, specified in application.yml and grails.build.info if it is present
This provides access to information like required grails version, application name, version etc but NOT general application settings.
- Specified by:
getMetadatain interfaceGrailsApplication- Returns:
- A read-only Map of data about the application, not environment specific
-
isWarDeployed
public boolean isWarDeployed()
Description copied from interface:GrailsApplicationReturns true if this application has been deployed as a WAR file- Specified by:
isWarDeployedin interfaceGrailsApplication- Returns:
- true if the application is WAR deployed
-
getConfig
public grails.config.Config getConfig()
Description copied from interface:GrailsApplicationReturns the ConfigObject instance.- Specified by:
getConfigin interfaceGrailsApplication- Returns:
- The ConfigObject instance
-
setConfig
public void setConfig(grails.config.Config config)
-
setConfig
public void setConfig(groovy.util.ConfigObject config)
-
configChanged
public void configChanged()
Description copied from interface:GrailsApplicationFired to inform the application when the Config.groovy file changes.- Specified by:
configChangedin interfaceGrailsApplication
-
setBeanClassLoader
public void setBeanClassLoader(java.lang.ClassLoader classLoader)
- Specified by:
setBeanClassLoaderin interfaceorg.springframework.beans.factory.BeanClassLoaderAware
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:GrailsApplicationReturns the class loader instance for the Grails application.- Specified by:
getClassLoaderin interfaceGrailsApplication- Returns:
- The ClassLoader instance
-
getClassForName
public java.lang.Class getClassForName(java.lang.String className)
Description copied from interface:GrailsApplicationRetrieves a class for the given name within the GrailsApplication or returns null- Specified by:
getClassForNamein interfaceGrailsApplication- Parameters:
className- The name of the class- Returns:
- The class or null
-
getMainContext
public org.springframework.context.ApplicationContext getMainContext()
Description copied from interface:GrailsApplicationReturns the Spring context for this application. Note that this will returnnulluntil the application is fully initialised. This context contains all the application artifacts, plugin beans, the works.- Specified by:
getMainContextin interfaceGrailsApplication
-
setMainContext
public void setMainContext(org.springframework.context.ApplicationContext context)
Description copied from interface:GrailsApplicationSets the main Spring context for this application.- Specified by:
setMainContextin interfaceGrailsApplication
-
getParentContext
public org.springframework.context.ApplicationContext getParentContext()
Description copied from interface:GrailsApplicationReturns the Spring application context that contains this application instance. It is the parent of the context returned byGrailsApplication.getMainContext().- Specified by:
getParentContextin interfaceGrailsApplication
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
-
supportsEventType
public boolean supportsEventType(java.lang.Class<? extends org.springframework.context.ApplicationEvent> eventType)
- Specified by:
supportsEventTypein interfaceorg.springframework.context.event.SmartApplicationListener
-
supportsSourceType
public boolean supportsSourceType(java.lang.Class<?> sourceType)
- Specified by:
supportsSourceTypein interfaceorg.springframework.context.event.SmartApplicationListener
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered- Specified by:
getOrderin interfaceorg.springframework.context.event.SmartApplicationListener
-
-