introduction to jboss seam
TRANSCRIPT
![Page 2: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/2.jpg)
Agenda
• What is Seam ?, The goal of this talk• Java EE 5 Programming Model
• Java Server Faces (JSF)
• Enterprise Java Bean 3.0 (EJB)
• Example Application
• What can be improved
• Seam• Key features
• Demo With JBoss Developer Studio
• The Contextual Component Model
• Bijection
• Demo
• Conversations and Workspace management
• Demo
• Seam and Object/Relational Mapping
• Demo
![Page 3: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/3.jpg)
Agenda
• Seam• JSF Validation in Seam
• Demo
• Security
• Demo
• Pageflows and Business Processes
• Event, Interceptors and Exceptions
• Demo
• Demo
• Testing Seam applications
• Demo
• Seam and others frameworks
• What’s coming
• Questions
• References
![Page 4: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/4.jpg)
What is Seam
• Seam is an application framework for Java EE 5 that simplify the development of web application”• Unify the 2 main Component models in Java EE 5, EJB 3.0 &
JSF
• Designed for Stateful Application
• Design with ORM in mind
![Page 5: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/5.jpg)
Java EE 5
• Java EE 5 is a major step forward from J2EE
• Java Server Faces
• EJB 3.0
![Page 6: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/6.jpg)
Java Server Faces
• Component Based MVC
• Component model for widget
• Embedded in Template language
• No more JSP, Facelets
• Component model for application logic, Managed Bean
• JavaBean component with xml deployment descriptor
• Stateful component attached to a context (request/session/application)
• EL for mapping between the 2 component models
• Other stuff like Validators and Converters
![Page 7: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/7.jpg)
EJB 3.0
• Transaction• Declarative Transaction Management
• Transaction Propagation
• Persistence• JPA, Java Persistence 1.0
• Persistence Context, Extended Persistence Context (for Optimistic Transaction)
• Interceptor for AOP
• Others Services• Concurrency, Security, Distributed Object, Asynchronous
Messaging, Naming, Timer Services
![Page 8: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/8.jpg)
EJB 3.0
• Stateful Session Bean
• Stateful Component that can be clustered
![Page 9: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/9.jpg)
Example ApplicationA Java EE 5 Application
![Page 10: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/10.jpg)
Entity BeanMark the Class
as an Entity
All entity must have an Id
Define the DatabaseConstraints using
Hibernate Validators
![Page 11: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/11.jpg)
Stateless Session Bean
The PC is injected
Mark the Classas Stateless
Session Bean
![Page 12: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/12.jpg)
JSF Search Page
![Page 13: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/13.jpg)
The JSF Life Cycle
![Page 14: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/14.jpg)
JSF Edit Page
![Page 15: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/15.jpg)
JSF Managed Bean
![Page 16: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/16.jpg)
Managed Bean Deployment Descriptor
![Page 17: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/17.jpg)
Navigation Rules
![Page 18: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/18.jpg)
What can be improved
• The concern of the Managed Bean is “Glue”• Layering is useful but does not have to be the first priority and
should not be imposed by the spec
• The Backing Bean isolate the Presentation from the Business Tier in a Wrong Way
• Calling the Session Bean directly make sense,
• Validation in JSF, Backing Bean and Entity Bean
• XML in JSF is very verbose
![Page 19: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/19.jpg)
What can be improved
• HttpSession is not the right place to store application state
![Page 20: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/20.jpg)
JBoss Seam
![Page 21: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/21.jpg)
Key Features of Seam
• Unify the 2 components Models• Remove the JSF Backing Bean
• Connect the Session Bean to the View
• No more verbose XML
![Page 22: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/22.jpg)
Key Features of Seam
• Natural Period of user Action
• Multi-tab with the conversation context
• WorkFlow, Wizard (stateful navigation)
• Business Process Management ( ex: Amazon order)
![Page 23: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/23.jpg)
DEMO
• Create a Seam application with JBoss Developer Studio
• First Application tour
• JBoss Developer Studio
• The project skeleton
• The Facelets template
• Login/logout functionality
![Page 24: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/24.jpg)
The Contextual Component Model
• The 3 built-in contexts are not especially meaningful from the point of view of the business logic
• Most components are scoped to the conversation or the Business Process context
• Contexts are created and destroyed by the framework or in some case via annotation
![Page 25: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/25.jpg)
The Contextual Component Model
• Seam Contexts• Stateless context
• Event context (request)
• Page context• attached to the page, useful for clickable list, ...
• Conversation context• one of the most powerful concept provided by Seam
• Session Context
• Business process context• longer than session, (eBay auction)
• Application Context
![Page 26: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/26.jpg)
The Contextual Component Model
• Seam component• Stateless Session Bean (SLSB)
• Stateful Session Bean (SFSB)
• Entity Bean
• Java Bean
• Message Driven Bean (MDB)
• Interception
![Page 27: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/27.jpg)
Bijection
• Seam emphasizes the concept of Stateful component, traditional DI is no longer very useful
• Bijection is : • Contextual, assembles various component from different context.
(even from narrower context)
• Bidirectional, values are injected from the context variables when the component is invoked and outjected back into the context variables.
• Dynamic, since values of contextual variable changes over time and since component are stateful, bijection takes place every time a component is invoked
![Page 28: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/28.jpg)
DEMO
• Seam Contextual Component Model
• Bijection
![Page 29: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/29.jpg)
Seam and Persistence
• Introduction• The optimistic transaction problem
• The EJB 3.0 improvement
• Seam’s solution
• Seam managed transactions• Seam managed persistence context
![Page 30: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/30.jpg)
JSF Validation in Seam
• The DRY Concept• JSF Tags
![Page 31: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/31.jpg)
DEMO
• Seam Validation
• Seam’s JSF Validation Tags
![Page 32: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/32.jpg)
Security in Seam
• Simple security• Advanced Security using JBoss Rules (Drools)
![Page 33: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/33.jpg)
Other Stuff
• Email Using Facelets Template• PDF Using Facelets Template
![Page 34: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/34.jpg)
Other Stuff
• Remoting• Web Services• Portal• Integration with different App Servers
![Page 35: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/35.jpg)
Seam and Other Frameworks
• Seam and GWT
• Seam and Spring
• Sean and Wicket
• Seam and Adobe Flex
• Groovy Integration
![Page 36: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/36.jpg)
What’s coming
• JAVA EE 6.0 (JSR 316)
• EJB 3.1 (JSR 220)
• JPA 2.0 (JSR 317)
• JSF 2.0 (JSR 314)
• Web Beans (JSR 299)
![Page 37: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/37.jpg)
EJB 3.1 New Features
• EJB Interfaces are Optional• Singleton Bean (@Singleton)• Concurrency• Direct use in the Servlet container (War file)• Stateful Web Services using SFSB
![Page 38: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/38.jpg)
JPA 2.0
• More flexible Model• Support for Collection of basic type (String, ...)• @OrderedList• Bean Validation (JSR 303)
![Page 39: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/39.jpg)
Questions ?
![Page 40: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/40.jpg)
References
• JBoss Seam http://www.seamframework.org
• JBoss Community http://www.jboss.org
• Java EE 5 http://java.sun.com/javaee
• EJB 3.0 http://java.sun.com/products/ejb
• JSF http://java.sun.com/javaee/javaserverfaces
• Facelets http://facelets.dev.java.net
• Web Beans http://jcp.org/en/jsr/detail?id=299
![Page 41: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/41.jpg)
Books
![Page 42: Introduction to JBoss Seam](https://reader035.vdocuments.mx/reader035/viewer/2022071602/613d5639736caf36b75c20df/html5/thumbnails/42.jpg)
Thank you !