Seam Glassfish Perspective
Upcoming SlideShare
Loading in...5
×
 

Seam Glassfish Perspective

on

  • 3,388 views

Seam a GlassFish Perspective by Dan Allen

Seam a GlassFish Perspective by Dan Allen

Statistics

Views

Total Views
3,388
Views on SlideShare
3,370
Embed Views
18

Actions

Likes
3
Downloads
111
Comments
0

4 Embeds 18

http://baixoacoplamento.blogspot.com.br 7
http://www.slideshare.net 5
http://baixoacoplamento.blogspot.com 5
http://www.luizavila.com.br 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Seam Glassfish Perspective Seam Glassfish Perspective Presentation Transcript

  • SEAM A GLASSFISH PERSPECTIVE DAN ALLEN JBOSS, A DIVISION OF RED HAT
  • SEAM BRINGS JAVA EE TOGETHER JSF EJB 3
  • SEAM'S MISSION “To provide a fully integrated development platform for building rich Internet applications based upon the Java EE environment.” - Gavin King http://in.relation.to/Bloggers/Seam3
  • WHAT SEAM PROVIDES “Glue” – Contextual component model – Dependency injection framework – Enhanced EL Simplify Java EE trouble spots Manage Java Persistence correctly Modules to integrate third-party libraries Rapid development environment – Project generator, CRUD framework, hot deploy
  • SEAM TODAY JavaServer Faces (JSF) Java Authentication and Authorization Service (JAAS) Facelets Hibernate search Java Persistence API (JPA) Drools Enterprise JavaBeans 3 (EJB 3) JavaScript / Ajax Java Transaction API (JTA) Quartz JAX-RS (RESTeasy) Wicket jBPM GWT JavaMail Spring framework iText (PDF) JBoss Cache JExcelApi (Excel) ...and more YARFRAW (RSS)
  • SEAM EJB COMPONENT EJB Local Reference in web.xml <ejb-local-ref> <ejb-ref-name>vehiclesee/VehicleTradeBean/local</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local>org.example.vehicles.action.VehicleTrade</local> </ejb-local-ref> EJB Local Interface and Seam SFSB component @Local @Stateful public interface VehicleTrade { @Name(quot;vehicleTradequot;) void trade(); public class VehicleTradeBean void remove(); implements VehicleTrade { } public void trade() { ... } @Remove public void remove() {} } How does Seam make the connection?
  • RESOLVING AN EJB IN SEAM A shared concern First option: @JndiName Second option: Resolve JNDI from pattern – #{ejbName} ● Value of name attribute on @Stateful/@Stateless ● Unqualified class name of component ● Value of <ejb-name> in ejb-jar.xml or web.xml – Plug into Seam's jndiPattern SFSB reference stored in Seam context – Default is conversation context
  • INVOKING AN EJB FROM JSF It's not a crime! <h:form> @Stateful ... @Name(quot;vehicleTradequot;) public class VehicleTradeBean <h:commandButton value=quot;Tradequot; implements VehicleTrade action=quot;#{vehicleTrade.trade}quot;/> { </h:form> public void trade() { ... } @Remove public void remove() {} } CLIENT SERVER
  • JAVA PERSISTENCE
  • PERSISTENCE MANAGER JPA EntityManager or Hibernate Session Manages object representations of database records Key services – First-level cache – Transparent database reads/writes Aligns well with use case – Seam terms this a “conversation”
  • CONVERSATION = UNIT OF WORK The task at hand Often involves more than one request Requires state management
  • EXTENDING THE PERSISTENCE CONTEXT Not expensive or dangerous! – “Just a HashMap” Challenging to do in Java EE – No good place to store it – Complex propagation rules We turn over this task to Seam
  • TWO STYLES OF MANAGEMENT Seam (bi)jection Standard Java EE injection @In @PersistenceContext EntityManager entityManager; EntityManager entityManager;
  • EXTENDING THE TRANSACTION Simulate a long transaction – Transcends many database/system transactions Manual flushing of persistence context – You control when write occurs – Rollback without involving database – Persistence context can be read-only – Only Hibernate provides this extension Need to replace JPA provider in GlassFish – Seam provides access to Hibernate extensions – Seam works agreeably with any JPA provider
  • APPLICATION TRANSACTION Conversation (flushMode = MANUAL) Request Response Request Response ... Transaction Transaction load flush
  • EMBEDDED JAVA EE TESTING SeamTest – Based on TestNG Test application “as is” – Full JSF life cycle – JTA, EJB 3, EL Currently uses Embedded JBoss – Has baggage Look forward to EJB 3.1
  • SEAM A GLASSFISH PERSPECTIVE DAN ALLEN JBOSS, A DIVISION OF RED HAT