Advertisment

Java EE 6 & GlassFish v3

author-image
PCQ Bureau
New Update

Arun Gupta, GlassFish Evangelist

Advertisment

The Java EE 6 platform defines a standard way to develop, deploy, and manage

distributed,  and multi-tier enterprise Java applications. There are three

components of the platform — a Specification, a Reference Implementation (RI),

and a Technology Compatibility Kit (TCK). The specification is created as Java

Specification Request (JSR) 316 under the open and collaborative Java Community

Process (JCP). The different aspects of the platform, such as Transactions,

Persistence, and Web services are defined in it's own specification following

the same collaborative process. For example, Java Persistence API 2.0 defines an

API for the management of persistence and object/relational mapping.  Reference

implementation is a binary distribution and is a proof-of-concept that the APIs

and assertions defined in the specification can be implemented.

GlassFish v3 is the open source reference implementation for Java EE 6 and is

extremely lightweight, highly performant, and production quality that can be

used in mission critical applications. The TCK is a set of tests that can be run

on any Java EE 6 implementation to ensure conformance with the specification.

Direct Hit!

Applies To: Developers, Program-mers,

Project Managers, CIO



USP: Learn Java EE has evolved


Primary Link:





http://glassfish.dev.java.net





http://www.ciol.com/sparkIT/2010




Search Engine Keywords: Java EE, GlassFish

Advertisment

The Java EE platform has evolved and matured over the past 10 years. There

are three main themes in the Java EE 6 platform — extensibility, profiles, and

pruning. Extension points and server provider interfaces are added to the

platform enabling other useful technologies desired by the web and enterprise

developer to plug into platform implementations cleanly and efficiently. This

allows a third party framework to be seamlessly integrated with a Java EE 6

implementation, such as GlassFish. For example, typically these frameworks have

to rely upon registering servlet filters/listeners in 'web.xml' or a similar

mechanism to register with the Web container. The Servlet 3.0 specification

defines 'web module deployment descriptor fragment' (aka 'web-fragment.xml')

that allows all the framework configuration information to be specified in

'META-INF/web-fragment.xml'. The Web container uses the specified configuration

for registering the framework.

Profile and Pruning together address the ever increasing size of the Java EE

platform. The profiles allow to refocus the Java EE platform on particular

classes of developers and applications. A profile is a reconfiguration of the

platform and consist of a proper subset of technologies contained in the

platform, technologies not present in the platform, and may tag certain

technologies optional. The platform specification defines the rules to create or

revise an existing profile. As part of Java EE 6, a Web Profile targeted at

developers of modern web applications is defined. It clearly defines the set of

technologies needed by most web application developers.

Advertisment

Certain technologies included in the Java EE platform  are no longer

relevant  as they were   introduced to the platform. Pruning defines a 2-step

process to convert a required feature of the platform into an optional

component. The platform Java EE 6 specification defines the technologies that

are pruned in this release. For example JAX-RPC 1.1 and JAXR 1.0 are marked for

pruning in this release and will be marked optional in the next release of the

platform.

In addition to the main themes, the platform continues to evolve on

simplicity and ease-of-development. A few new specifications are added to the

platform to make it more robust. Contexts and Dependency Injection (JSR 299),

aka CDI, provides a type-safe dependency injection for Java EE. It utilizes the

annotations defined by the more generic Dependency Injection for Java (JSR 330)

and adapts it for Java EE environments. Basically CDI adds a number of

additional features useful for enterprise applications. Bean Validation (JSR

303) defines a metadata model and API for JavaBean validation. Standard

constraints like @NotNull and @Size are defined in

'javax.validation.constraints.*' package and may be applied to JSF managed beans

and JPA entity beans. New constrains can be easily defined using the framework

defined by the specification. Java API for RESTful Web services (JSR 311), aka

JAX-RS, defines an API for RESTful Web services in the platform. This API has

been available for for some time and is now included in the platform.

Several other specifications in the platform received a major face lift as

well. Servlets 3.0 make 'web.xml' optional in most of the cases by introducing

equivalent annotations and following the better defaults and

convention-over-configuration rules defined in the specification. Dynamic

registration of servlets and filters, asynchronous processing, and security

enhancements are some other enhancements in this area. Java Server Faces (JSF)

2.0 now uses Facelets as the view technology, has Ajax support integrated, does

not require 'faces-config.xml' in common cases, and makes composite components'

authoring easier. Starting with Enterprise Java Beans (EJB) 3.1, EJBs can now be

easily packaged into a Web ARchive (WAR) file. A singleton bean for shared state

across the java Virtual Machine (JVM), optional interface, and cron-like

calendar semantics are some other improvements made in this area. JPA 2 expands

the object/relational mapping and makes it more natural to a Java developer. A

type-safe Criteria API, improvements to the Java Persistence Query Language (JPQL),

and a metamodel API provides useful additions for database developers.

Advertisment

Several other specifications like Java EE Connector Architecture 1.6, Java

API for XML Web Services (JAX-WS) 2.2, Java API for XML Binding (JAXB) 2.2, Web

Services Metadata MR3,  Java Server Pages (JSP) 2.2 / Expression Language (EL)

2.2, and many others are also updated to align with the platform. The complete

list of specifications is included in the Java EE 6 platform specification.

All features mentioned above can be taken for a test drive with GlassFish v3

which can be downloaded from http://glassfish.dev.java.net. GlassFish v3 is a

light-weight, modular, embeddable, extensible, and Java EE 6 compliant

application server. The modularity comes from the fact that the core of

GlassFish is an OSGi R4.1 compliant runtime. Even though Apache Felix is used,

and bundled, as the OSGi runtime but GlassFish can be easily configured to run

on top of other OSGi runtimes such as Equinox and Knopflerfish. Any standard

OSGi bundle can easily run on GlassFish.

Each deployed application is associated with one or more containers such as

Web, Security, and JPA. An efficient utilization of resources and memory is

achieved by starting only the containers required by all the deployed

applications. The embeddable feature allows GlassFish to run inside an existing

JVM using programmatic APIs. This removes the need for explicitly downloading

and configuring a binary bundle. In addition to Java EE 6, GlassFish can also

run Ruby-on-Rails, Sinatra, Ramaze, Groovy-and-Grails, and Python/Django

applications natively. Well defined extension points in monitoring, deployment,

configuration, administration, and other modules  allow to extend the core

functionality of GlassFish in a very smooth and seamless manner. A RESTful

interface to monitoring and management data from GlassFish allows toolkit

developers to write their custom scripts and clients using language of their

choice such as Java, JavaScript, or Ruby.

NetBeans, Eclipse, and IntelliJ provide a comprehensive set of tooling around

different Java EE 6 features. Wizard-drive development, integrated javadocs,

code completion, syntax coloring, debugging, and many other features like these

truly provide an integrated experience to develop Java EE 6 applications in

these IDEs. In addition, NetBeans and Eclipse boosts developer productivity

multi-folds by automatically deploying the application when the application

files are saved. Optionally, the session state may be preserved across multiple

deploys.

Advertisment