The Descriptor’s Body

The body of any XML document begins and ends with the tag for the document’s root element. For an EJB deployment descriptor, the root element is named <ejb-jar>, and looks like this (EJB 2.1 includes XML namespace and schemaLocation attributes not shown):

<ejb-jar ...>
... other elements ...
</ejb-jar>

All other elements must be nested within the <ejb-jar> element. You can place the following kinds of elements within <ejb-jar>:

<description> (optional)

The <description> element provides a description of the deployment descriptor. This element can be used in many contexts within a deployment descriptor: to describe the descriptor as a whole, to describe particular beans, to describe particular security roles, and so on. The Cabin EJB deployment descriptor doesn’t use a <description> element for the deployment descriptor as a whole, but it does provide a description for the Cabin EJB itself.

<display-name> (optional)

Tools (such as a deployment wizard) that are working with the deployment descriptor use the <display-name> element to provide a convenient visual label for the entire JAR file and for individual bean components.

<small-icon> and <large-icon> (optional)

These elements point to files within the JAR file that provide icons a deployment wizard or some other tool can use to represent the JAR file. Icons must be image files in either the JPEG or GIF format. Small icons must be 16 16 pixels; large icons must be 32 32 pixels. These icon elements are also used in the <entity>, <session>, and <message-driven> elements to represent individual enterprise bean components.

<enterprise-beans> (one required)

The <enterprise-beans> element contains descriptions of one or more enterprise beans that are contained in the JAR file. A deployment descriptor may have only one <enterprise-beans> element. Within this element, <entity>, <session>, and <message-driven> elements describe the individual beans.

<relationships> (optional)

The <relationships> element describes the container-managed relationships of entity beans declared in the deployment descriptor. The <relationships> element contains a number of other elements that describe the participants, direction, and cardinality of each relationship.

<assembly-descriptor> (optional)

The application assembler or bean developer adds an <assembly-descriptor> element to the deployment descriptor to define how the enterprise beans are used in an actual application. The <assembly-descriptor> contains a number of elements that define the security roles used to access the bean, the method permissions that govern which roles can call different methods, and the transaction attributes.

<ejb-client-jar> (optional)

The <ejb-client-jar> element provides the path of the client JAR, which normally contains all the classes (including stubs, remote and home interface classes, and so on) the client will need in order to access the beans defined in the deployment descriptor. How client JAR files are organized and delivered to the client is not specified—consult your vendor’s documentation.

These elements are quite simple, with the exception of the <enterprise-beans> and <assembly-descriptor> elements. These two elements contain a lot of nested material. We’ll look at the <enterprise-beans> element first.

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

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