SlideShare a Scribd company logo
1 of 17
Download to read offline
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

More Related Content

What's hot

Ejb 2.0
Ejb 2.0Ejb 2.0
Ejb 2.0
sukace
 
15 expression-language
15 expression-language15 expression-language
15 expression-language
snopteck
 

What's hot (17)

EJB Interview Questions
EJB Interview QuestionsEJB Interview Questions
EJB Interview Questions
 
Java EE 7 - New Features and the WebSocket API
Java EE 7 - New Features and the WebSocket APIJava EE 7 - New Features and the WebSocket API
Java EE 7 - New Features and the WebSocket API
 
WEB TECHNOLOGIES JSP
WEB TECHNOLOGIES  JSPWEB TECHNOLOGIES  JSP
WEB TECHNOLOGIES JSP
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
Struts 2 - Introduction
Struts 2 - Introduction Struts 2 - Introduction
Struts 2 - Introduction
 
Jsf+ejb 50
Jsf+ejb 50Jsf+ejb 50
Jsf+ejb 50
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 
Spring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCSpring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVC
 
Introduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
Introduction to Loops in Java | For, While, Do While, Infinite Loops | EdurekaIntroduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
Introduction to Loops in Java | For, While, Do While, Infinite Loops | Edureka
 
Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)
 
Hibernate
HibernateHibernate
Hibernate
 
Ejb 2.0
Ejb 2.0Ejb 2.0
Ejb 2.0
 
Session 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI BeansSession 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI Beans
 
15 expression-language
15 expression-language15 expression-language
15 expression-language
 
Jdbc
JdbcJdbc
Jdbc
 
20070329 Tech Study
20070329 Tech Study 20070329 Tech Study
20070329 Tech Study
 

Similar to Seam Glassfish Perspective

J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
Svetlin Nakov
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
Alassane Diallo
 

Similar to Seam Glassfish Perspective (20)

J2 Ee Overview
J2 Ee OverviewJ2 Ee Overview
J2 Ee Overview
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
 
Jsf Framework
Jsf FrameworkJsf Framework
Jsf Framework
 
EJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 PreludeEJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 Prelude
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
 
Web Applications of the future: Combining JEE6 & JavaFX
Web Applications of the future: Combining JEE6 & JavaFXWeb Applications of the future: Combining JEE6 & JavaFX
Web Applications of the future: Combining JEE6 & JavaFX
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 
JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011
 
Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
 
GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
Java EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's QuarrelJava EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's Quarrel
 
GlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for EclipseGlassFish Tool Bundle for Eclipse
GlassFish Tool Bundle for Eclipse
 
企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践
 
I know why your Java is slow
I know why your Java is slowI know why your Java is slow
I know why your Java is slow
 
Seam Introduction
Seam IntroductionSeam Introduction
Seam Introduction
 
Struts Action
Struts ActionStruts Action
Struts Action
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SE
 
What's new in DWR version 3
What's new in DWR version 3What's new in DWR version 3
What's new in DWR version 3
 

More from Eduardo Pelegri-Llopart

More from Eduardo Pelegri-Llopart (20)

Juggling at freenome
Juggling   at freenomeJuggling   at freenome
Juggling at freenome
 
Csumb capstone-fall2016
Csumb capstone-fall2016Csumb capstone-fall2016
Csumb capstone-fall2016
 
Digital activitymanagement
Digital activitymanagementDigital activitymanagement
Digital activitymanagement
 
Progress next iot_pelegri
Progress next iot_pelegriProgress next iot_pelegri
Progress next iot_pelegri
 
Pelegri Desarrollando en una nueva era de software
Pelegri   Desarrollando en una nueva era de software Pelegri   Desarrollando en una nueva era de software
Pelegri Desarrollando en una nueva era de software
 
Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015Market trends in IT - exchange cala - October 2015
Market trends in IT - exchange cala - October 2015
 
The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015The impact of IOT - exchange cala - 2015
The impact of IOT - exchange cala - 2015
 
IOT - Presentation to PEP @ Progress
IOT - Presentation to PEP @ ProgressIOT - Presentation to PEP @ Progress
IOT - Presentation to PEP @ Progress
 
Node.js as an IOT Bridge
Node.js as an IOT BridgeNode.js as an IOT Bridge
Node.js as an IOT Bridge
 
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
What is IoT and how Modulus and Pacific can Help - Featuring Node.js and Roll...
 
What is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts YouWhat is the Internet of Things and How it Impacts You
What is the Internet of Things and How it Impacts You
 
Community Update 25 Mar2010 - English
Community Update 25 Mar2010 - EnglishCommunity Update 25 Mar2010 - English
Community Update 25 Mar2010 - English
 
GlassFish Community Update 25 Mar2010
GlassFish Community Update 25 Mar2010GlassFish Community Update 25 Mar2010
GlassFish Community Update 25 Mar2010
 
Glass Fish Portfolio C1 West V3.Mini
Glass Fish Portfolio C1 West V3.MiniGlass Fish Portfolio C1 West V3.Mini
Glass Fish Portfolio C1 West V3.Mini
 
Virtual Box Aquarium May09
Virtual Box Aquarium May09Virtual Box Aquarium May09
Virtual Box Aquarium May09
 
Introduction To Web Beans
Introduction To Web BeansIntroduction To Web Beans
Introduction To Web Beans
 
Ehcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage PatternsEhcache Architecture, Features And Usage Patterns
Ehcache Architecture, Features And Usage Patterns
 
OpenDS Primer Aquarium
OpenDS Primer AquariumOpenDS Primer Aquarium
OpenDS Primer Aquarium
 
Fuji Overview
Fuji OverviewFuji Overview
Fuji Overview
 
Nuxeo 5.2 Glassfish
Nuxeo 5.2 GlassfishNuxeo 5.2 Glassfish
Nuxeo 5.2 Glassfish
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Seam Glassfish Perspective

  • 1. SEAM A GLASSFISH PERSPECTIVE DAN ALLEN JBOSS, A DIVISION OF RED HAT
  • 2. SEAM BRINGS JAVA EE TOGETHER JSF EJB 3
  • 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
  • 4. 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
  • 5. 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)
  • 6. 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?
  • 7. 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
  • 8. 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
  • 10. 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”
  • 11. CONVERSATION = UNIT OF WORK The task at hand Often involves more than one request Requires state management
  • 12. 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
  • 13. TWO STYLES OF MANAGEMENT Seam (bi)jection Standard Java EE injection @In @PersistenceContext EntityManager entityManager; EntityManager entityManager;
  • 14. 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
  • 15. APPLICATION TRANSACTION Conversation (flushMode = MANUAL) Request Response Request Response ... Transaction Transaction load flush
  • 16. 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
  • 17. SEAM A GLASSFISH PERSPECTIVE DAN ALLEN JBOSS, A DIVISION OF RED HAT