CONTENTS | PREV | NEXT | INDEX Designing Enterprise Applications
with the J2EETM Platform, Second Edition



7.1 Packaging Components

A J2EE component (such as a servlet or an enterprise bean) is an independent functional software unit that conforms to interfaces defined by a component specification, and has only explicit dependencies on its environment. A component may be a single class, but more often is a collection of classes, interfaces, and resources. The J2EE platform offers five types of components: enterprise beans, servlets and JSP pages, applets, application clients, and connectors.

The J2EE platform specification provides a way to bundle one or more components into a module, which is the smallest unit of independent deployment for any component type. A module may be deployed directly into a J2EE container, or one or more modules may be combined to form a J2EE application. For example, several enterprise bean components may be packaged into an EJB module that provides all or part of an application model, and that EJB module may be further combined with other modules to create a J2EE application.

Modules and applications for the J2EE platform are packaged and deployed as deployment units, which are compressed archive files similar to JAR files, but with a specified internal structure and file extension. There are four types of J2EE platform modules:

The deployment unit for each type of module has a structure defined by the corresponding component technology specification. For example, a Web module deployment unit is called a "Web archive," which has (among other things) a WEB-INF directory containing support files for the module. One or more J2EE platform modules can be composed into a J2EE application, which has its own type of deployment unit.

In addition to components and resources, each deployment unit contains a deployment descriptor, which is an XML file that specifies the explicit dependencies between each component and its environment. Deployment descriptors specify two kinds of information:

See Code Example 7.1 and the text following it for an example of structural and assembly information.

Each J2EE developer role has specific packaging and deployment responsibilities.



CONTENTS | PREV | NEXT | INDEX
Copyright © 2002 Sun Microsystems, Inc. All Rights Reserved.