Java EE 6 Feature Overview

Java EE 6Java EE 6 just got released yesterday, here is everything you need to know about, in brief.

A look back: Java EE 5 was a remarkable step towards a mature, widely deployed, well supported server-side development platform. EJB 3.0 was re-engineered to ease, the Entity Bean model was stripped and replaced by JPA as the persistence paradigm, JSF was introduced as the standard presentation tier framework and JAX-WS 2.0 replaced JAX-RPC as the SOAP web services API. The focus of Java EE 5 was squarely on reducing complexity by embracing the concepts of annotations, POJO programming, zero-configuration systems.

Overview

Java EE 6 is next big step in the journey towards the idea of a “simple, streamlined and well-integrated platform”. Java EE 6 includes a rich paradigm of innovations best reflected in the technologies that comprise the platform including brand new APIs like WebBeans 1.0 and JAX-RS 1.1, JPA 2.0 or even mature APIs like Servlet 3.0, EJB 3.1

JSR 316: JavaTM Platform, Enterprise Edition 6 (Java EE 6) Specification.

Let’s give each one of the features a brief look:

Pruning

Pruning the Dead meat: The Java EE platform is gainging weight since it’s initial launch in 1999. The idea now is to cut the dead (least used) stuff off. Java EE 6 begins the essential process of carefully pruning  APIs to make the platform more lightweight and to make room for healthier growth. Few APIs that are chopped off and why:

  • JAX-RPC — JAX-RPC was an early attempt at modeling SOAP web services as RPC calls. Web services are now much more robust, feature-rich and popular JAX-WS API effectively supercedes JAX-RPC.
  • JAXR — JAXR is for interfacing with UDDI registries. Unfortunately, UDDI is not widely used.
  • EJB 2.x Entity Beans CMP — The complex, heavyweight model replaced by the popular, lightweight, POJO based JPA persistence model.
  • Java EE Application Deployment — JSR 88 was an attempt at developing deployment tools that work across application servers. Unfortunately, this API has never got popular, and never gained much vendor support.
  • Java EE Management — Application server management tools that work in a cross-vendor manner. Like JSR 88, the idea never paved off.

“Pruning” an API essentially means that an application server vendor need not support these technologies, what this doesn’t mean is that you cannot support those APIs, few larger vendors will probably continue supporting them atleast for some time.

Profiles

What is the biggest  major criticism of Java EE? Its simply too large. The fact is, majority of Java web applications do not utilize/leverage   the full Java EE stack. So why is that stuff still in there?

Profiles are designed to address this issue. Profiles are essentially sub-sets of Java EE APIs geared towards a particular class of applications in mind. For example, the proposed Java EE Web Profile will only include APIs that are likely to be used in most Java web applications. The idea isn’t new,  Java ME supports the idea of Profiles already.

Although Java EE 6 defines the rules for creating new Profiles through separate JSRs, only one Profile, the Web Profile is included in platform this time. Detailed chart of Profiles can be found at Sun’s documentation.

Web Beans 1.0:

WebBeans is perhaps the most groundbreaking API developed in the Java EE 6 time-frame. WebBeans fills a number of gaps in Java EE. Although WebBeans is inspired by Seam, Google Guice as well as Spring, it does not directly mirror any of them. Indeed, WebBeans adds a number of unique innovations of its own. Here’s brief on it:

  • WebBeans unifies the JSF, JPA and EJB 3 programming models to truly feel like a single, well-integrated platform.
  • WebBeans implicitly manages the life-cycle of all registered components in appropriate contexts.
  • WebBeans brings a robust set of dependency injection features to the platform in a completely type-safe and Java-centric way.
  • WebBeans enhances the Java EE Interceptor model by adding the ability to bind interceptors to annotations instead of having to bind interceptors to target object classes themselves.

WebBeans adds a lot of other very cool features that pave way to nextgen web applications.

Read More: Detailed Spec for Web Beans

JSF 2.0:

JSF appears to be holding ground in the Web UI layer. However, there are a number of valid concerns around the usability and robustness of JSF. JSF 2.0 meets these concerns, and adds all new graded stuff:

  • JSF formally adds Facelets as a view technology, simplified page authoring. Facelets are usually written with XHTML markup language. This allows Facelets pages to be portable across diverse development platforms.
  • JSF 2.0 brings Java EE 5 style annotation-driven configuration to the table via annotations such as @ManagedBean and @ManagedProperty. (reduction of faces-config.xml file).
  • JSF 2.0 changes the JSF life-cycle to account for AJAX with concept of partial page processing to handle AJAX events.
  • Built-in capability to handle resources such as images, JavaScript files, CSS and the like, capability to refer to resources via logical names, grouping resources into libraries and versioning.
  • Templating: You can create a page that acts as a template for other pages in an application.
  • Composite Components: a new feature in JSF that makes it easy to create customized JSF components. You can create composite components by using JSF page markup, other JSF UI components, or both
  • Support for Events

Read More: JSF 2.0 Detailed Spec

EJB 3.1:

EJB 3.0 was relatively well-received by the community due to the ease it introduced. EJB 3.1 targets to continue the trend with groundbreaking new EJB 3.1 features:

  • Business interfaces are now optional, even for Session Beans.
  • EJB 3.1 adds the concept of Singleton Beans, thread-safe by default. Also, comes declarative concurrency controls for greater flexibility.
  • Scheduling:  Cron-style scheduling comes to enterprise apps. This a significant addition to the existing limited-scope timer API.
  • Async Session Bean Method calls: Using @Asynchronous annotation, you can even control the asynchronous EJB method via a handle to a java.util.concurrent.Future object.
  • EJB Lite: A Web Profile based stripped down version. EJB Lite includes features like transactions and security, it does not include features like messaging, remoting and scheduling.
  • Packaging becomes easy,  EJB in WAR files now possible.
  • run an embedded EJB 3.1 container in Java SE environments such as JUnit tests
  • utilize standardized global JNDI names for EJB

Read More: EJB 3.1 Detailed Spec

JPA 2.0:

Now, JPA has been officially separated from EJB as a distinct API in its own. JPA has been a success. It enjoys great adoption rates and first-class vendor support. JPA 2.0 aims to add to the trend by adding new features:

  • JPA 2.0 adds a number of much needed ORM mapping enhancements such as the ability to model collections, maps and lists  via the @ElementCollection annotation and the ability to map unidirectional one-to-many relationships (JPA 1.0 only allowed bidirectional one-to-many relationships)
  • EntityManager and Query APIs have been enhanced to support things like retrieving the first result (JPA 1.0 allowed the retrieval of a unique result), specifying the maximum size of query results, getting access to the underlying vendor-specific entity manager/query objects and pessimistic locking.
  • JPQL has been enhanced with SQL-like CASE, NULLIF, COALESCE and like capabilities.
  • JPA 2.0 adds a Criteria API. (The Criteria API in Hibernate or TopLink is essentially the object-oriented, type-safe, Java-centric equivalent of JPQL statements. This is a boon for use cases such as writing complex dynamic queries and avoiding runtime exceptions thrown while parsing JPQL.)
  • JPA2 standardizes second level caching, provides standard JDBC properties, flexibility of specifying timeouts and more.

Read More: JPA 2.0 Detailed Spec

Servlet 3.0:

Servlet 3.0 changes have generated quite a bit of excitement and is likely to be very well-received by the community:

  • Servlet 3.0 introduces annotations @WebServlet, @ServletFilter and @WebServletContextListener. (reduces web.xml  cofigs)
  • web.xml fragments: The container now  looks for configuration in web.xml fragments anywhere in the web application classpath (such as the WEB-INF/classes directory or jars in the WEB-INF/lib directory) in addition to the web.xml file in WEB-INF directory.
  • Programmatically add Servlets, Filters and Listeners through the ServletContext.
  • Support for Asynchronous processing

Read More: Servlet 3.0 Detailed Spec

JAX-RS 1.1:

REST is increasingly gaining traction as an alternative web services development paradigm. We know of the advantages from REST vs. SOAP

Much like JAX-WS abstracts away the low-level details of the SOAP protocol, JAX-RS is designed to reduce REST development to POJO programming and annotation based configuration. Here is a high level view of JAX-RS:

  • The @Path annotation determines the URL that a JAX-RS resource can be accessed, down to a method in a POJO.
  • Annotations like @GET, @POST, @PUT and @DELETE are used to specify the HTTP method that is used to access a resource.
  • Input from sources like URL query parameters, parts of the URL, cookie values and HTTP header values are mapped into variables via annotations like @QueryParam, @PathParam, @CookieParam and @HeaderParam respectively.
  • The @Produces annotation tells JAX-RS what the content type of returned values are such as text/xml, text/json and the like.
  • JAX-RS is integrated with Servlets, WebBeans and EJB.

Overall, JAX-RS has many other powerful features that make REST development a breeze, just like JAX-WS makes SOAP development almost transparent.

Read More: JAX-RS Detailed Spec

What’s More

We have covered the most important ones, Few we didn’t include are Enterprise Web services 1.3, JAX-WS 2.2, JAXB 2.2, XML Messaging and more. You can check them out at the official Java EE 6 Technologies page.

Right now, Netbeans 6.8, GlassFish Tools Bundle for Eclipse 1.2 Release Candidate are the only IDEs  and GlassFish3.1 is the only application server that fully support Java EE 6.

Refrences:  Java EE6 Detailed Overview, official Java EE 6 Technologies, theserverside, and devx

GD Star Rating
loading...
GD Star Rating
loading...

1 thought on “Java EE 6 Feature Overview”

  1. Frank Nimphius and Jobinesh Purushothaman is coming to Bangalore this April at Great Indian Developer Summit 2010 ( developersumit dot com) to to show how JavaServer Faces can be used to build compelling Ajax user interfaces for Web Services models giving end users a comfortable working environment that includes client side validation and user interface customization.

    GD Star Rating
    loading...
    GD Star Rating
    loading...
    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.