openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] OpenJPA > OpenTrader
Date Tue, 24 Aug 2010 19:53:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1810/9/5/_/styles/combined.css?spaceKey=openjpa&amp;forWysiwyg=true"
<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="">OpenTrader</a></h2>
    <h4>Page <b>edited</b> by             <a href="">Pinaki
                         <h4>Changes (2)</h4>
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>!OpenTrader-login.gif!
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">!OpenTrader-login.gif!</span>
<span class="diff-added-words"style="background-color: #dfd;"> </span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Once
you have entered OpenTrader, the browser application looks like  <br> !OpenTrader-screenshot.gif!
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="OpenTrader-OpenTrader%3Aatransactional%2CwebapplicationwithGoogleWebToolkit%2COpenJPA%2FSliceonTomcat"></a>OpenTrader:
a transactional, web application with Google Web Toolkit, OpenJPA/Slice on Tomcat</h1>

<p>OpenTrader is a sample web application to demonstrate integration and interaction
of Google Web Toolkit, OpenJPA and Tomcat Servlet Container. <br/>
Follow the steps to view OpenTrader source code, build the application, deploy it in your
favorite application container and run it in your favorite browser.</p>

<h3><a name="OpenTrader-1.Getthesourcecode"></a>1. Get the source code</h3>

<p>   OpenTrader source code is available as one of the OpenJPA examples. Checkout the
source files in a directory.</p>

<p>   <tt>$ svn checkout   <a href=""
class="external-link" rel="nofollow"></a></tt></p>

<p>  The source tree comes with </p>
	<li>Ant build script: <tt>build.xml</tt> and <tt></tt></li>
	<li>Java source code for OpenTrader application under <tt>src/main/java</tt></li>
	<li>GWT module descriptor  : <tt>OpenTrader.gwt.xml</tt> under <tt>src/main/java/org/apache/openjpa/trader</tt></li>
	<li>Persistence descriptor : <tt>persistence.xml</tt> under <tt>src/main/resources/META-INF</tt></li>
	<li>web descriptor         : <tt>web.xml</tt> under <tt>src/main/resources/WEB-INF</tt></li>
	<li>cascading style sheet  : <tt>OpenTrader.css</tt> under <tt>src/main/resources/css</tt></li>

<h3><a name="OpenTrader-2.Build"></a>2. Build</h3>

<p>   To build OpenTrader you will require following other libraries. </p>
	<li><b>Google Web Toolkit</b>: We have built it with GWT version 2.0.4
which can be downloaded from <a href=""
class="external-link" rel="nofollow">here</a>.</li>
	<li><b>cobogw widget library</b>: Provides rounded panel not using them
seems to be too un-cool. Download version 1.3.1 from <a href=""
class="external-link" rel="nofollow">here</a>.</li>
	<li>and, of course, <b>OpenJPA libraries</b>: OpenJPA now comes with all
its dependencies neatly packaged in a single jar including the JPA API. Download from <a
class="external-link" rel="nofollow">this site</a>.</li>

<h5><a name="OpenTrader-2.1Configurebuildenvironment"></a>2.1 Configure
build environment </h5>

<p>      Edit  <tt></tt> to point to the dependent libraries
you have downloaded. The file contains the instructions as comments. </p>

<h5><a name="OpenTrader-2.2RunAnt"></a>2.2 Run Ant</h5>

<p>     {{ $ ant compile}}</p>

<p>      will compile the source code, then compile it for GWT then compile it for OpenJPA.
Compiling for GWT will take ages. Even though it only compiles for a single browser (FireFox).
This is controlled by the following directives in the module descriptor <tt>OpenTrader.gwt.xml</tt></p>

     <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
        <span class="code-tag">&lt;set-property name=<span class="code-quote">"user.agent"</span>
value=<span class="code-quote">"gecko1_8"</span>/&gt;</span> 

<h3><a name="OpenTrader-3.Run"></a>3. Run</h3>

<p>    You can run either in <em>hosted</em> mode - an environment provided
by GWT to run within a Jetty container - or in a proper servlet container such as Tomcat,
Geronimo or GlassFish or even heavy-duty ones such as WebSphere or Weblogic. In either case,
you have to configure the <tt>persistence.xml</tt> found under <tt>src/main/resources/META-INF</tt>.
This descriptor specifies the database used by OpenTrader.</p>

     <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
        <span class="code-tag">&lt;property name=<span class="code-quote">"openjpa.ConnectionDriverName"</span>
value=<span class="code-quote">"com.mysql.jdbc.Driver"</span>/&gt;</span>
        <span class="code-tag">&lt;property name=<span class="code-quote">"openjpa.ConnectionURL"</span>
value=<span class="code-quote">"jdbc:mysql://localhost/exchange"</span>/&gt;</span>
        <span class="code-tag">&lt;property name=<span class="code-quote">"openjpa.ConnectionUserName"</span>
value=<span class="code-quote">"whoami"</span>/&gt;</span>
        <span class="code-tag">&lt;property name=<span class="code-quote">"openjpa.ConnectionPassword"</span>
value=<span class="code-quote">"secret"</span>/&gt;</span>

<p>    Also edit the <tt>jdbc.driver</tt> in <tt></tt>
for the driver/database you have selected.</p>

<p>    Now, for hosted mode, simply fire Ant as<br/>
     {{ $ ant devmode}}</p>

<p>    This should again take a very long time and pop open a horrible looking Swing
console titled <b>GWT Development Mode</b>. Go to <b>Development Mode</b>
tab and click <b>Launch Default Browser</b>. On my FireFox browser, that opens
up the page <tt><a href=""
class="external-link" rel="nofollow"></a></tt>.
If all goes well, at this point your browser will prompt you with a welcome dialog box</p>

<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/23335925/OpenTrader-login.gif?version=1&amp;modificationDate=1282678934447"
style="border: 0px solid black" /></span></p>

<p>Once you have entered OpenTrader, the browser application looks like <br/>
 <span class="error">Unable to render embedded object: File (OpenTrader-screenshot.gif)
not found.</span></p>

        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
        <a href="">View
        <a href="">View
        <a href=";showCommentArea=true#addcomment">Add

View raw message