home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book Home Enterprise JavaBeans Search this book

D.3. XML Deployment Descriptors

In EJB 1.0, the deployment descriptor information is stored in a serializable class defined in the javax.ejb.deployment package. While at first this appeared to be an excellent approach, it has limitations. It isn't clear which deployment information should be set by the bean developer and which by the deployer. In addition, the serializable classes are not very extensible and limit your ability to describe the bean's attributes.

To solve these problems, EJB 1.1 replaces the serializable deployment descriptor with an XML-based deployment descriptor. The XML deployment descriptor is defined by an XML DTD (Document Type Definition) that describes the structure that the XML deployment descriptors must have to be considered valid. The XML format is superior to the previous serializable object approach in many ways. First, it's more informative, allowing description tags to be associated with major elements so that the author can describe, in plain language, the purpose and expected behavior of attributes. Second, XML deployment descriptors can be viewed and edited using any text editor; the serializable deployment descriptor used in EJB 1.0 must be manipulated in a Java program (unless you're fluent in byte code!). Third, XML is more extensible and less fragile. In EJB 1.0, there are still problems with inconsistent versions of the deployment descriptor. As the specification evolves, the serializable deployment descriptor package would need to change, which introduces compatibility problems. With XML, new tags can be added without impacting existing deployment descriptor parsers. This makes deployment descriptors in EJB 1.1 more robust. Finally, XML is an industry standard, which means that deployment descriptors will enjoy universal support.

EJB 1.1 deployment descriptors also add some new declarative attributes and eliminate some old ones (like isolation levels!). Security, transactions, and environment properties change in EJB 1.1, necessitating changes in the type of information stored in the deployment descriptor. New features like bean and resource factory references were added, and the scope of the deployment descriptor was broadened to cover several beans for assembly. The division of labor for creating the deployment descriptor is better defined in EJB 1.1 as well. EJB 1.1 added new roles defining the development, assembly, deployment, and administration of beans. Contributions made by these roles to the deployment descriptor are well defined in EJB 1.1.

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.