Deployment Descriptors

A deployment descriptor is an Extensible Markup Language (XML) document (with an .xml extension) that describes a component's deployment settings. Because deployment descriptor information is declarative, it can be changed without modifying the Enterprise JavaBean source code. For example, a deployment descriptor declares transaction attributes and security authorizations for an Enterprise JavaBean. You can create the deployment descriptors by hand or use vendor tools to generate them. At deployment time, the J2EE server reads the deployment descriptor and acts on the component accordingly. The following sections describe various deployment descriptors.

Standard ejb-jar.xml

This file is the standard deployment descriptor as specified by Sun, and it must contain the Sun Microsystems–specific EJB document type definition (DTD).

The ejb-jar.xml describes the Enterprise JavaBean's deployment properties, such as its bean type and structure. The file also provides the EJB container with information about where it can find, and then load, the home interface, remote interface, and bean class. It declares its internal dependences and the application assembly information, which describes how the Enterprise JavaBean in the bundled ejb-jar file is assembled into an application deployment unit.

Here is a sample ejb-jar.xml file:

<?xml version="1.0"?>

<!DOCTYPE ejb-jar PUBLIC
'-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN'
'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>

<ejb-jar>
  <enterprise-beans>
    <session>
      <ejb-name>EnrollmentCart</ejb-name>
      <home>EnrollmentCartHome</home>
      <remote>EnrollmentCart</remote>
      <ejb-class>EnrollmentCartEJB</ejb-class>
      <session-type>Stateful</session-type>
       ...
    </session>
  </enterprise-beans>
</ejb-jar>

The prolog contains the declaration and the DTD for the validation. The document root is the <ejb-jar> tag. The element <enterprise-beans> contains subelements to describe the bean deployment properties. The remote and home interfaces and the bean class name are described using their fully qualified names. The bean's subtype is declared as a stateful session bean.

Note

The Enterprise JavaBean type is differentiated by the interface implemented and by the subtype declaration in the deployment descriptor.


Vendor-Specific Deployment Descriptor

In addition to standard ejb-jar.xml, an application typically requires a certain amount of additional environment-specific or vendor-specific binding information. In deploying an EJB to a specific application server, you might be required to have a vendor-specific deployment descriptor that provides information about how to map a package name to a JNDI name, and how to handle both security and persistence. For example, jboss.xml is specific to the JBoss server, and weblogic-ejb-jar.xml is specific to BEA WebLogic Server.

Caution

Vendor-specific deployment descriptors aren't standardized. They are different for different vendors. Also, they could potentially change for a given vendor.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.229.44