openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] OpenJPA > OpenTrader
Date Tue, 24 Aug 2010 19:53:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/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/OpenTrader">OpenTrader</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~ppoddar@apache.org">Pinaki
Poddar</a>
    </h4>
        <br/>
                         <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!
<br></td></tr>
            <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!
<br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
        </table>
</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="https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/opentrader"
class="external-link" rel="nofollow">https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/opentrader</a></tt></p>

<p>  The source tree comes with </p>
<ul>
	<li>Ant build script: <tt>build.xml</tt> and <tt>build.properties</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>
</ul>



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

<p>   To build OpenTrader you will require following other libraries. </p>
<ul>
	<li><b>Google Web Toolkit</b>: We have built it with GWT version 2.0.4
which can be downloaded from <a href="http://google-web-toolkit.googlecode.com/files/gwt-2.0.4.zip"
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="http://code.google.com/p/cobogw/downloads/list"
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
href="http://www.apache.org/dyn/closer.cgi/openjpa/2.0.0/apache-openjpa-2.0.0-binary.zip"
class="external-link" rel="nofollow">this site</a>.</li>
</ul>


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

<p>      Edit  <tt>build.properties</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).
<br/>
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> 
     </pre>
</div></div>

<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>
     </pre>
</div></div>

<p>    Also edit the <tt>jdbc.driver</tt> in <tt>build.properties</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="http://127.0.0.1:8888/OpenTrader.html?gwt.codesvr=127.0.0.1:9997"
class="external-link" rel="nofollow">http://127.0.0.1:8888/OpenTrader.html?gwt.codesvr=127.0.0.1:9997</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>
        <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/OpenTrader">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=23335925&revisedVersion=3&originalVersion=2">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/openjpa/OpenTrader?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message