Ria Spring Blaze Ds


Published on

In this tech talk, Rick Evans will introduce Spring BlazeDS Integration.

Spring BlazeDS Integration is a Spring Portfolio project that makes it easier to build Rich Internet Applications for the enterprise using Flex and Spring. Integrating the powerful remoting and messaging features of Adobe BlazeDS with the familiar Spring programming model, Spring BlazeDS Integration is a great jumping-on point for Java developers looking to front Spring-based server-side enterprise applications with rich and polished Flex front-ends on the client.

Some previous exposure to Spring and Flex is best if you want to get maximum benefit from the talk.

Published in: Technology

Ria Spring Blaze Ds

  1. 1. Spring BlazeDS Integration Adobe RIA London User Group Rick Evans Skills Matter
  2. 2. Two Great Flavours
  3. 3. Spring BlazeDS Integration Overviews of... Spring BlazeDS Spring BlazeDS Integration Roadmap Q&A... Pub
  4. 4. Spring Spring is a Java framework for developing enterprise applications it handles the infrastructure so that you can focus on developing your application latest version is 3.0.x
  5. 5. Spring Rich ecosystem of Spring projects Spring Batch Spring WebFlow Spring Security Spring Roo Grails Spring BlazeDS Integration Spring ActionScript – Flex DI/IOC
  6. 6. Spring
  7. 7. BlazeDS
  8. 8. Remoting Basics :: Client <mx:RemoteObject id="instrumentService" destination="instrument-static"/> <mx:DataGrid id="instrumentStatic" dataProvider="{instrumentService.getStatic.lastResult}"/> <mx:Button label="Load Instruments" click="instrumentService.getStatic()"/> (in some MXML file of the client-application source)
  9. 9. Remoting Basics :: Server <destination id="instrument-static"> <properties> <source>skillsmatter.flug.InstrumentService</source> </properties> </destination> (in the file remoting-config.xml on the server) This is vanilla BlazeDS with no Spring integration flavouring
  10. 10. Spring BlazeDS Integration Open source BlazeDS integration library A collaboration between Adobe and Springsource Preserves investment in existing Spring-based server tier Spring configuration of BlazeDS components Idiomatic Spring remoting inline with other offerings Spring programming model for BlazeDS components Easier integration with other Spring Portfolio projects Spring Security Spring Integration (EMS)
  11. 11. Spring BlazeDS Integration Differences from vanilla BlazeDS No need for MessageBrokerServlet configuration MessageBroker (MB) configured directly as a Spring bean MB lifecycle controlled by Spring container MB itself can benefit from dependency injection MB can be dependency injected into dependant beans Messages are routed through Spring's DispatcherServlet
  12. 12. Spring BlazeDS Integration
  13. 13. Remoting BlazeDS remoting is idiomatic Spring remoting Middle-tier services are exported for remoting by Spring No need for separate remoting-config.xml Exported services are agnostic of the remoting You can effect the export via: regular Spring beans XML config custom <flex:namespace/> Spring namespace annotations
  14. 14. Remoting
  15. 15. Messaging BlazeDS messaging components are first-class Spring beans No need for vanilla messaging-config.xml Inversion of Control for pushing messages to consumers MessageTemplate for basic server-push capability Easy integration with Spring's JMS features Custom JmsAdapter provided
  16. 16. Messaging
  17. 17. Security Previous releases have supported Spring Security 2.x Latest release sports Spring Security 3.0.x integration You can apply security at... Endpoints (URLs) Channels (IDs) Service methods
  18. 18. Security
  19. 19. Security <flex:message-broker> <flex:secured/> </flex:message-broker> This installs a Spring Security-specific LoginCommand ChannelSet.[login,logout]() now integrated
  20. 20. Security <destination id="productService"> <security> <security-constraint> <auth-method>Custom</auth-method> <roles> <role>ROLE_USER</role> </roles> </security-constraint> </security> </destination>
  21. 21. Security :: Channel <flex:message-broker> <flex:secured> <flex:secured-channel channel="my-amf" access="ROLE_USER"/> </flex:secured> </flex:message-broker>
  22. 22. Security :: Endpoint <flex:message-broker> <flex:secured> <flex:secured-endpoint-path pattern="**/messagebroker/**" access="ROLE_USER"/> </flex:secured> </flex:message-broker>
  23. 23. Security :: Annotations public interface BankService { @Secured("IS_AUTHENTICATED_ANONYMOUSLY") public Account readAccount(Long id); @Secured("IS_AUTHENTICATED_ANONYMOUSLY") public Account[] findAccounts(); @Secured("ROLE_TELLER") public Account post(Account account, double amount); }
  24. 24. Security :: Client Side var token:AsyncToken = channelSet.login("high","5"); token.addResponder( new AsyncResponder( function(event:ResultEvent, token:Object = null):void { if (event.result.authorities .indexOf("ROLE_ADMIN") >= 0) { // ... } }, function(event:FaultEvent, token:Object = null):void {} ) );
  25. 25. Roadmap Spring BlazeDS Integration 1.0.2 Released February 2010 Spring Security 3 Integration Maintenance mode for 1.0.3 Spring BlazeDS Integration 1.5 BlazeDS 4 support Serialization of Hibernate entities to AMF (Later) LCDS support
  26. 26. Resources Spring BlazeDS Integration Homepage http://www.springsource.org/spring-flex Adobe BlazeDS Homepage http://opensource.adobe.com/blazeds/ Skills Matter Flex on Java Exchange London, June 2010
  27. 27. Pub