Configuring the Working Directory


Once you have hardware and software in place, it is time to configure the working directory used to organize application components. There is no single right way to organize application components in the working directory. The organization should reflect the specifics of the application, and it will often reflect the preferences of the development team. We ll simply present and explain the rationale behind a reasonable structure we recommend based on our experience building WebLogic Server applications.

Figure 13.2 presents a high-level picture of the recommended directory structure. Its major components include the following:

/build .    A temporary directory structure containing compiled Java classes.

/lib .    Directory containing third-party archive files used by application components.

/src/java .    Root directory for Java source files.

/src/web .    Root directory for Web application components.

/src/scripts .    Directory containing SQL scripts and other scripts.

/dd .    Directory containing deployment descriptors for the application.


Figure 13.2:  Recommended working directory structure.

With the exception of the temporary class files in the build directory, EJB archives, and any code-generated source and descriptor files, all components in this working directory structure should be controlled in the project source-code control system. The goal is to have every component and file required to build and deploy the application located in this work area to ensure proper control and promotion of the application during the development process.

Resist the temptation to place and edit Web application components directly in the applications area in the domain itself as a shortcut. Doing so complicates the source-code control process by involving directories not related by a common parent directory and makes the packaging and deployment process less self-contained. All creation and editing of components should occur in the working directory structure ”the build and deployment process moves files to the proper location in the domain.

Best Practice  

Create and edit application components in the working directory structure. Don t edit Web application components or other files directly in the deployed application.

The bigrez.com application includes two separate Web applications, as discussed in Chapters 4 and 5. The working directory structure for bigrez.com replaces the single /src/web directory in Figure 13.2 with separate /src/web- user and /src/web-admin directories, but it follows the recommended structure in all other ways.

You might wonder where EJB descriptor files such as ejb-jar.xml and the WebLogic Server-specific files weblogic-ejb-jar.xml and weblogic-cmp-rdbms-jar.xml are located in this directory structure. If these files are created and edited by hand, they should be placed in the dd directory. If the application requires multiple EJB archive files, and therefore requires multiple sets of descriptor files, consider using subdirectories under the dd directory for hand-created descriptor files. Obviously, these descriptors must be controlled in the source-code management system like any other source file in the system. If you are using a code-generation tool such as EJBGen, the EJB descriptor files can be recreated at any time using the bean input files and should not be placed in source-code control.

Best Practice  

Avoid placing generated source files or descriptors in the source-code management system. When using EJBGen, only the bean source files are required to recreate all descriptors and interfaces, so only the bean files should be controlled and managed in the source-code management system.




Mastering BEA WebLogic Server. Best Practices for Building and Deploying J2EE Applications
Mastering BEA WebLogic Server: Best Practices for Building and Deploying J2EE Applications
ISBN: 047128128X
EAN: 2147483647
Year: 2003
Pages: 125

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