Java EE 6 = Less Code + More PowerArun Gupta, Java EE & GlassFish Guyblogs.oracle.com/arungupta, @arungupta               ...
The following is intended to outline our generalproduct direction. It is intended for informationpurposes only, and may no...
The Java EE 6 Platform   Servlets 3.0      JPA 2.0           EJB 3.1    JDBC      StAX                   Interceptors     ...
Light-weight●   Java EE 6 Web Profile●   Pruning    ●   Pruned today, means        –   Optional in the next release       ...
●   EJB-in-WAR●   No-interface EJB●   Optional    “web.xml”/”faces-    config.xml”●   Annotation-driven    ●   @Schedule  ...
<web-fragment>   <filter>         <filter-name>wicket.helloworld</filter-name>         <filter-class>org.apache.wicket.pro...
From the real users ...                                                  Jigsaw puzzle, Modular,                          ...
Compatible Java EE 6 ImplsToday:                             Web Profile OnlyAnnounced:
3.1 Overview●   Built on GlassFish 3●   Modular and Extensible HK2 Kernel    ●   ~260+ modules    ●   OSGi/Java EE Hybrid ...
Sample App Overview  CLI                            JPA Servlet         EJB              Database           CDI     JAX-RS...
What will we do ?1. Generate JPA Entities from the database table2. Refactor generated entities for a more intuitive O/R m...
What will we use ?
Generate JPA EntitiesAnd customize them    CLI                                      JPA  Servlet                  EJB     ...
Java Persistence API 2●   Improved O/R mapping●   Type-safe Criteria API●   Expanded and Richer JPQL●   2nd-level Cache●  ...
Create an EJBFor querying the database    CLI                                     JPA   Servlet                EJB        ...
Create an EJB – Sample CodeFor querying the database@PersistenceContextEntityManager em;public List<Customer> getCustomers...
EJB 3.1●   Simplified Packaging●   No interface view – one source file per bean●   Embeddable API●   @Singleton    ●   Ini...
Create a ServletFor testing EJB and display values from the database    CLI                                      JPA   Ser...
Create a Servlet – Sample CodeFor testing EJB and display values from the database@EJB CustomerSessionBean ejb;out.println...
Servlets 3.0●   @WebServlet, @WebListener, @WebFilter, …●   Asynchronous Servlets    ●   @WebServlet(asyncSupported=true)●...
Enable CDIMake the EJB EL-injectable    CLI                                     JPA   Servlet                EJB          ...
Enable CDI – Sample CodeMake the EJB EL-injectable@javax.inject.Named
Contexts & Dependency Injection●   Standards-based Dependency Injection●   Type-safe – Buids on @Inject API●   Context/Sco...
CDI●   Qualifiers●   Events●   Stereotypes●   Interceptors●   Decorators●   Alternatives●   ...
Display the valuesIn JSF2/Facelets-based view    CLI                                     JPA   Servlet                EJB ...
Display the values – Sample CodeIn JSF2/Facelets-based viewhttp://localhost:8080/JavaEE6SampleApp/faces/index.xhtml<h1>Jav...
Java Server Faces 2.0●   Facelets as “templating language” for the page    ●   Custom components much easier to develop●  ...
RESTful resourceUsing JAX-RS   CLI                                JPA  Servlet            EJB              Database       ...
RESTful resource – Sample CodeUsing JAX-RS@Path("/customers")@GET@Path("/customer/{id}")@Produces("application/xml")public...
JAX-RS 1.1●   Java API for building RESTful Web Services●   POJO based●   Annotation-driven●   Server-side API●   HTTP-cen...
Sample App Review  CLI                            JPA Servlet         EJB              Database           CDI     JAX-RS  ...
Java EE for the Cloud : JSR 342●   More easily operate on private/public clouds    ●   Multi-tenancy    ●   Elasticity    ...
Java EE 7 : Technology Refresh●   Ease-of-development: JMS 2.0●   Latest web standards    ●   New JSRs: Web Sockets, Java ...
Java EE 7 – When ?●   Late 2012●   Date-driven release    ●   Anything not ready will be deferred to Java EE 8●   Particip...
Transparency Checklisthttp://jcp.org/en/resources/transparency                                              NEW●   EG memb...
●   Find out whats new with Java technology●   See new tools and techniques●   Learn how to create solutions●   Network wi...
References●   oracle.com/javaee●   glassfish.org●   oracle.com/goto/glassfish●   blogs.oracle.com/theaquarium●   youtube.c...
Java EE 6 = Less Code + More PowerArun Gupta, Java EE & GlassFish Guyblogs.oracle.com/arungupta, @arungupta               ...
Java EE 6 workshop at Dallas Tech Fest 2011
Upcoming SlideShare
Loading in …5
×

Java EE 6 workshop at Dallas Tech Fest 2011

4,808 views
4,684 views

Published on

Java EE 6 workshop at Dallas Tech Fest 2011

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,808
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
40
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java EE 6 workshop at Dallas Tech Fest 2011

  1. 1. Java EE 6 = Less Code + More PowerArun Gupta, Java EE & GlassFish Guyblogs.oracle.com/arungupta, @arungupta 1
  2. 2. The following is intended to outline our generalproduct direction. It is intended for informationpurposes only, and may not be incorporated intoany contract. It is not a commitment to deliver anymaterial, code, or functionality, and should not berelied upon in making purchasing decisions.The development, release, and timing of anyfeatures or functionality described for Oraclesproducts remains at the sole discretion of Oracle.
  3. 3. The Java EE 6 Platform Servlets 3.0 JPA 2.0 EJB 3.1 JDBC StAX Interceptors JSF 2.0 JAX-RS JNDI JavaMail 1.1 Bean EJB 3.1 Lite JAXB JMS JACC Validation1.0 JSP 2.2 CDI 1.0 JAX-WS JAXP SAAJ Managed JTA 1.1 JASPIC JAX-RPC ... Beans 1.0 Contributed by RedHat New Updated Web Profile 1.0
  4. 4. Light-weight● Java EE 6 Web Profile● Pruning ● Pruned today, means – Optional in the next release – Deleted in the subsequent releases ● Technologies marked in Javadocs – EJB 2.x Entity Beans, JAX-RPC, JAXR, JSR 88
  5. 5. ● EJB-in-WAR● No-interface EJB● Optional “web.xml”/”faces- config.xml”● Annotation-driven ● @Schedule ● @Path ● @Inject ● ...
  6. 6. <web-fragment> <filter> <filter-name>wicket.helloworld</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>...</param-value> </init-param> </filter> <filter-mapping> <filter-name>wicket.helloworld</filter-name> <url-pattern>/*</url-pattern> </filter-mapping></web-fragment>
  7. 7. From the real users ... Jigsaw puzzle, Modular, standard, less xml, easy, Developers can concentrate easy, have I said easy? on business logic, Java EE 6 is providing a standard for Standards compliance, vendor the infrastructure. independence, milliseconds and kilobyte deployment Faster development, less frameworks, less complexity, more greatHigher integrated specs, code shippedsimple and annotation driven,single-classloader WARs,next level of industrystandard Definite excuse to avoid Spring forever Simplified Java Not your fat grandfathers Development, Focus on enterprise Java anymore, building great products enterprise Java renaissance http://blogs.oracle.com/arungupta/tags/community+feedback
  8. 8. Compatible Java EE 6 ImplsToday: Web Profile OnlyAnnounced:
  9. 9. 3.1 Overview● Built on GlassFish 3● Modular and Extensible HK2 Kernel ● ~260+ modules ● OSGi/Java EE Hybrid Apps● Clustering and High Availability ● HTTP, EJB, IIOP, SSO, Metro● Containers start on demand● End-to-end extensibility
  10. 10. Sample App Overview CLI JPA Servlet EJB Database CDI JAX-RS JSF
  11. 11. What will we do ?1. Generate JPA Entities from the database table2. Refactor generated entities for a more intuitive O/R mapping3. Create an EJB for querying the database4. Create a Servlet for testing the EJB and displaying values from the database table5. Enable CDI and make the EJB EL-injectable6. Display the values in JSF2/Facelets-based view7. Expose JPA entities as a RESTful resource by using JAX-RS
  12. 12. What will we use ?
  13. 13. Generate JPA EntitiesAnd customize them CLI JPA Servlet EJB Database CDI JAX-RS JSF
  14. 14. Java Persistence API 2● Improved O/R mapping● Type-safe Criteria API● Expanded and Richer JPQL● 2nd-level Cache● New locking modes ● PESSIMISTIC_READ – grab shared lock ● PESSIMISTIC_WRITE – grab exclusive lock ● PESSIMISTIC_FORCE_INCREMENT – update version● Standard configuration options ● javax.persistence.jdbc.[driver | url | user | password]
  15. 15. Create an EJBFor querying the database CLI JPA Servlet EJB Database CDI JAX-RS JSF
  16. 16. Create an EJB – Sample CodeFor querying the database@PersistenceContextEntityManager em;public List<Customer> getCustomers() {return (List<Customer>)em.createNamedQuery("Customer.findAll").getResultList();}
  17. 17. EJB 3.1● Simplified Packaging● No interface view – one source file per bean● Embeddable API● @Singleton ● Initialization in @PostContruct● Simplified Cron-like syntax for Timer● Asynchronous Session Bean● Portable Global JNDI Name
  18. 18. Create a ServletFor testing EJB and display values from the database CLI JPA Servlet EJB Database CDI JAX-RS JSF
  19. 19. Create a Servlet – Sample CodeFor testing EJB and display values from the database@EJB CustomerSessionBean ejb;out.println(ejb.getCustomers());http://localhost:8080/JavaEE6SampleApp/TestServlet
  20. 20. Servlets 3.0● @WebServlet, @WebListener, @WebFilter, …● Asynchronous Servlets ● @WebServlet(asyncSupported=true)● Plugin libraries using web fragments● Dynamic registration of Servlets● WEB-INF/lib/[*.jar]/META-INF/resources accessible in the root● Programmatic authentication login/logout● Default Error Page● ...
  21. 21. Enable CDIMake the EJB EL-injectable CLI JPA Servlet EJB Database CDI JAX-RS JSF
  22. 22. Enable CDI – Sample CodeMake the EJB EL-injectable@javax.inject.Named
  23. 23. Contexts & Dependency Injection● Standards-based Dependency Injection● Type-safe – Buids on @Inject API● Context/Scope management● Strong Typing, Loose Coupling● Includes ELResolver @Inject @LoggedIn User userRequest What ?Injection Which one ? (Qualifier) (Type)
  24. 24. CDI● Qualifiers● Events● Stereotypes● Interceptors● Decorators● Alternatives● ...
  25. 25. Display the valuesIn JSF2/Facelets-based view CLI JPA Servlet EJB Database CDI JAX-RS JSF
  26. 26. Display the values – Sample CodeIn JSF2/Facelets-based viewhttp://localhost:8080/JavaEE6SampleApp/faces/index.xhtml<h1>Java EE 6 Sample App</h1><center>Powered by GlassFish!</center><h:dataTable value="#{customerSessionBean.customers}" var="c"><h:column>#{c.name}</h:column><h:column>#{c.customerId}</h:column></h:dataTable>
  27. 27. Java Server Faces 2.0● Facelets as “templating language” for the page ● Custom components much easier to develop● Integrated Ajax● “faces-config.xml” optional in common cases● Default navigation rules● Much more … ● Runs on Servlet 2.5+ ● Bookmarkable URLs ● Conditional navigation ● ...
  28. 28. RESTful resourceUsing JAX-RS CLI JPA Servlet EJB Database CDI JAX-RS JSF
  29. 29. RESTful resource – Sample CodeUsing JAX-RS@Path("/customers")@GET@Path("/customer/{id}")@Produces("application/xml")public Customer getCustomer(@PathParam("id")Integer id) {return(Customer)em.createNamedQuery("Customer.findByCustomerId").setParameter("customerId", id).getSingleResult();}http://localhost:8080/JavaEE6SampleApp/resources/customers/customer/1@Produces({"application/xml", "application/json"})
  30. 30. JAX-RS 1.1● Java API for building RESTful Web Services● POJO based● Annotation-driven● Server-side API● HTTP-centric
  31. 31. Sample App Review CLI JPA Servlet EJB Database CDI JAX-RS JSF
  32. 32. Java EE for the Cloud : JSR 342● More easily operate on private/public clouds ● Multi-tenancy ● Elasticity ● Service Provisioning● Tighter requirements for resource/state management● Better isolation between applications● Potential standard APIs for NRDBMS, Caching, other● Common management and monitoring interfaces● Better packaging● Evolution, not revolution
  33. 33. Java EE 7 : Technology Refresh● Ease-of-development: JMS 2.0● Latest web standards ● New JSRs: Web Sockets, Java JSON API ● HTTP Client API (JAX-RS 2.0)● Possible JSRs inclusion ● Concurrency Utilities for Java EE (JSR 236) ● JCache (JSR 107)
  34. 34. Java EE 7 – When ?● Late 2012● Date-driven release ● Anything not ready will be deferred to Java EE 8● Participate ● Expert Groups forming ● Public discussion lists ● JCP membership free for individuals
  35. 35. Transparency Checklisthttp://jcp.org/en/resources/transparency NEW● EG members names● EG business reported on a publicly readable alias● Schedule is public, current and updated regularly● Public can read/write to a wiki● Discussion board on jcp.org● Public read-only issue tracker
  36. 36. ● Find out whats new with Java technology● See new tools and techniques● Learn how to create solutions● Network with peers● Meet with experts● Influence the future of the Java platform● 400+ sessions/BoFs/HOLs● ... oracle.com/javaone
  37. 37. References● oracle.com/javaee● glassfish.org● oracle.com/goto/glassfish● blogs.oracle.com/theaquarium● youtube.com/GlassFishVideos● Follow @glassfish
  38. 38. Java EE 6 = Less Code + More PowerArun Gupta, Java EE & GlassFish Guyblogs.oracle.com/arungupta, @arungupta 39

×