jboss seam

30
1 JBOSS SEAM

Upload: slimen-belhaj-ali

Post on 21-Dec-2014

381 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Jboss Seam

1

JBOSS SEAM

Page 2: Jboss Seam

PLAN

2

PRÉSENTATION DU FRAMEWORK

MODÈLE COMPOSANT SEAM

CONCEPTS TECHNIQUES DU FRAMEWORK

CONCLUSION

INTRODUCTION

Page 3: Jboss Seam

3

Page 4: Jboss Seam

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

Page 5: 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

Page 6: 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

Page 7: Jboss Seam

7

MODÈLE COMPOSANT SEAM

Page 8: Jboss Seam

8

MODÈLE COMPOSANT SEAM

8

Page 9: Jboss Seam

<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

Page 10: Jboss Seam

Seam-gen

10

Jboss tools

Outillage

MODÈLE COMPOSANT SEAM

Page 11: Jboss Seam

11

DEMO

11

Page 12: Jboss Seam

12

SEAM-GEN

Demo

12

Page 13: Jboss Seam

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)

Page 14: Jboss Seam

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

Page 15: Jboss Seam

Gestion des événements assynchrones avec seam

15

CONCEPTS TECHIQUES DU FRAMEWORK SEAM

Observer:

@Observer("postAdded ")

Page 16: Jboss Seam

Gestion des événements assynchrones avec seam

16

<components> <event type="PostAdded"> <action execute="#{PostAddedListener.inform}"/> </event> </components>

CONCEPTS TECHIQUES DU FRAMEWORK SEAM

Page 17: Jboss 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

Page 18: Jboss Seam

Gestion de la conversation

18

CONCEPTS TECHIQUES DU FRAMEWORK SEAM

Page 19: Jboss Seam

19

Gestion de la conversation

CONCEPTS TECHIQUES DU FRAMEWORK SEAM

Demo

Page 20: Jboss Seam

Gestion de la conversation

20

Conversation mère

Sous_conversation1

Sous_conversation1.2

Sous_conversation2

CONCEPTS TECHIQUES DU FRAMEWORK SEAM

Nested conversation

Page 21: Jboss Seam

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

Page 22: Jboss Seam

@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

Page 23: Jboss Seam

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

Page 24: Jboss 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.

Page 25: Jboss Seam

25

Démo Authentification

CONCEPTS TECHIQUES DU FRAMEWORK SEAM

Page 26: Jboss 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

Page 27: Jboss Seam

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’’)

Page 28: Jboss Seam

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

Page 29: Jboss Seam

CONCLUSION

29

Seam a apporté une vraie valeur ajoutée à notre projet JSF/EJB3/JPA et nous a permis de gagner en productivité.

Page 30: Jboss Seam

30

*Merci pour votre attention

*