GraniteDS 360|Flex DC

3,770 views

Published on

Published in: Technology
3 Comments
1 Like
Statistics
Notes
  • Thank you. I put my more detailed question on forum.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • GraniteDS integrates with the JBoss container security, so you just have to configure JBoss as for any web application. For example define the security domain in jboss-web.xml and the login module in login-config.xml.
    Please note that the user forums is here: http://groups.google.com/group/graniteds
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hello, is there a sample how to use Flex - JBoss 5.x security (DatabaseServerLoginModule - Loads user/role information from a database). In all samples from graniteds authentification and authorization is made using roles.properties and users.properties files. How it is done using database? How to configure SecurityDoman ?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
3,770
On SlideShare
0
From Embeds
0
Number of Embeds
768
Actions
Shares
0
Downloads
50
Comments
3
Likes
1
Embeds 0
No embeds

No notes for slide

GraniteDS 360|Flex DC

  1. 1. ENTERPRISE RIA WITH FLEX, JAVA AND GRANITEDS 2010, September 22 Franck WOLFF and William DRAI
  2. 2. A comprehensive open source alternative to Adobe server solutions THE PROJECT OPEN SOURCE : LGPLv2 MATURE : Started late 2006 WEB SITE : http://www.graniteds.org COMMUNITY : 650 members (estimated 5000 users) ADOPTION : Many administrations and corporations in Europe, USA and many other countries
  3. 3. PLATFORM STACK
  4. 4. AGENDA LIVE DEMO REMOTING TO JAVA SERVICES PERSISTENCE WITH JPA MESSAGING AND DATA SYNCHRONIZATION SECURITY NUMERIC DATA TYPES (new in GDS 2.2) MODEL-DRIVEN VALIDATION (new in GDS 2.2)
  5. 5. End-to-end typesafety <ul><li>STANDARD SOLUTION : RemoteObject API
  6. 6. Lots of boilerplate code and server-side configuration
  7. 7. Not typesafe, no code-completion
  8. 8. ALTERNATIVE SOLUTION : Tide API
  9. 9. Typesafe client stubs generated by GAS3 for usual Java services (Spring, EJB3, CDI...) </li></ul><ul><li>IDE code-completion </li></ul><ul><li>Simplified configuration (annotation scanning)
  10. 10. Typesafe remote service injection (Spring, CDI beans only)
  11. 11. Numeric types in AS3 are limited to int and Number </li></ul>ACCESSING REMOTE SERVICES (1/2)
  12. 12. @RemoteDestination public class HelloService { public String hello(String name); } [Inject] public var helloService:HelloService; private function hello(name:String):void { helloService.hello(name, saveResult, saveFault ); } private function saveResult(event:TideResultEvent):void { trace(event.result); } private function saveFault(event:TideFaultEvent):void { Alert.show(event.fault.faultCode); } ACCESSING REMOTE SERVICES (2/2)
  13. 13. Simple data management <ul><li>PROBLEMS : Manually write AS3 objects, write a server adapter layer to avoid lazy initialization errors
  14. 14. SOLUTION :
  15. 15. AS3 entities are generated by GAS3
  16. 16. Serialization of JPA detached objects with their full internal state
  17. 17. A local entity cache ensures that each instance exists only once
  18. 18. Transparent lazy loading of collections </li></ul>PERSISTENCE WITH JPA (1/2)
  19. 19. @Entity public class Book { @Id private Long id; @Basic private String uid; @Basic private String title; } [Inject] public var bookService:BookService; private function saveBook():void { var book:Book = new Book(); book.title = titleInput.text; bookService.saveBook(book); } @Stateless public class BookServiceBean implements BookService { @PersistenceContext private EntityManager em; public Book saveBook(Book book) { return em.merge(book) ; } } PERSISTENCE WITH JPA (2/2)
  20. 20. Gravity can scale to thousands of simultaneous clients <ul><li>PROBLEM : Ensure all clients 'see' the same data
  21. 21. POOR SOLUTION : 'Refresh' button
  22. 22. RICH SOLUTION : Use of messaging with the Consumer/Producer pattern (chat)
  23. 23. GraniteDS includes a performant Comet engine (Gravity) that uses the capabilities of the underlying application server (non-blocking I/O, native APR, Servlet 3.0...) </li></ul>MESSAGING (1/2)
  24. 24. Tide data cache + Flex binding = easy data synchronization <ul><li>SIMPLIFIED DATA SYNCHRONIZATION :
  25. 25. 1. GraniteDS detects data updates and pushes them on a messaging topic
  26. 26. 2. The Tide framework merges incoming updates in its local data cache
  27. 27. 3. The UI is automatically updated by the Flex data binding mechanism </li></ul>MESSAGING (2/2)
  28. 28. End-to-end security <ul><li>PROBLEM : Integrate with server authentication and authorization
  29. 29. Built-in Flex Identity component integrated with Java security frameworks (servlet containers, Spring security, Seam security)
  30. 30. Support for web-based authentication (SSO, OpenID...)
  31. 31. Role-based and permission-based authorization </li></ul>SECURITY (1/2)
  32. 32. [Inject] public var identity:Identity ; private function login():void { identity.login(username, password); } private function logout():void { identity.logout(); } // Retrieve current server authentication state private function creationComplete():void { identity.isLoggedIn (); } Role-based authorization <s:Button label='Delete' enabled=' identity.hasRole( &quot; admin &quot; ) '/> Permission-based authorization <s:Button label='Delete' enabled=' identity.hasPermission(book, &quot; delete &quot; ) '/> SECURITY (2/2)
  33. 33. 359.999999999999|Flex Critical for financial data <ul><li>3 PROBLEMS : </li></ul><ul><li>Numeric types in AS3 are limited to int, uint and Number with fixed maximum precision and scale
  34. 34. Computing with Numbers does not offer fine control over rounding modes </li></ul><ul><li>Transferring numeric data between Java server and Flex client loses precision </li></ul>NUMERIC TYPES (1/2)
  35. 35. 360|Flex var a:BigDecimal = new BigDecimal('123.45'); var b:BigDecimal = new BigDecimal('6.789'); var q:BigDecimal = a.divide(b, 5, RoundingMode.FLOOR) ; <ul><li>SOLUTION :
  36. 36. Implementation of Long, BigInteger and BigDecimal types in AS3
  37. 37. No loss of precision during serialization
  38. 38. Simple arithmetic operations implemented, with fine control over decimal expansion </li></ul>NUMERIC TYPES (2/2)
  39. 39. <mx:StringValidator/> <mx:EmailValidator/> … <mx:RegExpValidator/> <ul><li>PROBLEM : Enforce constraints on the client
  40. 40. STANDARD SOLUTION : Flex Validator API
  41. 41. Requires one validator per input
  42. 42. Requires to manually maintain consistency between client-side and server-side validation </li></ul>MODEL-DRIVEN VALIDATION (1/3)
  43. 43. public class Book { [Size(min=&quot;5&quot;, max=&quot;20&quot;)] public function get title():String {...} } <ul><li>ALTERNATIVE SOLUTION : Apply Java Bean Validation API (JSR-303) to Flex
  44. 44. 1. GraniteDS includes a client validation engine implementing the Bean Validation API
  45. 45. 2. The GAS3 generator replicates Bean Validation annotations into AS3 entities
  46. 46. 3. The Flex component FormValidator enforces constraints for all inputs in a form </li></ul>MODEL-DRIVEN VALIDATION (2/3)
  47. 47. <fx:Declarations> <model:Book id='book'/> <v:FormValidator form='{bookForm}' entity='{book}'/> </fx:Declarations> <s:Form id='bookForm'> <s:FormItem label='Title'> <s:TextInput text=' @{book.title} '/> </s:FormItem> </s:Form> MODEL-DRIVEN VALIDATION (3/3) <ul><li>Easy creation of custom constraints
  48. 48. Client and server validations are always consistent (Gas3)
  49. 49. Custom error messages with bundles
  50. 50. Server-side validation errors are also notified to the UI </li></ul>
  51. 51. Q/A THANK YOU www.graniteds.org

×