KEMBAR78
RIAs with Java, Spring, Hibernate, BlazeDS, and Flex | PDF
RIAs with Java, Spring,
Hibernate, BlazeDS, and
Flex

James Ward
www.jamesward.com
Technical Evangelist - Adobe
#6662
Applications have evolved

Easy
                                                       2004


                      WEB APPLICATIONS
 EASE OF DEPLOYMENT




                                                                    RICH INTERNET
                                                1998                APPLICATIONS




                                         1992
Hard
                       MAINFRAME                                    CLIENT/ SERVER


                                                        Client
                        Limited                        Capability            Full
Adobe’s Software Development Platform
 Applications
                               Adobe
                               Media
                                                 Open Bug Database: Acrobat
                                                      Buzzword      Connect
                               Player           http:/ / bugs.adobe.com

Designer/ Developer Tools   Clients
                            Client
                            Runtimes                        Adobe              Flash               PDF
                                                            AIR                Player
60 Day Free Trial

Free for students           Frameworks
                            High Performance
                                                                                          Adobe
 and Creative Suite 4
      educators                JIT’ing VM: Ajax                                           Flex 3
                            Mozilla Tamarin
                            Servers/ Services
                                                               Open Source: MPL

       Flex Builder
                              LiveCycle   ColdFusion
                                                        Use any text editor Scene7
                                                              Acrobat
                                                       Flash Media    Flash  / IDE
                                                          Server     Connect       Cast
Adobe AIR Application Stack
        HTML                                 Flash
                                                                             Cross- OS
  HTML                                  Flex                                 Application
  JavaScript              Flash         ActionScript             HTML        Integrated
  XML                                   XML                                  Rendering
  CSS                                   Audio
                                                                             Integrated DOMs
                          PDF           Video                    PDF
                                                                             & Scripting



 File Syst em Network                   Applicat ion Drag and  Local
    Access    Detect ion
                         Not ifications
                                          Update       Drop   Database
                                                                       ...   Adobe AIR APIs


                        Mac, Windows, Linux & Device OS
How Flex Works
  Flex Builder IDE              Browser and ActionScript AIR
                                   MXML           Adobe
                             Flash Player
      Flex SDK
  MXML      ActionScript
   Flex Class Library
                             SOAP      HTTP/ S      AMF/ S    RTMP/ S



                                          Web Server
       Compile
                              XML/ HTTP               BlazeDS or
                                 REST              LC Data Services
                           SOAP Web Services
                                                 J2EE Application Server
         .swf
                            Ex isting Applications and Infrastructure
Tour de Flex - flex.org/ tour
Flex with Java via XML (RESTful / SOAP)

                               App Server




                        Web Service

            XML
Client   (RESTful /
           SOAP)
Introducing Open Source BlazeDS
                                                                      BlazeDS
                                                                                      Service
                                                           Data Management
 BlazeDS is the remoting and HTTP- based                                             Adapters
                                                          Data Synchronization
 messaging technology which Adobe is                                                 LiveCycle
                                                          Off- line Applications
 contributing to the community under LGPL
                                                              Data Paging               SQL
 v3
Capabilities                                                 RPC Services            Hibernate
>   Easily connects Flex & AIR applications to existing       Web Service
    server logic                                              HTTP Service           ColdFusion
>   High performance data transfer for more responsive    Rem ote Object Service
    applications                                                                        JMS
                                                              Messaging
>   Real- time data push over standard HTTP                                             Java
                                                           Publish & Subscribe
>   Full pub/ sub messaging that ex tends existing            Collaboration
    messaging infrastructure                               Real Tim e Data Push
                                                                                     Custom…

Publication of the Action Message Format                            Prox y Service
(AMF3) binary data protocol specification                        Web- tier Compiler
                                                                 Portal Deployment
Certified builds, warranty protection and
                                                                 RIA- PDF Generation
enterprise support subscriptions available
http:/ / www.jamesward.com/ census/
Flex with Java via Remoting

                                   J2EE Server
                      BlazeDS

                                                    POJO




                        Endpoint                 Spring Bean

         AMF
Client
                                                     EJB




                                                    Other
Flex with Java via Messaging

                                     J2EE Server
                                BlazeDS

                                                           Messaging
                                             Adapter X
                                                           System X



                                  Message                     JMS
                  Endpoint                  JMS Adapt er
                                  Service                   Provider



                                                           Messaging
                                             Adapter Y
                                                           System Y



         RTMP
         AMF
         HTTP                Publisher
                             Subscriber
Spring and Flex!

     SpringSource and Adobe have formed a joint partnership to turn this idea into
     reality!
     The foundations of this new integration will be available as open source
       – A new Spring subproject in the web portfolio:
                                                 Spring BlazeDS Integration
     Focus on integrating the open source BlazeDS with Spring




12
M1 - Dec 2 0 0 8

     Bootstrap the BlazeDS MessageBroker as a Spring- managed bean (no more
     web.xml MessageBrokerServlet config needed)


     Route http- based Flex messages to the MessageBroker through the Spring
     DispatcherServlet


     Expose Spring beans for remoting using typical Spring remoting exporter
     configuration




13
M2 - March 2 0 0 8

     Spring Security integration
       – Ensure that Spring security can secure any Springmanaged
          endpoints with credentials provided by the Flex app




14
post M2
Spring JMS integration
  – Integration with the BlazeDS MessageService
   – Use Spring configuration to manage BlazeDS
     MessageDestinations
   – Let Spring manage the JMS details
   – Allows easy communication from Flex clients to Spring
     message- driven POJOs
Spring 3.0 REST integration
   – Provides support for multiple client- types
   –   Flex apps can already consume Spring 3.0 RESTful endpoints through
       HTTPService
   –   Additional value could be realized by providing an AMFView
       implementation
           
               Response  or  TTP 
                        f H      request w i h  Cont ­
                                        s  t a      ent Type= applcat on/ i
                                                                 i i act onscri
                                                                              pt
web.xml
< listener>
                       < listener-
class> org.springframework.web.contex t.Contex tLoaderListener< / listener- class>
< / listener>


< servlet>
                        < servlet- name> testdrive< / servlet- name>
                       < servlet-
class> org.springframework.web.servlet.DispatcherServlet< / servlet- class>
                        < load- on- startup> 1< / load- on- startup>
< / servlet>


< servlet- mapping>
                        < servlet- name> testdrive< / servlet- name>
                        < url- pattern> / messagebroker/ *< / url- pattern>
< / servlet- mapping>
web.xml - Security Config
< contex t- param>
                       < param- name> contextConfigLocation< / param- name>
                       < param- value>
                                                              / WEB- INF/ config/ web- application- config.x ml
                                                              / WEB- INF/ config/ web- application- security.x ml
                       < / param- value>
< / contex t- param>


< filter>
                       < filter- name> springSecurityFilterChain< / filter- name>
                       < filter- class> org.springframework.web.filter.DelegatingFilterProx y< / filter- class>
< / filter>


< filter- mapping>
                       < filter- name> springSecurityFilterChain< / filter- name>
                       < url- pattern> / *< / url- pattern>
< / filter- mapping>
web- application- config.xml
< beans xmlns= "http:/ / www.springframework.org/ schema/ beans"
                              xmlns:flex = "http:/ / www.springframework.org/ schema/ flex"
                              xmlns:security= "http:/ / www.springframework.org/ schema/ security"
      xmlns:x si= "http:/ / www.w3.org/ 2001/ XMLSchema- instance"
      xsi:schemaLocation= "

http:/ / www.springframework.org/ schema/ beans

http:/ / www.springframework.org/ schema/ beans/ spring- beans- 2.5.xsd
                                                         http:/ / www.springframework.org/ schema/ flex

http:/ / www.springframework.org/ schema/ flex/ spring- flex- 1.0.xsd

http:/ / www.springframework.org/ schema/ security

http:/ / www.springframework.org/ schema/ security/ spring- security- 2.0.4.xsd">


                            < flex :message- broker>
                                                         < flex:secured / >
                            < / flex :message- broker>
web- application- config.xml - Remoting
Beans       < !- - Ex pose the productDAO bean for BlazeDS remoting - - >
                       < flex:remote- service ref= "productService" / >


< !- - A secured version of productService - - >
< bean id= "securedProductService" class= "flex .spring.samples.product.ProductDAO" >
  < flex:remote- service/ >
  < constructor- arg ref= "dataSource"/ >
  < security:intercept- methods>
                              < security:protect method= "find*" access= "ROLE_USER" / >
                       < / security:intercept- methods>
< / bean>
20


Hibernate Integration

   Either wrap beans by remoting Spring services / EJB Session Beans /
    POJOs...
    public class Employee
    public class EmployeeService

   Or use dpHibernate

   Or use LCDS’s Data Management Service
21


EJB Entity Beans and Session Beans
The End

Questions?


Learn More:
> Tour de Flex - flex .org/ tour
> www.jamesward.com

RIAs with Java, Spring, Hibernate, BlazeDS, and Flex

  • 1.
    RIAs with Java,Spring, Hibernate, BlazeDS, and Flex James Ward www.jamesward.com Technical Evangelist - Adobe #6662
  • 2.
    Applications have evolved Easy 2004 WEB APPLICATIONS EASE OF DEPLOYMENT RICH INTERNET 1998 APPLICATIONS 1992 Hard MAINFRAME CLIENT/ SERVER Client Limited Capability Full
  • 3.
    Adobe’s Software DevelopmentPlatform Applications Adobe Media Open Bug Database: Acrobat Buzzword Connect Player http:/ / bugs.adobe.com Designer/ Developer Tools Clients Client Runtimes Adobe Flash PDF AIR Player 60 Day Free Trial Free for students Frameworks High Performance Adobe and Creative Suite 4 educators JIT’ing VM: Ajax Flex 3 Mozilla Tamarin Servers/ Services Open Source: MPL Flex Builder LiveCycle ColdFusion Use any text editor Scene7 Acrobat Flash Media Flash / IDE Server Connect Cast
  • 4.
    Adobe AIR ApplicationStack HTML Flash Cross- OS HTML Flex Application JavaScript Flash ActionScript HTML Integrated XML XML Rendering CSS Audio Integrated DOMs PDF Video PDF & Scripting File Syst em Network Applicat ion Drag and Local Access Detect ion Not ifications Update Drop Database ... Adobe AIR APIs Mac, Windows, Linux & Device OS
  • 5.
    How Flex Works Flex Builder IDE Browser and ActionScript AIR MXML Adobe Flash Player Flex SDK MXML ActionScript Flex Class Library SOAP HTTP/ S AMF/ S RTMP/ S Web Server Compile XML/ HTTP BlazeDS or REST LC Data Services SOAP Web Services J2EE Application Server .swf Ex isting Applications and Infrastructure
  • 6.
    Tour de Flex- flex.org/ tour
  • 7.
    Flex with Javavia XML (RESTful / SOAP) App Server Web Service XML Client (RESTful / SOAP)
  • 8.
    Introducing Open SourceBlazeDS BlazeDS Service Data Management BlazeDS is the remoting and HTTP- based Adapters Data Synchronization messaging technology which Adobe is LiveCycle Off- line Applications contributing to the community under LGPL Data Paging SQL v3 Capabilities RPC Services Hibernate > Easily connects Flex & AIR applications to existing Web Service server logic HTTP Service ColdFusion > High performance data transfer for more responsive Rem ote Object Service applications JMS Messaging > Real- time data push over standard HTTP Java Publish & Subscribe > Full pub/ sub messaging that ex tends existing Collaboration messaging infrastructure Real Tim e Data Push Custom… Publication of the Action Message Format Prox y Service (AMF3) binary data protocol specification Web- tier Compiler Portal Deployment Certified builds, warranty protection and RIA- PDF Generation enterprise support subscriptions available
  • 9.
  • 10.
    Flex with Javavia Remoting J2EE Server BlazeDS POJO Endpoint Spring Bean AMF Client EJB Other
  • 11.
    Flex with Javavia Messaging J2EE Server BlazeDS Messaging Adapter X System X Message JMS Endpoint JMS Adapt er Service Provider Messaging Adapter Y System Y RTMP AMF HTTP Publisher Subscriber
  • 12.
    Spring and Flex! SpringSource and Adobe have formed a joint partnership to turn this idea into reality! The foundations of this new integration will be available as open source – A new Spring subproject in the web portfolio: Spring BlazeDS Integration Focus on integrating the open source BlazeDS with Spring 12
  • 13.
    M1 - Dec2 0 0 8 Bootstrap the BlazeDS MessageBroker as a Spring- managed bean (no more web.xml MessageBrokerServlet config needed) Route http- based Flex messages to the MessageBroker through the Spring DispatcherServlet Expose Spring beans for remoting using typical Spring remoting exporter configuration 13
  • 14.
    M2 - March2 0 0 8 Spring Security integration – Ensure that Spring security can secure any Springmanaged endpoints with credentials provided by the Flex app 14
  • 15.
    post M2 Spring JMSintegration – Integration with the BlazeDS MessageService – Use Spring configuration to manage BlazeDS MessageDestinations – Let Spring manage the JMS details – Allows easy communication from Flex clients to Spring message- driven POJOs Spring 3.0 REST integration – Provides support for multiple client- types – Flex apps can already consume Spring 3.0 RESTful endpoints through HTTPService – Additional value could be realized by providing an AMFView implementation  Response  or  TTP  f H request w i h  Cont ­ s  t a  ent Type= applcat on/ i i i act onscri pt
  • 16.
    web.xml < listener> < listener- class> org.springframework.web.contex t.Contex tLoaderListener< / listener- class> < / listener> < servlet> < servlet- name> testdrive< / servlet- name> < servlet- class> org.springframework.web.servlet.DispatcherServlet< / servlet- class> < load- on- startup> 1< / load- on- startup> < / servlet> < servlet- mapping> < servlet- name> testdrive< / servlet- name> < url- pattern> / messagebroker/ *< / url- pattern> < / servlet- mapping>
  • 17.
    web.xml - SecurityConfig < contex t- param> < param- name> contextConfigLocation< / param- name> < param- value> / WEB- INF/ config/ web- application- config.x ml / WEB- INF/ config/ web- application- security.x ml < / param- value> < / contex t- param> < filter> < filter- name> springSecurityFilterChain< / filter- name> < filter- class> org.springframework.web.filter.DelegatingFilterProx y< / filter- class> < / filter> < filter- mapping> < filter- name> springSecurityFilterChain< / filter- name> < url- pattern> / *< / url- pattern> < / filter- mapping>
  • 18.
    web- application- config.xml <beans xmlns= "http:/ / www.springframework.org/ schema/ beans" xmlns:flex = "http:/ / www.springframework.org/ schema/ flex" xmlns:security= "http:/ / www.springframework.org/ schema/ security" xmlns:x si= "http:/ / www.w3.org/ 2001/ XMLSchema- instance" xsi:schemaLocation= " http:/ / www.springframework.org/ schema/ beans http:/ / www.springframework.org/ schema/ beans/ spring- beans- 2.5.xsd http:/ / www.springframework.org/ schema/ flex http:/ / www.springframework.org/ schema/ flex/ spring- flex- 1.0.xsd http:/ / www.springframework.org/ schema/ security http:/ / www.springframework.org/ schema/ security/ spring- security- 2.0.4.xsd"> < flex :message- broker> < flex:secured / > < / flex :message- broker>
  • 19.
    web- application- config.xml- Remoting Beans < !- - Ex pose the productDAO bean for BlazeDS remoting - - > < flex:remote- service ref= "productService" / > < !- - A secured version of productService - - > < bean id= "securedProductService" class= "flex .spring.samples.product.ProductDAO" > < flex:remote- service/ > < constructor- arg ref= "dataSource"/ > < security:intercept- methods> < security:protect method= "find*" access= "ROLE_USER" / > < / security:intercept- methods> < / bean>
  • 20.
    20 Hibernate Integration  Either wrap beans by remoting Spring services / EJB Session Beans / POJOs... public class Employee public class EmployeeService  Or use dpHibernate  Or use LCDS’s Data Management Service
  • 21.
    21 EJB Entity Beansand Session Beans
  • 22.
    The End Questions? Learn More: >Tour de Flex - flex .org/ tour > www.jamesward.com