This script opens a new, small, floating window and puts TOC<name>.html and IX<name>.html files in it and sets a generic popup window code to enable the display of some viewlets in the WebLogic Platform Tour.
Previous Next

 Building the MedRec Applications

Tutorial 5: Creating the MedRec Project Directory

This tutorial describes how to create the main project directory that holds the MedRec source files and compiled classes. The tutorial also explains the high-level directory structure and contents for the MedRec application suite components.

Tutorials that follow provide more detail about the development directory structure and WebLogic Server ant tasks that help you easily build and deploy Enterprise Applications and their subcomponents—Web applications, EJBs, and Web services.

This tutorial includes the following sections:

 

 

 

Prerequisites

Before starting this tutorial, create the MedRec domain and MedRec server. See Tutorial 1: Creating a WebLogic Domain and Server Instance for Development.

 

 

 

Procedure

Follow these steps to create the source directory structure for the MedRec application suite:

Step 1: Create the tutorial project directory.

Begin by creating a top-level project directory in which you will store source and output files for the MedRec Enterprise Applications and client programs. Name the directory medrec_tutorial:

mkdir c:\medrec_tutorial

Step 2: Unpack the project subdirectories.

BEA provides a .zip file that contains the source files and build subdirectories needed to complete the MedRec tutorials. To populate your project directory with the necessary files and directories:

  1. Download the medrec_tutorial.zip file from http://download.oracle.com/docs/cd/E13222_01/wls/docs81/medrec_tutorial.zip. Save the downloaded file to the c:\medrec_tutorial directory.

  2. Set your command shell environment with the MedRecDomain environment script:
    c:\bea\user_projects\domains\MedRecDomain\setEnv.cmd
    

  3. Move to the MedRec project directory and unpack the downloaded .zip file:
    cd c:\medrec_tutorial
    
    jar xvf medrec_tutorial.zip
    

Step 3: Verify the project directory contents.

Verify that the following files and subdirectories were created:

dir
 Directory of C:\medrec_tutorial
02/13/2003  08:59a      <DIR>          .
02/13/2003 08:59a <DIR> ..
02/13/2003 08:59a <DIR> build
02/13/2003 08:59a <DIR> dist
02/13/2003 08:59a <DIR> lib
02/13/2003 08:59a 2,782,963 medrec_tutorial.zip
02/13/2003 08:59a <DIR> META-INF
02/13/2003 08:59a 4,505 README.TXT
02/13/2003 08:59a <DIR> src
02/13/2003 08:59a 299 substitute.xml

The \build directory contains the compiled classes generated by the various MedRec build scripts. It does not contain editable source files or deployment descriptors, which reside in \src. Each subdirectory in \build represents the compiled classes for MedRec clients (\client) or for a MedRec application (\medrec, \physician, and \startup applications).

If you look at the contents of the \build directory, you notice that certain classes have already been built for you. These include utility classes and the MedRec value objects that many applications in the MedRec tutorial require. Having these classes prebuilt allows you to concentrate on compiling Enterprise Applications using the WebLogic wlcompile task, as described in Tutorial 7: Compiling Applications Using the Split Development Directory.

The \src directory contains the full source for all MedRec applications. You will be working in this directory for most remaining tutorials. Step 4: Verify the source directory contents. describes the subdirectories in \src.

\build and \src together represent a WebLogic Server split development directory. You can deploy individual MedRec applications to a development server by targeting an application subdirectory in \build (such as \build\medrecEar) using weblogic.Deployer or the wldeploy ant task described in Tutorial 9: Deploying MedRec from the Development Environment. WebLogic Server locates the necessary deployment descriptors (available in \src) by examining the .beabuild.txt file located in \build subdirectory.

The \dist directory is also an output directory—it will store the archived .ear files or exploded .ear directories created by the wlpackage task in Tutorial 14: Packaging MedRec for Distribution. Right now it contains only the MedRecService.wsdl file which is required to compile parts of the physicianEar application in Tutorial 7: Compiling Applications Using the Split Development Directory. It will eventually store complete, exploded .ear directories for the different MedRec applications. \dist is not considered part of the split development directory structure, because it is not required for compiling or deploying applications during development. It is used only for storing final, completed applications—.ear files or exploded .ear directories—that you generate after completing the development process.

\lib contains precompiled, third-party .jar files that several of the MedRec applications require. This includes supporting .jars for struts and log4j.

Step 4: Verify the source directory contents.

The \src subdirectory contains the full application source for the MedRec applications, and it is the subdirectory in which you will spend the most time during the remaining tutorials. Take a look at the installed \src directory:

dir src
 Directory of C:\medrec_tutorial\src

02/13/2003 11:22p <DIR> .
02/13/2003 11:22p <DIR> ..
02/13/2003 11:22p 1,909 build.xml
02/13/2003 11:22p <DIR> clients
02/13/2003 11:22p <DIR> common
02/13/2003 11:23p 3,479 medrec.properties
02/13/2003 11:22p <DIR> medrecEar
02/13/2003 11:22p <DIR> physicianEar
02/13/2003 11:22p <DIR> security
02/13/2003 11:22p <DIR> startupEar

The build.xml file in the top level of the medrec_tutorial directory is a project-wide build file. It:

You will use this project-level build.xml before moving the WebLogic Server instance into production mode in Tutorial 13: Compiling the Entire MedRec Project. However, do not try to use it yet—you need to complete the next few tutorials to create the application-level build.xml files that this script calls.

The subdirectories of \src represent either deployable MedRec applications or MedRec components that are used by those applications:

Step 5: Edit the \src\medrec.properties file and run substitute.xml.

\src also contains a medrec.properties file that defines property values used by the project-level build.xml file, as well as the build.xml files used in each applications subdirectory. Follow these instructions to edit the properties file so that it points to your tutorial domain and project directory:

  1. Use a text editor to open the properties file:
    notepad c:\medrec_tutorial\src\medrec.properties
    

  2. Edit the wl.home property to point to your WebLogic Server installation directory (c:/bea/weblogic81 by default):
    wl.home=c:/bea/weblogic81
    

  3. Edit the port property, setting the value to 7101:
    port=7101
    

  4. Edit the medrec.domain.dir property to point to the MedRecDomain directory you created:
    medrec.domain.dir=c:/bea/user_projects/domains/MedRecDomain
    

  5. Edit the medrec.home property to point to your new project directory:
    medrec.home.dir=c:/medrec_tutorial
    

  6. The remaining property definitions build on medrec.home and you do not need to modify them.

  7. Save your changes and exit the editor.

  8. Go to the c:\medrec_tutorial directory and run the substitute.xml script:
    cd c:\medrec_tutorial
    
    ant -f substitute.xml
    

    This script substitutes a variable in the project files with the path to your WebLogic home directory.

 

 

 

Best Practices

 

 

 

The Big Picture

The MedRec application suite consists of three separate applications for the patient, physician, and administrator user roles. Using a separate application for each user role allows you to distribute each application function across different WebLogic Server instances as needed. For example, the MedRec sample domain (optionally installed with WebLogic Server) deploys all three applications on a single server instance for easy demonstration purposes. The MedRec tutorials also deploy the applications in a single-server domain, which is typical for development environments. However, you can also deploy the MedRec and Physician applications on two different server instances (in separate domains) to illustrate the use of Web Services between the applications.

The MedRec project directory also contains subdirectories for compiling the client applications that access MedRec via Web Services.

 

 

 

Related Reading

 

 Back to Top Previous Next