Your SlideShare is downloading. ×
Java Enterprise Edition 6 Overview
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Java Enterprise Edition 6 Overview

1,991
views

Published on

This presentation provides a short overview of the new features on Javan Enterprise Edition 6. It was for the CapGemini http://Javanight.nl event

This presentation provides a short overview of the new features on Javan Enterprise Edition 6. It was for the CapGemini http://Javanight.nl event

Published in: Technology

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,991
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
173
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Developer at ease with Java EE 6 JavaNight@capgemini December 7, 2009 Eugene Bogaart Solution Architect Sun Microsystems NL 1
  • 2. Java EE: Past & Present Rightsizing Ease of Development Java EE 6 Web Services Pruning Java EE 5 Extensibility Robustness Profiles Enterprise Java Ease of Platform J2EE 1.4 Development Ease of Development Annotations J2EE 1.3 Web EJB Lite J2EE 1.2 Services EJB 3.0 RESTful Management CMP Persistence Services Servlet Deployment JPE Connector New and Dependency Project JSP Architecture Async. Updated Ejection EJB Connector Web Services JMS Web Profile RMI/IIOP 2
  • 3. Java EE 6 Overview 3
  • 4. Rightsizing the Platform: Profiles Platform Flexibility • Decouple specifications to allow more combinations • Expand potiential licensee ecosystem • Profiles > Targeted technology bundles > Web Profile 4
  • 5. Profiles • Profiles are targeted bundles of technologies • (Simple) rules set by platform spec • Profiles can be subsets, supersets or overlapping • First profile: the Web Profile • Decoupling of specs to allow more combinations • Future profiles defined in the Java Community Process 5
  • 6. Rightsizing the Platform Web Profile • Fully functional mid-sized profile • Actively discussed > Expert Group > Industry • Technologies > Servlet 3.0, EJB Lite 3.1, JPA 2.0, JSP 2.2, EL 1.2, JSTL 1.2, JSF 2.0, JTA 1.1, JSR 45, Common Annotations 6
  • 7. Rightsizing the Platform Pruning (Deprecation) • Some technologies optional > Optional in next release > Deleted in subsequent release > Marked in Javadocs • Pruning list > JAX-RPC > EJB 2.x Entity Beans > JAXR > JSR-85 (Rules based Auth & Audit) 9
  • 8. Rightsizing the Platform Extensibility • Embrace open source libraries and frameworks • Zero-configuration, drag-n- drop web frameworks > Servlets, servlet filters > Framework context listeners are discovered & registered • Plugin library jars using Web Fragments 11
  • 9. Ease of Development Extensibility • Continue Java EE 5 advancements • Primary focus: Web Tier • Multiple areas easier to use: EJB 3.1 • General Principles > Annotation-based programming model > Reduce or eliminate need for deployment descriptors > Traditional API for advanced users 12
  • 10. Ease of Development Adding an EJB to a Web Application ShoppingCart BuyBooks.war EJB Class BuyBooks.war ShoppingCart.jar ShoppingCart EJB Class BuyBooks.ear 15
  • 11. Ease of Development - Annotations Servlet in Java EE 5: Create two source files /* Code in Java Class */ <!--Deployment descriptor web.xml --> package com.foo; <web-app> public class MyServlet extends <servlet> HttpServlet { <servlet-name>MyServlet public void </servlet-name> doGet(HttpServletRequest <servlet-class> req,HttpServletResponse res) com.foo.MyServlet </servlet-class> { </servlet> <servlet-mapping> ... <servlet-name>MyServlet </servlet-name> } <url-pattern>/myApp/* </url-pattern> ... </servlet-mapping> ... } </web-app> 16
  • 12. Ease of Development - Annotations Servlet in Java EE 5: Java Class /* Code in Java Class */ package com.foo; public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) { /* doGet body */ } } 17
  • 13. Ease of Development - Annotations Servlet in Java EE 5: Descriptor <!--Deployment descriptor web.xml --> <web-app> <servlet> <servlet-name>MyServlet </servlet-name> <servlet-class> com.foo.MyServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>MyServlet </servlet-name> <url-pattern>/myApp/* </url-pattern> </servlet-mapping> ... </web-app> 18
  • 14. Ease of Development - Annotations Java EE 6 Servlet: Single Source file (many cases) package com.foo; @WebServlet(name=”MyServlet”, urlPattern=”/myApp/*”) public class MyServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) { ... } 19
  • 15. Demo Java EE 6 20
  • 16. Servlet 3.0 Other annotation for servlets • @ServletContextListener • @ServletFilter • @FilterMapping(urlPattern=”/foo”) SKIP 21
  • 17. Enterprise Java Beans 3.1 Lite Highlights 32
  • 18. EJB 3.1 Sample Simple Singleton @Singleton public class SharedBean { private SharedData shared; @PostConstruct private void init() { shared = ...; } public int getXYZ() { return shared.xyz; } } 33
  • 19. Singleton Client @Stateless public class FooBean { // Inject reference to Singleton bean @EJB private SharedBean shared; public void foo() { int xyz = shared.getXYZ(); ... } } 34
  • 20. EJB 3.1 Sample – Calendar Timer @Stateless public class TimerBean { @Schedule(dayOfWeek=”Sun”) public void onSunday() { ... periodically do some work ... } } 35
  • 21. EJB 3.1 No Local Business Interface Just a bean class @Stateless public class HelloWorldBean { /* no interface */ public String hello(String name) { return “hello, “ + name; } } //Still a EJB reference @EJB HelloWorldBean hello; hello.hello(“David”); 36
  • 22. EJB 3.1 Lite • Simple, modern subset of EJB for use outside of the full platform • Contents: > Session beans (stateful, stateless, singletons) > Transaction and security attributes > Interceptors > Annotations/ejb-jar.xml • Embeddable container API • Beans looked up by global name 37
  • 23. JavaServer Faces 2.0 Highlights 38
  • 24. JavaServer Faces 2.0 • Top Five Goals > Make custom components much easier to develop > Ajax support > Page description language (PDL) > Reduce the configuration burden > Provide for better compatibility between JSF component libraries from different vendors 39
  • 25. Ingredients of a JavaServer Faces Component+Ajax solution • Resource Delivery Mechanism • Partial Tree Traversal • Partial Page Update ↑ In JSF 2.0 Spec • Ajaxification Capability ↓ In Component Library • Ajax Enabled Components 40
  • 26. Ingredients of a JavaServer Faces component+Ajax solution Resource Delivery Mechanism • Delivers static resources to the user-agent in response to HTTP GET requests • Includes support for localized, versioned resources and resource libraries 41
  • 27. Ingredients of a JavaServer Faces component+Ajax solution Partial Tree Traversal 42
  • 28. Ingredients of a JavaServer Faces Component+Ajax solution Partial Page Update 43
  • 29. Ingredients of a JavaServer Faces Component+Ajax solution Ajaxification Capability • A way to give ajax capability to existing JavaServer Faces components without writing any JavaScript™ language • Common approaches include > AjaxZone tag, enclose region to ajaxify > AjaxSupport tag, nest inside of component to ajaxify 44
  • 30. Ingredients of a JavaServer Faces Component+Ajax solution Ajax Enabled Components • Such components always build on top of the previous ingredients • Current offerings are tightly coupled to their specific implementation of the previous ingredients. • By standardizing the foundations upon which these components build, we can guarantee interoperability between them. 45
  • 31. Wrapup 46
  • 32. Java Enterprise Edition 6 Status • Public reviews complete • Final and released • IDE support from NB 6.8 • & GlassFish v3 > Reference Implementation 47
  • 33. NetBeans & Java EE 6 Version 6.8 (released this Month) New: (Java EE 6) • Java EE6 Web Projects with profiles & EJBs in web Apps • EJB 3.1 project support • RESTful web services (JAX-RS 1.1), GlassFish Metro 2.0 web services (JAX-WS 2.2), JAXB 2.2 • Java Persistence JPA 2.0, deployment, debugging and profiling with GlassFish v3 application server 48
  • 34. NetBeans & Java EE 6 Version 6.8 (released this Month) More updates on • Java Server Faces 2.0 • JavaFX 1.2.1 • Kenai.Com: Connected Developer • Ruby & PHP • Maven • And much more • C/C++ 49
  • 35. Participate! • Learn about Java EE 6 with NetBeans 6.8 • Download GlassFish V3 (incl with NB 6.8 Full) • Send feedback on the component technologies. • Participate. • Contribute. • Enjoy! 50
  • 36. Thanks Eugene Bogaart Eugene.Bogaart@sun.com 51
  • 37. Developer at ease with Java EE 6 JavaNight@capgemini December 7, 2009 Eugene Bogaart Solution Architect Sun Microsystems NL 1 Page 1
  • 38. Java EE: Past & Present Rightsizing Ease of Development Java EE 6 Web Services Pruning Java EE 5 Extensibility Robustness Profiles Enterprise Java Ease of Platform J2EE 1.4 Development Ease of Development Annotations J2EE 1.3 Web EJB Lite J2EE 1.2 Services EJB 3.0 RESTful CMP Management Persistence Services Servlet Deployment JPE Connector New and Dependency Project JSP Architecture Async. Updated Ejection EJB Connector Web Services JMS Web Profile RMI/IIOP 2 Page 2 Each release of Java EE or J2EE had an overarching umbrella theme. J2EE 1.2 defined the overall platform as we know it today. 1.3 built on top of 1.2 adding robustness and introduced features like connector architecture. J2EE 1.4 focussed on Web Services primarily through the 109 specification. With Java EE 5, there was a recognition that perhaps the platform should be easier to program with. Consequently a lot of effort was put into using Annotations and allow for ease of development with Java EE 5. Apart from annotations with EJB 3.0 – EJBs were made easier to program with and JPA i.e. persistence specification was added. With EE 6 – there is a recoginition that as we have added features over the years, the platform has grown big. Consequently the theme has been “Right Sizing” the platform. We will delve into what rightsizing is and how it is achieved. EE 6 also continues on the ease of development theme set by Java EE 5. Almost all the spec have some ease of use annotations introduced.
  • 39. Java EE 6 Overview 3 Page 3 ● Make the platform: ● Easier to use ● More flexible, adaptable ● Easier to learn ● Easier to evolve going forward ● Major New Features ● Profiles ● Pruning ● Extensibility ● Ease of development
  • 40. Rightsizing the Platform: Profiles Platform Flexibility • Decouple specifications to allow more combinations • Expand potiential licensee ecosystem • Profiles > Targeted technology bundles > Web Profile 4 Page 4 As partof right sizing – the notion of profiles was defined. Right sizing is really right sizing for you. The idea is to allow multiple specifications to be coupled in a manner such that they satisify a business need. For example – the web profile targets the web development needs. You could have additional profiles for eg: a telco profile that will target the telco market. This gives companies an opportuniity to build and license a profile that they are specialized in. What this means for you as a developer, adopter or a company is that you will have a large ecosystem of licensed products to choose from. This increased set of choices can help you choose the product that meets your specific requirements.
  • 41. Profiles • Profiles are targeted bundles of technologies • (Simple) rules set by platform spec • Profiles can be subsets, supersets or overlapping • First profile: the Web Profile • Decoupling of specs to allow more combinations • Future profiles defined in the Java Community Process 5 Page 5
  • 42. Rightsizing the Platform Web Profile • Fully functional mid-sized profile • Actively discussed > Expert Group > Industry • Technologies > Servlet 3.0, EJB Lite 3.1, JPA 2.0, JSP 2.2, EL 1.2, JSTL 1.2, JSF 2.0, JTA 1.1, JSR 45, Common Annotations 6 Page 6 An example of profile is the web profile. The web profile is targeted to the “modern” web applications. The way web applications are written have changed since the first servlet specification came about. . Most web applications have significant requirements in the areas of transaction management, security and persistence. Such requirements can be readily addressed by technologies that have been part of the Java EE platform for quite some time, such as the Enterprise JavaBeans (EJB) 3.x technology and the Java Persistence API, but that are rarely supported by “plain” servlet containers. By incorporating many of these APIs, the Web Profile aims at raising the bar for what should be considered a basic stack for the development of web applications using the Java platform. Targeting “modern” web applications then implies offering a reasonably complete stack, composed of standard APIs, and capable out-of-the-box of addressing the needs of a large class of web applications. Furthermore, this stack should be easy to grow, so as to address any remaining developer needs. Against this drive towards completeness, one wishes to balance a desire to limit the footprint of web containers, both in physical and in conceptual terms. From the point of view of developers learning the Web Profile, it is more valuable to have a small, focused profile, with as little overlap between technologies as possible, rather than a more powerful but overly complex one, with redundant APIs.
  • 43. Rightsizing the Platform Pruning (Deprecation) • Some technologies optional > Optional in next release > Deleted in subsequent release > Marked in Javadocs • Pruning list > JAX-RPC > EJB 2.x Entity Beans > JAXR > JSR-85 (Rules based Auth & Audit) 9 Page 9 -admitting the fact that the platform grew. Some technologies did not have the adoption in the market place or the underlying technology did not have the adoption. - UDDI – JAXR - Same with JSR-85. - Pruning makes it optional. As the APIs are trimmed down, the Expert Group hopes to reduce the need for APIs that may have limited appeal by providing more extensibility points within the specification. These interfaces and plug-in points should make it easier to create technologies that extend that platform whilst remaining well integrated into it, and may help the specification itself regain some of its focus.
  • 44. Rightsizing the Platform Extensibility • Embrace open source libraries and frameworks • Zero-configuration, drag-n- drop web frameworks > Servlets, servlet filters > Framework context listeners are discovered & registered • Plugin library jars using Web Fragments 11 Page 11 -Container Initializer: Framework writer defines the kinds of resources it handles. At runtime the Container delegates requests to it. The framework serves the request. - The framework writer defines a CI. The developer does not need to do anything. The framework is bootstrapped by simply by including in the class path - The second technique is for an application developer to bundle the framework with the app.In this case the framework writer has defined a web-fragment.xml that indicates the kind of resources it serves. At runtime, the container gives the framework an opportunity to serve the requests. - In GF we have actually refactored JSP, JSF containers to be plugged in this way with GF v3. Additionally scripting containers have also been integrated this way. With this technology – you will be able to integrate third party frameworks into your existing Java EE 6 installations.
  • 45. Ease of Development Extensibility • Continue Java EE 5 advancements • Primary focus: Web Tier • Multiple areas easier to use: EJB 3.1 • General Principles > Annotation-based programming model > Reduce or eliminate need for deployment descriptors > Traditional API for advanced users 12 Page 12
  • 46. Ease of Development Adding an EJB to a Web Application ShoppingCart BuyBooks.war EJB Class BuyBooks.war ShoppingCart.jar ShoppingCart EJB Class BuyBooks.ear 15 ● Ejb 3.1 Page 15 ● Simplified packaging ● Singleton beans: @Singleton ● No interface view: one source file per bean ● Calendar timers: @Schedule(dayOfWeek=“Mon,Wed”) ● Global JNDI names for beans ● java:global/(app)/(module)/(bean)#(interface)
  • 47. Ease of Development - Annotations Servlet in Java EE 5: Create two source files /* Code in Java Class */ <!--Deployment descriptor web.xml --> package com.foo; <web-app> public class MyServlet extends <servlet> HttpServlet { <servlet-name>MyServlet public void </servlet-name> doGet(HttpServletRequest <servlet-class> req,HttpServletResponse res) com.foo.MyServlet </servlet-class> { </servlet> <servlet-mapping> ... <servlet-name>MyServlet </servlet-name> } <url-pattern>/myApp/* </url-pattern> ... </servlet-mapping> ... } </web-app> 16 Page 16
  • 48. Ease of Development - Annotations Servlet in Java EE 5: Java Class /* Code in Java Class */ package com.foo; public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) { /* doGet body */ } } 17 Page 17
  • 49. Ease of Development - Annotations Servlet in Java EE 5: Descriptor <!--Deployment descriptor web.xml --> <web-app> <servlet> <servlet-name>MyServlet </servlet-name> <servlet-class> com.foo.MyServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>MyServlet </servlet-name> <url-pattern>/myApp/* </url-pattern> </servlet-mapping> ... </web-app> 18 Page 18
  • 50. Ease of Development - Annotations Java EE 6 Servlet: Single Source file (many cases) package com.foo; @WebServlet(name=”MyServlet”, urlPattern=”/myApp/*”) public class MyServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) { ... } 19 Page 19
  • 51. Demo Java EE 6 20 Page 20
  • 52. Servlet 3.0 Other annotation for servlets • @ServletContextListener • @ServletFilter • @FilterMapping(urlPattern=”/foo”) SKIP 21 Page 21
  • 53. Enterprise Java Beans 3.1 Lite Highlights 32 Page 32
  • 54. EJB 3.1 Sample Simple Singleton @Singleton public class SharedBean { private SharedData shared; @PostConstruct private void init() { shared = ...; } public int getXYZ() { return shared.xyz; } } 33 Page 33 Everytime, the container starts, the init () will call.
  • 55. Singleton Client @Stateless public class FooBean { // Inject reference to Singleton bean @EJB private SharedBean shared; public void foo() { int xyz = shared.getXYZ(); ... } } 34 Page 34 Client is calling this Singleton session bean.
  • 56. EJB 3.1 Sample – Calendar Timer @Stateless public class TimerBean { @Schedule(dayOfWeek=”Sun”) public void onSunday() { ... periodically do some work ... } } 35 Page 35 35
  • 57. EJB 3.1 No Local Business Interface Just a bean class @Stateless public class HelloWorldBean { /* no interface */ public String hello(String name) { return “hello, “ + name; } } //Still a EJB reference @EJB HelloWorldBean hello; hello.hello(“David”); 36 Page 36 ● Sometimes separate local business interface isn't needed ● Better to completely remove interface from developer's view than to generate it ● Result : “no-interface” view ● Just a bean class ● All public bean class methods exposed to client ● Same behavior and client programming model as Local view ● Client still acquires an EJB reference instead of calling new() ● Not available to Remote clients 36
  • 58. EJB 3.1 Lite • Simple, modern subset of EJB for use outside of the full platform • Contents: > Session beans (stateful, stateless, singletons) > Transaction and security attributes > Interceptors > Annotations/ejb-jar.xml • Embeddable container API • Beans looked up by global name 37 Page 37
  • 59. JavaServer Faces 2.0 Highlights 38 Page 38
  • 60. JavaServer Faces 2.0 • Top Five Goals > Make custom components much easier to develop > Ajax support > Page description language (PDL) > Reduce the configuration burden > Provide for better compatibility between JSF component libraries from different vendors 39 Page 39
  • 61. Ingredients of a JavaServer Faces Component+Ajax solution • Resource Delivery Mechanism • Partial Tree Traversal • Partial Page Update ↑ In JSF 2.0 Spec • Ajaxification Capability ↓ In Component Library • Ajax Enabled Components 40 Page 40
  • 62. Ingredients of a JavaServer Faces component+Ajax solution Resource Delivery Mechanism • Delivers static resources to the user-agent in response to HTTP GET requests • Includes support for localized, versioned resources and resource libraries 41 Page 41
  • 63. Ingredients of a JavaServer Faces component+Ajax solution Partial Tree Traversal 42 Page 42
  • 64. Ingredients of a JavaServer Faces Component+Ajax solution Partial Page Update 43 Page 43
  • 65. Ingredients of a JavaServer Faces Component+Ajax solution Ajaxification Capability • A way to give ajax capability to existing JavaServer Faces components without writing any JavaScript™ language • Common approaches include > AjaxZone tag, enclose region to ajaxify > AjaxSupport tag, nest inside of component to ajaxify 44 Page 44
  • 66. Ingredients of a JavaServer Faces Component+Ajax solution Ajax Enabled Components • Such components always build on top of the previous ingredients • Current offerings are tightly coupled to their specific implementation of the previous ingredients. • By standardizing the foundations upon which these components build, we can guarantee interoperability between them. 45 Page 45
  • 67. Wrapup 46 Page 46
  • 68. Java Enterprise Edition 6 Status • Public reviews complete • Final and released • IDE support from NB 6.8 • & GlassFish v3 > Reference Implementation 47 Page 47 And Open Source can really lower TCO. Many critics say that open source isn’t less expensive as that even though up front costs are less – there are other factors that increase overall costs. But Sun’s Enterprise Quality open source solves these issues by: Lower Initial Cost Lower Annual Costs Pay only at the point of value (not up front) Lower skills required (than standard open source) because we make it enterprise quality, pre-bundle, add value adds And we add additional value adds to open source which other proprietary vendors add to increase performance, configuration mgmt, version control And we add tools to increase productivity
  • 69. NetBeans & Java EE 6 Version 6.8 (released this Month) New: (Java EE 6) • Java EE6 Web Projects with profiles & EJBs in web Apps • EJB 3.1 project support • RESTful web services (JAX-RS 1.1), GlassFish Metro 2.0 web services (JAX-WS 2.2), JAXB 2.2 • Java Persistence JPA 2.0, deployment, debugging and profiling with GlassFish v3 application server 48 Page 48 Web Projects with Java EE 6 and Java EE 6 Web profiles, EJBs in web applications EJB 3.1 support, EJB project file wizard also supports Singleton session type RESTful web services (JAX-RS 1.1), GlassFish Metro 2.0 web services (JAX-WS 2.2), JAXB 2.2 Java Persistence JPA 2.0, deployment, debugging and profiling with GlassFish v3 application server
  • 70. NetBeans & Java EE 6 Version 6.8 (released this Month) More updates on • Java Server Faces 2.0 • JavaFX 1.2.1 • Kenai.Com: Connected Developer • Ruby & PHP • Maven • And much more • C/C++ 49 Page 49 Web Projects with JavaServer Faces 2.0 (Facelets) • Code & namespace completion and error hints, doc popups, & tag auto-import for Facelets • Editor support for Facelets libraries, composite components, expression language, including generators for JSF and HTML forms • Customizable JSF components palette generates JSF forms and JSF data tables from entities • New File wizard generates customizable CRUD (create/read/update/delete) JSF pages from entities • Broader usage of annotations instead of deployment descriptors JavaFX • Added support for the latest JavaFX SDK 1.2.1 • Improved code completion • Editor Hints: Fix Imports, Surround With, Implements Abstract Methods, and more • Improved navigation: Hyperlinks, Go to Type, Find Usages Full JIRA support Kenai.com (Connected Developer) (plugin from update center) Project dashboard with more member and project details, improved search and navigation, easier project sharing Improved instant messenger integration: Online presence, private and group chat with Kenai members, easy to add links to code / files /issues / stack traces to messages Improved issue tracker integration
  • 71. Participate! • Learn about Java EE 6 with NetBeans 6.8 • Download GlassFish V3 (incl with NB 6.8 Full) • Send feedback on the component technologies. • Participate. • Contribute. • Enjoy! 50 Page 50 50
  • 72. Thanks Eugene Bogaart Eugene.Bogaart@sun.com 51 Page 51