SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
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.

Contenu connexe

Tendances

Basics About Git & GitHub
Basics About Git & GitHubBasics About Git & GitHub
Basics About Git & GitHub
Raiful Hasan
 
GR8Conf 2011: Groovy Maven Builds
GR8Conf 2011: Groovy Maven BuildsGR8Conf 2011: Groovy Maven Builds
GR8Conf 2011: Groovy Maven Builds
GR8Conf
 

Tendances (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
 

Similaire à GR8Conf 2009. The Grails Plugin System by Graeme Rocher

Building GPE: What We Learned
Building GPE: What We LearnedBuilding GPE: What We Learned
Building GPE: What We Learned
rajeevdayal
 

Similaire à 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?
 

Plus de GR8Conf

Plus 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
 

Dernier

FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | DelhiFULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
SaketCallGirlsCallUs
 
FULL NIGHT — 9999894380 Call Girls In Ashok Vihar | Delhi
FULL NIGHT — 9999894380 Call Girls In Ashok Vihar | DelhiFULL NIGHT — 9999894380 Call Girls In Ashok Vihar | Delhi
FULL NIGHT — 9999894380 Call Girls In Ashok Vihar | Delhi
SaketCallGirlsCallUs
 
❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...
❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...
❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...
Sheetaleventcompany
 
Call Girls in Sakinaka 9892124323, Vashi CAll Girls Call girls Services, Che...
Call Girls in Sakinaka  9892124323, Vashi CAll Girls Call girls Services, Che...Call Girls in Sakinaka  9892124323, Vashi CAll Girls Call girls Services, Che...
Call Girls in Sakinaka 9892124323, Vashi CAll Girls Call girls Services, Che...
Pooja Nehwal
 
Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...
Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...
Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...
Business Bay Call Girls || 0529877582 || Call Girls Service in Business Bay Dubai
 
FULL NIGHT — 9999894380 Call Girls In Kishangarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Kishangarh | DelhiFULL NIGHT — 9999894380 Call Girls In Kishangarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Kishangarh | Delhi
SaketCallGirlsCallUs
 
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Business Bay Call Girls || 0529877582 || Call Girls Service in Business Bay Dubai
 
Bobbie goods coloring book 81 pag_240127_163802.pdf
Bobbie goods coloring book 81 pag_240127_163802.pdfBobbie goods coloring book 81 pag_240127_163802.pdf
Bobbie goods coloring book 81 pag_240127_163802.pdf
MARIBEL442158
 
FULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | DelhiFULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | Delhi
SaketCallGirlsCallUs
 
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Business Bay Call Girls || 0529877582 || Call Girls Service in Business Bay Dubai
 
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | DelhiFULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
SaketCallGirlsCallUs
 
FULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | DelhiFULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
SaketCallGirlsCallUs
 

Dernier (20)

FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | DelhiFULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
FULL NIGHT — 9999894380 Call Girls In Delhi | Delhi
 
Sirmaur Call Girls Book Now 8617697112 Top Class Pondicherry Escort Service A...
Sirmaur Call Girls Book Now 8617697112 Top Class Pondicherry Escort Service A...Sirmaur Call Girls Book Now 8617697112 Top Class Pondicherry Escort Service A...
Sirmaur Call Girls Book Now 8617697112 Top Class Pondicherry Escort Service A...
 
FULL NIGHT — 9999894380 Call Girls In Ashok Vihar | Delhi
FULL NIGHT — 9999894380 Call Girls In Ashok Vihar | DelhiFULL NIGHT — 9999894380 Call Girls In Ashok Vihar | Delhi
FULL NIGHT — 9999894380 Call Girls In Ashok Vihar | Delhi
 
❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...
❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...
❤️Call girls in Chandigarh ☎️8264406502☎️ Call Girl service in Chandigarh☎️ C...
 
Moradabad Call Girls - 📞 8617697112 🔝 Top Class Call Girls Service Available
Moradabad Call Girls - 📞 8617697112 🔝 Top Class Call Girls Service AvailableMoradabad Call Girls - 📞 8617697112 🔝 Top Class Call Girls Service Available
Moradabad Call Girls - 📞 8617697112 🔝 Top Class Call Girls Service Available
 
Call Girls in Sakinaka 9892124323, Vashi CAll Girls Call girls Services, Che...
Call Girls in Sakinaka  9892124323, Vashi CAll Girls Call girls Services, Che...Call Girls in Sakinaka  9892124323, Vashi CAll Girls Call girls Services, Che...
Call Girls in Sakinaka 9892124323, Vashi CAll Girls Call girls Services, Che...
 
Storyboard short: Ferrarius Tries to Sing
Storyboard short: Ferrarius Tries to SingStoryboard short: Ferrarius Tries to Sing
Storyboard short: Ferrarius Tries to Sing
 
sources of Hindu law kdaenflkjwwfererger
sources of Hindu law kdaenflkjwwferergersources of Hindu law kdaenflkjwwfererger
sources of Hindu law kdaenflkjwwfererger
 
Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...
Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...
Pakistani Bur Dubai Call Girls # +971528960100 # Pakistani Call Girls In Bur ...
 
FULL NIGHT — 9999894380 Call Girls In Kishangarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Kishangarh | DelhiFULL NIGHT — 9999894380 Call Girls In Kishangarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Kishangarh | Delhi
 
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
Dubai Call Girls Service # +971588046679 # Call Girls Service In Dubai # (UAE)
 
Bobbie goods coloring book 81 pag_240127_163802.pdf
Bobbie goods coloring book 81 pag_240127_163802.pdfBobbie goods coloring book 81 pag_240127_163802.pdf
Bobbie goods coloring book 81 pag_240127_163802.pdf
 
FULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | DelhiFULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | Delhi
FULL NIGHT — 9999894380 Call Girls In New Ashok Nagar | Delhi
 
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
 
VIP Ramnagar Call Girls, Ramnagar escorts Girls 📞 8617697112
VIP Ramnagar Call Girls, Ramnagar escorts Girls 📞 8617697112VIP Ramnagar Call Girls, Ramnagar escorts Girls 📞 8617697112
VIP Ramnagar Call Girls, Ramnagar escorts Girls 📞 8617697112
 
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
Dubai Call Girl Number # 0522916705 # Call Girl Number In Dubai # (UAE)
 
Akbar Religious Policy and Sufism comparison.pptx
Akbar Religious Policy and Sufism comparison.pptxAkbar Religious Policy and Sufism comparison.pptx
Akbar Religious Policy and Sufism comparison.pptx
 
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | DelhiFULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
FULL NIGHT — 9999894380 Call Girls In Mahipalpur | Delhi
 
(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7
(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7
(INDIRA) Call Girl Dehradun Call Now 8617697112 Dehradun Escorts 24x7
 
FULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | DelhiFULL NIGHT — 9999894380 Call Girls In Najafgarh | Delhi
FULL NIGHT — 9999894380 Call Girls In Najafgarh | 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.