Building the MedRec Applications

Tutorial 13: Compiling the Entire MedRec Project

Previous tutorials explained how to compile, build, and deploy parts of individual MedRec applications. In this tutorial, you compile and build the entire MedRec application suite using the project-level build.xml file. Compiling the entire application suite is necessary to deploy all components on your system and verify that MedRec is running and usable.

The tutorial includes the following sections:

- Prerequisites
- Procedure
- Best Practices
- The Big Picture
- Related Reading

Prerequisites

Before starting this tutorial, create the project directory using the instructions in Tutorial 5: Creating the MedRec Project Directory.

Procedure

The project directory contains a master build.xml script that compiles all of the MedRec applications in the correct order. To run this script:

1. Open a command shell and set the development environment:

   >     c:\bea\user_projects\domains\medrecdomain\setenv.cmd

2. Move to the src subdirectory of the MedRec project directory:

   >     cd c:\medrec_tutorial\src

3. Use the Ant command to execute the master build.xml script with the deploy.dev target:

   >     ant deploy.dev

   The build process displays messages indicating the progress for each application. The entire build process take approximately 2 to 5 minutes to complete, depending on the speed of your computer. The script should complete with the message, "BUILD SUCCESSFUL."

Best Practices

- Not all projects require a master build script. If you are creating only a single Enterprise Application or a single component of an Enterprise Application, a single build.xml file using the WebLogic ant tasks will suffice.
- If your project requires multiple Enterprise Applications to be compiled in a particular sequence (because of shared utility classes or Web Services dependencies), use a master build.xml file at the source level to iterate through each application's build.xml files.

The Big Picture

The MedRec application suite has many dependencies that require coordination during the build process. When you run the master build file, the following events occur:

1. The contents of startupEar are compiled using the wlcompile task.

2. The contents of common are compiled. The common directory contains the source for several kinds of objects used by different MedRec applications:

   - Utility classes—constants used throughout the application suite, exceptions, factories, and the ServiceLocator class. Servlets in the Web Tier of the MedRec application suite use ServiceLocator to lookup generic services such as Enterprise JavaBeans.

   - Value objects—classes that represent data passed between tiers of the MedRec suite.

   - Action classes—classes used by the struts framework to control page flow in the Web tier of the MedRec suite.

   - JavaBeans—component beans used in the Web tier.

3. The medrecEar Enterprise Application is compiled. Although medrecEar uses the split development directory structure and the WebLogic Ant tasks in the build script, the application has several internal dependencies that are hard-coded in its build.xml script, using the include and exclude options to wlcompile.

4. The physicianEar application is compiled. The physicianEar Web Service client is generated from the .wsdl file copied into the dist directory.

5. The MedRec application suite client applications are compiled.

Related Reading

- Developing WebLogic Server Applications