SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Seam


             Pete Muir
    JBoss, a Division of Red Hat

http://in.relation.to/Bloggers/Pete

       pete.muir@jboss.org
Road Map

 •   What is Seam?
 •   Why should I care about atomic conversations?
 •   How do I quickly build an application with Seam?
 •   What tools are available?
 •   The future
Application Stack
                                                    "%'($%%
                      :.&8!0&/1%quot;*quot;23               )*+,$%%

                                                     !quot;#$%


                      !quot;#!$%&'quot;()%*
                      4&5!6,7#&8quot;,9                  -.,/$




                                             !quot;#$
                                                    0,/$1quot;#$

                      !quot;#$quot;%&%'!(quot;)&*               0$,quot;*'23


                                                    4+,quot;5$(2
                    +&,-.-'&%/&!0&/1%quot;*quot;23
                                                      62,777
Where can I run my app?

                 WebSphere                   Web Logic



                   Tomcat                     Glassfish




                                          JBoss Enterprise
           JBoss Application Server
                                         Application Platform


                            JBoss SOA Platform
!quot;#quot;$%$&&
Seam is contextual
                                                 '($)quot;
 •   Stateful
     •   store objects for as long as you        *#+$
         need them

     •   Seam manages all interactions       ,-)($.&#quot;/-)
         with the context

     •   dependencies are injected and          !$&&/-)
         updated every time a component
         is accessed
                                            01&/)$&&!*.-2$&&


                                              344%/2#quot;/-)
Seam will store the
 The unified component model                                    component in the
                                                             conversation context
@Name(quot;discEditorquot;) @Scope(CONVERSATION)
public class DiscEditor {
                                          Inject the
    @In EntityManager entityManager;    EntityManager

    @In Session mailSession;

    @In @Out Item disc;                                                   Inject a
                                                                         JavaMail
    @In(scope=SESSION) User user;                                         session
                                           Alias the item from the
    // Use the components in some way     context, and update the
                                        ;-)
                                            context if the object
}                                                  changes
        Specify the
      context to inject
           from                                                      8
Road Map

 •   What is Seam?
 •   Why should I care about atomic conversations?
 •   How do I quickly build an application with Seam?
 •   What tools are available?
 •   The future
Why do I want an atomic conversation?

 •   Here’s a common scenario:
     •   A user has a task to complete which:
         •    spans multiple pages

         •    should be able to click cancel or back at any time, no changes made
              until the user is finished

         •    should be able to do the same task in multiple windows



                                                         Review and confirm
         View a hotel           Enter your booking
                                                              booking
What does Seam provide?
 •   A conversation scope
     •   shorter than the session, longer than a request

     •   demarcated by the application developer

     •   a conversation per window/tab


                                          Application
                                Session                                Session
               Conversation                             Conversation
     Request                  Request
What does Seam provide?

 •   A conversation scoped persistence context keeps entities
     attached for the entirety of the user’s task
     •   guarantees object equality

     •   allows lazy loading

 •   An atomic conversation needs to only flush changes at
     particular points
     •   Only flush the persistence context when explicitly instructed to
What does Seam provide?
 •   An atomic conversation needs to only flush changes at
     particular points
     •   Need to use a manual flush mode from Hibernate


         @Begin(flushMode=MANUAL)
         public void editDisc() {
             // Load the item to edit
         }

         @End
         public void saveDisc() {
            entityManager.flush();
         }
How do I manage the system transaction then?
  •   Seam manages the system transaction for you
      •   A read-write transaction

      •   A read only transaction for rendering the page (slightly better
          than Open Session in View)

                              CONVERSATION
                        EVENT                                 EVENT
          APPLY                          INVOKE     RENDER
RESTORE          PROCESS      UPDATE
        REQUEST                        APPLICATION RESPONSE
  VIEW          VALIDATIONS   MODEL
         VALUES


                         PERSISTENCE CONTEXT
                                                                 FLUSH

            SYSTEM TRANSACTION
Road Map

 •   What is Seam?
 •   Why should I care about atomic conversations?
 •   How do I quickly build an application with Seam?
 •   What tools are available?
 •   The future
Application Framework
  •   UI orientated controller components               Can define in XML or
                                                          Java for custom
  •   EntityHome for CRUD                                    behaviour

<fwk:entity-home entity-class=quot;com.acme.Discquot; name=quot;discHomequot;/>



<s:decorate template=quot;/edit.xhtmlquot;>
  <h:inputText value=quot;#{disc.name}quot; required=quot;truequot; />
</s:decorate>
<h:commandButton action=quot;#{discHome.update}quot; value=quot;Savequot; />
<h:commandButton action=quot;#{discHome.remove}quot; value=quot;Deletequot; />

 Seam provides JSF                             Bind directly to
  controls for easy                            the entities, no
 decoration of fields                           need for DTOs
Application Framework
   •   EntityQuery for search
<fwk:entity-query name=quot;discsquot; ejbql=quot;select d from Disc dquot; order=quot;d.namequot;
max-results=quot;5quot;>
  <fwk:restrictions>
    <value>lower(d.name) like concat(#{exampleDisc.name}, '%'))</value>
  </fwk:restrictions>
</fwk:entity-query>                               Basic queries can be
                                                   specified in XML

<component name=quot;exampleDiscquot; class=quot;com.acme.Artistquot; scope=quot;sessionquot; />

                         A prototype, used
                           to bind query
                            parameters
                          between UI and
                               query
Application Framework
   •   EntityQuery for search
                                        Search criteria
<h:form>
  Filter by name:
  <h:inputText value=quot;#{exampleDisc.name}quot;>
    <a:support reRender=quot;artistsquot; event=quot;onkeyupquot; />
  </h:inputText>
</h:form>
                                                          Output the results
<h:table value=quot;#{discs.dataModel}quot; var=quot;dquot; id=quot;discsquot;>
  <h:column>
    <s:link action=quot;discquot; value=quot;#{disc.name}quot;>
      <f:param name=quot;discIdquot; value=quot;#{disc.id}quot; />

   </s:link>
  </h:column>
</h:table>
<h:inputText value=quot;#{disc.name}quot; required=quot;truequot;>
                          <s:validate />
                        </h:inputText>



Validation
 •    Need to report validation errors back to the user on the correct
      field
 •    BUT normally need to enforce same constraints at the
      persistence layer and the database

@Entity public class Item {

    @Id @GeneratedValue Long id;

    @Length(min=3, max=1000, message=quot;Must be between 3 & 1000 charsquot;)
    String description;
}
Road Map

 •   What is Seam?
 •   Why should I care about atomic conversations?
 •   How do I quickly build an application with Seam?
 •   What tools are available?
 •   The future
Tooling

 • seam-gen - command line tool for generating skeleton
    project and reverse engineering a database schema
    using Seam Application Framework
 • JBoss Developer Studio - Eclipse based IDE
    •     For $99 you get a full installer + JBoss EAP
    •     Based on the freely available JBoss Tools Eclipse plugins
Demo
Road Map

 •   What is Seam?
 •   Why should I care about atomic conversations?
 •   How do I quickly build an application with Seam?
 •   What tools are available?
 •   The future
Flex as a view layer

•   A community effort
•   Uses Granite Data Services or Blaze Data Services
•   Check out a couple of demos at


                    http://www.rationaldeveloper.com
JSF 2

 •   Easy Component Creation & Templating
     •   Standardizes Facelets

     •   No XML needed to create a component

 •   Built in Ajax support
 •   Many improvements to JSF
     •   lifecycle (performance!)

     •   error handling

     •   navigation
What else?

 •   Seam 2.1 release candidate in the next week or two
     •   Friendly URLs

     •   Identity Management

     •   ACL style permissions

     •   Wicket support

     •   Excel reporting module

     •   Support for JAX-RS (REST)
Q&A




      http://in.relation.to/Bloggers/Pete


      http://www.seamframework.org

Más contenido relacionado

La actualidad más candente

Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJLeonardo Balter
 
Building Realtime Apps with Ember.js and WebSockets
Building Realtime Apps with Ember.js and WebSocketsBuilding Realtime Apps with Ember.js and WebSockets
Building Realtime Apps with Ember.js and WebSocketsBen Limmer
 
Video.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video PlayerVideo.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video Playersteveheffernan
 
Symfony tips and tricks
Symfony tips and tricksSymfony tips and tricks
Symfony tips and tricksJavier Eguiluz
 
State And Ajax Zend Con
State And Ajax   Zend ConState And Ajax   Zend Con
State And Ajax Zend ConZendCon
 
Hands on Pier
Hands on PierHands on Pier
Hands on PierESUG
 
Seam Introduction
Seam IntroductionSeam Introduction
Seam Introductionihamo
 
Keypoints html5
Keypoints html5Keypoints html5
Keypoints html5dynamis
 
Browsers with Wings
Browsers with WingsBrowsers with Wings
Browsers with WingsRemy Sharp
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...David Kaneda
 
Developing for Mobile
Developing for MobileDeveloping for Mobile
Developing for MobileRemy Sharp
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsJames Pearce
 
Firefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next levelFirefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next levelFrédéric Harper
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gearsdion
 
[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web Design[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityPeter Lubbers
 

La actualidad más candente (19)

Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
 
Building Realtime Apps with Ember.js and WebSockets
Building Realtime Apps with Ember.js and WebSocketsBuilding Realtime Apps with Ember.js and WebSockets
Building Realtime Apps with Ember.js and WebSockets
 
Video.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video PlayerVideo.js - How to build and HTML5 Video Player
Video.js - How to build and HTML5 Video Player
 
Symfony tips and tricks
Symfony tips and tricksSymfony tips and tricks
Symfony tips and tricks
 
Step objects
Step objectsStep objects
Step objects
 
State And Ajax Zend Con
State And Ajax   Zend ConState And Ajax   Zend Con
State And Ajax Zend Con
 
Hands on Pier
Hands on PierHands on Pier
Hands on Pier
 
Seam Introduction
Seam IntroductionSeam Introduction
Seam Introduction
 
Keypoints html5
Keypoints html5Keypoints html5
Keypoints html5
 
Browsers with Wings
Browsers with WingsBrowsers with Wings
Browsers with Wings
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
 
Developing for Mobile
Developing for MobileDeveloping for Mobile
Developing for Mobile
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Firefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next levelFirefox OS Web APIs, taking it to the next level
Firefox OS Web APIs, taking it to the next level
 
Angularjs Performance
Angularjs PerformanceAngularjs Performance
Angularjs Performance
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
 
[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web Design[cssdevconf] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in Responsive Web Design
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and Connectivity
 

Destacado

[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practicejavablend
 
[Strukelj] Why will Java 7.0 be so cool
[Strukelj] Why will Java 7.0 be so cool[Strukelj] Why will Java 7.0 be so cool
[Strukelj] Why will Java 7.0 be so cooljavablend
 
windows linux BEÑAT HAITZ
windows linux BEÑAT HAITZwindows linux BEÑAT HAITZ
windows linux BEÑAT HAITZguest5b2d8e
 
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your applicationjavablend
 
Portfólio - Zarabatana Digital 360
Portfólio - Zarabatana Digital 360 Portfólio - Zarabatana Digital 360
Portfólio - Zarabatana Digital 360 Sergio Akash
 

Destacado (7)

[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice[Roblek] Distributed computing in practice
[Roblek] Distributed computing in practice
 
[Strukelj] Why will Java 7.0 be so cool
[Strukelj] Why will Java 7.0 be so cool[Strukelj] Why will Java 7.0 be so cool
[Strukelj] Why will Java 7.0 be so cool
 
.
..
.
 
Bryanpulido
BryanpulidoBryanpulido
Bryanpulido
 
windows linux BEÑAT HAITZ
windows linux BEÑAT HAITZwindows linux BEÑAT HAITZ
windows linux BEÑAT HAITZ
 
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
 
Portfólio - Zarabatana Digital 360
Portfólio - Zarabatana Digital 360 Portfólio - Zarabatana Digital 360
Portfólio - Zarabatana Digital 360
 

Similar a [Muir] Seam 2 in practice

Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Steve Souders
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Librariesjeresig
 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixBruce Snyder
 
Google Back To Front: From Gears to App Engine and Beyond
Google Back To Front: From Gears to App Engine and BeyondGoogle Back To Front: From Gears to App Engine and Beyond
Google Back To Front: From Gears to App Engine and Beyonddion
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client DevelopmentTamir Khason
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesJohn Brunswick
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验yiditushe
 
SXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSteve Souders
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Railsdosire
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009Christopher Judd
 
Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2sleguiza
 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applicationsjeff tapper
 
Developing Desktop Applications using HTML and Javascript
Developing Desktop Applications using HTML and JavascriptDeveloping Desktop Applications using HTML and Javascript
Developing Desktop Applications using HTML and JavascriptJeff Haynie
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous MerbMatt Todd
 

Similar a [Muir] Seam 2 in practice (20)

Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09
 
T5 Oli Aro
T5 Oli AroT5 Oli Aro
T5 Oli Aro
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
Service Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMixService Oriented Integration With ServiceMix
Service Oriented Integration With ServiceMix
 
Google Back To Front: From Gears to App Engine and Beyond
Google Back To Front: From Gears to App Engine and BeyondGoogle Back To Front: From Gears to App Engine and Beyond
Google Back To Front: From Gears to App Engine and Beyond
 
Sinatra
SinatraSinatra
Sinatra
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client Development
 
I Feel Pretty
I Feel PrettyI Feel Pretty
I Feel Pretty
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server Pages
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验
 
SXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSXSW: Even Faster Web Sites
SXSW: Even Faster Web Sites
 
Sxsw 20090314
Sxsw 20090314Sxsw 20090314
Sxsw 20090314
 
Os Haase
Os HaaseOs Haase
Os Haase
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
When To Use Ruby On Rails
When To Use Ruby On RailsWhen To Use Ruby On Rails
When To Use Ruby On Rails
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009
 
Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2Webcast 09/2008 - Silverlight 2 Beta 2
Webcast 09/2008 - Silverlight 2 Beta 2
 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applications
 
Developing Desktop Applications using HTML and Javascript
Developing Desktop Applications using HTML and JavascriptDeveloping Desktop Applications using HTML and Javascript
Developing Desktop Applications using HTML and Javascript
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
 

Último

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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 TerraformAndrey Devyatkin
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 DiscoveryTrustArc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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 SavingEdi Saputra
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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...apidays
 
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, Adobeapidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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 businesspanagenda
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - 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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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...
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

[Muir] Seam 2 in practice

  • 1. Seam Pete Muir JBoss, a Division of Red Hat http://in.relation.to/Bloggers/Pete pete.muir@jboss.org
  • 2. Road Map • What is Seam? • Why should I care about atomic conversations? • How do I quickly build an application with Seam? • What tools are available? • The future
  • 3. Application Stack &quot;%'($%% :.&8!0&/1%quot;*quot;23 )*+,$%% !quot;#$% !quot;#!$%&'quot;()%* 4&5!6,7#&8quot;,9 -.,/$ !quot;#$ 0,/$1quot;#$ !quot;#$quot;%&%'!(quot;)&* 0$,quot;*'23 4+,quot;5$(2 +&,-.-'&%/&!0&/1%quot;*quot;23 62,777
  • 4. Where can I run my app? WebSphere Web Logic Tomcat Glassfish JBoss Enterprise JBoss Application Server Application Platform JBoss SOA Platform
  • 5. !quot;#quot;$%$&& Seam is contextual '($)quot; • Stateful • store objects for as long as you *#+$ need them • Seam manages all interactions ,-)($.&#quot;/-) with the context • dependencies are injected and !$&&/-) updated every time a component is accessed 01&/)$&&!*.-2$&& 344%/2#quot;/-)
  • 6. Seam will store the The unified component model component in the conversation context @Name(quot;discEditorquot;) @Scope(CONVERSATION) public class DiscEditor { Inject the @In EntityManager entityManager; EntityManager @In Session mailSession; @In @Out Item disc; Inject a JavaMail @In(scope=SESSION) User user; session Alias the item from the // Use the components in some way context, and update the ;-) context if the object } changes Specify the context to inject from 8
  • 7. Road Map • What is Seam? • Why should I care about atomic conversations? • How do I quickly build an application with Seam? • What tools are available? • The future
  • 8. Why do I want an atomic conversation? • Here’s a common scenario: • A user has a task to complete which: • spans multiple pages • should be able to click cancel or back at any time, no changes made until the user is finished • should be able to do the same task in multiple windows Review and confirm View a hotel Enter your booking booking
  • 9. What does Seam provide? • A conversation scope • shorter than the session, longer than a request • demarcated by the application developer • a conversation per window/tab Application Session Session Conversation Conversation Request Request
  • 10. What does Seam provide? • A conversation scoped persistence context keeps entities attached for the entirety of the user’s task • guarantees object equality • allows lazy loading • An atomic conversation needs to only flush changes at particular points • Only flush the persistence context when explicitly instructed to
  • 11. What does Seam provide? • An atomic conversation needs to only flush changes at particular points • Need to use a manual flush mode from Hibernate @Begin(flushMode=MANUAL) public void editDisc() { // Load the item to edit } @End public void saveDisc() { entityManager.flush(); }
  • 12. How do I manage the system transaction then? • Seam manages the system transaction for you • A read-write transaction • A read only transaction for rendering the page (slightly better than Open Session in View) CONVERSATION EVENT EVENT APPLY INVOKE RENDER RESTORE PROCESS UPDATE REQUEST APPLICATION RESPONSE VIEW VALIDATIONS MODEL VALUES PERSISTENCE CONTEXT FLUSH SYSTEM TRANSACTION
  • 13. Road Map • What is Seam? • Why should I care about atomic conversations? • How do I quickly build an application with Seam? • What tools are available? • The future
  • 14. Application Framework • UI orientated controller components Can define in XML or Java for custom • EntityHome for CRUD behaviour <fwk:entity-home entity-class=quot;com.acme.Discquot; name=quot;discHomequot;/> <s:decorate template=quot;/edit.xhtmlquot;> <h:inputText value=quot;#{disc.name}quot; required=quot;truequot; /> </s:decorate> <h:commandButton action=quot;#{discHome.update}quot; value=quot;Savequot; /> <h:commandButton action=quot;#{discHome.remove}quot; value=quot;Deletequot; /> Seam provides JSF Bind directly to controls for easy the entities, no decoration of fields need for DTOs
  • 15. Application Framework • EntityQuery for search <fwk:entity-query name=quot;discsquot; ejbql=quot;select d from Disc dquot; order=quot;d.namequot; max-results=quot;5quot;> <fwk:restrictions> <value>lower(d.name) like concat(#{exampleDisc.name}, '%'))</value> </fwk:restrictions> </fwk:entity-query> Basic queries can be specified in XML <component name=quot;exampleDiscquot; class=quot;com.acme.Artistquot; scope=quot;sessionquot; /> A prototype, used to bind query parameters between UI and query
  • 16. Application Framework • EntityQuery for search Search criteria <h:form> Filter by name: <h:inputText value=quot;#{exampleDisc.name}quot;> <a:support reRender=quot;artistsquot; event=quot;onkeyupquot; /> </h:inputText> </h:form> Output the results <h:table value=quot;#{discs.dataModel}quot; var=quot;dquot; id=quot;discsquot;> <h:column> <s:link action=quot;discquot; value=quot;#{disc.name}quot;> <f:param name=quot;discIdquot; value=quot;#{disc.id}quot; /> </s:link> </h:column> </h:table>
  • 17. <h:inputText value=quot;#{disc.name}quot; required=quot;truequot;> <s:validate /> </h:inputText> Validation • Need to report validation errors back to the user on the correct field • BUT normally need to enforce same constraints at the persistence layer and the database @Entity public class Item { @Id @GeneratedValue Long id; @Length(min=3, max=1000, message=quot;Must be between 3 & 1000 charsquot;) String description; }
  • 18. Road Map • What is Seam? • Why should I care about atomic conversations? • How do I quickly build an application with Seam? • What tools are available? • The future
  • 19. Tooling • seam-gen - command line tool for generating skeleton project and reverse engineering a database schema using Seam Application Framework • JBoss Developer Studio - Eclipse based IDE • For $99 you get a full installer + JBoss EAP • Based on the freely available JBoss Tools Eclipse plugins
  • 20. Demo
  • 21. Road Map • What is Seam? • Why should I care about atomic conversations? • How do I quickly build an application with Seam? • What tools are available? • The future
  • 22. Flex as a view layer • A community effort • Uses Granite Data Services or Blaze Data Services • Check out a couple of demos at http://www.rationaldeveloper.com
  • 23. JSF 2 • Easy Component Creation & Templating • Standardizes Facelets • No XML needed to create a component • Built in Ajax support • Many improvements to JSF • lifecycle (performance!) • error handling • navigation
  • 24. What else? • Seam 2.1 release candidate in the next week or two • Friendly URLs • Identity Management • ACL style permissions • Wicket support • Excel reporting module • Support for JAX-RS (REST)
  • 25. Q&A http://in.relation.to/Bloggers/Pete http://www.seamframework.org