Skip to content

Latest commit

 

History

History
58 lines (27 loc) · 3.17 KB

File metadata and controls

58 lines (27 loc) · 3.17 KB

Grails architecture

Overview

Grails at its core is built on top of the Spring framework. It uses Spring’s core dependency injection container to manage all its objects as well as Spring’s MVC framework as an underlying technology for its MVC subsystem. Grails adds Groovy-based convention-over-configuration system, scaffolding of the core artefacts such as Controllers and Views, highly dynamic persistence framework called GORM by wrapping Hibernate OR Mapper underneath, the Groovy-based DSLs for just about anything from configuration, validation constraints to very rich web flow DSL built on top of Spring WebFlow, highly flexible build scripting system based on Gant and Ivy.

The secret sauce of the Grails architecture which makes the above things possible is Groovy programming language with its highly dynamic facility, namely Meta Object Protocol (MOP). Also another advantage of using Groovy here is its ability to natively inter-operate with ‘raw’ Java, so that users of the framework (as well as Grails itself) are not constrained and limited by ‘language isolation’. The entire rich repository of any imaginable Java libraries on Earth is available to Grails developers and users.

The core of Grails is mostly implemented in ‘raw’ Java

Core (in $GRAILS_SRC_HOME/grails/src/commons)

The core of Grails runtime is based around the concept of org.codehaus.groovy.grails.commons.GrailsApplication which is a singleton runtime representation of a running Grails application, and a set of well known Artefacts known to the application represented as a root interface org.codehaus.groovy.grails.commons.GrailsClass Each Artefact knows how to handle a specific task well such as representing the domain classes, controller classes, services classes, etc. GrailsApplication interacts with Artefacts via ArtefactHandler API

The default implementation of GrailsApplication is org.codehaus.groovy.grails.commons.DefaultGrailsApplication

The Grails artefacts are:

  • org.codehaus.groovy.grails.commons.GrailsBootstrapClass
  • org.codehaus.groovy.grails.commons.GrailsDomainClass
  • org.codehaus.groovy.grails.commons.GrailsDataSource
  • org.codehaus.groovy.grails.commons.GrailsControllerClass
  • org.codehaus.groovy.grails.commons.GrailsCodecClass
  • org.codehaus.groovy.grails.commons.GrailsServiceClass
  • org.codehaus.groovy.grails.commons.GrailsTagLibClass
  • org.codehaus.groovy.grails.commons.GrailsUrlMappingsClass

and they’re managed by:

  • org.codehaus.groovy.grails.commons.BootstrapArtefactHandler
  • org.codehaus.groovy.grails.commons.DomainClassArtefactHandler
  • org.codehaus.groovy.grails.commons.ControllerArtefactHandler
  • org.codehaus.groovy.grails.commons.CodecArtefactHandler
  • org.codehaus.groovy.grails.commons.ServiceArtefactHandler
  • org.codehaus.groovy.grails.commons.TagLibArtefactHandler
  • org.codehaus.groovy.grails.commons.UrlMappingsArtefactHandler

Plugins
TODO: To be continued…