10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Once a <strong>Java</strong> <strong>EE</strong> unit has been produced, it is ready to be deployed. Deployment typically<br />

involves using a platform’s deployment tool to specify location-specific information, such as a<br />

list of local users that can access it and the name of the local database. Once deployed on a local<br />

platform, the application is ready to run.<br />

Packaging Applications<br />

A <strong>Java</strong> <strong>EE</strong> application is delivered in an Enterprise Archive (EAR) file, a standard <strong>Java</strong> Archive<br />

(JAR) file with an .ear extension. Using EAR files and modules makes it possible to assemble a<br />

number of different <strong>Java</strong> <strong>EE</strong> applications using some of the same components. No extra coding<br />

is needed; it is only a matter of assembling (or packaging) various <strong>Java</strong> <strong>EE</strong> modules into <strong>Java</strong> <strong>EE</strong><br />

EAR files.<br />

An EAR file (see Figure 1–6) contains <strong>Java</strong> <strong>EE</strong> modules and deployment descriptors. A<br />

deployment descriptor is an XML document with an .xml extension that describes the<br />

deployment settings of an application, a module, or a component. Because deployment<br />

descriptor information is declarative, it can be changed without the need to modify the source<br />

code. At runtime, the <strong>Java</strong> <strong>EE</strong> server reads the deployment descriptor and acts upon the<br />

application, module, or component accordingly.<br />

FIGURE 1–6 EAR File Structure<br />

META-INF<br />

application.xml<br />

sun-application.xml<br />

Assembly<br />

Root<br />

Web<br />

Module<br />

Application<br />

Client Module<br />

EJB<br />

Module<br />

Resource<br />

Adapter Module<br />

Packaging Applications<br />

<strong>The</strong>re are two types of deployment descriptors: <strong>Java</strong> <strong>EE</strong> and runtime. A <strong>Java</strong> <strong>EE</strong> deployment<br />

descriptor is defined by a <strong>Java</strong> <strong>EE</strong> specification and can be used to configure deployment settings<br />

on any <strong>Java</strong> <strong>EE</strong>-compliant implementation. A runtime deployment descriptor is used to<br />

configure <strong>Java</strong> <strong>EE</strong> implementation-specific parameters. For example, the Sun <strong>Java</strong> System<br />

Chapter 1 • Overview 51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!