Grails Plugins

50 %
50 %
Information about Grails Plugins

Published on February 25, 2016

Author: NexThoughts

Source: slideshare.net

1. Plugins

2. Mail plugin • Install: grails install-plugin mail Dependency: compile "org.grails.plugins:mail:1.0.7" sendMail { to "fred@g2one.com" subject "Hello Fred" body 'How are you?' }

3. Mail plugin sendMail { to "fred@g2one.com" subject "Hello John" html '<b>Hello</b> World' } ======================================= sendMail { to "john@g2one.com" subject "Hello John" html g.render(template:"myMailTemplate") }

4. Mail plugin async sendMail { async true to "john@g2one.com" subject "Hello John" html g.render(template:"myMailTemplate") } =========== sendMail { multipart true to issue.watchers.email.toArray() subject "The issue you watch has been updated" body "Hello Watcher!" attachBytes "Some-File-Name.xml", "text/xml", contentOrder.getBytes("UTF-8") //To get started quickly, try the following //attachBytes './web-app/images/grails_logo.jpg','image/jpg', new File('./web- app/images/grails_logo.jpg').readBytes()

5. Mail plugin Configuration(grails-app/Config.groovy) grails { mail { host = "smtp.gmail.com" port = 465 username = "youracount@gmail.com" password = "yourpassword" props = ["mail.smtp.auth":"true", "mail.smtp.socketFactory.port":"465", "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory ", "mail.smtp.socketFactory.fallback":"false"] } }

6. Mail plugin default grails.mail.default.from="" grails.mail.overrideAddress="" grails.mail.poolSize=5

7. Quartz plugin Quartz plugin allows your Grails application to schedule jobs to be executed using a specified interval or cron expression. Dependency: compile "org.grails.plugins:quartz:1.0.2" compile ':quartz:1.0.1' (build.config)

8. Quartz plugin Job Scheduling: class MyJob { static triggers = { simple name: 'mySimpleTrigger', startDelay: 60000, repeatInterval: 1000 } def group = "MyGroup" def description = "Example job with Simple Trigger" def execute(){ print "Job run!" }

9. Quartz plugin cron Cron expression: cronExpression: "s m h D M W Y" | | | | | | `- Year [optional] | | | | | `- Day of Week, 1-7 or SUN-SAT, ? | | | | `- Month, 1-12 or JAN-DEC | | | `- Day of Month, 1-31, ? | | `- Hour, 0-23 | `- Minute, 0-59 `- Second, 0-59

10. Quartz with cron class MyJob { static triggers = { cron name: 'myTrigger', cronExpression: "0 0 6 * * ?" } def group = "MyGroup" def description = "Example job with Cron Trigger" def execute(){ print "Job run!" } }

11. Quartz configuration quartz { autoStartup = true jdbcStore = false } environments { test { quartz { autoStartup = false } } }

12. Console plugin Console plugin provides a web-based Groovy console for interactive runtime application management and debugging. Dependency: compile "org.grails.plugins:console:1.5.7" plugins { runtime ':console:1.5.7' } Local Storage uses HTML5 Web Storage. The files are serialized and stored in the browser as a map under the key gconsole.files. Remote Storage uses the filesystem of the server on which the application is running.

13. Console plugin Implicit variable: ctx - the Spring ApplicationContext grailsApplication - the GrailsApplication instance config - the Grails configuration request - the current HTTP request session - the current HTTP session out - the output PrintStream restricting access to localhost Ips: grails.plugin.springsecurity.controllerAnnotations.staticRules = [ "/console/**": ["hasRole('ROLE_ADMIN') && (hasIpAddress('127.0.0.1') || hasIpAddress('::1'))"], "/plugins/console*/**": ["hasRole('ROLE_ADMIN') && (hasIpAddress('127.0.0.1') || hasIpAddress('::1'))"] ]

14. Console plugin

15. Console plugin command Key Command Ctrl-Enter / Cmd-Enter Execute Ctrl-S / Cmd-S Save EscClear output Link:(For properties and their description) https://github.com/sheehan/grails- console/blob/master/README.md

16. DB migration plugin The Database Migration plugin helps you manage database changes while developing Grails applications. The plugin uses the Liquibase library. Dependency: runtime "org.grails.plugins:database-migration:1.4.1" plugins { runtime ':database-migration:1.3.6' } All of the scripts start with dbm- to ensure that they're unique and don't clash with scripts from Grails or other plugins.

17. DB migration plugin To generate changelog • grails dbm-generate-gorm-changelog changelog.xml To sync db with changelog • grails dbm-changelog-sync Database Migration plugin uses ./grails-app/migrations as the default. So, you can either move your scripts or add this setting to your grails-app/conf/Config.groovy file: • grails.plugin.databasemigration.changelogLocation = "whereEverYouWantLocatin"

18. DB migration plugin Link:(Configurations) http://grails-plugins.github.io/grails-database-migration/docs/manual/gui grails.plugin.databasemigration.reports.updateOntart = true grails.plugin.databasemigration.reports.changelogFileName = changelog-reports.groovy

19. DB migration plugin • You have a few options with dbm-gorm-diff: • dbm-gorm-diff will dump to the console if no filename is specified, so you can copy/paste from there • Gorm support(Grails object relational mapping ) create-drop, create, and update • It's very pessimistic and won't make any changes that could lose data. So it will add new tables and columns, but won't drop anything. If you remove a not-null domain class property you'll find you can't insert anymore since the column is still there. And it will create not-null columns as nullable since otherwise existing data would be invalid. It won't even widen a column e.g. from VARCHAR(100) to VARCHAR(200).

20. DB migration Dbm-gorm-diff This command provide a script that will compare your GORM current domain model with a database that you specify, and the result is a Liquibase changeset - dbm-gorm-diff. This is the same changeset you would get if you exported your domain model to a scratch database and diffed it with the other database, but it's more convenient.

21. Thanks for listening...

Add a comment

Related pages

Grails Plugins

Grails 3 plugins are available in Bintray. You can request to get your Grails 3 plugin listed by clicking the “Include My Package” ...
Read more

The Grails Framework

Grails is a powerful web framework, ... Build plugins that extend and enhance Grails or reuse an existing plugin already published by the ...
Read more

plugins - Maven - Bintray - Bintray - Download Center ...

plugins, by grails. Smartly served to you by Bintray.com. A repository of plugins for Grails 3.0 or above
Read more

Grails – Wikipedia

Grails ist ein Web Application Framework für die Programmiersprache Groovy. Grails bietet Konzepte wie Scaffolding, automatische Validatoren und ...
Read more

18 Plugins 3.1.3 - GitHub Pages

18 Plugins - Reference Documentation. Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari. Version: 3.1.3
Read more

Spring Security Core Plugin - Reference Documentation

The Spring Security plugin simplifies the integration of Spring Security into Grails applications. The plugin provides sensible defaults with many ...
Read more

IntelliJ IDEA 15.0 Help :: Working with Grails Plugins

Working with Grails Plugins. Please note that for Grails versions 2.3.0 and later, you need to use Grails plugin repository to find and install Grails plugins.
Read more

Index of plugins/org/grails/plugins

Index of plugins/org/grails/plugins Name Last modified Size ../ acegi/ 12-Mar-2012 10:43 - active ... Artifactory Online Server at repo.grails.org Port 80 ...
Read more

About

grails-plugins.org is a static website for searching Grails 3 plugins. It pulls data from Bintray and Github APIs into a unified interface ...
Read more

Grails Plugins · GitHub - GitHub · Where software is built

grails-quartz. This project provides integration of the Quartz scheduling framework into the Grails Framework Updated Mar 2, 2016
Read more