Introduction to Seam Applications


Published on

An introduction to JBoss Seam framework

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introduction to Seam Applications

  1. 1. Introduction to Seam Applications Nuwan Gunarathna
  2. 2. Agenda <ul><li>Common WebApp Development Patterns.
  3. 3. Why Seam?
  4. 4. Features.
  5. 5. CRUD App demo with seam-gen.
  6. 6. Q&A </li></ul>
  7. 7. Today’s Web Applications <ul><li>Too many layers </li><ul><li>Too many Integration Points
  8. 8. Too much Xml configuration </li></ul><li>For new features, You have to lean new Frameworks
  9. 9. “ Stateless” Architecture
  10. 10. JSF falls short – Not fully enough for Web 2.0
  11. 11. Not a platform, merely a set of libraries and wrappers
  12. 12. Documentation is not at one place(Too many dependent frameworks) </li></ul>
  13. 13. Why Seam? <ul><li>To provide a Complete solution for Java Web Application </li><ul><li>Whithin an Application </li></ul><li>Is it good? Yes. </li></ul>Gavin King
  14. 14. Some Good Reasons <ul><li>Stateful Wep Applications </li><ul><li>All components are inherently stateful – no need state management Code </li></ul><li>Configuration by Exception( convention over configuration ) </li><ul><li>Idea is to have a common-sense default behaviors for components </li></ul><li>Gluing JSF and EJB3 across framework boundaries. </li><ul><li>Collapse artificial façade object layer in between </li></ul><li>Annotation based integration
  15. 15. Gives correct wayt to use ORM </li><ul><li>Lazy loading just works fine: Eliminate most encountered Exception with stateless frameworks all the time
  16. 16. Only framework that support lazy loading correctly in web application </li></ul></ul>
  17. 17. Some Good Reasons cont.. <ul><li>No more DTOs to write
  18. 18. POJO as business services </li><ul><li>No framework interfaces, No Abstract classes
  19. 19. Using dependency bijection </li></ul><li>App Generator via seam-gen (aka scaffolding)
  20. 20. It makes persistence a breeze
  21. 21. Annotations over XML, end to end
  22. 22. Automated integration testing using TestNg and JUnit
  23. 23. And many more … (Rules Engine, BPM, Ajax Support, Pdf, E-mail, RESTful …)
  24. 24. Open source. Open standards. Future of Java EE </li></ul>
  25. 25. Layers in Seam View (JSF/Wicket/GWT/Flex etc.,) Business Layer (SFSB/SLSB/POJO) DB Persistence Layer (Entities) Hey, No Integration Layer! <ul>Seam exposes Business Layer objects and their attributes on the front-end using EL expressions. <li>No DAOs
  26. 26. No DTOs </li></ul>
  27. 27. Contextual Components <ul><li>Most of the problems relate to state management
  28. 28. Traditional contexts for Java Servlets focused on technology instead of on application
  29. 29. EJB itself has no strong model of state management
  30. 30. We need a richer context model that includes “logical” context
  31. 31. We should be able to use annotations everywhere
  32. 32. An EJB should be able to be a JSF managed bean (vice versa)
  33. 33. Main idea: realization of desktop-like wizards and dialogs, possibly in parallel
  34. 34. It makes sense to think of binding EJB components directly to the JSF view </li></ul>
  35. 35. The Seam Context Model *source:
  36. 36. Conversations <ul><li>Conversations are not that exciting until you really start thinking about them:
  37. 37. Multi-window operation
  38. 38. “ Workspace Management”
  39. 39. Stack of continuable states (nested conversation)
  40. 40. No more HttpSession object </li><ul><li>Reduce codes and memory leaks </li></ul><li>Avoid unexpected behaviors with multiple browser windows </li></ul>
  41. 41. Conversations Cont.. <ul><li>Allows multiple concurrent state containers for a single user over HTTP session
  42. 42. Each conversation resides in its own Browser or Tab </li></ul>User Session Browser1 Browser2 Browser3 User Concurrent Conversations C3 C2 C1
  43. 43. Page Flow/Navigation Rules <ul><li>Seam specific file to enhance page navigation </li></ul><ul><ul><li>pages.xml integrates stateful components </li></ul><li>Manage complicated navigation flows based on current state of the application
  44. 44. Define navigation rules for each page
  45. 45. Flow is based on events and conditions </li></ul>
  46. 46. New Programing Patterns <ul><li>EntityHome </li><ul><li>Manage persistence state of a single Object
  47. 47. CRUD operations
  48. 48. • persist();
  49. 49. • getInstance();
  50. 50. • update();
  51. 51. • remove(); </li></ul><li>EntityQuery </li><ul><li>Manage JP/EJB QL(Query Language) result se t </li></ul></ul>
  52. 52. Ajax Support <ul><li>Seam's totally unique concurrency model and state-management model was conceived and designed with AJAX in mind.
  53. 53. Page Wide Support (region, zone) </li><ul><li>Add support to existing components
  54. 54. Sub view processing
  55. 55. Partial tree rendering, partial page refresh </li></ul><li>Component Wide </li><ul><li>Ajaxified components
  56. 56. Client validations </li></ul></ul>
  57. 57. Integration Testing <ul><li>Seam components can easily be tested in TestNG or Junit
  58. 58. The JBoss Embeddable EJB3 container is a great platform for integration testing: perform an end to end testing in it’s own embeddable container -- in a single unit test!
  59. 59. Test he entire flow of a request or conversation
  60. 60. Test all layers of Java code in the application, from presentation to persistence. </li></ul>
  61. 61. Seam-gen <ul><li>Generate a project structure with build
  62. 62. Generate CRUD views
  63. 63. Reverse engineering of POJOs
  64. 64. Entity model validations enforced with ajax feedback
  65. 65. Generates Ant build script itself
  66. 66. Ready made project files for eclipse, netbeans, idea
  67. 67. Basic page level authorization
  68. 68. Datasource creation and configuring persistence layer
  69. 69. Richfaces Ui components </li></ul>
  70. 70. Other Technologies? <ul><li>But what about Spring, Spring MVC, Grails, hibernate stack or JSF?
  71. 71. Grails ... Probably. </li><ul><li>Leverage the Groovy programming language </li></ul><li>But Seam is: </li><ul><li>An “application stack” not a “web framework”
  72. 72. A unified development platform of {programming model, frameworks, best practices and tooling} </li></ul></ul>
  73. 73. Resources <ul><ul><li>Reference docs, more than 30 examples, forums and best overall place -
  74. 74. Richfaces 3.3 -
  75. 75. Richfaces book – Practical Richfaces (Max Katz)
  76. 76. JSF 2 (includes “seam” like features) -
  77. 77. EJB 3.1 -
  78. 78. Seam Books – Seam in Action (Dan Allen) & Seam Framework – Experience the evolution of Java EE (Jacob Orshalick)
  79. 79. Tools: JBoss Tools for Eclipse. Intellij and Netbeans also have excellent support for Seam </li></ul></ul>