JBoss Seam Introduction Xiaogang Cao, RedSaga

Slides:



Advertisements
Similar presentations
Apache Struts Technology
Advertisements

ISE 390 Dynamic Web Development Java EE Web Applications.
Spring, Hibernate and Web Services 13 th September 2014.
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
JBoss Seam: Contextual Components Jason Bechtel
© 2005, Cornell University. Rapid Application Development using the Kuali Architecture (Struts, Spring and OJB) A Case Study Bryan Hutchinson
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
© Internna Technologies 1 IWebMvc Features, Possibilities & Goals.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
WebWork in Action An introduction to WebWork Patrick A. Lightbody.
JavaServer Faces: The Fundamentals Compiled from Sun TechDays workshops (JSF Basics, Web-Tier Codecamp: JavaServer Faces, Java Studio Creator; IBM RAD)
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
Spring Overview, Application demo -Midhila Paineni 09/23/2011 Spring Overview, Application demo9/8/20151.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
JBoss Seam Presented by Andy Nguyen Truc Pham. What is JBoss Seam? Created by Gavin King Created by Gavin King A lightweight framework for Java EE 5.0.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
J2EE Structure & Definitions Catie Welsh CSE 432
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
CHEF II / Sakai Architecture. CHEF II Changes uPortal replaces Jetspeed –jsr 168 portlet, servlet compliant Spring replaces Turbine component framework.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Presentation. Recap A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate. Taken advantage of Spring’s multi layer.
JavaEE Seams Easy JBoss Seam: A Web Application Component Framework for EJB3, JPA, JSF and AJAX.
Peter Laird. | 1 Building Dynamic Google Gadgets in Java Peter Laird Managing Architect WebLogic Portal BEA Systems.
Introduction to Web Dimitar Nenchev Ivan Nakov
1 Apache TomEE // JavaEE Web Profile on Tomcat Jonathan #TomEE.
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
.  A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate.  Taken advantage of Spring’s multi layer injection.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
Spring and DWR Frameworks for Rich Web Enterprise Application Thomas Wiradikusuma Presentation to the 20 th.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
JAVA EE 6 Best Practices for Migrating Spring to WTF ?!?
Presentation.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Apache Struts Technology A MVC Framework for Java Web Applications.
Apache TomEE Tomcat with a kick. Apache TomEE: Overview ● Java EE 6 Web Profile certification in progress ● Apache TomEE Includes support for: ● Servlet.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
Form Builder Tomáš Černý Michael J. Donahoo Eunjee Song Department of Computer Science Baylor University, Waco, TX.
J2EE Platform Overview (Application Architecture)
Structure of a web application
ORACLE ADF ONLINE TRAINING COURSE
Field of Dreams An Online Sporting Goods Marketplace
Introduction to J2EE Architecture
Unit 6-Chapter 2 Struts.
PHP / MySQL Introduction
Migrating Oracle Forms Using Oracle Application Express
Sakai WebApp Structure
SharePoint-Hosted Apps and JavaScript
Design and Maintenance of Web Applications in J2EE
Intro to Spring CJUG - January 2013.
ISE 390 Dynamic Web Development
Distributed System Using Java 2 Enterprise Edition (J2EE)
Lecture 1: Multi-tier Architecture Overview
Evaluating Compuware OptimalJ as an MDA tool
JavaServer Faces: The Fundamentals
Web Application Server 2001/3/27 Kang, Seungwoo. Web Application Server A class of middleware Speeding application development Strategic platform for.
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Developing and testing enterprise Java applications
Back end Development CS Programming Languages for Web Applications
Enterprise Java Beans.
CS4961 Software Design Laboratory Understand Aquila Backend
Back end Development CS Programming Languages for Web Applications
Presentation transcript:

JBoss Seam Introduction Xiaogang Cao, RedSaga

MVC  Pros pull the page logic out of mud A clean structure of request process  Cons It ’ s only focus on request/response Modal and View are linked static Very hard to abstract ‘ widgets ’ in web pages  I dreamed : XML,DB,entity, web based data window been unified

The Seam way  Consider the whole web app in a human understandable way  Servlet Context is not enough, people have to write codes to manage state everywhere  Seam unified all state management to ‘ Declared State Management ’  The core cool feature of Seam is ‘ Conversation Context ’

Conversations Samples  Create Order: Select a customer Check balance Add a product to detail list Add more products Confirm and assign a Order Number

Conversations Samples(cont.)  Online Digital Photo Print Wizard Browse for photos, add them to print cart Review and update print qty Print them  User profile update wizard View and begin edit of user profile Add a photo Edit details Review changes Confirm change

Seam ’ s Contexts  Stateless context  Event (or request) context  Page context  Conversation context  Session context / Http Session  Business process context / JBPM  Application context  Contexts.lookupInStatefulContexts()

Conversation context  Conversation spans more than one page  Conversation is a whole interaction of a certain task  Conversation may means a ‘ User Story ’ or a ‘ Use Case ’  Nothing magic it ’ s implemented by url param(ServerConversationContext) or a client param(ClientConversationContext) Contexts Class use ThreadLocal to store all contexts.

Conversation Lifecycle  Conversation have timeout  Conversation doesn ’ t result to a transaction  Conversations can be nested  Conversation can be merged by same id  Conversation can be managed by ‘ workspace ’

Business Process Context  BusinessProcessContext can span more than 1 user  jBPM backend  Sample

The meaning of 2 additional context  Make program much more clear and easy to understand  Use conversations and Business Process (jBPM) directly in JSF  Eliminate the chance of silly mistakes and memory leaks  Reduce the debug time  You never want to convert back

Events  Events JSF events  jBPM transition events  Seam page actions  Seam component-driven events  public class HelloWorld public void sayHello() { FacesMessages.instance().add("Hello World!"); } } Seam contextual events  Lots of build-in events, such as org.jboss.seam.validationFailed  No Event object exists in seam. You can pass params if needed

Seam Component  Seam component is a mix of jsf backingbean(managed bean),service class(normally named as ***Manager or **Service. )  It can maintain the states for your objects  It can be Stateless session beans Stateful session beans Entity beans JavaBeans Message-driven beans

Seam Component (cont.)  The key of lightweight container is Dependency Injection (DI).  DI uses the lightweight framework container to inject services or other objects into a POJO.  The major differences between lightweight frameworks are how they wire container services together and implement Dependency Injection. The service architecture and metadata expression are the key issues here.  ‘ Components ’ are the ‘ Spring beans ’ in Seam world  Components have the ability to be wired in Web tier  ----Michael Juntao YuanMichael Juntao Yuan

Seam Component public class Greeter implements Serializable { private long id; private String public long getId() { return id;} public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }  Please enter your name:

Seam Component @Name("manager") public class ManagerAction implements Manager private Greeter private List private EntityManager em; public String sayHello () { em.persist (greeter); allGreeters = em.createQuery("from Greeter g").getResultList(); return null; } }  The following persons have said "hello" to JBoss Seam:  above codes from Michael Yuan,

Seam bijection  In other containers DI happens only when the POJO is created Injection is the action between container and beans the reference does not subsequently change for the lifetime of the component instance This is good for stateless beans  For a stateful component, we need to change the reference within different context  In Seam injection and outjection are the action between context and components DI happens when the context switches

Seam bijection(cont.)  Bijection is Contextual  Reference can change in difference context bidirectional  Values are ‘ Injected ’ from context, and also ‘ Outjected ’ to the context dynamic Bijection and contextual components are the soul of Seam!

Other cool stuffs  JSF with EJB 3.0 (Ajax4jsf,icefaces,..)  Enhance to JSF EL  Validation  Conversation written with JPA considered  Build-in Testable  Build-in BPM  Build-in Security  Build-in mail, webmail as a option

Develop simplified  Rails style seam-gen  Template based generation  EL support in HQL/EJB-QL  simplified annotation based configuration

Highly integrated  JSF  EJB3/JPA  JAAS authentication  JSP  Unified EL  JavaMail  Portlet  buni-meldware mail/web mail  Facelets  jBPM  Hibernate  iText  Drools  JCaptcha  Ajax4JSF  ICEFaces  Spring  MyFaces  Jboss microcontainer

EJB 3.0 or Java Beans?  Both EJB 3.0 session beans and entity beans are supported as a component  Java Beans also supported  EJB 3.0 have declared transactions and state replicate capability  Use Java Beans instead of EJB 3.0 allow you use Seam directly in Tomcat, not a EJB 3.0 container  Java Beans support hot deploy

EJB 3.0 and JavaBeans(Cont.)  booking example have several versions /examples/booking is a EJB 3.0 version /examples/hibernate is a Hibernate 3.0 version /examples/icefaces is using icefaces instead of Ajax4JSF /examples/glassfish is a version runs on Java EE 5 reference implementation  Tips: Seam has a lot of well written completed examples comparing to hibernate

Seam and JSF  EJB 3 beans are JSF managed Beans  Actually every Component are JSF managed Beans  Currently JSF is the only view supported  Seam will be a main strength to promote JSF  However, JSF is not very popular in China now

Seam and iText  Pros: Seam use facelets document to generate PDF  Cons: Still like a toy, comparing to Crystal Reports or JReport Report is one of very important feature in real world Suggest to use JasperReports as a solid report tool  Tips: Foxit Reader ActiveX can render PDF in lighting speed within the IE browser.

Seam and AJAX  Interface.js  Remote.js  Make the AJAX call Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback);  Return fields is been controlled at server = {"widgetList.secret", "widgetMap[value].secret"}) public Widget getWidget();  Return Data is typed Primitives / Basic Types,String, Date,Number, Boolean,Enum, Bag, Map  Support subscribe to JMS topic

Seam and AJAX(Cont.)  Pros: Seam remoting allow seam been used with other client JS library Currently two open source JSF-based AJAX solutions: ICEfaces and Ajax4JSF  Cons: Actually, RichFaces also like a toy comparing to dojo or Ext AJAX design pattern is still evolving. Especially in a portal page. Current Seam remote.js is tied too tight with JSF. It ’ s possible to write a customized Ext dataset to communicate with Seam Remoting, but require many codes. Hope it can support JSON/Burlap in the future and support a dataSet model

Seam PageFlow  Pros:jPDL visiable XML define  Cons: you must use jBPM

Seam Security  Simple mode and Advanced mode Advanced mode use Drools, provide rule based security checks  Authenticate built upon JAAS offers a much more simplified method of authentication  Authorization Security API for securing access to components, component methods, and pages Role based security check  Security is a major advantage comparing to other frameworks like ROR.

Seam and persistence  Tight integration with EJB 3.0 entity bean,JPA and Hibernate  No need to say more!

Conclusion  Seam is the most advanced J2EE stack now State Management is the most important feature But Seam is also heavy and complex Still lack of advanced Report ability AJAX support is behind era  You must use JSF to gain max benefit But JSF is not popular enough  Seam can simplify your code Remove glue codes between layers  Some of Seam function is not standard yet No, but maybe that isn ’ t a problem, just like the success of hibernate in EJB 2.0 era.

Conclusion(cont.)  Ruby improve productivity by using dynamic language and provide a ready to use Rails framework  ROR is lack of wide range of libraries support comparing to Java  Seam introduce Contextual Components, which will dramatically improve java programmer ’ s productivity  But Seam ’ s inner complex will cost more time for developers to go in deep

Hope  resolve the problem of EJB 3 beans hot deploy, that ’ s really a handy feature  Add more views besides JSF. How about Eclipse RAP or Ext? Current client conversation can be used in a full AJAX solution.  Exadel can improve the usability of Seam

About redsaga  an open source community only for matures  Open source project hosting service available for good projects  Contributed to Hibernate & Spring by organize the translate of reference documents and write book in Chinese Hibernate Core Hibernate Annotations Hibernate EntityManager Spring Reference  Seam Reference translation in progress and open for volunteers 1+GA+Reference+Translate+Overview 1+GA+Reference+Translate+Overview Coming soon! 