SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Grails Plugins

                                         Modularizing your application with
                                                      Plugins




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Objectives

             • Understand the basics of the Grails plugin
               system
             • Explore how to create modular applications
               through plugins
             • Unlock the potential of Convention over
               Configuration




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   2
Agenda

             •       Plugin basics
             •       Creating, packaging and installing plugins
             •       Building functional plugins
             •       Automating configuration
             •       Enhancing behavior




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   3
The Background

                 • Grails is designed to wire
                   together different libraries
                   and make them easy to use
                 • In this sense it can be seen
                   as a "platform for runtime
                   configuration"
                 • De-coupling those
                   components was hard
                   without a well defined
                   system
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   4
The Plugin Architecture




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   5
The Extension Points

               • Build System
               • Spring Application Context
               • Dynamic method
                 registration
               • Auto Reloading
               • Container Config (web.xml)
               • Adding new Artefacts




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   6
What is a Plugin?

              • Just like a normal Grails
                project!
              • The only difference is the
                presence of a
                *GrailsPlugin.groovy file
              • Use grails create-plugin
                to create one!




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   7
Creating and Running a
                                 Plugin


                • A plugin is just a regular Grails project
                  and can be developed like one:


                  $ grails create-plugin blog

                  $ cd ../blog

                  $ grails run-app


Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   8
A Plugin Project

                                                                                                                     A Plugin project is the
                                                                                                                     same as a regular Grails
                                                                                                                     project except it has a
                                                                                                                     special plugin Groovy




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                    9
The Plugin Descriptor

                              class LoggingGrailsPlugin {

                                    def version = 0.4
                                    def dependsOn = [core:"1.0 > *"]

                                    ...                                                                              Plug-in
                                                                                                                     Dependencies
                                                           The Plugin Version
                              }


Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.            10
Packaging & Installation


                • Installation of Grails plugins can then be
                  achieved with a few simple commands:

                  $ grails package-plugin

                  $ cd ../my-project
                  $ grails install-plugin
                         ../logging/grails-blog-0.4.zip
                  // or remotely
                  $ grails install-plugin http://myserver/
                  grails-blog-0.4.zip


Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   11
Plugins & Application
                                    Modularity
                                                Messaging                                           Security         Search
                                                 Plugin                                              Plugin          Plugin




                                                                                                 Grails
                                                                                               Application




                                                  Blog                                                 Wiki            Maps
                                                 Plugin                                               Plugin           Plugin




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.              12
Adding Basic Artefacts

                  • A Plugin can add new tag libraries,
                    controllers and services simply by
                    creating them in the plugin project
                  • Since a plugin project is just like any
                    project you can run and debug a
                    plugin in its own project before
                    distributing it
                  • Once you're done package and
                    distribute it!



Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   13
Demo

                                                      Building a Functional Plugin




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
Automating Configuration
                   import org.springframework.cache.ehcache.*
                   import grails.util.*
                                                                                                                     Implement ‘doWithSpring’
                                                                                                                     to modify Spring context
                   def doWithSpring = {

                           blogCache(EhCacheFactoryBean) {
                              if(Environment.current ==
                                   Environment.PRODUCTION) {
                                 timeToLive = 2400
                              }                         Sets the “timeToLive” of
                           }                            the cache for
             Configures a Spring                                                                                        production only
             bean called “blogCache”
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                    15
Automating Configuration

            • Plugins allow you to manipulate the underlying
              Spring context based on:
                       – The Environment
                       – The Conventions
                       – The State of other Plugins
            • Simply implement the doWithSpring plugin
              hook
            • See the user guide for a description of the
              Spring Domain Specific Langauge (DSL)



Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   16
Enhancing Behavior
               def doWithDynamicMethods = { ApplicationContext ctx ->
                     application.domainClasses.each { domainClass ->
                            domainClass.metaClass.constructor = {->
                                    ctx.getBean("Bookmark")
                            }                                                                                        Support auto-wiring from
                                                                                                                     Spring in regular constructors!
                          // adds a new Foo.load(21) method
                          def template =
                                  new HibernateTemplate(ctx.getBean("sessionFactory"))


                          domainClass.metaClass.static.load = {Long id->
                                  template.load(delegate.getClass(), id)
                          }
                     }
               }                                                                                                        Interact with the
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
                                                                                                                        Hibernate session!17
Enhancing Behavior

             • Plugins can add new methods and APIs using
               metaprogramming techniques
             • Simply implement the doWithSpring plugin
               hook
             • See the metaprogramming guide on Groovy’s
               website: http://groovy.codehaus.org/
               Dynamic+Groovy
             • Huge number of possibilities are opened up
               via plugins




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   18
What plugins enable...




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
What plugins enable...

                • Test Grails: selenium,
                  fitnesse, code coverage etc.




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
What plugins enable...

                • Test Grails: selenium,
                  fitnesse, code coverage etc.
                • Rich Grails: Flex, GWT,
                  GrailsUI (YahooUI) etc.




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
What plugins enable...

                • Test Grails: selenium,
                  fitnesse, code coverage etc.
                • Rich Grails: Flex, GWT,
                  GrailsUI (YahooUI) etc.
                • Secure Grails: Spring
                  Security, JSecurity, OpenID
                  etc.




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
What plugins enable...

                • Test Grails: selenium,
                  fitnesse, code coverage etc.
                • Rich Grails: Flex, GWT,
                  GrailsUI (YahooUI) etc.
                • Secure Grails: Spring
                  Security, JSecurity, OpenID
                  etc.
                • Integrate Grails: Search,
                  Jasper Reports, JMS etc,



Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
The Plugin Portal
                     • http://grails.org/




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   20
Summary

                • Plugins are crucial the the Grails story
                • Everyone is a plugin developer, not just
                  the gurus
                • Plugins help create modular applications
                • Plugin automate configuration through
                  Convention over Configuration




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   21
Q&A




Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.

Mais conteúdo relacionado

Mais procurados

Flex Continuous Quality Builds Flex & (Ant || Maven)
Flex Continuous Quality Builds Flex & (Ant || Maven)Flex Continuous Quality Builds Flex & (Ant || Maven)
Flex Continuous Quality Builds Flex & (Ant || Maven)François Le Droff
 
Mobile developments at eXo
Mobile developments at eXoMobile developments at eXo
Mobile developments at eXoArnaud Héritier
 
Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891
Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891
Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891Cisco DevNet
 
Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896
Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896
Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896Cisco DevNet
 
OSGi, Eclipse and API Tooling
OSGi, Eclipse and API ToolingOSGi, Eclipse and API Tooling
OSGi, Eclipse and API ToolingChris Aniszczyk
 
Basics About Git & GitHub
Basics About Git & GitHubBasics About Git & GitHub
Basics About Git & GitHubRaiful Hasan
 
GR8Conf 2011: Groovy Maven Builds
GR8Conf 2011: Groovy Maven BuildsGR8Conf 2011: Groovy Maven Builds
GR8Conf 2011: Groovy Maven BuildsGR8Conf
 
Seven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuseSeven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuseMatt Raible
 
Spring Native and Spring AOT
Spring Native and Spring AOTSpring Native and Spring AOT
Spring Native and Spring AOTVMware Tanzu
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoMohd Safian
 
Enterprise Maven Repository BOF
Enterprise Maven Repository BOFEnterprise Maven Repository BOF
Enterprise Maven Repository BOFMax Andersen
 
Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?Max Andersen
 
Magnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - ArchitectureMagnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - ArchitecturePhilipp Bärfuss
 
Resource Handling in Spring MVC 4.1
Resource Handling in Spring MVC 4.1Resource Handling in Spring MVC 4.1
Resource Handling in Spring MVC 4.1Rossen Stoyanchev
 
How to be effective with JBoss Developer Studio
How to be effective with JBoss Developer StudioHow to be effective with JBoss Developer Studio
How to be effective with JBoss Developer StudioMax Andersen
 
Groovy for Java Devs
Groovy for Java DevsGroovy for Java Devs
Groovy for Java DevsZachary Klein
 
What's new in Spring Boot 2.0
What's new in Spring Boot 2.0What's new in Spring Boot 2.0
What's new in Spring Boot 2.0VMware Tanzu
 
Perspectives on Cloud COmputing - Google
Perspectives on Cloud COmputing - GooglePerspectives on Cloud COmputing - Google
Perspectives on Cloud COmputing - GoogleACMBangalore
 

Mais procurados (19)

Flex Continuous Quality Builds Flex & (Ant || Maven)
Flex Continuous Quality Builds Flex & (Ant || Maven)Flex Continuous Quality Builds Flex & (Ant || Maven)
Flex Continuous Quality Builds Flex & (Ant || Maven)
 
Mobile developments at eXo
Mobile developments at eXoMobile developments at eXo
Mobile developments at eXo
 
Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891
Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891
Webex Teams Widgets Technical Drill down - Cisco Live Orlando 2018 - DEVNET-3891
 
Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896
Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896
Chatbots 101: design, code, deploy - Cisco Live Orlando 2018 - DEVNET-2896
 
OSGi, Eclipse and API Tooling
OSGi, Eclipse and API ToolingOSGi, Eclipse and API Tooling
OSGi, Eclipse and API Tooling
 
Basics About Git & GitHub
Basics About Git & GitHubBasics About Git & GitHub
Basics About Git & GitHub
 
GR8Conf 2011: Groovy Maven Builds
GR8Conf 2011: Groovy Maven BuildsGR8Conf 2011: Groovy Maven Builds
GR8Conf 2011: Groovy Maven Builds
 
Seven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuseSeven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuse
 
Spring Native and Spring AOT
Spring Native and Spring AOTSpring Native and Spring AOT
Spring Native and Spring AOT
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs Railo
 
Enterprise Maven Repository BOF
Enterprise Maven Repository BOFEnterprise Maven Repository BOF
Enterprise Maven Repository BOF
 
Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?
 
Magnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - ArchitectureMagnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - Architecture
 
Resource Handling in Spring MVC 4.1
Resource Handling in Spring MVC 4.1Resource Handling in Spring MVC 4.1
Resource Handling in Spring MVC 4.1
 
How to be effective with JBoss Developer Studio
How to be effective with JBoss Developer StudioHow to be effective with JBoss Developer Studio
How to be effective with JBoss Developer Studio
 
Groovy for Java Devs
Groovy for Java DevsGroovy for Java Devs
Groovy for Java Devs
 
What's new in Spring Boot 2.0
What's new in Spring Boot 2.0What's new in Spring Boot 2.0
What's new in Spring Boot 2.0
 
Build system
Build systemBuild system
Build system
 
Perspectives on Cloud COmputing - Google
Perspectives on Cloud COmputing - GooglePerspectives on Cloud COmputing - Google
Perspectives on Cloud COmputing - Google
 

Semelhante a GR8Conf 2009. The Grails Plugin System by Graeme Rocher

Custom Runtimes for the Cloud
Custom Runtimes for the CloudCustom Runtimes for the Cloud
Custom Runtimes for the CloudCloudBees
 
Introduction To Groovy And Grails - SpringPeople
Introduction To Groovy And Grails - SpringPeopleIntroduction To Groovy And Grails - SpringPeople
Introduction To Groovy And Grails - SpringPeopleSpringPeople
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaSetting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaTalentica Software
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for androidzhang ghui
 
Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...
Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...
Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...Sumeet Pareek
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubScott Graham
 
Building GPE: What We Learned
Building GPE: What We LearnedBuilding GPE: What We Learned
Building GPE: What We Learnedrajeevdayal
 
UnBBayes Plugin Framework
UnBBayes Plugin FrameworkUnBBayes Plugin Framework
UnBBayes Plugin FrameworkRommel Carvalho
 
Apigee deploy grunt plugin.1.0
Apigee deploy grunt plugin.1.0Apigee deploy grunt plugin.1.0
Apigee deploy grunt plugin.1.0Diego Zuluaga
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsGR8Conf
 
Ways to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptxWays to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptxohupalo
 
Self Hosted Web-based GIT Repository Managers
Self Hosted Web-based GIT Repository ManagersSelf Hosted Web-based GIT Repository Managers
Self Hosted Web-based GIT Repository ManagersPurav Gandhi
 
Moving the Guidewire platform to OSGi - Paul D'Albora
Moving the Guidewire platform to OSGi - Paul D'AlboraMoving the Guidewire platform to OSGi - Paul D'Albora
Moving the Guidewire platform to OSGi - Paul D'Alboramfrancis
 
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...Martin Bergljung
 
Operations and Monitoring with Spring
Operations and Monitoring with SpringOperations and Monitoring with Spring
Operations and Monitoring with SpringEberhard Wolff
 
How to prepare a project for automated deployment?
How to prepare a project for automated deployment?How to prepare a project for automated deployment?
How to prepare a project for automated deployment?ONE BCG
 

Semelhante a GR8Conf 2009. The Grails Plugin System by Graeme Rocher (20)

Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Custom Runtimes for the Cloud
Custom Runtimes for the CloudCustom Runtimes for the Cloud
Custom Runtimes for the Cloud
 
Introduction To Groovy And Grails - SpringPeople
Introduction To Groovy And Grails - SpringPeopleIntroduction To Groovy And Grails - SpringPeople
Introduction To Groovy And Grails - SpringPeople
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaSetting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | Talentica
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for android
 
Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...
Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...
Drupal Solutions Comparison For Multiple Sites With Related Content - Acquia ...
 
Advanced angular
Advanced angularAdvanced angular
Advanced angular
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHub
 
Building GPE: What We Learned
Building GPE: What We LearnedBuilding GPE: What We Learned
Building GPE: What We Learned
 
UnBBayes Plugin Framework
UnBBayes Plugin FrameworkUnBBayes Plugin Framework
UnBBayes Plugin Framework
 
Apigee deploy grunt plugin.1.0
Apigee deploy grunt plugin.1.0Apigee deploy grunt plugin.1.0
Apigee deploy grunt plugin.1.0
 
Cut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature pluginsCut your Grails application to pieces - build feature plugins
Cut your Grails application to pieces - build feature plugins
 
Ways to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptxWays to Level Up Your Java Application with GraalVM.pptx
Ways to Level Up Your Java Application with GraalVM.pptx
 
Self Hosted Web-based GIT Repository Managers
Self Hosted Web-based GIT Repository ManagersSelf Hosted Web-based GIT Repository Managers
Self Hosted Web-based GIT Repository Managers
 
Moving the Guidewire platform to OSGi - Paul D'Albora
Moving the Guidewire platform to OSGi - Paul D'AlboraMoving the Guidewire platform to OSGi - Paul D'Albora
Moving the Guidewire platform to OSGi - Paul D'Albora
 
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
 
ICONUK 2015 - Gradle Up!
ICONUK 2015 - Gradle Up!ICONUK 2015 - Gradle Up!
ICONUK 2015 - Gradle Up!
 
Operations and Monitoring with Spring
Operations and Monitoring with SpringOperations and Monitoring with Spring
Operations and Monitoring with Spring
 
How to prepare a project for automated deployment?
How to prepare a project for automated deployment?How to prepare a project for automated deployment?
How to prepare a project for automated deployment?
 

Mais de GR8Conf

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your TeamGR8Conf
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle GR8Conf
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerGR8Conf
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with GroovyGR8Conf
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with GebGR8Conf
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidGR8Conf
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the DocksGR8Conf
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean CodeGR8Conf
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applicationsGR8Conf
 
Ratpack and Grails 3
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3GR8Conf
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGR8Conf
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEBGR8Conf
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCGR8Conf
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshopGR8Conf
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spockGR8Conf
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedGR8Conf
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGR8Conf
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and GroovyGR8Conf
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineGR8Conf
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8confGR8Conf
 

Mais de GR8Conf (20)

DevOps Enabling Your Team
DevOps Enabling Your TeamDevOps Enabling Your Team
DevOps Enabling Your Team
 
Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle Creating and testing REST contracts with Accurest Gradle
Creating and testing REST contracts with Accurest Gradle
 
Mum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developerMum, I want to be a Groovy full-stack developer
Mum, I want to be a Groovy full-stack developer
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
 
Scraping with Geb
Scraping with GebScraping with Geb
Scraping with Geb
 
How to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and AndroidHow to create a conference android app with Groovy and Android
How to create a conference android app with Groovy and Android
 
Ratpack On the Docks
Ratpack On the DocksRatpack On the Docks
Ratpack On the Docks
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Ratpack and Grails 3
 Ratpack and Grails 3 Ratpack and Grails 3
Ratpack and Grails 3
 
Grails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloudGrails & DevOps: continuous integration and delivery in the cloud
Grails & DevOps: continuous integration and delivery in the cloud
 
Functional testing your Grails app with GEB
Functional testing your Grails app with GEBFunctional testing your Grails app with GEB
Functional testing your Grails app with GEB
 
Deploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPCDeploying, Scaling, and Running Grails on AWS and VPC
Deploying, Scaling, and Running Grails on AWS and VPC
 
The Grails introduction workshop
The Grails introduction workshopThe Grails introduction workshop
The Grails introduction workshop
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
 
The Groovy Ecosystem Revisited
The Groovy Ecosystem RevisitedThe Groovy Ecosystem Revisited
The Groovy Ecosystem Revisited
 
Groovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examplesGroovy 3 and the new Groovy Meta Object Protocol in examples
Groovy 3 and the new Groovy Meta Object Protocol in examples
 
Integration using Apache Camel and Groovy
Integration using Apache Camel and GroovyIntegration using Apache Camel and Groovy
Integration using Apache Camel and Groovy
 
CRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual MachineCRaSH the shell for the Java Virtual Machine
CRaSH the shell for the Java Virtual Machine
 
Grooscript gr8conf
Grooscript gr8confGrooscript gr8conf
Grooscript gr8conf
 

Último

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhisoniya singh
 
Islamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad Escorts
Islamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad EscortsIslamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad Escorts
Islamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad Escortswdefrd
 
Alex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson StoryboardAlex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson Storyboardthephillipta
 
FULL ENJOY - 9953040155 Call Girls in Uttam Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Uttam Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Uttam Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Uttam Nagar | DelhiMalviyaNagarCallGirl
 
FULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | DelhiFULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | DelhiMalviyaNagarCallGirl
 
Bridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.comBridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.comthephillipta
 
Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024samlnance
 
RAK Call Girls Service # 971559085003 # Call Girl Service In RAK
RAK Call Girls Service # 971559085003 # Call Girl Service In RAKRAK Call Girls Service # 971559085003 # Call Girl Service In RAK
RAK Call Girls Service # 971559085003 # Call Girl Service In RAKedwardsara83
 
Call girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room serviceCall girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room servicediscovermytutordmt
 
Roadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMRoadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMroute66connected
 
Young⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort Service
Young⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort ServiceYoung⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort Service
Young⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort Servicesonnydelhi1992
 
Patrakarpuram ) Cheap Call Girls In Lucknow (Adult Only) 🧈 8923113531 𓀓 Esco...
Patrakarpuram ) Cheap Call Girls In Lucknow  (Adult Only) 🧈 8923113531 𓀓 Esco...Patrakarpuram ) Cheap Call Girls In Lucknow  (Adult Only) 🧈 8923113531 𓀓 Esco...
Patrakarpuram ) Cheap Call Girls In Lucknow (Adult Only) 🧈 8923113531 𓀓 Esco...akbard9823
 
Jeremy Casson - An Architectural and Historical Journey Around Europe
Jeremy Casson - An Architectural and Historical Journey Around EuropeJeremy Casson - An Architectural and Historical Journey Around Europe
Jeremy Casson - An Architectural and Historical Journey Around EuropeJeremy Casson
 
Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...
Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...
Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...anilsa9823
 
Akola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service AkolaAkola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service Akolasrsj9000
 
Editorial sephora annual report design project
Editorial sephora annual report design projectEditorial sephora annual report design project
Editorial sephora annual report design projecttbatkhuu1
 
FULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | DelhiFULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | DelhiMalviyaNagarCallGirl
 

Último (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
 
Islamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad Escorts
Islamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad EscortsIslamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad Escorts
Islamabad Call Girls # 03091665556 # Call Girls in Islamabad | Islamabad Escorts
 
Alex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson StoryboardAlex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson Storyboard
 
FULL ENJOY - 9953040155 Call Girls in Uttam Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Uttam Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Uttam Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Uttam Nagar | Delhi
 
FULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | DelhiFULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
 
Bridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.comBridge Fight Board by Daniel Johnson dtjohnsonart.com
Bridge Fight Board by Daniel Johnson dtjohnsonart.com
 
Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024
 
RAK Call Girls Service # 971559085003 # Call Girl Service In RAK
RAK Call Girls Service # 971559085003 # Call Girl Service In RAKRAK Call Girls Service # 971559085003 # Call Girl Service In RAK
RAK Call Girls Service # 971559085003 # Call Girl Service In RAK
 
Call girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room serviceCall girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room service
 
Roadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMRoadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NM
 
Bur Dubai Call Girls # 971504361175 # Call Girls In Bur Dubai || (UAE)
Bur Dubai Call Girls # 971504361175 # Call Girls In Bur Dubai || (UAE)Bur Dubai Call Girls # 971504361175 # Call Girls In Bur Dubai || (UAE)
Bur Dubai Call Girls # 971504361175 # Call Girls In Bur Dubai || (UAE)
 
Pakistani Deira Call Girls # 00971589162217 # Pakistani Call Girls In Deira D...
Pakistani Deira Call Girls # 00971589162217 # Pakistani Call Girls In Deira D...Pakistani Deira Call Girls # 00971589162217 # Pakistani Call Girls In Deira D...
Pakistani Deira Call Girls # 00971589162217 # Pakistani Call Girls In Deira D...
 
Young⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort Service
Young⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort ServiceYoung⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort Service
Young⚡Call Girls in Uttam Nagar Delhi >༒9667401043 Escort Service
 
Patrakarpuram ) Cheap Call Girls In Lucknow (Adult Only) 🧈 8923113531 𓀓 Esco...
Patrakarpuram ) Cheap Call Girls In Lucknow  (Adult Only) 🧈 8923113531 𓀓 Esco...Patrakarpuram ) Cheap Call Girls In Lucknow  (Adult Only) 🧈 8923113531 𓀓 Esco...
Patrakarpuram ) Cheap Call Girls In Lucknow (Adult Only) 🧈 8923113531 𓀓 Esco...
 
Jeremy Casson - An Architectural and Historical Journey Around Europe
Jeremy Casson - An Architectural and Historical Journey Around EuropeJeremy Casson - An Architectural and Historical Journey Around Europe
Jeremy Casson - An Architectural and Historical Journey Around Europe
 
Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...
Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...
Lucknow 💋 Call Girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 892311...
 
Akola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service AkolaAkola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service Akola
 
Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)
Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)
Dxb Call Girls # +971529501107 # Call Girls In Dxb Dubai || (UAE)
 
Editorial sephora annual report design project
Editorial sephora annual report design projectEditorial sephora annual report design project
Editorial sephora annual report design project
 
FULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | DelhiFULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
 

GR8Conf 2009. The Grails Plugin System by Graeme Rocher

  • 1. Grails Plugins Modularizing your application with Plugins Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 2. Objectives • Understand the basics of the Grails plugin system • Explore how to create modular applications through plugins • Unlock the potential of Convention over Configuration Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 2
  • 3. Agenda • Plugin basics • Creating, packaging and installing plugins • Building functional plugins • Automating configuration • Enhancing behavior Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 3
  • 4. The Background • Grails is designed to wire together different libraries and make them easy to use • In this sense it can be seen as a "platform for runtime configuration" • De-coupling those components was hard without a well defined system Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4
  • 5. The Plugin Architecture Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 5
  • 6. The Extension Points • Build System • Spring Application Context • Dynamic method registration • Auto Reloading • Container Config (web.xml) • Adding new Artefacts Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 6
  • 7. What is a Plugin? • Just like a normal Grails project! • The only difference is the presence of a *GrailsPlugin.groovy file • Use grails create-plugin to create one! Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 7
  • 8. Creating and Running a Plugin • A plugin is just a regular Grails project and can be developed like one: $ grails create-plugin blog $ cd ../blog $ grails run-app Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 8
  • 9. A Plugin Project A Plugin project is the same as a regular Grails project except it has a special plugin Groovy Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 9
  • 10. The Plugin Descriptor class LoggingGrailsPlugin { def version = 0.4 def dependsOn = [core:"1.0 > *"] ... Plug-in Dependencies The Plugin Version } Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 10
  • 11. Packaging & Installation • Installation of Grails plugins can then be achieved with a few simple commands: $ grails package-plugin $ cd ../my-project $ grails install-plugin ../logging/grails-blog-0.4.zip // or remotely $ grails install-plugin http://myserver/ grails-blog-0.4.zip Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 11
  • 12. Plugins & Application Modularity Messaging Security Search Plugin Plugin Plugin Grails Application Blog Wiki Maps Plugin Plugin Plugin Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 12
  • 13. Adding Basic Artefacts • A Plugin can add new tag libraries, controllers and services simply by creating them in the plugin project • Since a plugin project is just like any project you can run and debug a plugin in its own project before distributing it • Once you're done package and distribute it! Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 13
  • 14. Demo Building a Functional Plugin Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.
  • 15. Automating Configuration import org.springframework.cache.ehcache.* import grails.util.* Implement ‘doWithSpring’ to modify Spring context def doWithSpring = { blogCache(EhCacheFactoryBean) { if(Environment.current == Environment.PRODUCTION) { timeToLive = 2400 } Sets the “timeToLive” of } the cache for Configures a Spring production only bean called “blogCache” Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 15
  • 16. Automating Configuration • Plugins allow you to manipulate the underlying Spring context based on: – The Environment – The Conventions – The State of other Plugins • Simply implement the doWithSpring plugin hook • See the user guide for a description of the Spring Domain Specific Langauge (DSL) Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 16
  • 17. Enhancing Behavior def doWithDynamicMethods = { ApplicationContext ctx -> application.domainClasses.each { domainClass -> domainClass.metaClass.constructor = {-> ctx.getBean("Bookmark") } Support auto-wiring from Spring in regular constructors! // adds a new Foo.load(21) method def template = new HibernateTemplate(ctx.getBean("sessionFactory")) domainClass.metaClass.static.load = {Long id-> template.load(delegate.getClass(), id) } } } Interact with the Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Hibernate session!17
  • 18. Enhancing Behavior • Plugins can add new methods and APIs using metaprogramming techniques • Simply implement the doWithSpring plugin hook • See the metaprogramming guide on Groovy’s website: http://groovy.codehaus.org/ Dynamic+Groovy • Huge number of possibilities are opened up via plugins Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 18
  • 19. What plugins enable... Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19
  • 20. What plugins enable... • Test Grails: selenium, fitnesse, code coverage etc. Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19
  • 21. What plugins enable... • Test Grails: selenium, fitnesse, code coverage etc. • Rich Grails: Flex, GWT, GrailsUI (YahooUI) etc. Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19
  • 22. What plugins enable... • Test Grails: selenium, fitnesse, code coverage etc. • Rich Grails: Flex, GWT, GrailsUI (YahooUI) etc. • Secure Grails: Spring Security, JSecurity, OpenID etc. Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19
  • 23. What plugins enable... • Test Grails: selenium, fitnesse, code coverage etc. • Rich Grails: Flex, GWT, GrailsUI (YahooUI) etc. • Secure Grails: Spring Security, JSecurity, OpenID etc. • Integrate Grails: Search, Jasper Reports, JMS etc, Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19
  • 24. The Plugin Portal • http://grails.org/ Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 20
  • 25. Summary • Plugins are crucial the the Grails story • Everyone is a plugin developer, not just the gurus • Plugins help create modular applications • Plugin automate configuration through Convention over Configuration Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 21
  • 26. Q&A Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited.