Your SlideShare is downloading. ×
Java EE 6
The Future of Enterprise Applications




                                        copyright 2008 trainologic LTD
Java EE 6



• Introduction.
• New Concepts.
• New Components.
• Q&A.




                    copyright 2008 trainologic L...
Java EE 6



                    Introduction

• Java EE 5, was all about ease of development.
• The major change was made...
Java EE 6



                     Introduction

• The status of the JSR is Early Draft Review.
• Release is expected in Ma...
Java EE 6



            Goals




              5
                    copyright 2008 trainologic LTD
Java EE 6



                          Goals

• Easier to Use, Easier to Learn.




                             5
       ...
Java EE 6



                          Goals

• Easier to Use, Easier to Learn.
  Well, this is the usual stuff. What’s re...
Java EE 6



                          Goals

• Easier to Use, Easier to Learn.
  Well, this is the usual stuff. What’s re...
Java EE 6



                          Goals

• Easier to Use, Easier to Learn.
  Well, this is the usual stuff. What’s re...
Java EE 6



                          Goals

• Easier to Use, Easier to Learn.
  Well, this is the usual stuff. What’s re...
Java EE 6



• Introduction.
• New Concepts.
• New Components.
• Q&A.




                    copyright 2008 trainologic L...
Java EE 6



                      Extensibility

• During the lifetime of the Java EE platform, many
  frameworks has evo...
Java EE 6



                     Extensibility

• Java EE 6 Embraces the frameworks by supplying auto
  discovery of Serv...
Java EE 6



                         Profiles

• Java EE has became a huge platform.
• Most Java EE projects do not use m...
Java EE 6



                                Profiles

• “A profile is a configuration of the Java EE platform
  targeted at...
Java EE 6



                         Profiles

• So... is a profile just a bundle of Java EE sub
  specifications?

• No,...
Java EE 6



                         Profiles

• Each profile is defined by the JCP as a separate JSR.
• The first profil...
Java EE 6



                         Pruning

• As the Java EE platform is getting older, it is carrying
  some pre-histo...
Java EE 6



                          Pruning

• A component marked pruned at the current version
  may become optional i...
Java EE 6



• Introduction.
• New Concepts.
• New Components.
• Q&A.




                    copyright 2008 trainologic L...
Java EE 6



                  New Components

• EJB 3.1                    • JAXB 2.2
• JPA 2.0                    • JAX-...
Java EE 6



                 New Components

• As you can see, there is a long list of components.
• We will explore the ...
Java EE 6



                          EJB 3.1

• Stage: Public Review.
• The long waited Singleton bean has arrived.
• No...
Java EE 6



               EJB 3.1 - Singleton

• Up to version 3.1 there was no easy way to share data
  throughout the ...
Java EE 6



                    EJB 3.1 - Singleton
            @Singleton
            public class DiscountRateBean {
  ...
Java EE 6



             EJB 3.1 - Asynchronous

• In Java EE there is a rule in the specification forbidding
  the devel...
Java EE 6



                  EJB 3.1 - Asynchronous

@Stateless
public class OrderBillingServiceBean implements OrderBil...
Java EE 6



                      EJB 3.1 - Lite

• EJBs outside of the container.
• Subset of EJB 3.1
• Embeddable conta...
Java EE 6



            EJB 3.1 - Lite




                  24
                             copyright 2008 trainologic L...
Java EE 6



                           JPA 2.0

• More sophisticated mapping options:
      Access control in the propert...
Java EE 6



                        JPA 2.0

• Relationships in embeddable objects.
• Unidirectional one to many with for...
Java EE 6



                     Servlets 3.0

• Stage: Public Review.
• Annotation based configuration.
• Auto-discovery...
Java EE 6



            Servlets 3.0 - Annotations

• Like in EJB, deployment descriptors becomes
  completely optional i...
Java EE 6



            Servlets 3.0 - Annotations



       @Servlet(urlMappings={quot;/MyAppquot;})
       public class...
Java EE 6



            Servlets 3.0 - Asynchronous
                     Invocation
• Sometimes we need to perform a long...
Java EE 6



              Servlets 3.0 - Asynchronous
                       Invocation


@WebServlet(quot;/fooquot; asyn...
Java EE 6



            Servlets 3.0 - Asynchronous
                     Invocation


 public class AsyncWebService imple...
Java EE 6



                          JSF 2.0

• Stage: Public Review.
• ProjectStage, did anybody say ROR?
      The val...
Java EE 6



                          JSF 2.0

• Better Resource management for components.
• Resource re-location.
• Bot...
Java EE 6



                        JSF 2.0

• Enhanced flexible event mechanism.
• New Scope: View.
• Full Ajax support ...
Thank You



            Q&A
             Gal Marder,

             CEO, Trainologic LTD




                  copyright 2...
Upcoming SlideShare
Loading in...5
×

What's new in Java EE 6

12,470

Published on

This is a presentation given in a Java Open day conducted by Trainologic.
Trainologic shares its training content for free at trainologic.org you can find many more free full course there.

Published in: Technology, Education
1 Comment
15 Likes
Statistics
Notes
No Downloads
Views
Total Views
12,470
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
15
Embeds 0
No embeds

No notes for slide

Transcript of "What's new in Java EE 6"

  1. 1. Java EE 6 The Future of Enterprise Applications copyright 2008 trainologic LTD
  2. 2. Java EE 6 • Introduction. • New Concepts. • New Components. • Q&A. copyright 2008 trainologic LTD
  3. 3. Java EE 6 Introduction • Java EE 5, was all about ease of development. • The major change was made by moving to EJB 3. • Java EE 6, A.K.A JSR 316, will make the use of Java EE easier and more feasible in different environments. 3 copyright 2008 trainologic LTD
  4. 4. Java EE 6 Introduction • The status of the JSR is Early Draft Review. • Release is expected in May 09, but as we have already learned, it might not be exactly on time... 4 copyright 2008 trainologic LTD
  5. 5. Java EE 6 Goals 5 copyright 2008 trainologic LTD
  6. 6. Java EE 6 Goals • Easier to Use, Easier to Learn. 5 copyright 2008 trainologic LTD
  7. 7. Java EE 6 Goals • Easier to Use, Easier to Learn. Well, this is the usual stuff. What’s really new??? 5 copyright 2008 trainologic LTD
  8. 8. Java EE 6 Goals • Easier to Use, Easier to Learn. Well, this is the usual stuff. What’s really new??? • Easier Extensibility - More ways to integrate frameworks. 5 copyright 2008 trainologic LTD
  9. 9. Java EE 6 Goals • Easier to Use, Easier to Learn. Well, this is the usual stuff. What’s really new??? • Easier Extensibility - More ways to integrate frameworks. • Easier to Evolve - The size and wideness of the Java EE has made it difficult to evolve. Profiles and Pruning should take care of that. 5 copyright 2008 trainologic LTD
  10. 10. Java EE 6 Goals • Easier to Use, Easier to Learn. Well, this is the usual stuff. What’s really new??? • Easier Extensibility - More ways to integrate frameworks. • Easier to Evolve - The size and wideness of the Java EE has made it difficult to evolve. Profiles and Pruning should take care of that. • SOA - Better support for SOA is also defined as a goal of the new spec. 5 copyright 2008 trainologic LTD
  11. 11. Java EE 6 • Introduction. • New Concepts. • New Components. • Q&A. copyright 2008 trainologic LTD
  12. 12. Java EE 6 Extensibility • During the lifetime of the Java EE platform, many frameworks has evolved. • Several of these frameworks became de-facto standards, like Struts and Facelets. • Integrating these frameworks with a Java EE application is a pain. • Java EE 6 plans to “relief” this pain. 7 copyright 2008 trainologic LTD
  13. 13. Java EE 6 Extensibility • Java EE 6 Embraces the frameworks by supplying auto discovery of Servlets, Servlet Filters and Web Application Listeners. • These are all widely used integration point for known frameworks. • The Connector Architecture SPI is expected to change as well. 8 copyright 2008 trainologic LTD
  14. 14. Java EE 6 Profiles • Java EE has became a huge platform. • Most Java EE projects do not use major part of the platform. • For example, there are many cases where EJBs are not in use while Servlets, Naming and JDBC are. • Profiles tries to focus the Java EE platform towards specific classes of applications. 9 copyright 2008 trainologic LTD
  15. 15. Java EE 6 Profiles • “A profile is a configuration of the Java EE platform targeted at a specific class of applications.” the Java EE 6 Specification, early draft. • The idea is to identify typical uses of the platform and create a profile that includes only the parts of the platform which are relevant to the typical use. 10 copyright 2008 trainologic LTD
  16. 16. Java EE 6 Profiles • So... is a profile just a bundle of Java EE sub specifications? • No, each profile must include the minimum set of mandatory components and may add some other components which are not part of Java EE. • Moreover, a profile must implement the special interactions between the different components, like dependency injection. 11 copyright 2008 trainologic LTD
  17. 17. Java EE 6 Profiles • Each profile is defined by the JCP as a separate JSR. • The first profile is already defined by the Java EE 6 spec: The Web Profile. • You have guessed correctly, it is for web applications. 12 copyright 2008 trainologic LTD
  18. 18. Java EE 6 Pruning • As the Java EE platform is getting older, it is carrying some pre-historic creatures like EJB Entity Beans on its back. • A process called pruning is starting with Java EE 6. • Marking a component as pruned, means it is candidate to become optional. • Pruning is marked in the JavaDoc. 13 copyright 2008 trainologic LTD
  19. 19. Java EE 6 Pruning • A component marked pruned at the current version may become optional in the next version. • It is for the comity of the next version to decide it the component becomes optional or not. • Current Pruning list: JAX-RPC - Replaced by JAX-WS. • EJB Entity Beans - Replaced by JPA. • JAXR - API for XML Registries, never widely adopted. • JSR 88 - Deployment API, never widely adopted. • 14 copyright 2008 trainologic LTD
  20. 20. Java EE 6 • Introduction. • New Concepts. • New Components. • Q&A. copyright 2008 trainologic LTD
  21. 21. Java EE 6 New Components • EJB 3.1 • JAXB 2.2 • JPA 2.0 • JAX-WS 2.2 • Servlets 3.0 • EL 1.2 • JSF 2.0 • JSP 2.1 • JAX-RS 1.0 • Authentication SPI • JCA 1.6 • Concurrency Utilities • Web Beans 1.0 • Bean Validation 1.0 16 copyright 2008 trainologic LTD
  22. 22. Java EE 6 New Components • As you can see, there is a long list of components. • We will explore the most popular ones: EJB • JPA • Servlets • JSF • 17 copyright 2008 trainologic LTD
  23. 23. Java EE 6 EJB 3.1 • Stage: Public Review. • The long waited Singleton bean has arrived. • No Object Interface required. • Asynchronous business methods. • Standard global JNDI name: java:global/app/module/bean#interface • 18 copyright 2008 trainologic LTD
  24. 24. Java EE 6 EJB 3.1 - Singleton • Up to version 3.1 there was no easy way to share data throughout the application. • The EJB 3.1 Singleton is an Application wide Singleton. • Concurrency can be managed either by the container or by the Bean Developer. • Container Managed Concurrency enables Read/Write Lock using annotations. 19 copyright 2008 trainologic LTD
  25. 25. Java EE 6 EJB 3.1 - Singleton @Singleton public class DiscountRateBean { @PersistenceContext private EntityManager entityManager; private Rate rate; @PostConstruct private void init() { rate = entityManager.find(Rate.class, 1); } @ConcurrencyAttribute(READ_WRITE_LOCK) public void setRate(Rate rate) { this.rate = rate; } @ConcurrencyAttribute(READ_LOCK) public Rate getRate() { return rate; } } 20 copyright 2008 trainologic LTD
  26. 26. Java EE 6 EJB 3.1 - Asynchronous • In Java EE there is a rule in the specification forbidding the developer from opening new threads. • The “correct” way to perform asynchronous operations in Java EE is using JMS. This is quite cumbersome... • EJB 3.1 solves this problem by presenting the new asynchronous method calls in session beans. • Since the method returns before creating the return value, it can either be void or return a Future. 21 copyright 2008 trainologic LTD
  27. 27. Java EE 6 EJB 3.1 - Asynchronous @Stateless public class OrderBillingServiceBean implements OrderBillingService { ... @Asynchronous public Future<OrderStatus> billOrder(Order order) { try { // Attempt to charge the order. bill(order); return new AsyncResult<OrderStatus>(OrderStatus.COMPLETE); } catch (BillingException be) { // Send email notification of billing failure. notifyBillingFailure(be, order); return new AsyncResult<OrderStatus> (OrderStatus.BILLING_FAILED); } } } 22 copyright 2008 trainologic LTD
  28. 28. Java EE 6 EJB 3.1 - Lite • EJBs outside of the container. • Subset of EJB 3.1 • Embeddable container API. • Bootstrap on Java SE. 23 copyright 2008 trainologic LTD
  29. 29. Java EE 6 EJB 3.1 - Lite 24 copyright 2008 trainologic LTD
  30. 30. Java EE 6 JPA 2.0 • More sophisticated mapping options: Access control in the property/field level. • Orphan Removal. • • Order Columns. • Persisting non-entity collections. 25 copyright 2008 trainologic LTD
  31. 31. Java EE 6 JPA 2.0 • Relationships in embeddable objects. • Unidirectional one to many with foreign key. • Criteria API for Querying. • Validation by JSR 303. 26 copyright 2008 trainologic LTD
  32. 32. Java EE 6 Servlets 3.0 • Stage: Public Review. • Annotation based configuration. • Auto-discovery of Servlets, Filters and Listeners. • Modular web.xml. • Asynchronous Support. • Authentication API. • HTTP-Only Cookies. 27 copyright 2008 trainologic LTD
  33. 33. Java EE 6 Servlets 3.0 - Annotations • Like in EJB, deployment descriptors becomes completely optional in Servlets 3.0 • All configuration can be defined using annotations. • In case annotations and xml co-exist, the data in the xml takes precedence over the data in the annotations. 28 copyright 2008 trainologic LTD
  34. 34. Java EE 6 Servlets 3.0 - Annotations @Servlet(urlMappings={quot;/MyAppquot;}) public class MyServlet { @GET public void handleGet(HttpServletRequest req, HttpServletResponse res) { .... } } 29 copyright 2008 trainologic LTD
  35. 35. Java EE 6 Servlets 3.0 - Asynchronous Invocation • Sometimes we need to perform a long running blocking operation as a part of a Servlet request. • Performing this kind of operation from the thread running the servlet code is not efficient. • This can cause a starvation in cases this operation common. • Asynchronous Invocation solves this problem by releasing the original thread and passing the control to another thread. 30 copyright 2008 trainologic LTD
  36. 36. Java EE 6 Servlets 3.0 - Asynchronous Invocation @WebServlet(quot;/fooquot; asyncSupported=true) public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) { ... AsyncContext aCtx = request.startAsync(req, res); ScheduledThreadPoolExecutor executor = new ThreadPoolExecutor(10); executor.execute(new AsyncWebService(aCtx)); } } 31 copyright 2008 trainologic LTD
  37. 37. Java EE 6 Servlets 3.0 - Asynchronous Invocation public class AsyncWebService implements Runnable { AsyncContext ctx; public AsyncWebService(AsyncContext ctx) { this.ctx = ctx; } public void run() { // Invoke web service and save result in request attribute // Forward the request to render the result to a JSP. ctx.forward(quot;/render.jspquot;); } } 32 copyright 2008 trainologic LTD
  38. 38. Java EE 6 JSF 2.0 • Stage: Public Review. • ProjectStage, did anybody say ROR? The value is set using JNDI or Context parameter. • Can be one of Production, Development, UnitTest, • SystemTest or Extension. Then you can query for the stage using: • Application.getProjectStage() 33 copyright 2008 trainologic LTD
  39. 39. Java EE 6 JSF 2.0 • Better Resource management for components. • Resource re-location. • Both of these features enables component authors to load their own resources like css, js scrips, images and other resources. 34 copyright 2008 trainologic LTD
  40. 40. Java EE 6 JSF 2.0 • Enhanced flexible event mechanism. • New Scope: View. • Full Ajax support including partial processing and js Library. • Facelets. 35 copyright 2008 trainologic LTD
  41. 41. Thank You Q&A Gal Marder, CEO, Trainologic LTD copyright 2008 trainologic LTD

×