Slides from the Grails Integration Strategies BOF at JavaOne 2009. You can see these in context in a video shot by Bryan Williams of the Chicago Groovy User Group - http://cgug.blip.tv
11. Grails: More Than Just a Cool Framework
> Undeniable productivity gains
> Built on top of proven technologies
> Less code means less bugs
> Allows you to embrace change
> Reduce developer turnover (who would quit a Grails job?)
> Simple and painless deployment
11
13. Integration Strategies
> Calling EJB Session Beans from a Grails App
• EJB 2
• EJB 3
> Accessing JNDI Resources from a Grails App
• Using JNDI Datasources
• Other JNDI Resources
> Legacy Databases
• GORM DSL
• Annotations
13
14. Integration Strategies
> Calling Grails Actions from Non-Grails Apps
• From the server side using wget or curl
• From the client using AJAX
> Java Message Service
> Reuse Existing Spring Beans
> Reuse Existing Hibernate Entities
> What else?
14
17. Integration Strategies
> Calling EJB Session Beans from Grails Services
• EJB 2
• EJB 3
> Accessing JNDI Resources from a Grails App
• Using JNDI Datasources
• Other JNDI Services
> Legacy Databases
• GORM DSL
• Annotations
17
18. JNDI Datasources: Too Easy Not To Use
In app/grails-app/conf/DataSource.groovy
dataSource{
jndiName = “java:comp/env/jdbc/EnterpriseData”
}
Or in app/grails-app/conf/spring/resources.groovy
beans = {
dataSource(org.springframework.jndi.JndiObjectFactoryBean){
jndiName = “java:comp/env/jdbc/EnterpriseData”
}
}
18
20. Integration Strategies
> Calling EJB Session Beans from a Grails App
• EJB 2
• EJB 3
> Accessing JNDI Resources from a Grails App
• Using JNDI Datasources
• Other JNDI Services
> Legacy Databases
• GORM DSL
• Annotations
20
21. TABLE BK01
Column Name Date Type
ID_BK_PK NUMBER
BK_TITLE VARCHAR2(100)
BK_AUTHOR VARCHAR2(100)
BK_PGS NUMBER
ID_PUB_FK NUMBER
SEQUENCE ID_BK_PK_SEQ
class Book {
String title
String author
Integer pages
Publisher publisher
static belongsTo = Publisher
static mapping = {
table 'BK01'
columns{
id column: 'ID_BK_PK'
title column: 'BK_TITLE'
author column: 'BK_AUTHOR'
pages column: 'BK_PGS'
publisher column: 'ID_PUB_FK'
}
id generator: 'sequence', params:[sequence:'ID_BK_PK_SEQ']
}
}
21
22. @
Or you can use annotations
(if you really want to)
22
23. Brief Tangent on How to Sneak Introduce
Groovy and Grails Into The Enterprise
> Unit Testing
> Utility Scripts
> Internal Web Applications
> Prototypes
> JDBC -> GSQL
> XML Processing
> Itʼs easier to get forgiveness than permission
> Success Sells!
23
24. Integration Strategies
> Calling Grails Actions from Non-Grails Apps
• From the server side using wget or curl
• From the client using AJAX
> Java Message Service
> Reuse Existing Spring Beans
> Reuse Existing Hibernate Entities
> What else?
24
25. > Calling Grails Actions from Non-Grails Apps
> REST
• URL Mapping DSL
> SOAP
• Plugins for XFire, Axis, SpringWS and more
> Plain Old HTTP Call
> Execute process in Grails
> Return data - HTML, XML, JSON
• Grails Converters are awesome!
25
26. Integration Strategies
> Calling Grails Actions from Non-Grails Apps
• From the server side using wget or curl
• From the client using AJAX
> Java Message Service
> Reuse Existing Spring Beans
> Reuse Existing Hibernate Entities
> What else?
25
26