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



7.2 Roles and Tasks

Three development roles play a part in the J2EE packaging and deployment process: application component providers, application assemblers, and deployers. The packaging and deployment tasks that each role performs are summarized in Figure 7.1.

Figure 7.1 J2EE Packaging and Deployment Tasks

Developers in each of these roles create deployment units and perform specific tasks with the deployment descriptors of the deployment units they create.


7.2.1 Application Component Provider Tasks

Application component providers develop enterprise beans, HTML and JSP pages, servlets, applets, application clients, and associated helper classes. They also create the deployment descriptor for each component. Code Example 7.1 contains an excerpt from the sample application's enterprise bean deployment descriptor:

<session>
	<description>This is the Catalog ejb</description>
	<display-name>The Catalog</display-name>
	<ejb-name>TheCatalog</ejb-name>
	<local-home>
		com.sun.j2ee.blueprints.catalog.ejb.CatalogLocalHome
	</local-home>
	<local>com.sun.j2ee.blueprints.catalog.ejb.CatalogLocal</local>
	<ejb-class>
		com.sun.j2ee.blueprints.catalog.ejb.CatalogEJB
	</ejb-class>
	<session-type>Stateless</session-type>
	<transaction-type>Container</transaction-type>
	<env-entry>
		<env-entry-name>
			ejb/catalog/CatalogDAOClass
		</env-entry-name>
		<env-entry-type>java.lang.String</env-entry-type>
		<env-entry-value>
			com.sun.j2ee.blueprints.catalog.dao.CatalogDAOImpl
		</env-entry-value>
	</env-entry>
	<resource-ref>
		<res-ref-name>jdbc/CatalogDataSource</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>
</session>
Code Example 7.1 Descriptor Elements for an Entity Bean

Code Example 7.1 shows the deployment descriptor declaration of the sample application's catalog session bean. For this example, assembly information is shown in italics and structural information is in regular code font. Notice that structural information defines the public interface of the bean and the resources the bean uses. Structural information corresponds to hard-coded features of the bean, such as the classes it uses and the environment entries and resources it accesses. Assembly information, such as the bean's name, its description, and the values of environment entries, can be changed without causing inconsistencies with the code. Notice also that additional whitespace and newlines are significant within deployment descriptor text elements, and so should usually be avoided, except when it is truly desired. For example, text content to be used as a label may include whitespace, but resource reference names must not.

An application component provider typically creates the structural information in a deployment descriptor and may assign default values for some assembly informations. Application assemblers and deployers change or define the assembly information to configure the component for its role in an application, but usually leave structural information unchanged.


7.2.2 Application Assembler Tasks

Application assemblers combine existing components into applications and provide application assembly information for the application as a whole. Code Example 7.2 is an excerpt from the sample application's Web deployment descriptor:

<web-app>
	...
	<servlet>
		<servlet-name>MainServlet</servlet-name>
		<display-name>HTML Client Front Controller</display-name>
		<description>no description</description>
		<servlet-class>
			com.sun.j2ee.blueprints.waf.controller.web.MainServlet
		</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>webTierEntryPoint</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	...
</web-app>
Code Example 7.2 Web Application Assembly Information

In the sample application, the application assembler uses the deployment descriptor to configure servlet class MainServlet to serve all URLs ending in suffix .do. The application assembler also defines the error pages that the application uses, its security constraints and roles, and so on. The only structural information shown in Code Example 7.2 is the servlet class. Everything else is assembly information created by the application assembler.


7.2.3 Deployer Tasks

Deployers deploy J2EE components and applications into an operational environment. They use tools created by the J2EE product provider to install J2EE modules and applications and configure them to their runtime environment. The J2EE platform and its related specifications for releases prior to the J2EE 1.4 release define some requirements for deployment tools, but do not define the interface between the deployment tools and containers; therefore, deployment tools for these releases are vendor-specific. Thus, prior to the J2EE 1.4 release, the deployment process is not standardized and portable across products. However, the J2EE 1.4 release will standardize the deployment process so that work a deployer performs will be portable across products.

Although the details differ from product to product, deployment typically involves two high-level tasks:

  1. Installation--The deployer moves the media to the server, generates the additional container-specific classes and interfaces that enable the container to manage the components at runtime, and installs the components and additional classes and interfaces into the J2EE server.
  2. Configuration--The deployer resolves all the external dependencies declared by the application component provider and follows the application assembly instructions defined by the application assembler. For example, the deployer configures the data sources that the application uses to persist data and maps the security roles defined by the application assembler to the operational environment's user groups and accounts. In some cases, a qualified deployer may customize the application components' business logic at deployment time, using tools provided with a J2EE product. For example, a deployer may write application code that wraps an enterprise bean's business methods or may add a company's logo to a login JSP page.


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