openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] OpenJPA > Building and Running OpenBooks
Date Fri, 18 Feb 2011 16:10:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2036/9/5/_/styles/combined.css?spaceKey=openjpa&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/openjpa/Building+and+Running+OpenBooks">Building
and Running OpenBooks</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~kwsutter@gmail.com">Kevin
Sutter</a>
    </h4>
        <br/>
                         <h4>Changes (42)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">h2.<span
class="diff-added-chars"style="background-color: #dfd;"> </span>Instructions</span>
to download and run OpenBooks Demo <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br></td></tr>
            <tr><td class="diff-unchanged" >OpenBooks comes with

* complete source code
* build scripts to demonstrate how to build a typical OpenJPA application and package it for
JSE or JEE environment
* scripts to run OpenBooks in on your local database installation.


Follow the simple instructions below to build and run OpenBooks:
 <br>h2. Download Instructions <br> <br>OpenBooks can be checked out from
OpenJPA repository. <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
<br>   {{$ svn co https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks}}.
<br> <br>   will check out the source code and build scripts of OpenBooks in current
directory. <br> <br>   OpenBooks requires following software environment to run:
<br> <br>  *  Java Runtime version 6.0 or higher <br>  *  OpenJPA Libraries
version 2.0 or higher <br>  *  Ant version 1.6 or higher <br>  *  Any JDBC complaint
database supported by OpenJPA.    <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
{{$ svn co}} {{[https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks]}}.
<br> <br>will check out the source code and build scripts of OpenBooks in current
directory. <br> <br>OpenBooks requires following software environment to run:
<br> <br>* Java Runtime version 6.0 or higher <br>* OpenJPA Libraries version
2.0 or higher <br>* Ant version 1.6 or higher <br>* Any JDBC complaint database
supported by OpenJPA (embedded Derby is the default). <br> <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. Configure build and run environment
<br> <br></td></tr>
            <tr><td class="diff-changed-lines" >OpenBooks builds with Ant. The
Ant build script is somewhat involved because OpenBooks can be built and packaged <span
class="diff-added-words"style="background-color: #dfd;">either as a JSE (Swing based) application
or a JEE Web Application. By default, OpenBooks is built as a JSE application.</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
  either as a JSE (Swing based) application or a JEE Web Application. By default, OpenBooks
is built as a  <br>   JSE application. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >OpenBooks can be built in JSE
and JEE mode -- and to keep things simple the common build steps are available in <span
class="diff-added-words"style="background-color: #dfd;">main build script {{build.xml}}
while JSE and JEE specific packaging steps are described in separate {{build.jse.xml}} and
{{build.jee.xml}}, respectively. Furthermore, for JEE, the deployment step is further refined
for each application server. See {{build.jee.was.xml}} for WebSphere installation steps.</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
  main build script {{build.xml}} while JSE and JEE specific packaging steps are described
in separate  <br>   {{build.jse.xml}} and {{build.jee.xml}} respectively. Furthermore,
for JEE, the deployment step is further <br>   refined for each application server.
See {{build.jee.was.xml}} for WebSphere installation. <br> <br>   Before you run
a build, configure the build environment by editing {{build.properties}}.  <br>   Essentially,
you need to  <br> <br>     * point {{openjpa.lib}} variable to the local directory
where OpenJPA class library(ies) reside. <br>     Notice that the variable points to
a directory and not a {{* .jar}} file. All {{* .jar}} files <br>     found under the
directory are included in compilation classpath. OpenJPA version 2.0, however, <br>
    is also available with all its runtime dependencies (such as JPA specification <br>
    API, Apache Commons Collections and others) packaged together in a _single_ library. 
<br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
    * Ideally, a JPA-compliant application _should_ not require provider-specific library
during compilation. <br>       OpenBooks persistent domain model and application logic
also does not use any OpenJPA specific features, <br>       but OpenJPA libraries are
still used during compilation because bytecode for persistent entities are  <br>   
   _enhanced_ as a post-compilation step. This bytecode enhancement is not essential but an
important step <br>       for using OpenJPA.  <br> <br>    The next step
is to configure runtime configuration descriptors and environment variables.   <br>
<br>      * For JSE environment, edit {{persistence.xml}} located in {{resources/META-INF}}
directory.  <br>      Modify the {{javax.persistence.jdbc.driver}} and {{javax.persistence.jdbc.url}}
property to suit your local database  <br>      and its driver. <br> <br>
     * In JEE environment, you may already have a JTA data source configured and registered
in JNDI. <br>      Of course, then the appropriate configuration is to be edited accordingly
in  <br>      {{&amp;lt;jta-data-source&amp;gt;}} clause. See {{persistence.jee.was.xml}}
for WebSphere environment. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Before
you run a build, configure the build environment by editing {{openjpa-examples/openbooks/build.properties}}.
Essentially, you need to <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*
Point {{openjpa.lib}} variable to the local directory where OpenJPA class library(ies) reside.
Notice that the variable points to a directory and not a {{\* .jar}} file. All {{\* .jar}}
files found under the directory are included in compilation classpath. OpenJPA version 2.0,
however, is also available with all its runtime dependencies (such as JPA specification API,
Apache Commons Collections and others) packaged together in a _single_ library. <br>
<br>*Note:&amp;nbsp;* Access to the OpenJPA class libraries is easier if you have
a Maven repository (.m2) available on your system.&amp;nbsp; In this case, all that is
required is to update the {{openjpa.version}} variable to point at the proper OpenJPA SNAPSHOT
version. <br> <br>* Ideally, a JPA-compliant application _should_ not require
provider-specific library during compilation. OpenBooks persistent domain model and application
logic also does not use any OpenJPA specific features, but OpenJPA libraries are still used
during compilation because bytecode for persistent entities are _enhanced_ as a post-compilation
step. This bytecode enhancement is not essential but an important step for using OpenJPA.
<br> <br>The next step is to configure runtime configuration descriptors and environment
variables. <br> <br>* For JSE environment, edit {{persistence.xml}} located in
{{openjpa-examples/openbooks/src/main/resources/META-INF}} directory. Modify the {{javax.persistence.jdbc.driver}}
and {{javax.persistence.jdbc.url}} property to suit your local database and its driver. <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >* In JSE mode, edit <span class="diff-changed-words">{{<span
class="diff-added-chars"style="background-color: #dfd;">openjpa-examples/openbooks/</span>run.properties}}</span>
to specify location of OpenJPA class libraries and JDBC Driver <span class="diff-added-words"style="background-color:
#dfd;">used in runtime classpath.  Here again, the use of the {{openjpa.version}} variable
with a Maven repository makes this configuration easy.</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
       used in runtime classpath. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>* In JEE environment, you may already have a JTA data source configured and registered
in JNDI. Of course, then the appropriate configuration is to be edited accordingly in {{&lt;jta-data-source&gt;}}
clause. See {{persistence.jee.was.xml}} for WebSphere environment. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >* In JEE mode, OpenJPA library
and JDBC drivers are configured in JEE server and hence variables in <span class="diff-added-words"style="background-color:
#dfd;">this file are irrelevant.</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
     this file are irrelevant.   <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >Both {{build.properties}} and
{{run.properties}} files are commented in-place on what is to be <span class="diff-added-words"style="background-color:
#dfd;">edited.</span> <br><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">edited.</span>
<span class="diff-added-words"style="background-color: #dfd;"> </span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Build OpenBooks from source <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >Once you have configured the environment,
simply issue <span class="diff-added-words"style="background-color: #dfd;">(from the
{{openjpa-examples/openbooks}} directory):</span> <br></td></tr>
            <tr><td class="diff-unchanged" >
 {{$ ant}}
 <br>or <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >{{$ ant <span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">\</span>-Dbuild.mode=jee}}</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
<br>    The default target of the ant script will  <br>    * generate metamodel
classes (required for Criteria API) <br>    * compile the source code <br>   
* enhance the persistence domain model <br>    * package the application based on the
build.mode as a Swing-based application or a Web Application Archive. <br>    and  <br>
  * copy the deployable artifacts to {{target/openbooks}} directory relative to the current
directory.   <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">The
default target of the ant script will <br>* generate metamodel classes (required for
Criteria API) <br>* compile the source code <br>* enhance the persistence domain
model <br>* package the application based on the build.mode as a Swing-based application
or a Web Application Archive. <br>* copy the deployable artifacts to {{target/openbooks}}
directory relative to the current directory. <br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br>h2. Deploy OpenBooks
in an Application Server <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
<br>   Deployment techniques and configuration vary across JEE compliant application
servers. Hence, OpenBooks <br>   does not provide an uber-deployment script for all
application server. Instead, application server <br>   specific steps are encoded in
separate build scripts for each application server. Using generic <br>   build as described
in the previous section, the {{openbooks.war}} web archive need to be deployed manually. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
  For WebSphere Application Server, automated build scripts are available in {{build.jee.was.xml}}.
 <br>   WebSphere deployment needs to be triggered by {{ws_ant}} utility as follows
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Deployment
techniques and configuration vary across JEE compliant application servers. Hence, OpenBooks
does not provide an uber-deployment script for all application server. Instead, application
server specific steps are encoded in separate build scripts for each application server. Using
generic build as described in the previous section, the {{openbooks.war}} web archive need
to be deployed manually. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
    {{$ ws_ant -Dbuild.mode=jee -Dappserver=was -Dwas.home=WAS_HOME}} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">For
WebSphere Application Server, automated build scripts are available in {{build.jee.was.xml}}.
WebSphere deployment needs to be triggered by {{ws_ant}} utility as follows <br> {{$
ws_ant \-Dbuild.mode=jee \-Dappserver=was \-Dwas.home=WAS_HOME}} <br> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >where {{WAS_HOME}} denotes the
root directory where WAS V7 with JPA 2.0 feature pack has been installed. <span class="diff-added-words"style="background-color:
#dfd;">Yes, OpenBooks requires the WAS V7 JPA 2.0 feature pack with a profile augmented
to run with the feature pack. Further information on this feature pack is available [here|http://www-01.ibm.com/support/docview.wss?rs=180&amp;uid=swg27018836].</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
  Yes, OpenBooks requires the WAS V7 JPA 2.0 feature pack with a profile augmented to run
with the feature pack.  <br>   Further information on this feature pack is available
[here|http://www-01.ibm.com/support/docview.wss?rs=180&amp;uid=swg27018836]. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >The WebSphere specific build will
configure appropriate JTA data sources using a python script (found under {{openbooks/scripts/}}
<span class="diff-added-words"style="background-color: #dfd;">directory before deploying
OpenBooks as a web application. The script assumes a single server instance. If multiple profiles
exist, the script will use the first server profile.</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
  directory before deploying OpenBooks as a web application. The script assumes a single server
instance. If multiple profiles exist,  <br>   the script will use the first server profile.
 <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. Run OpenBooks <br>
<br>If you have built OpenBooks for JSE, then go to the {{target/openbooks}} directory.
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
<br>    Invoke the Ant script to run OpenBooks <br>    {{$ ant -f run.xml}} <br>
<br> <br>    If you have build OpenBooks for JEE, a Web Application Archive {{openbooks.war}}
will be <br>    created in {{target/openbooks}} directory. You need to deploy {{openbooks.war}}
<br>    to a JEE Application Server. Once deployed, you can point a browser to Application
Server URL <br> <br>    {{http:// &amp;lt; app server host &amp;gt;:&amp;lt;port&amp;gt;/openbooks/}}
<br> <br>    to access OpenBooks as an web application. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Invoke
the Ant script to run OpenBooks <br>{{$ ant \-f run.xml}} <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>If you have build OpenBooks for JEE, a Web Application Archive {{openbooks.war}}
will be created in {{target/openbooks}} directory. You need to deploy {{openbooks.war}} to
a JEE Application Server. Once deployed, you can point a browser to Application Server URL
<br> <br> {{http:// &lt; app server host &gt;:&lt;port&gt;/openbooks/}}
<br> <br>to access OpenBooks as an web application. <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. Populate OpenBooks Database <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >OpenBooks checks for existing
data at first connection to the database. <span class="diff-added-words"style="background-color:
#dfd;">If the database is empty, the schema is defined and populated with initial data.
However, you can explicitly populate the database in JSE build.</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
   If the database is empty, the schema is defined and populated with initial data. <br>
   However, you can explicitly populate the database in JSE build.  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
   Edit {{load.properties}} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*Note:*
By default, the OpenBooks example uses and populates an Embedded Derby instance.  So, no further
configuration or loading is required for the default configuration. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-added-words"style="background-color:
#dfd;">Edit {{load.properties}}</span> to specify load parameters such as number
of Books etc. OpenBooks uses this data to populate a database <span class="diff-added-words"style="background-color:
#dfd;">with some sample data. This example file has some typical values. If you are satisfied
with it, you can leave them as it is. Then invoke the Ant script</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
   with some sample data. This example file has some typical values. If you are satisfied
with it,  <br>    you can leave them as it is. Then invoke the Ant script <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >{{$ ant <span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">\</span>-f</span> run.xml
load}} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="BuildingandRunningOpenBooks-InstructionstodownloadandrunOpenBooksDemo"></a>Instructions
to download and run OpenBooks Demo</h2>

<p>OpenBooks comes with</p>

<ul>
	<li>complete source code</li>
	<li>build scripts to demonstrate how to build a typical OpenJPA application and package
it for JSE or JEE environment</li>
	<li>scripts to run OpenBooks in on your local database installation.</li>
</ul>



<p>Follow the simple instructions below to build and run OpenBooks:</p>

<h2><a name="BuildingandRunningOpenBooks-DownloadInstructions"></a>Download
Instructions</h2>

<p>OpenBooks can be checked out from OpenJPA repository.</p>

<p> <tt>$ svn co</tt> <tt><a href="https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks"
class="external-link" rel="nofollow">https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks</a></tt>.</p>

<p>will check out the source code and build scripts of OpenBooks in current directory.</p>

<p>OpenBooks requires following software environment to run:</p>

<ul>
	<li>Java Runtime version 6.0 or higher</li>
	<li>OpenJPA Libraries version 2.0 or higher</li>
	<li>Ant version 1.6 or higher</li>
	<li>Any JDBC complaint database supported by OpenJPA (embedded Derby is the default).</li>
</ul>




<h2><a name="BuildingandRunningOpenBooks-Configurebuildandrunenvironment"></a>Configure
build and run environment</h2>

<p>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.</p>

<p>OpenBooks can be built in JSE and JEE mode &#8211; and to keep things simple
the common build steps are available in main build script <tt>build.xml</tt> while
JSE and JEE specific packaging steps are described in separate <tt>build.jse.xml</tt>
and <tt>build.jee.xml</tt>, respectively. Furthermore, for JEE, the deployment
step is further refined for each application server. See <tt>build.jee.was.xml</tt>
for WebSphere installation steps.</p>

<p>Before you run a build, configure the build environment by editing <tt>openjpa-examples/openbooks/build.properties</tt>.
Essentially, you need to</p>

<ul>
	<li>Point <tt>openjpa.lib</tt> variable to the local directory where OpenJPA
class library(ies) reside. Notice that the variable points to a directory and not a <tt>&#42;
.jar</tt> file. All <tt>&#42; .jar</tt> files found under the directory
are included in compilation classpath. OpenJPA version 2.0, however, is also available with
all its runtime dependencies (such as JPA specification API, Apache Commons Collections and
others) packaged together in a <em>single</em> library.</li>
</ul>


<p><b>Note:&nbsp;</b> Access to the OpenJPA class libraries is easier
if you have a Maven repository (.m2) available on your system.&nbsp; In this case, all
that is required is to update the <tt>openjpa.version</tt> variable to point at
the proper OpenJPA SNAPSHOT version.</p>

<ul>
	<li>Ideally, a JPA-compliant application <em>should</em> not require provider-specific
library during compilation. OpenBooks persistent domain model and application logic also does
not use any OpenJPA specific features, but OpenJPA libraries are still used during compilation
because bytecode for persistent entities are <em>enhanced</em> as a post-compilation
step. This bytecode enhancement is not essential but an important step for using OpenJPA.</li>
</ul>


<p>The next step is to configure runtime configuration descriptors and environment variables.</p>

<ul>
	<li>For JSE environment, edit <tt>persistence.xml</tt> located in <tt>openjpa-examples/openbooks/src/main/resources/META-INF</tt>
directory. Modify the <tt>javax.persistence.jdbc.driver</tt> and <tt>javax.persistence.jdbc.url</tt>
property to suit your local database and its driver.</li>
</ul>


<ul>
	<li>In JSE mode, edit <tt>openjpa-examples/openbooks/run.properties</tt>
to specify location of OpenJPA class libraries and JDBC Driver used in runtime classpath.
 Here again, the use of the <tt>openjpa.version</tt> variable with a Maven repository
makes this configuration easy.</li>
</ul>


<ul>
	<li>In JEE environment, you may already have a JTA data source configured and registered
in JNDI. Of course, then the appropriate configuration is to be edited accordingly in <tt>&lt;jta-data-source&gt;</tt>
clause. See <tt>persistence.jee.was.xml</tt> for WebSphere environment.</li>
</ul>


<ul>
	<li>In JEE mode, OpenJPA library and JDBC drivers are configured in JEE server and
hence variables in this file are irrelevant.</li>
</ul>




<p>Both <tt>build.properties</tt> and <tt>run.properties</tt>
files are commented in-place on what is to be edited.</p>


<h2><a name="BuildingandRunningOpenBooks-BuildOpenBooksfromsource"></a>Build
OpenBooks from source</h2>

<p>Once you have configured the environment, simply issue (from the <tt>openjpa-examples/openbooks</tt>
directory):</p>

<p> <tt>$ ant</tt></p>

<p>or</p>

<p> <tt>$ ant &#45;Dbuild.mode=jee</tt></p>

<p>The default target of the ant script will</p>
<ul>
	<li>generate metamodel classes (required for Criteria API)</li>
	<li>compile the source code</li>
	<li>enhance the persistence domain model</li>
	<li>package the application based on the build.mode as a Swing-based application or
a Web Application Archive.</li>
	<li>copy the deployable artifacts to <tt>target/openbooks</tt> directory
relative to the current directory.</li>
</ul>



<h2><a name="BuildingandRunningOpenBooks-DeployOpenBooksinanApplicationServer"></a>Deploy
OpenBooks in an Application Server</h2>

<p>Deployment techniques and configuration vary across JEE compliant application servers.
Hence, OpenBooks does not provide an uber-deployment script for all application server. Instead,
application server specific steps are encoded in separate build scripts for each application
server. Using generic build as described in the previous section, the <tt>openbooks.war</tt>
web archive need to be deployed manually.</p>

<p>For WebSphere Application Server, automated build scripts are available in <tt>build.jee.was.xml</tt>.
WebSphere deployment needs to be triggered by <tt>ws_ant</tt> utility as follows</p>

<p> <tt>$ ws_ant &#45;Dbuild.mode=jee &#45;Dappserver=was &#45;Dwas.home=WAS_HOME</tt></p>

<p>where <tt>WAS_HOME</tt> denotes the root directory where WAS V7 with
JPA 2.0 feature pack has been installed. Yes, OpenBooks requires the WAS V7 JPA 2.0 feature
pack with a profile augmented to run with the feature pack. Further information on this feature
pack is available <a href="http://www-01.ibm.com/support/docview.wss?rs=180&amp;uid=swg27018836"
class="external-link" rel="nofollow">here</a>.</p>

<p>The WebSphere specific build will configure appropriate JTA data sources using a
python script (found under <tt>openbooks/scripts/</tt> directory before deploying
OpenBooks as a web application. The script assumes a single server instance. If multiple profiles
exist, the script will use the first server profile.</p>


<h2><a name="BuildingandRunningOpenBooks-RunOpenBooks"></a>Run OpenBooks</h2>

<p>If you have built OpenBooks for JSE, then go to the <tt>target/openbooks</tt>
directory.</p>

<p>Invoke the Ant script to run OpenBooks<br/>
<tt>$ ant &#45;f run.xml</tt></p>


<p>If you have build OpenBooks for JEE, a Web Application Archive <tt>openbooks.war</tt>
will be created in <tt>target/openbooks</tt> directory. You need to deploy <tt>openbooks.war</tt>
to a JEE Application Server. Once deployed, you can point a browser to Application Server
URL</p>

<p> <tt>http:// &lt; app server host &gt;:&lt;port&gt;/openbooks/</tt></p>

<p>to access OpenBooks as an web application.</p>


<h2><a name="BuildingandRunningOpenBooks-PopulateOpenBooksDatabase"></a>Populate
OpenBooks Database</h2>

<p>OpenBooks checks for existing data at first connection to the database. If the database
is empty, the schema is defined and populated with initial data. However, you can explicitly
populate the database in JSE build.</p>

<p><b>Note:</b> By default, the OpenBooks example uses and populates an
Embedded Derby instance.  So, no further configuration or loading is required for the default
configuration.</p>

<p>Edit <tt>load.properties</tt> 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. Then invoke the Ant script</p>

<p> <tt>$ ant &#45;f run.xml load</tt></p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/openjpa/Building+and+Running+OpenBooks">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=21790751&revisedVersion=6&originalVersion=5">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/openjpa/Building+and+Running+OpenBooks?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message