Jboss Seam
-
Upload
slimen-belhaj-ali -
Category
Technology
-
view
381 -
download
0
description
Transcript of Jboss Seam
1
JBOSS SEAM
PLAN
2
PRÉSENTATION DU FRAMEWORK
MODÈLE COMPOSANT SEAM
CONCEPTS TECHNIQUES DU FRAMEWORK
CONCLUSION
INTRODUCTION
3
Le framework JBoss Seam est un framework Open Source
à l'initiative de Gavin King
(fondateur du framework Hibernate).
Premiere version:seam 1.0 sortie en juin 2006
4
FRAMEWORK JBOSS SEAM
Un framework fournissant un modèle
de composant, une API et des annotations.
5
Un framework destiné à la simplification du développement des applications web complexes.
Un framework basé sur des concepts de la spécification JAVA EE 5.
FRAMEWORK JBOSS SEAM
6
Modèle de composant(processus métier et persistance)
MODÈLE COMPOSANT SEAM
Deux composants d’architecture clefs pour la création des applications web
Couche présentation
7
MODÈLE COMPOSANT SEAM
8
MODÈLE COMPOSANT SEAM
8
<h:commandButton action="#{universite.trouverClasse(filiere, niveau)}" value=“classe"/>
9
JBoss EL
Intégration jsf,ejb3.0
Expressions paramétrées
MODÈLE COMPOSANT SEAM
Seam-gen
10
Jboss tools
Outillage
MODÈLE COMPOSANT SEAM
11
DEMO
11
12
SEAM-GEN
Demo
12
Contextes aplicatifs
13
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Contexte Business Process @scope(Business_Process)
Contexte stateless @scope(STATELESS)
Contexte event @scope(EVENT)
Contexte page @scope(PAGE)
Contexte session @scope(SESSION)
Contexte application @scope(APPLICATION)
Contexte conversation @scope(CONVERSATION)
Gestion des événements assynchrones avec seam
14
@RaiseEvent("postAdded ")
@RaiseAsynchronousEvent(« postAdded »)
EVENT:Déclencher l’événement dans le corps de la méthode
Déclencher l’événement sur l’appel d’une méthode
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Gestion des événements assynchrones avec seam
15
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Observer:
@Observer("postAdded ")
Gestion des événements assynchrones avec seam
16
<components> <event type="PostAdded"> <action execute="#{PostAddedListener.inform}"/> </event> </components>
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Gestion de la conversation
17
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Manière explicite:des javabeans declarés dans le contexte conversation
Manière implicite:composant type ejb statefull
Gestion de la conversation
18
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
19
Gestion de la conversation
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Demo
Gestion de la conversation
20
Conversation mère
Sous_conversation1
Sous_conversation1.2
Sous_conversation2
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Nested conversation
21
@In
@Out
<component name="entityManager" scope="session" auto-create="true" class="org.jboss.seam.core.ManagedPersistenceContext"> <property name="persistenceUnitJndiName">java:/odaceEntityManagerFactory</property> </component>
Principe de l’injection et de la bijection
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
@Name("connection")
@Scope(ScopeType.SESSION)
public class ConnectionBean implements Connection {
String id;
String password;
@In("entityManager")
EntityManager em;
…
}
21
@Stateless @Name("useraction") public class UserAction implements UserIt { @In @Out private User user; @Out private List userList; @PersistenceContext private EntityManager e
m; public String addAndDisplay() { user = new User (); userList = em.createQuery("From User u order by u.name").getResultList(); return null; }
@In
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Principe de l’injection et de la bijection@Out
22
23
Page flow
Browse.xhtml
Checkout.xhtml
Complete.xhtml
browse
checkout checkout
complete
Process shopping<pageflow-definition […] name="shopping"><start-state name="start"><transition to="browse"/></start-state><page name="browse" view-id="/browse.xhtml" redirect="true"><transition name="browse" to="browse"/><transition name="checkout" to="checkout"/></page><page name="checkout" view-id="/checkout.xhtml" redirect="true"><transition name="checkout" to="checkout"/><transition name="complete" to="complete"/></page><page name="complete" view-id="/complete.xhtml" redirect="true"><end-conversation /></page></pageflow-definition>
Pageflow.jpdl.xml@Begin(join=true, processDefinition="shopping")public String doSearch() {…}
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Authentification
Identity contient les méthodes pour l'authentification et la connaissance l'état de
l'utilisateur (loggé ou non etc ...)
24
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Deux composants Seam pour l’authentification:
Credentials contient les données de l'utilisateur.
25
Démo Authentification
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
RichFaces et IceFaces
(composants graphiques riches)
26
Integration ajax 1/2
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Librairies JSF
Ajax4JSF : extension Ajax des composants JSF de base
Seam remoting
27
Integration ajax 2/2
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
Appel de méthode distante comme si elle était locale.
@WebRemote
mycomponent=seam.compenent.getinstance(‘’mycomponent’’)
28
Integration avec seam framework
CONCEPTS TECHIQUES DU FRAMEWORK SEAM
JBOSS server =>Weblogic, WebSphere,OC4J,Tomcat,Glassfish
JSF =>Wicket, Tapestry, GWT, ou Flex
EJB =>POJO, Composant Spring
JExcelApi
YARFRAW
iText
Jboss-Seam-Mail
CONCLUSION
29
Seam a apporté une vraie valeur ajoutée à notre projet JSF/EJB3/JPA et nous a permis de gagner en productivité.
30
*Merci pour votre attention
*