jboss seam ein jee 5 webframework jörg wüthrich infopoint, 4. februar 2009
TRANSCRIPT
![Page 1: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/1.jpg)
JBoss Seam
Ein JEE 5 Webframework
Jörg Wüthrich
Infopoint, 4. Februar 2009
![Page 2: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/2.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 2 / 28
Inhalt
Einführung
Warum Seam?
Zentrale Konzepte
Demo
Validierung
Abschliessende Gedanken
![Page 3: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/3.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 3 / 28
Einführung
Positionierung
![Page 4: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/4.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 4 / 28
Einführung
Seam ist ein Applikations-Framework für Enterprise Java 5Integriert Java Server Faces (JSF) Enterprise JavaBeans (EJB3) Asynchrones JavaScript und XML (AJAX) Java Persistence API (JPA) Business Process Management (BPM)
Design-Fokus: Elimination von Komplexität auf Architektur- und API-Level
![Page 5: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/5.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 5 / 28
Warum Seam?
Ein einfacher Weg, um mit EJB 3.0 zu beginnen EJB 3.0 unterstützt die Entwicklung
von transaktionalen Business Komponenten
Seam liefert die Integration dieser Komponenten vom GUI bis zur Persistenz-Schicht
![Page 6: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/6.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 6 / 28
Warum Seam?
Der schnellste Weg um "rich" zu werden AJAX Clients kommunizieren mit vielen
asynchronen, konkurrenzierenden Detail-Anfragen mit dem Server
Seam wurde entwickelt mit guter Unterstützung für parallele Zugriffe und ausgereifter Zustands-Verwaltung
Richfaces und ICEFaces sind integriert
![Page 7: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/7.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 7 / 28
Warum Seam?
Der beste Weg, JSF zum Fliegen zu bringen Ersatz der vielen XML-Konfiguration
durch ein paar Annotationen Multi-Windowing Unterstützung Modell-basierte Validierung Saubere Integration von
transaktionalen Ressourcen (JPA, JTA, EJB3)
![Page 8: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/8.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 8 / 28
Warum Seam?
Gute Integration von BPM Optimierung der Arbeits-Abläufe
heute immer wichtiger Voraussetzung, um optimieren zu
können, ist Messbarkeit Workflows verdeutlichen die Arbeits-
Abläufe und ermöglichen Messungen Seam integrierts
![Page 9: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/9.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 9 / 28
Warum Seam?
Persistenz wird zum Kinderspiel Seam ist aus der Hibernate
Community entstanden Seams Konversations-Modell löst
diverse Probleme der traditionell zustandslosen Web Applikationen
![Page 10: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/10.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 10 / 28
Warum Seam?
Beste Unterstützung für CRUD Applikatikonen Seam zu gross für eine einfache
Datenbank-Applikation? „seam-gen“ erstellt kleine
Applikationen mit DB-Anbindung im Nu (vergleiche „ruby on rails“)
![Page 11: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/11.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 11 / 28
Warum Seam?
Automatisierte Integrations-Test Unittests können Interaktionen
zwischen Komponenten nicht testen Seam bietet einen Ansatz, um User-
Interaktionen zu simulieren und so von UI bis zur Persistenz durchgängig zu testen
![Page 12: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/12.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 12 / 28
Zentrale Konzepte
Komponente beliebige POJOs, EJB3s (Session,
Entity, MDB) oder Spring Beans annotiert mit @Name(„...“) lebt immer in einem Kontext (->
zuständig für Lifecycle)
![Page 13: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/13.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 13 / 28
Zentrale Konzepte
Kontext
Event Event Event
Page Page
Conversation Conversation
Event Event
Page
Session
Business-Process
Application
Session
Conversation
Event Event
Page
![Page 14: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/14.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 14 / 28
Zentrale Konzepte
Kontext Event: entspricht einem JSF-Request Page: eine Instanz einer gerenderten Seite Conversation: Arbeitseinheit aus Sicht des Users
(kann mehrere Server-Requests beinhalten) Session: Session-Scope des Servlet-APIs Business-Process: hält Zustand über länger
dauernden Geschäftsprozess, in welchen mehrere Akteure involviert sein können
Application: entspricht Application-Scope von JSF
![Page 15: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/15.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 15 / 28
Zentrale Konzepte
Bijection alle Seam Komponenten werden in einem
Kontext gehalten Injection: eine Komponente wird einer anderen
aus dem Kontext zur Verfügung gestellt Outjection: eine Komponente gibt eine andere
nach Bearbeitung an den Kontext zurück Bijection: Kunstbegriff von Seam, um In- und
Outjection in ein Wort zu fassen
![Page 16: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/16.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 16 / 28
Bijection
Seam Kontext
<<Seam Komponente>>
todoDao:TodoDao@Name("todoDao")public class TodoDao @In @Outprivate Todo todo;
<<Seam Komponente>>
todo:Todo
1. inject „todo“
2. modify „todo“
3. outject „todo“
@Entity @Name("todo")public class Todo implements Serializable {
![Page 17: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/17.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 17 / 28
Beispiel-Anwendung
Demo
![Page 18: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/18.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 18 / 28
Beispiel-Anwendung Seam
edit.xhtml
<<Entity>>Todo
<<Stateful>>TodoDao
Seam Kontext
{@Name("todo")}
{@Name("todoDao")}
<h:outputLabel value="#{todo.title}"/>
<h:commandButton action="#{todoDao.update}"/>
![Page 19: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/19.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 19 / 28
Beispiel-Anwendung JSF
edit.xhtml
<<Entity>>Todo
<<Stateful>>TodoDao
<<managed-bean>>TodoBean
faces-config.xml
{registriert}
<h:outputLabel value="#{todoBean.todo.title}"/>
<h:commandButton action="#{todoBean.update}"/>
JSF Kontext
![Page 20: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/20.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 20 / 28
Klasse TodoDao@Stateful@Name("todoDao")public class TodoDao implements TodoDaoInt {
@In(required=false) @Out(required=false) private Todo todo; @PersistenceContext(type=EXTENDED) private EntityManager em;
@DataModel private List<Todo> todos;
@Factory("todos") @Begin(join=true) public void findTodos() { todos = em.createQuery("select t from Todo t").getResultList(); }
…
![Page 21: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/21.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 21 / 28
Validierung
![Page 22: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/22.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 22 / 28
Validierung@Entity@Name("todo")public class Todo implements Serializable { … private String description;
public Todo () { description =""; } … @NotNull @Length(min=2, max=250) public String getDescription() {return description;}}
![Page 23: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/23.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 23 / 28
Validierung
<tr> <td>Description:</td> <td> <h:inputTextarea id="description" value="#{todo.description}"> <s:validate /> </h:inputTextarea> <h:message for="description" /> </td> </tr>
![Page 24: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/24.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 24 / 28
Validierung JSF
<tr> <td>Description:</td> <td> <h:inputTextarea id="description" value="#{todoBean.todo.description}"> <f:validateLength minimum="2" maximum="250"/> </h:inputTextarea> <h:message for="description"> </td> </tr>
![Page 25: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/25.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 25 / 28
Validierung erweitert<f:facet name="beforeInvalidField"> <h:graphicImage styleClass="errorImg" value="error.png"/></f:facet><f:facet name="afterInvalidField"> <s:message styleClass="errorMsg" /></f:facet><f:facet name="aroundInvalidField"> <s:div styleClass="error"/></f:facet>
<s:validateAll>
<tr><td>Description:</td> <td> <s:decorate> <h:inputTextarea id="description" value="#{todo.description}" cols="50" rows="10"/> </s:decorate> </td> </tr>
<s:validateAll>
![Page 26: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/26.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 26 / 28
Abschliessende Gedanken zu Seam
Seam ist nicht alleine einsatzfähig – liefert Zusammenhalt für diverse Komponenten-Frameworks
Setzt Kenntnis der zu integrierenden Technologien voraus
Performance??
![Page 27: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/27.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 27 / 28
Referenzen
Dokumentation zu Seam: http://www.seamframework.org/Seam Referenz-Dokumentation: http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/Seam Tutorial mit JSF-Vergleich: http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Getting_Started/index.html
![Page 28: JBoss Seam Ein JEE 5 Webframework Jörg Wüthrich Infopoint, 4. Februar 2009](https://reader035.vdocuments.net/reader035/viewer/2022062312/55204d7e49795902118cfe00/html5/thumbnails/28.jpg)
04.02.2009 Infopoint - JBoss Seam - Jörg Wüthrich 28 / 28
Referenzen
JBoss Seam – die Webbeans Implementierung (http://www.webbeans.eu/ISBN 978-3-446-41190-6)
Seam in Action(http://www.manning.com/dallen/ISBN 978-1-933988-40-1)