Section A.3. Application Archives (application .xml)


A.3. Application Archives (application .xml)

Enterprise application archives (ears) contain collections of component archives (web, EJB, and so on) that make up an application. An application.xml deployment descriptor is used to declare and configure the component archives, as well as declare applicationwide security roles. Figure A-14 shows the structure of the application deployment descriptor.

Example A-14 shows a sample application deployment descriptor, annotated with descriptive comments. Note that this example uses the application descriptor schema from the J2EE 1.4 specification, referencing the schema from the default location on the java.sun.com server. To use the J2EE 1.3 application descriptor DTD, you would need to replace the application element tag and its schema reference with the following empty tag and DOCTYPE enTRy:

 <!DOCTYPE application PUBLIC     "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"     "http://java.sun.com/dtd/application_1_3.dtd"> <application>     . . . </application> 

Figure A-14. Application archive deployment descriptor overview


Example A-14. Annotated application deployment descriptor
 <?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://java.sun.com/xml/ns/j2ee"              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"              xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee                  http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"              version="1.4">     <!-- Description of the application, for tools. -->     <description>This application is...</description>     <!-- Display name of the application. -->     <display-name>My Application</display-name>     <!-- Icons to be used to represent the app in tools. -->     <icon>         <small-icon>my/icon/file</small-icon>         <large-icon>my/large/icon/file</large-icon>     </icon>     <!-- Each module element specifies an archive containing          components or clients that are part of the application. -->     <module>         <!-- The connector element references the archive file for              a set of JCA Connectors. The file reference is relative              to the root of the enterprise application archive (ear) file. -->         <connector>myConnector.rar</connector>         <!-- The alt-dd element can be used in any of the module              variations, to specify a deployment descriptor that should              be used in lieu of the descriptor in the component archive.              The descriptor must be of the appropriate format for the              type of archive, and the file reference is made relative              to the root of the ear file. -->         <alt-dd>my-alt-rar-dd.xml</alt-dd>     </module>     <module>         <!-- Include the specified EJB archive in the application. -->         <ejb>myEJBs.jar</ejb>     </module>     <module>         <!-- Include the specified J2EE client jar in the application. -->         <java>myClient.jar</java>     </module>     <module>         <!-- Include the specified web archive in the application. -->         <web>             <!-- The location of the web archive (war) file -->             <web-uri>myWebComps.war</web-uri>             <!-- The web context root to use for the web components in                  this archive. -->             <context-root>myapp</context-root>         </web>     </module>     <!-- The security-role element can be used here much as it is used          in individual archive deployment descriptors  , but the roles          declared here can be used in any components in the archives          specified in the module entries above. See section X for          additional information on the security-role element. -->     <security-role>         <description>desc</description>         <!-- Name of the role, which must be mapped to a physical role              in the application server's runtime environment. -->         <role-name>app-level-admin</role-name>     </security-role> </application> 



Java Enterprise in a Nutshell
Java Enterprise in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596101422
EAN: 2147483647
Year: 2004
Pages: 269

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net