Java EE 7, under the specification of JSR342, is expected to be released in mid-late 2012. Anticipation of the update’s platform as a service (PaaS) capabilities is looming large among technological enthusiasts. With a promise of numerous key improvements, the focus will be on the suitability of Java EE for cloud environments. This article spotlights key things to look for in Java EE 7.
Spotlights in Java EE 7
The sections to follow list the notable features of the major Java EE 7 technologies.
Enterprise Java Bean 3.2 (JSR 345)
- Enhancing EJB architecture to enable the PaaS model with features such as multi-tenancy
- Factorization of container-managed transactions to use other component technologies of the Java EE platform
- Enhanced use of annotations to simplify EJB programming model
- Alignment and integration with other specifications related to JSRs within the Java EE 7 platform such as CDI, JMS, Bean Validation, etc
Servlet 3.1 (JSR 340)
The main objectives of upgrading to Servlet 3.1 from Servlet 3.0 involve ease of development, plugins and security features in the web tier. Thus, enhancement will be focused mainly on the following areas of the Java Web container:
- Optimize Java EE PaaS model, leveraging the cloud for Web applications
- Optimizing PaaS model leveraging multi-tenancy. To support this into the Web container, the main areas of optimization will be security, session state, resources and other multi-tenant awareness requirements for Web applications.
- Enhance the asynchronous support of Servlet 3.0 and simplify further in building asynchronous applications
- Utilize Java EE concurrency APIs for asynchronous support
- Enhance the Servlet 3.0 built-in security features
- Optimize the built-in plug-ability support of Servlet 3.0
- Focus on providing necessary functionality for building easier-to-use, high-level protocol support for Web Sockets and other protocols that work with HTTP in the Servlet API
Java Persistence API 2.1 (JSR 338)
- Addition of the javax.persistence.StoredProcedureQuery interface to control stored procedure query execution. >Javax.persistence.EntityManager has added four variants of methods that return a StoredProcedureQuery for executing a stored procedure, including one allowing named stored procedure query. The newly introduced annotation @NamedStoredProcedureQuery can be specified on an entity or mapped class, similar to the @NamedQuery. The parameters IN, OUT and INOUT can be used to manipulate values from the stored procedure.
StoredProcedureQuery createNamedStoredProcedureQuery(java.lang.String name)StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureNameStoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName, java.lang.Class... resultClasses)StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName, java.lang.String... resultSetMappings)
- The javax.persistence.criteria.AbstractQuery interface has been refactored by CriteriaUpdate, CriteriaDelete and CommonAbstractQuery interfaces.
- Added new identifiers for persistence query language (JPQL), such as FUNCTION for supporting JPQL built-in functions, TREAT for down casting within path expressions in the FROM and WHERE clauses, and ON for specifying the relationship between the tables.
- The entity listeners can be annotated with @PostConstruct and @PostDestroy for their lifecycle. Also, the usual lifecycle callback methods, such as @PrePersist, @PostPersist, @PreUpdate and @PreRemove can be used for entities.
- Added support for unsynchronized persistence context to create container-managed unsynchronized persistence context. For example,
Java Messaging Service 2.0 (JSR 343)
The new introduction will be an evolution of the previous version, JSR-914.
- Enhanced JMS programming model to make application development easier, cleaning up ambiguities in the present specification
- Enhanced integration with CDI for easier and more unified use of API
- Make necessary changes to API in allowing any JMS provider to integrate with any Java EE container
- Make JSR more cloud-friendly, leveraging multi-tenancy and other cloud-related features from the platform
JAX-RS 2.0 (JSR 339)
- Define two client APIs, both REST-compatible — a low-level API using builder pattern and a higher-level API leveraging the low-level APIs
- Hypermedia, an important RESTful feature of Web applications, will be easy to create, and it will process links associated with resources in representation either as a header or as a links within the entity peripheral.
- Make it possible to validate parameters of forms or query using bean validation and return a meaningful response on failure to validate
Expression Language 3.0 (JSR 341)
- Separate expression language context into parsing and evaluation contexts independent of the JSP specification
- Introduction of new customizable expression language coercion rules
- Reference static methods and members directly in EL expressions without having to define them in Tag Library Descriptor, similar to instance method invocation
- Adding equality, string concatenation, and sizeof operators
- CDI Integration so that events can be generated before/during/after the expressions are evaluated
Java Server Faces 2.2 (JSR 344)
- Making configuration options dynamic, eliminate tag handler class even for non-composite JSP components, introduce shorthand URLs for Facelet Tag Libraries, make cc:interface in composite components optional, enhance deployment, integrate with CDI
- Component identification and Ajax
- Support implementation of Portlet Bridge 2.0
- Support for HTML5 features, such as Forms, Heading, Metadata and Section content model, Flow management, Listener for page navigation events, and new components like FileUpload and BackButton
Context and Dependency Injection 1.1 (JSR 346)
- Global ordering of interceptors and decorators,
- API for managing built-in context,
- Embedded mode to allow startup outside the Java EE container
- Declarative control over which packages/classes are scanned in a bean archive
- Bean declaration at constructor level
- Injection for static members, such as loggers
- Send CDI events for Servlet events
- Better support for CDI in libraries when used in the Java EE platform
Bean Validation 1.1 (JSR 349)
- Integration with other Java EE specs
- APIs to validate parameters and return values of method calls.
- Validate parameters and return values on HTTP calls
- Ability to translate a group into another group while cascading the validation
- APIs to validate parameters and return values of method calls
- Apply constraints on group collection
- Extend the model to support AND and OR style composition
JCache — Java Temporary Caching API (JSR 107)
In-process caching of Java objects allows an efficient implementation and removes the programmer from the burden of implementing cache expiration, mutual exclusion, spooling, and cache consistency. Objects type, which can be known only at runtime, can be cached, but those which implement the serializable interface can only be spooled. Package: javax.cache.
Cloud Ready Because of Container-based Model
The main focus of Java EE 7 is the cloud. The Java EE platform is already suited for cloud environment, owing to its container-based model and the abstraction of its resource access. Java EE always has been a managed environment where access to external resources and the system is controlled by the containers. The advantage of this container-based model is that portable applications can target single machines as well as cluster deployment without fundamental changes in the programming model. Java EE 7 is expected to evolve this paradigm and enhance it with some incremental changes. The interesting enhancement to look for is on how much it can leverage current architecture to support Java EE platform as a service. However, the promised enhancement under the umbrella of Java EE 7 will definitely have some operational impact on the arena of cloud computing.