Special Edition Using Enterprise JavaBeans 2.0
Authors: Cavaness Ch. Keeton B.
Published year: 2000
Pages: 150-151/223
Buy this book on amazon.com >>
   

Deployer Responsibilities

Part of the deployer's job is to complete any deployment information that wasn't supplied by the application assembler. There also might be changes needed to environment entries that were supplied but don't reflect the true target environment. The deployer must ensure that all EJBs referenced by the application are present in the environment and that all required resources are available and accessible.

Much of what the deployer must do is outside the bounds of entering data into the deployment descriptor. The deployer is instead responsible for using tools specific to the application server and the rest of the target environment to support the references declared in the descriptor. For example, the deployer must bind data sources to any connection factory references that exist. If the authorization method for a resource ( res-auth ) is specified as Container , the deployer must also supply the necessary login information. Any referenced administered objects, such as JMS queues or topics, must be configured and made available to the application as well.

A significant responsibility of the deployer is to take the logical security roles specified by the application assembler and map them to the actual security domain of the target environment. This includes assigning the principals and groups recognized by the target environment to the application assembler's security roles. Security topics are discussed in more detail in Chapter 14, "Security Design and Management."

The important point to remember about the work of the deployer is that much of it is vendor specific. The deployer will often be working with supplemental deployment files, such as WebLogic's weblogic-ejb-jar.xml file, and other configuration data used by the application server to bind an EJB application to the resources and security mechanisms it requires.

Note

Vendors typically will have a different name for their proprietary deployment descriptor. For example, the deployment descriptor for the Orion EJB server is called orion-ejb-jar .xml .


Summary of Responsibilities

Table 15.4 summarizes the deployment responsibilities assigned to each of the applicable EJB roles.

Table 15.4. Deployment Responsibilities by EJB Role

EJB Role

Responsibilities

Bean provider

All source code. The preliminary ejb-jar.xml file identifying the beans, their relationships, any resource and environment dependencies, and so on.

Application assembler

The assembly-descriptor section of ejb-jar.xml , including elements defining security roles, method permissions, and transaction attributes. The assembler also can supply values for any environment entries not already defined. The purpose of this role is to define the behavior of one or more beans when used as part of a particular application.

Deployer

The contents of any vendor-specific deployment descriptors. The deployer must finalize all deployment information and create the JAR (and possible WAR and EAR) files needed to deploy the application in the target environment. This includes satisfying any resource and security dependencies of the deployed beans.

   

Packaging EJBs

EJBs and their deployment descriptor are passed between the EJB roles and eventually deployed using an ejb-jar file. This JAR file contains

  • The home and component interfaces

  • The bean implementation classes

  • Any custom primary key classes

  • All dependent classes and interfaces

  • The ejb-jar.xml deployment descriptor (stored in a META-INF subdirectory relative to the root of the JAR)

  • Any vendor-specific deployment descriptors

As a bean provider, you can create an ejb-jar file by following these steps:

  1. Compile your EJBs and their supporting classes and interfaces

  2. Define the required parts of the deployment descriptor(s) and copy these files to a META- INF directory that's parallel to the root directory of your package hierarchy. For example, if your root package is com and your class files are compiled into a directory structure starting at c:\examples\classes\com , you should place your deployment descriptors in c:\examples\classes\META-INF . Your container vendor may specify a different location for any vendor-specific descriptors.

  3. Create a new JAR file that holds the class files and descriptors using the jar command. For example, building a JAR that holds all the classes under a com directory (and its subdirectories) and the deployment descriptors could be done using the following line:

    jar cf auction.jar META-INF com
    

The preceding example creates a new JAR file that contains the deployment descriptors and all class files under the com directory. If that includes files you don't need in the JAR, you can restrict the contents using path specifications such as

com\que\ejb20\auction\model\*.class.

The ejb-client File

The EJB specification also defines the concept of an ejb-client JAR file. This is a JAR you can create that holds only the class files that a client application needs to access the beans included in a corresponding ejb-jar file. This JAR would include the home and component interfaces, any primary key classes, any custom application exceptions exposed to the client, and the client stubs generated by the container. If you create this file, you can reference it in the ejb-client-jar element of ejb-jar using a pathname relative to the location of the ejb- jar file. The EJB specification doesn't dictate any required support for this file by an application server, but it is a convenient way for you to package the class files needed to deploy your client applications.

Special Edition Using Enterprise JavaBeans 2.0
Authors: Cavaness Ch. Keeton B.
Published year: 2000
Pages: 150-151/223
Buy this book on amazon.com >>