CONTENTS | PREV | NEXT | INDEX J2EE BluePrints



7.1 Roles and Tasks

The J2EE packaging and deployment process involves three different development roles: 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

Application Component Providers develop enterprise beans, HTML and JSP pages, and their associated helper classes. They supply the structural information of the deployment descriptor for each component. This information includes the home and remote interfaces and implementation classes of enterprise beans, the persistence mechanisms used, and the type of resources the components use, information typically hard coded in the application and not configurable at deployment time. Code Example 7.1 contains an excerpt from the sample application's enterprise bean deployment descriptor:


<entity>
	<display-name>TheAccount</display-name>
	<ejb-name>TheAccount</ejb-name>
	<home>com.sun.estore.account.ejb.AccountHome</home>
	<remote>com.sun.estore.account.ejb.Account</remote>
	<ejb-class>
		com.sun.estore.account.ejb.AccountEJB
	</ejb-class>
	<persistence-type>Bean</persistence-type>
	<prim-key-class>java.lang.String</prim-key-class>
	<reentrant>False</reentrant>
	<resource-ref>
		<description>description</description>
		<res-ref-name>jdbc/EstoreDataSource</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>
</entity>
Code Example 7.1 Descriptor Elements for an Entity Bean

Application Assemblers provide information related to the application as a whole. In the sample application, the Application Assembler configures the file Main.jsp to handle requests coming to the URL namespace, (/control/*), the error pages the application uses, its security constraints and roles, and so on. Code Example 7.2 contains excerpts from the sample application's Web deployment descriptor:


<web-app>
	<display-name>JavaPetStoreDemoWebTier</display-name>
	<servlet>
		<servlet-name>webTierEntryPoint</servlet-name>
		<display-name>centralJsp</display-name>
		<description>central point of entry for the Web app
		</description>
		<jsp-file>Main.jsp</jsp-file>
	</servlet>
	<servlet-mapping>
		<servlet-name>webTierEntryPoint</servlet-name>
		<url-pattern>/control/*</url-pattern>
	</servlet-mapping>
	...
	<error-page>
		<exception-type>java.lang.Exception</exception-type>
		<location>/errorpage.jsp</location>
	</error-page>
	...
</web-app>
Code Example 7.2 Descriptor Elements for Web Application

A Deployer is responsible for deploying J2EE components and applications into an operational environment. Deployment typically involves two 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 is responsible for mapping the security roles defined by the Application Assembler to the user groups and accounts that exist in the operational environment into which the components and applications are deployed. In some cases, a qualified Deployer may customize the business logic of the application's components at deployment time by using tools provided with a J2EE product. For example, a Deployer may write application code that wraps an enterprise bean's business methods or customizes the appearance of a JSP page, for example, by adding a company's logo or other graphics to a login page.


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