SCJP,SCWCD,OCA,OCP
http://java.sun.com/javaee/downloads/(Java EE 5 SDK Preview (includes Sun Java System Application Server PE 9 Beta))
The Advantages of the Java EE 5 Platform: A Conversation with Distinguished Engineer Bill Shannon
By Janice J. Heiss, March 2006 |
![]() |
Version 5 of the Java Platform, Enterprise Edition (Java EE, formerly referred to as J2EE), has arrived. Its streamlined features offer added convenience, improved performance, and reduced development time, all of which enable developers to bring products to market faster.
To get an update on the Java EE 5 platform, we met with Java EE specification lead Bill Shannon, a Distinguished Engineer at Sun Microsystems. Shannon has been with Sun since 1982 and previously worked on the JavaMail API, the HotJava Views product, the Common Desktop Environment (CDE), the Solaris Operating Environment, and all versions of SunOS. He graduated from Case Western Reserve University with an MS in Computer Engineering.


I think one of the biggest improvements is that, in most cases, you no longer need to use deployment descriptors. Even something as simple as combining modules together into an "ear" file used to require a deployment descriptor to list where the modules were. Now all you need to do is to put the modules in the ear file in an obvious way, follow some simple conventions like putting all your shared libraries in the "lib" directory, and that's it.
Here's a simple programming example. Previously, to create a web service, you needed to write a Java interface that describes the web service API, a Java class that implements the web service, a deployment descriptor that tells the container about the web service, and a configuration file that tells the web service runtime how to map Java classes to web service operations. Much of this was boilerplate that changed little from application to application. In Java EE 5 all of this can be done by writing a single Java source file -- the class that implements the web service. The rest is taken care of for you by the container, based on annotations you include in your source code, and based on default rules for what to do when no annotations are present.
Here's the complete source code for a simple web service:
package endpoint; import javax.jws.WebService; @WebService public class Hello { public String sayHello(String param) { return "Hello " + param; } } |
![]() |
|
"There are so many ways we've made life simpler for developers, it's hard to know where to start."
Distinguished Engineer, Sun Microsystems |




So, instead of calling an API to request the container to do something for you, and instead of writing a deployment descriptor that has to be synchronized with the code you're writing, you can put your request for the container right in the code. You can say "please expose this class as a web service" or "please start a transaction when this method is called".
"If you were scared off of J2EE because it seemed too complex, it's time to take another look."
Distinguished Engineer, Sun Microsystems |
|
Of course, this new capability in no way removes or interferes with older capabilities. There are cases in which a deployment descriptor is the right approach, and you can continue to use them when desired.


If you were scared off of J2EE because it seemed too complex, it's time to take another look. If you've been attracted to alternative technologies such as Spring and Hibernate, you'll find many of the good ideas from those technologies in Java EE 5.
Take a look at Java EE 5, you'll be amazed at how easy it is.
|
![]() |
![]() |


Java Persistence is in many ways a replacement for EJB CMP (Container Manager Persistence), although CMP is still fully supported. Java Persistence is a much simpler approach to mapping Java objects to relational databases, and benefits greatly from work done in other products and technologies such as Hibernate, TopLink, and Java Data Objects (JDO). The lessons we've learned from them, and from years of using EJB CMP, led us to create Java Persistence. Java Persistence is a significant departure from EJB CMP, and more resembles those other technologies. Java Persistence is based on POJOs with annotations. Java Persistence is available both as part of Java EE, and for use outside Java EE in a Java SE environment.
In addition, we've greatly simplified the basic EJB programming model. It is much easier to write a stateless or stateful component that takes full advantage of the transactional capabilities of the EJB container. EJB components can be written as POJOs with, for example, a simple @Stateless
annotation. By default, the public methods of the component will be exposed to clients and will run in a transaction. Additional annotations can be used to control security requirements for methods and transaction requirements.
![]() |


There is a large third-party component market for JSF, which means the developer has the option to leverage high quality commercial off-the-shelf components in their application. JSF is a Java Community Process (JCP) standard that already has broad adoption from major vendors such as IBM, Oracle, BEA, JBoss, and Borland. With such market penetration, you can be sure that your investment in JSF will be preserved.
The technical convenience of JSF stems from its component model, which allows page authors to compose their user-interface at a higher level of abstraction than previous technologies. JSF presents a Swing-like event model for web applications that works very well with tools.
Lastly, JSF is very adaptable and extensible. Existing popular technologies such as Spring and Hibernate have included JSF adapters to allow their use with JSF. Naturally, because JSF is a part of Java EE 5, it integrates very well with Java Persistence and EJB 3.0.
![]() |


JAX-WS is mostly based on JAX-RPC (Java API for XML-based Remote Procedure Calls), but has been improved to better support the latest web service standards and programming styles.
JAXB 2.0 is a significant improvement over JAXB 1.0, which adds full support for W3C XML schemas. JAXB is used to map Java classes to XML data and is used by JAX-WS to encode and decode data that is sent in web services calls.
Once again, the use of annotations makes it much easier to create and use web services. JSR 181 defines the annotations that are used with JAX-WS to define web services. In the simplest case a POJO is annotated with the @WebService annotation to make it a web service, as I previously described. JAXB also uses annotations to control the mapping to XML. Both JAX-WS and JAXB provide useful defaults so that it's often not necessary to use most of the annotations they provide. The simple cases "just work" and the more complex cases are made easy through the use of annotations.


But an IDE is not necessary to create Java EE applications. Some first time Java EE developers might prefer to start by writing simple JSP pages, making use of the JSP expression language, and never need to learn the Java language at all.


The PE application server, built from the GlassFish code, is the application server included in the Java EE 5 SDK, as well as our development tools such as NetBeans and Java Studio Creator.
![]() |


|
"If you're interested in helping to build the reference implementation of the Java EE spec, GlassFish is the place to be."
Distinguished Engineer, Sun Microsystems |
GlassFish is free, and it is open source. I repeat: GlassFish is free, and it is open source. GlassFish uses the OSI-certified CDDL license.


Developers who are interested in understanding "how it all works" will definitely want to explore GlassFish.
The GlassFish site also includes tips and examples that will be useful to developers. Developers who want to get involved in contributing to the GlassFish project will find instructions there.
Finally, developers who want to contribute directly to the development of future Java EE specs should become JCP members, review draft specs, and consider participating in future expert groups to develop specs.


来源:https://www.cnblogs.com/shiqiang124/archive/2006/03/28/360680.html