Tuesday, August 26, 2008

Describe the packaging and deployment requirements for enterprise beans - Sun SCBCD Exam Objective EJB3 JEE5

Objective: Describe the packaging and deployment requirements for enterprise beans

Chapter 20 of the JEE5 EJB Core Contracts document fairly succinctly describes how EJB3 applications must be packaged and deployed. Basically, Enterprise JavaBean applications should be deployed at ejb-jar files.

"The ejb-jar file format is the contract between the Bean Provider and the Application Assembler, and between the Application Assembler and the Deployer. An ejb-jar file produced by the Bean Provider contains one or more enterprise beans that typically do not contain application assembly instructions. The ejb-jar file produced by an Application Assembler (which can be the same person or organization as the Bean Provider) contains one or more enterprise beans, plus application assembly information describing how the enterprise beans are combined into a single application deployment unit.

The ejb-jar file must contain the deployment descriptor (if any) in the format defined in Chapter 19. The deployment descriptor must be stored with the name META-INF/ejb-jar.xml in the ejb-jar file.

The ejb-jar file must contain, either by inclusion or by reference, the class files of each enterprise bean as follows:

• The enterprise bean class.
• The enterprise bean business interfaces, web service endpoint interfaces, and home and com-
ponent interfaces.
• Interceptor classes.
• The primary key class if the bean is an entity bean.

We say that a jar file contains a second file “by reference” if the second file is named in the Class-Path attribute in the Manifest file of the referencing jar file or is contained (either by inclusion or by reference) in another jar file that is named in the Class-Path attribute in the Manifest file of the referencing jar file.
The ejb-jar file must also contain, either by inclusion or by reference, the class files for all the classes and interfaces that each enterprise bean class and the home interfaces, component interfaces, and/or web service endpoints depend on, except Java EE and J2SE classes. This includes their superclasses and superinterfaces, dependent classes, and the classes and interfaces used as method parameters, results, and exceptions.
The Application Assembler must not package the stubs of the EJBHome and EJBObject interfaces in the ejb-jar file. This includes the stubs for the enterprise beans whose implementations are provided in the ejb-jar file as well as the referenced enterprise beans. Generating the stubs is the responsibility of the container. The stubs are typically generated by the Container Provider’s deployment tools for each class that extends the EJBHome or EJBObject interfaces, or they may be generated by the container at runtime."

-From Chapter 20, EJB Core Contracts Docuement

No comments: