Two major versions of Enterprise JavaBeans (EJB) deployment descriptors are currently in circulation. The EJB 1.1 deployment descriptor describes the structure and assembly of EJB applications built to the EJB 1.1 specification. The EJB 2.0 deployment descriptor adds a number of tags that are necessary to describe the additional features of EJB 2.0 applications. While EJB 2.0-compliant EJB containers are required to support EJB 1.1 applications, EJB containers that haven't been upgraded to support the 2.0 specification won't support EJB 2.0 deployment descriptors.
Note that every EJB deployment descriptor must be named ejb-jar.xml.
This article touches on developing EJB applications that conform to the 2.0 specification. Thus, when selecting an EJB container, you should use support for the EJB 2.0 specification as a selection criteria. Leading EJB container vendors — including IBM's WebSpere, BEA's WebLogic, and the open source JBoss Application Server — are good places to start looking.
The root element of an EJB deployment descriptor is <ejb-jar>. All tags must be nested inside the <ejb-jar> tag. Within the <ejb-jar> tag are three subelements:
- <enterprise-beans> : This tag contains descriptive information about the EJB components in an EJB application. When an entity bean needs to make references to external resources, system resources, and other entity beans, those resources are described in this section.
- <relationships> : This tag describes the relationships between entity beans using the container-managed relationship support for EJB 2.0 applications.
- <assembly-descriptor> : This tag is used to describe assembly information for an EJB application. While bean providers may supply some assembly information, application assembly is a responsibility that primarily falls on the application assembler's shoulders. The two major elements of application assembly are describing transactions and describing security.
The <enterprise-beans> tag contains descriptions for each kind of enterprise bean that can be defined in an EJB application. It has three subelements: <session> for session beans, <entity> for entity beans, and <message-driven> for message-driven beans. Session, entity, and message-driven beans share several XML tags in common. Here's the lowdown on these general tags:
- Logical name: Every EJB component has a logical name that identifies the name by which each bean is referenced in the rest of the deployment descriptor. The logical name is contained in the <ejb-name> tag. It must be unique for the scope of the ejb-jar file in which the component is packaged. The <ejb-name> tag is a subelement of the <session>, <entity>, and <message-driven> tags.
- Enterprise bean class: The enterprise bean class is the class that implements all the business methods and lifecycle management methods of the EJB component. This class must be identified by the <ejb-class> tag. The <ejb-class> must have the fully qualified class name of the EJB class. The <ejb-class> tag is a subelement of the <session>, <entity>, and <message-driven> tags.
- Component interfaces: Session and entity beans also can have both local and remote component interfaces. The EJB container needs to know which classes implement the component interfaces for the session and entity beans. The <remote> tag is used to identify a remote interface and must contain the fully qualified class name of the remote interface (if one exists). The <local> tag is used to identify a local interface and must contain the fully qualified class name of the local interface (if one exists).
- An EJB component doesn't have to have both remote and local interfaces, but it must have one or the other. The exception to this rule is message-driven beans, which can't have remote or local interfaces. For entity beans and session beans, you can have both local and remote interfaces. For each component interface, the deployment descriptor must define a corresponding home interface for an enterprise bean.
- Home interfaces: Home interfaces can be defined for session and entity beans. The local home interface provides local access to the enterprise bean while the remote home interface provides remote access to the enterprise bean. The local home interface is identified by the <local-home> tag in the deployment descriptor. The remote home interface is identified by the <home> tag in the deployment descriptor.
- Transaction type: Every enterprise bean component has a <transaction-type> tag. The <transaction-type> tag is used to describe whether the enterprise bean's transaction service is managed by the bean or by the EJB container. The two allowed values for the <transaction-type> tag are Bean (for bean-managed transactions) and Container (for container-managed transactions).
- Bean-managed transactions can be very complex and are certainly beyond the scope of an entry-level EJB programmer.
- Description: Each EJB component can have an optional description tag that describes the purpose of the EJB component. The description element is demarcated by the <description> tag, which should include documentation about the purpose of the EJB component.
- Build tool tags: There are several optional tags in each enterprise bean used to provide additional information for build tools. Build tools provide a graphical interface for creating EJB applications. Build tool tags are used to improve the presentation of enterprise beans in the build tool's user interface.
• <display-name>: This tag identifies the name under which the enterprise bean component should be displayed in a build tool.
• <large-icon>: This tag identifies the path to a 32 pixel by 32 pixel icon used to display the enterprise bean. The image must be in either a JPEG or GIF format.
• <small-icon>: This tag identifies the path to a 16 pixel by 16 pixel icon used to display the enterprise bean. The image must be in either a JPEG or GIF format.
dummies
Source:http://www.dummies.com/how-to/content/delving-into-the-enterprise-javabeans-deployment-d.html
No comments:
Post a Comment