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:42: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 (1)</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" >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. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h3. 1. Get the source code <br> <br>   OpenTrader source code is available
as one of the OpenJPA examples. Checkout the source files in a directory. <br> <br>
  {{$ svn checkout   https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/opentrader}}
<br> <br>  The source tree comes with  <br>   * Ant build script: {{build.xml}}
and {{build.properties}} <br>   * Java source code for OpenTrader application under
{{src/main/java}} <br>   * GWT module descriptor  : {{OpenTrader.gwt.xml}} under {{src/main/java/org/apache/openjpa/trader}}
<br>   * Persistence descriptor : {{persistence.xml}} under {{src/main/resources/META-INF}}
<br>   * web descriptor         : {{web.xml}} under {{src/main/resources/WEB-INF}} <br>
  * cascading style sheet  : {{OpenTrader.css}} under {{src/main/resources/css}} <br>
<br> <br>h3. 2. Build <br> <br>   To build OpenTrader you will require
following other libraries.  <br>   * *Google Web Toolkit*: We have built it with GWT
version 2.0.4 which can be downloaded from [here|http://google-web-toolkit.googlecode.com/files/gwt-2.0.4.zip].
<br>   * *cobogw widget library*: Provides rounded panel not using them seems to be
too un-cool. Download version 1.3.1 from [here|http://code.google.com/p/cobogw/downloads/list].
<br>   * and, of course, *OpenJPA libraries*: OpenJPA now comes with all its dependencies
neatly packaged in a single jar including the JPA API. Download from [this site|http://www.apache.org/dyn/closer.cgi/openjpa/2.0.0/apache-openjpa-2.0.0-binary.zip].
 <br> <br>   h5. 2.1 Configure build environment  <br> <br>      Edit
 {{build.properties}} to point to the dependent libraries you have downloaded. The file contains
the instructions as comments.  <br> <br>   h5. 2.2 Run Ant <br> <br>
    {{ $ ant compile}} <br> <br>      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 {{OpenTrader.gwt.xml}} <br> <br>     {code:xml} <br>
       &lt;set-property name=&quot;user.agent&quot; value=&quot;gecko1_8&quot;/&gt;
 <br>     {code} <br> <br>h3. 3. Run <br> <br>    You can run
either in _hosted_ 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 {{persistence.xml}}
found under {{src/main/resources/META-INF}}. This descriptor specifies the database used by
OpenTrader. <br> <br>     {code:xml} <br>        &lt;property name=&quot;openjpa.ConnectionDriverName&quot;
value=&quot;com.mysql.jdbc.Driver&quot;/&gt; <br>        &lt;property
name=&quot;openjpa.ConnectionURL&quot; value=&quot;jdbc:mysql://localhost/exchange&quot;/&gt;
<br>        &lt;property name=&quot;openjpa.ConnectionUserName&quot; value=&quot;whoami&quot;/&gt;
<br>        &lt;property name=&quot;openjpa.ConnectionPassword&quot; value=&quot;secret&quot;/&gt;
<br>     {code} <br> <br>    Also edit the {{jdbc.driver}} in {{build.properties}}
for the driver/database you have selected. <br> <br>    Now, for hosted mode,
simply fire Ant as <br>     {{ $ ant devmode}} <br> <br>    This should
again take a very long time and pop open a horrible looking Swing console titled *GWT Development
Mode*. Go to *Development Mode* tab and click *Launch Default Browser*. On my FireFox browser,
that opens up the page {{http://127.0.0.1:8888/OpenTrader.html?gwt.codesvr=127.0.0.1:9997}}.
If all goes well, at this point your browser will prompt you with a welcome dialog box <br>
<br>!OpenTrader-login.gif! <br> !OpenTrader-login.gif! <br> <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="error">Unable to render embedded object: File (OpenTrader-login.gif)
not found.</span><br/>
 <span class="error">Unable to render embedded object: File (OpenTrader-login.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=2&originalVersion=1">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