SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von Eduardo Pelegri-Llopart

Mehr von 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
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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, ...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

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