Author: ppoddar
Date: Thu May 20 22:12:24 2010
New Revision: 946811

URL: http://svn.apache.org/viewvc?rev=946811&view=rev
Log:
Add JSE/JEE Ant build files

Added:
    openjpa/trunk/openjpa-examples/openbooks/build.jee.xml   (with props)
    openjpa/trunk/openjpa-examples/openbooks/build.jse.xml   (with props)
Modified:
    openjpa/trunk/openjpa-examples/openbooks/build.xml
    openjpa/trunk/openjpa-examples/openbooks/index.html

Added: openjpa/trunk/openjpa-examples/openbooks/build.jee.xml
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/build.jee.xml?rev=946811&view=auto
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/build.jee.xml (added)
+++ openjpa/trunk/openjpa-examples/openbooks/build.jee.xml Thu May 20 22:12:24 
2010
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.   
+-->
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--   Ant build script for JEE version of OpenBooks                        -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+                    
+<project name="OpenBooks.JEE" default="package">
+       
+       <target name="package"
+               description="Build, package and deploy OpenBooks as a WAR 
application in an Application Server">
+               <delete file="${deploy.dir}/openbook.war" failonerror="false"/>
+               <mkdir dir="${classes.dir}/META-INF"/>
+               <copy file="${rsrc.dir}/META-INF/persistence.xml" 
todir="${classes.dir}/META-INF"/>
+               <war destfile="openbooks.war" 
webxml="${rsrc.dir}/META-INF/web.xml" filesonly="true">
+                       <fileset dir="${web.dir}"/>
+                       <classes dir="${classes.dir}" />
+                       <fileset dir="${rsrc.dir}">
+                               <include name="images/Add2Cart.jpg"/>
+                               <include name="images/OpenBooks.jpg"/>
+                       </fileset>
+               </war>
+               <move file="openbooks.war" todir="${deploy.dir}" 
overwrite="true"/>
+       </target>
+
+       <target name="compile"
+               description="Compile classes.">
+               <javac srcdir="${src.dir}" destdir="${classes.dir}" 
debug="true">
+                       <classpath refid="compile.classpath" />
+                       <exclude name="jpa/tools/**/*.java"/>
+                       <exclude name="openbook/client/**/*.java"/>
+               </javac>
+       </target>
+       
+</project>

Propchange: openjpa/trunk/openjpa-examples/openbooks/build.jee.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/openjpa-examples/openbooks/build.jse.xml
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/build.jse.xml?rev=946811&view=auto
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/build.jse.xml (added)
+++ openjpa/trunk/openjpa-examples/openbooks/build.jse.xml Thu May 20 22:12:24 
2010
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.   
+-->
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--     Ant build script to build/package JSE version of OpenBooks         -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+                    
+<project name="OpenBooks.JSE" default="package">
+       
+       <target name="package"
+               description="Build, package and deploy OpenBooks as a 
Swing-based JSE application">
+               <delete file="${target.dir}/openbooks.jar" failonerror="false"/>
+               <delete file="${target.dir}/openbooks.zip" failonerror="false"/>
+               
+               <jar destfile="${target.dir}/openbooks.jar" 
basedir="${classes.dir}">
+                       <exclude name="junit/**" />
+               </jar>
+               <jar destfile="${target.dir}/openbooks.jar"
+                    basedir="${rsrc.dir}"
+                    update="true">
+                       <include name="images/*" />
+               </jar>
+        <!-- ASF released jars must include License and Notice files -->
+               <jar destfile="${target.dir}/openbooks.jar"
+                    basedir="${basedir}"
+                    update="true">
+                       <include name="NOTICE.txt"/>
+                       <include name="LICENSE.txt"/>
+               </jar>
+
+               <zip destfile="${target.dir}/openbooks.zip" 
basedir="${basedir}">
+                       <include name="run.properties" />
+                       <include name="run.xml" />
+                       <include name="index.html" />
+                       <include name="NOTICE.txt"/>
+                       <include name="LICENSE.txt"/>
+               </zip>
+               <zip destfile="${target.dir}/openbooks.zip" 
basedir="${target.dir}" update="true">
+                       <include name="openbooks.jar" />
+               </zip>
+               <zip destfile="${target.dir}/openbooks.zip" 
basedir="${rsrc.dir}" update="true">
+                       <include name="load.properties" />
+                       <include name="demo.properties" />
+                       <include name="META-INF/persistence.xml" />
+                       <include name="slides/**" />
+               </zip>
+               <zip destfile="${target.dir}/openbooks.zip" 
basedir="${target.dir}" update="true">
+                       <include name="source/**" />
+               </zip>
+               
+               <delete dir="${deploy.dir}" failonerror="false"/>
+               <mkdir dir="${deploy.dir}"/>
+               <unzip dest="${deploy.dir}" src="${target.dir}/openbooks.zip" 
overwrite="true"/>
+       </target>
+       
+       <target name="compile" 
+               description="Compile classes.">
+               <javac srcdir="${src.dir}" destdir="${classes.dir}" 
debug="true">
+                       <classpath refid="compile.classpath" />
+               </javac>
+       </target>
+
+</project>

Propchange: openjpa/trunk/openjpa-examples/openbooks/build.jse.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-examples/openbooks/build.xml
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/build.xml?rev=946811&r1=946810&r2=946811&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/build.xml (original)
+++ openjpa/trunk/openjpa-examples/openbooks/build.xml Thu May 20 22:12:24 2010
@@ -23,21 +23,49 @@
 <!--                                                                        -->
 <!-- ====================================================================== -->
                     
-<project name="OpenBooks" default="info">
+<project name="OpenBooks" default="package">
        
+       <!-- ================================================================== 
-->
        <property file="build.properties" />
-       
+       <!-- ================================================================== 
-->
        <property name="jpa.provider" value="openjpa" />
+       <!-- ================================================================== 
-->
+       <property name="build.mode" value="jse"/>
+       <!-- ================================================================== 
-->
+       <!-- root directory of Java Source files                                
-->
        <property name="src.dir"      value="${basedir}/src/main/java"/>
+       <!-- ================================================================== 
-->
+       <!-- root directory of JSP and other web content files                  
-->
+       <property name="web.dir"     value="${basedir}/web"/>
+       <!-- ================================================================== 
-->
+       <!-- root directory of resource files e.g web.xml or persistence.xml    
-->
        <property name="rsrc.dir"     value="${basedir}/src/main/resources"/>
-       <property name="msrc.dir"     
value="${basedir}/target/generated-sources/java"/>
-       <property name="classes.dir"  value="${basedir}/target/classes"/>
-       <property name="deploy.dir"   value="${basedir}/target/openbooks"/>
-       <property name="generated.html.dir"  value="${basedir}/target/source"/>
-
-       <property name="jpa.properties"  
value="META-INF/persistence.xml#OpenBooks" />
+       <!-- ================================================================== 
-->
+       <!-- JPA configuration file anchored by the persistence unit name       
-->
+       <property name="jpa.properties"  
value="META-INF/persistence.xml#OpenBooks"/>
+       <!-- ================================================================== 
-->     
+       
+       
+       
+       <!-- ================================================================== 
-->     
+       <!-- Root directory of all derived artifacts                            
-->
+       <property name="target.dir" value="${basedir}/target"/>
+       <!-- ================================================================== 
-->
+       <!-- root directory of compiled class files                             
-->
+       <property name="classes.dir"  value="${target.dir}/classes"/>
+       <!-- ================================================================== 
-->
+       <!-- root directory of generated canonical meta-model source files      
 -->
+       <property name="generated.src.dir"  
value="${target.dir}/generated-sources/java"/>
+       <!-- ================================================================== 
-->
+       <!-- root directory of generated html for Java source files             
-->
+       <property name="generated.html.dir"  value="${target.dir}/source"/>
+       <!-- ================================================================== 
-->
+       <!-- directory for deployable artifacts                                 
-->
+       <property name="deploy.dir"   value="${target.dir}/openbooks"/>         
 
+       <!-- ================================================================== 
-->
 
-       <path id="compile.classpath" description="compilation requires OpenJPA 
specific library">
+       <path id="compile.classpath" 
+               description="Compilation classpath requires OpenJPA specific 
library because of bytecode enhancement">
                <pathelement location="${src.dir}" />
                <pathelement location="${classes.dir}" />
                <pathelement location="${rsrc.dir}" />
@@ -46,7 +74,8 @@
                </fileset>
        </path>
        
-       <path id="java2html.classpath">
+       <path id="java2html.classpath"
+               description="Classpath for generating HTML version of source 
code using Java2HTML library">
                <pathelement location="${rsrc.dir}" />
                <fileset dir="${java2html.lib}">
                        <include name="*.jar" />
@@ -60,21 +89,26 @@
        </fileset>
        
        <target name="clean" description="Removes all *.class and generated 
metamodel source files">
-               <delete dir="${basedir}/target" failonerror="false"/>
+               <delete dir="${target.dir}" failonerror="false"/>
                <delete>
                        <fileset refid="canonical.metamodel"/>
                </delete>
        </target>
 
-       <target name="info" depends="check-env">
+       <target name="info"
+               description="Prints environmental variables">
                <echo>
                        Builds OpenBooks demo application.
                        OpenJPA Library: ${openjpa.lib}
+                       Build mode     : ${build.mode}
+                       Deploy Location: ${deploy.dir}
                </echo>
        </target>
        
-       <target name="check-env" description="Checks if required libraries 
exist">
-               <available file="${openjpa.lib}" property="openjpa.exists"/>
+       <target name="check-env" 
+                   description="Checks if required libraries exist"
+                   depends="info">
+               <available file="${openjpa.lib}"   property="openjpa.exists"/>
                <fail unless="openjpa.exists">*** Error:
                   The directory for OpenJPA libraries can not be located at 
${openjpa.lib}. 
                   Make sure openjpa.lib property value is correct in 
build.properties file.    
@@ -84,14 +118,25 @@
                   The directory for Java2HTML libraries can not be located at 
${java2html.lib}. 
                   Make sure java2html.lib property value is correct in 
build.properties file.  
                </fail>
+               <condition property="build.mode.is.valid">
+                       <or>
+                               <equals arg1="${build.mode}" arg2="jse" 
casesensitive="false" trim="true"/>
+                               <equals arg1="${build.mode}" arg2="jee" 
casesensitive="false" trim="true"/>
+                       </or>
+               </condition>
+               <fail unless="build.mode.is.valid" message="Invalid build.mode 
${build.mode}"/>
+               <condition property="build.mode.is.jse">
+                       <equals arg1="${build.mode}" arg2="jse" 
casesensitive="true" trim="true"/>
+               </condition>
+               <condition property="build.mode.is.jee">
+                       <equals arg1="${build.mode}" arg2="jee" 
casesensitive="true" trim="true"/>
+               </condition>
+               <mkdir dir="${deploy.dir}"/>
        </target>
        
-       <target name="build" depends="check-env,genmodel,compile,enhance"
-               description="Compilation will also generate canonical 
meta-model classes.">
-       </target>
-       <target name="genmodel" depends="check-env"
+       <target name="generate-canonical-model" depends="check-env"
                description="Generate canonical meta-model source">
-               <mkdir dir="${msrc.dir}" />
+               <mkdir dir="${generated.src.dir}" />
                <mkdir dir="${classes.dir}" />
                <javac srcdir="${src.dir}" destdir="${classes.dir}" 
debug="true">
                        <classpath refid="compile.classpath" />
@@ -99,17 +144,21 @@
                        <compilerarg value="-Aopenjpa.metamodel=true" />
                        <compilerarg value="-Aopenjpa.log=TRACE" />
                        <compilerarg value="-s"/>
-                       <compilerarg value="${msrc.dir}" />
+                       <compilerarg value="${generated.src.dir}" />
                </javac>
        </target>
-       <target name="compile" depends="genmodel"
+       
+       <target name="compile" depends="generate-canonical-model"
                description="Compile classes.">
-               <javac srcdir="${src.dir}" destdir="${classes.dir}" 
debug="true">
-                       <classpath refid="compile.classpath" />
-               </javac>
+               <subant antfile="build.${build.mode}.xml" 
+                       target="compile" 
+                       inheritrefs="true" 
+                       inheritall="true"
+                       buildpath="${basedir}"/>
        </target>
+       
        <target name="enhance" depends="check-env"
-               description="Enhance classes.">
+               description="Enhance persistent domain classes.">
                <java classname="org.apache.openjpa.enhance.PCEnhancer" 
fork="true">
                        <arg value="-properties" />
                        <arg value="${jpa.properties}" />
@@ -117,60 +166,24 @@
                </java>
        </target>
        
-       <target name="package" depends="clean,build,generate-html-source"
-               description="Generates HTML version of source code and creates 
distribution layout">
-               <delete file="${basedir}/target/openbooks.jar" 
failonerror="false"/>
-               <delete file="${basedir}/target/openbooks.zip" 
failonerror="false"/>
-               
-               <jar destfile="${basedir}/target/openbooks.jar" 
basedir="${classes.dir}">
-                       <exclude name="junit/**" />
-               </jar>
-               <jar destfile="${basedir}/target/openbooks.jar"
-                    basedir="${rsrc.dir}"
-                    update="true">
-                       <include name="images/*" />
-               </jar>
-                <!-- ASF released jars must include License and Notice files 
-->
-               <jar destfile="${basedir}/target/openbooks.jar"
-                    basedir="${basedir}"
-                    update="true">
-                       <include name="NOTICE.txt"/>
-                       <include name="LICENSE.txt"/>
-               </jar>
-
-               <zip destfile="${basedir}/target/openbooks.zip" 
basedir="${basedir}">
-                       <include name="run.properties" />
-                       <include name="run.xml" />
-                       <include name="index.html" />
-                       <include name="NOTICE.txt"/>
-                       <include name="LICENSE.txt"/>
-               </zip>
-               <zip destfile="${basedir}/target/openbooks.zip" 
basedir="${basedir}/target" update="true">
-                       <include name="openbooks.jar" />
-               </zip>
-               <zip destfile="${basedir}/target/openbooks.zip" 
basedir="${rsrc.dir}" update="true">
-                       <include name="load.properties" />
-                       <include name="demo.properties" />
-                       <include name="META-INF/persistence.xml" />
-                       <include name="slides/**" />
-               </zip>
-               <zip destfile="${basedir}/target/openbooks.zip" 
basedir="${basedir}/target" update="true">
-                       <include name="source/**" />
-               </zip>
-       </target>
-       
-       <target name="deploy" description="Transfers the distribution packge to 
a deploy directory">
-               <delete dir="${deploy.dir}" failonerror="false"/>
-               <mkdir dir="${deploy.dir}"/>
-               <unzip dest="${deploy.dir}" 
src="${basedir}/target/openbooks.zip" overwrite="true">
-               </unzip>
+       <target name="package" description="Build and Package based on JSE or 
JEE mode"
+               depends="check-env,
+                    clean,
+                                generate-canonical-model,
+                                compile,
+                                enhance,
+                                generate-html-source">
+               <subant antfile="build.${build.mode}.xml" 
+                       target="package" 
+                       inheritrefs="true" 
+                       inheritall="true"
+                       buildpath="${basedir}"/>
        </target>
        
-       <target name="generate-html-source" 
+       <target name="generate-html-source" if="java2html.exists"
                description="Generates HTML Source Code using Java2HTML 
utility">
                <delete dir="${generated.html.dir}" failonerror="false"/>
                <mkdir dir="${generated.html.dir}"/>
-                <!-- Create HTML of svn source files -->
                <java classname="de.java2html.Java2Html" fork="true">
                        <classpath refid="java2html.classpath"/>
                        <arg value="-srcdir"/>
@@ -180,11 +193,10 @@
                        <arg value="-style"/>
                        <arg value="Eclipse"/>
                </java>
-                <!-- Create HTML of meta-model generated source files -->
                <java classname="de.java2html.Java2Html" fork="true">
                        <classpath refid="java2html.classpath"/>
                        <arg value="-srcdir"/>
-                       <arg value="${msrc.dir}"/>
+                       <arg value="${generated.src.dir}"/>
                        <arg value="-targetdir"/>
                        <arg value="${generated.html.dir}"/>
                        <arg value="-style"/>
@@ -192,6 +204,5 @@
                </java>
                <replace dir="${generated.html.dir}" token="10pt" value="14pt">
            </replace>
-    </target>
-       
+    </target>  
 </project>

Modified: openjpa/trunk/openjpa-examples/openbooks/index.html
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/index.html?rev=946811&r1=946810&r2=946811&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/index.html (original)
+++ openjpa/trunk/openjpa-examples/openbooks/index.html Thu May 20 22:12:24 2010
@@ -24,19 +24,25 @@ under the License.
 <style type="text/css">
 body {
 background-color:#FFFFFF;
+font-family:"Tahoma";
 }
 h1 {
 color:black;
 text-align:center;
+font-family:"Tahoma";
 }
 h2 {
 color:blue;
 text-align:left;
+font-family:"Tahoma";
 }
 
 p{
-font-family:"Times New Roman";
-font-size:20px;
+font-family:"Tahoma";
+}
+code{
+font-family:"Courier New";
+font-size:16px;
 }
 </style>
 </head>
@@ -47,35 +53,44 @@ font-size:20px;
   OpenBooks is a sample (and perhaps simple) application to demonstrate some 
of the new features of 
   version 2.0 of <A HREF="http://jcp.org/en/jsr/detail?id=317";>Java 
Persistence API</A> (JPA) specification, such as
   <br>
+  <OL>
   <LI>Creating dynamic Criteria Query from an input form
   <LI>Using compound, derived identity and orphan delete for modeling 
composite relationship
   <LI>Browsing Persistent Domain Model via MetaModel API
+  </LI>
+  </OL>
   <br>
   
   OpenBooks runs with <A HREF="http://openjpa.apache.org";>OpenJPA</A> as its 
JPA provider.
   <hr>
 <h2>Instructions to download and run OpenBooks Demo</h2>
-   OpenBooks comes with complete source code, build scripts to demonstrate how 
to build a typical OpenJPA application
-   and scripts to run OpenBooks in on your local database installation. Follow 
the simple instructions below:
+   OpenBooks comes with 
+   <OL>
+   <LI>complete source code
+   <LI>build scripts to demonstrate how to build a typical OpenJPA application 
and package it for JSE or JEE 
+   environment
+   <LI>scripts to run OpenBooks in on your local database installation. 
+   </OL>
+   <br>
+   Follow the simple instructions below to build and run OpenBooks:
    
 <OL>
    <LI><A href="#Download">Download OpenBooks distribution</A>.
+   <LI><A href="#Configure">Configure build and run environment</A>.
    <LI><A href="#Build">Build OpenBooks from source</A>
-   <LI><A href="#Configure">Edit for your local environment to run</A>
-   <LI><A href="#Load">Populate a Database</A>
    <LI><A href="#Run">Run OpenBooks</A>
 </OL>
    <hr>
-<h2 A name="Download">Download Instructions</A></h2>
+<h2><A name="Download">Download Instructions</A></h2>
    OpenBooks is distributed under <A 
HREF="http://www.apache.org/licenses/LICENSE-2.0";>Apache License, Version 
2.0</A>  
    <br>
    OpenBooks can be checked out from OpenJPA repository.
    <br>
-   <code>$ svn co 
https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks</code>.
-   <p>
+   &nbsp;&nbsp;<code>$ svn co 
https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks</code>.
+   <br>
    will check out the source code and build scripts of OpenBooks in current 
directory.
-    
-   OpenBooks require following software environment to run:
+   <br>
+   OpenBooks requires following software environment to run:
   <OL>
   <LI> Java Runtime version 6.0 or higher
   <LI> OpenJPA Libraries version 2.0 or higher
@@ -86,34 +101,76 @@ font-size:20px;
   <hr>
   
 
-<h2><A name="Build">Build OpenBooks from source</h2>
-   OpenBooks builds with Ant. Before you run a build, configure the build 
environment by editing
-    <A HREF="build.properties"><code>build.properties</code></A>. Essentially 
you need to point to OpenJPA class library.
-    The file is commented on what is to be edited. Once you have edited 
<code>build.properties</code>, simply issue
-    <br>
-    <code>$ ant package deploy</code>
+<h2><A name="Configure">Configure build and run environment</A></h2>
+   OpenBooks builds with Ant. The Ant build script is somewhat involved 
because OpenBooks can be built and packaged
+   either as a JSE (Swing based) application or a JEE Web Application. By 
default, OpenBooks is built as a 
+   JSE application.
+   <br>
+   Before you run a build, configure the build environment by editing
+   <A HREF="build.properties"><code>build.properties</code></A>. 
+   Essentially, you need to 
+     <OL>
+     <LI>point <code>openjpa.lib</code> variable to the local directory where 
OpenJPA class library(ies) reside.
+     Notice that the variable points to a directory and not a 
<code>*.jar</code> file. All <code>*.jar</code> files
+     found under the directory are included in compilation classpath.
+     </OL>     
     <br>
-    This will compile the source code, generate metamodel classes, enhance the 
persistence domain model, package
-    the application and copy it to a <code>target/openbooks</code> directory.  
+    The next  step is to configure runtime environment.  
+    <OL>
+      <LI>Edit <A 
HREF="resources/META-INF/persistence.xml"><code>persistence.xml</code></A> 
located in 
+      <code>resources/META-INF</code> directory. 
+      Modify the <code>javax.persistence.jdbc.driver</code>
+      and <code>javax.persistence.jdbc.url</code> property to suit your local 
database and its driver.
+      <br>
+      The example <code>persistence.xml</code> provided is primarily for a JSE 
environment.
+      In JEE environment, you may already have a JTA data source configured 
and registered in JNDI.
+      Of course, then the <code>persistence.xml</code> is to be edited 
accordingly in 
+      <code>&lt;jta-data-source&gt;</code> clause. 
+      <LI>In JSE mode, edit <A 
HREF="run.properties"><code>run.properties</code></A> to specify location of 
OpenJPA 
+      class libraries and JDBC Driver used in runtime classpath.
+      <br>
+      In JEE mode, OpenJPA library and JDBC drivers are configured in JEE 
server and hence variables in
+      this file are irrelevant.  
+      <LI>Edit <A HREF="load.properties"><code>load.properties</code></A> to 
specify load parameters such as number of 
+      Books etc. OpenBooks uses this data to populate a database with some 
sample data.
+      This example file has some typical values. If you are satisfied with it, 
you can leave them as it is.
+    </OL> 
+    
+    
+    Both <code>build.properties</code> and <code>run.properties</code> files 
are commented in-place on what is to be 
+    edited.  
   <hr>
     
-<h2><A name="Configure">Edit for your local environment to run</A></h2>
-   Now go to the <em>deploy</em> directory i.e. <code>target/openbooks</code> 
directory
-    <OL>
-      <LI>Edit <A HREF="run.properties"><code>run.properties</code></A> to 
specify location of OpenJPA class libraries and JDBC Driver
-      <LI>Edit <A 
HREF="META-INF/persistence.xml"><code>META-INF/persistence.xml</code></A> to 
specify database properties
-      <LI>Edit <A HREF="load.properties"><code>load.properties</code></A> to 
specify load parameters such as number of Books etc.
-          This example file has some typical values. If you are satisfied with 
it, you can leave them as it is.
-    </OL>
+<h2><A name="Build">Build OpenBooks from source</A></h2>
+    Once you have configured the environment, simply issue 
+    <br>
+    &nbsp;&nbsp;<code>$ ant</code>
+    <br>or<br>
+    &nbsp;&nbsp;<code>$ ant -Dbuild.mode=jee</code>
+    <br>
+    The default target of the ant script will 
+    <LI>generate metamodel classes (required for Criteria API)
+    <LI>compile the source code
+    <LI>enhance the persistence domain model
+    <LI>package the application based on the build.mode as a Swing-based 
application or a Web Application Archive.
+    and <LI>copy the deployable artifacts to <code>target/openbooks</code> 
directory relative to the current directory.    
     <hr>
-<h2><A name="Load">Populate a Database</A></h2>
-  Invoke the Ant script to populate the database.<br>
-  <code>$ ant -f run.xml load</code>
-  <hr>
-  
+    
 <h2><A name="Run">Run OpenBooks</A></h2> 
-  Invoke the Ant script to run OpenBooks<br>
-  <code>$ ant -f run.xml run</code>
+    If you have built OpenBooks for JSE, then go to the 
<code>target/openbooks</code> directory. 
+    <br>
+    Invoke the Ant script to populate the database.<br>
+    &nbsp;&nbsp;<code>$ ant -f run.xml load</code>
+    <br>
+    Then invoke the Ant script to run OpenBooks<br>
+    &nbsp;<code>$ ant -f run.xml run</code>
  <hr>
+    If you have build OpenBooks for JEE, a Web Application Archive 
<code>openbooks.war</code> will be
+    created in <code>target/openbooks</code> directory. You need to deploy 
<code>openbooks.war</code>
+    to a JEE Application Server. Once deployed, you can point a browser to 
Application Server URL
+    <br>
+    &nbsp;&nbsp;<code>http://&lt;app server 
host&gt;:&lt;port&gt;/openbooks/</code>
+    <br>
+    to access OpenBooks as an web application.
 </body>
 </html>


Reply via email to