Your SlideShare is downloading. ×
  • Like
Grails Integration Strategies
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Grails Integration Strategies

  • 4,065 views
Published

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

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

Published in Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
4,065
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
72
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Grails Enterprise Integration Strategies Dave Klein Contegix Beyond Managed Hosting
  • 2. 2
  • 3. Use the coupon code “javaone” for a 30% discount http://groovymag.com 3
  • 4. Beta version available now at http://pragprog.com 4
  • 5. Birds of a Feather 5
  • 6. Grails [buzzword] [buzzword] Strategies What do we mean by Enterprise Integration? 6
  • 7. 7
  • 8. Java Enterprise Edition J E E 8
  • 9. JEE JEE JEE JEE JEE JEE JEE 9
  • 10. Why Bother? Why not leave well enough alone? 10
  • 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
  • 12. Itʼs a Really Cool Framework! 12
  • 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
  • 15. Calling an EJB 2 Session Bean From Grails In app/grails-app/conf/spring/resources.groovy beans = { ejbJndi(org.springframework.jndi.JndiTemplate){ environment = [ "java.naming.factory.initial":"weblogic.jndi.WLInitialContextFactory", "java.naming.provider.url" : "t3://some.enterprise.server:7001", "java.naming.security.principal" : "dave", "java.naming.security.credentials" : "1234" ] } empSession(org.springframework.ejb.access. SimpleRemoteStatelessSessionProxyFactoryBean){ jndiName = "EmpSession" businessInterface = "com.enterprise.some.ejb.session.EmpSession" jndiTemplate = ref("ejbJndi") } } 15
  • 16. Calling an EJB 3 Session Bean From Grails In app/grails-app/conf/spring/resources.groovy beans = { ejbJndi(org.springframework.jndi.JndiTemplate){ environment = [ "java.naming.factory.initial" : "weblogic.jndi.WLInitialContextFactory", "java.naming.provider.url" : "t3://some.enterprise.server:7001" "java.naming.security.principal" : "dave", "java.naming.security.credentials" : "1234" ] } empSession(org.springframework.jndi.JndiObjectFactoryBean){ jndiName = "CoverageSession#org.foo.app.ejb.session.IEmpSessionRemote" jndiTemplate = ref("ejbJndi") } } 16
  • 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
  • 19. Other JNDI Resources In app/grails-app/conf/spring/resources.groovy beans = { jndi(org.springframework.jndi.JndiTemplate){ environment = [ "java.naming.factory.initial" : "weblogic.jndi.WLInitialContextFactory", "java.naming.provider.url" : "t3://some.enterprise.server:7001" "java.naming.security.principal" : "dave", "java.naming.security.credentials" : "1234" ] } } 19
  • 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
  • 27. Dave Klein dave.klein@contegix.com Blog: dave-klein.blogspot.com Twitter: daveklein