The Contents of a Deployment Descriptor

We’ve discussed XML deployment descriptors throughout this book—you probably know enough to write deployment descriptors on your own. However, it is still worthwhile to take a tour through a complete descriptor. Example 18-1 is a complete deployment descriptor for the Cabin EJB, which we created in Chapter 4. Other than the type of schema used (XSD or DTD) and the fact that EJB 2.1 uses XML namespaces, the elements are the same in EJB 2.1 and 2.0. The Cabin EJB’s deployment descriptor contains most of the tags that are needed to describe entity beans; session and message-driven beans are not much different. The differences between the versions are small but significant. We’ll use this deployment descriptor to guide our discussion in the following sections.

Example 18-1. Cabin EJB deployment descriptor

<?xml version="1.0" encoding="UTF-8"?>
...
<ejb-jar ...>
    <enterprise-beans>
        <entity>
            <description>
                This Cabin enterprise bean entity represents a cabin 
                on a cruise ship.
            </description>
            <ejb-name>CabinEJB</ejb-name>
            <home>com.titan.cabin.CabinHomeRemote</home>
            <remote>com.titan.cabin.CabinRemote</remote>
            <local-home>com.titan.cabin.CabinHomeLocal</local-home>
            <local>com.titan.cabin.CabinLocal</local>
            <ejb-class>com.titan.cabin.CabinBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>com.titan.cabin.CabinPK</prim-key-class>
            <reentrant>False</reentrant>
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>Cabin</abstract-schema-name>
            <cmp-field><field-name>id</field-name></cmp-field>
            <cmp-field><field-name>name</field-name></cmp-field>
            <cmp-field><field-name>deckLevel</field-name></cmp-field>
            <cmp-field><field-name>shipId</field-name></cmp-field>
            <cmp-field><field-name>bedCount</field-name></cmp-field>
            <primkey-field>id</primkey-field>
        </entity>
    </enterprise-beans>
 
    <assembly-descriptor>
        <security-role>
            <description>
                This role represents everyone who is allowed full access 
                to the Cabin EJB.
            </description>
            <role-name>everyone</role-name>
        </security-role>

        <method-permission>
            <role-name>everyone</role-name>
            <method>
                <ejb-name>CabinEJB</ejb-name>
                <method-name>*</method-name>
            </method>
        </method-permission>

        <container-transaction>
            <method>
                <ejb-name>CabinEJB</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
        </container-transaction>
    </assembly-descriptor>
</ejb-jar>
..................Content has been hidden....................

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