geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v2.2 > Sample applications
Date Tue, 02 Feb 2010 06:58:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=GMOxDOC22&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/GMOxDOC22/Sample+applications">Sample
applications</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~xiaming">Forrest
Xia</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
width='33%' class='ScrollbarPrevName'>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC22/Samples"><img border='0' align='middle' src='/confluence/images/icons/up_16.gif'
width='8' height='8'></a></sup><a href="/confluence/display/GMOxDOC22/Samples">Samples</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/GMOxDOC22/Sample+plug-ins">Sample
plug-ins</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/GMOxDOC22/Sample+plug-ins"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>
<p>This topic is organized in the following sections:</p>
<div>
<ul>
    <li><a href='#Sampleapplications-Installingasprebuiltplugins'>Installing as
prebuilt plugins</a></li>
<ul>
    <li><a href='#Sampleapplications-Installingthroughtheadministrativeconsole'>Installing
through the administrative console</a></li>
    <li><a href='#Sampleapplications-InstallingthroughGShell'>Installing through
GShell</a></li>
</ul>
    <li><a href='#Sampleapplications-Buildingfromsource'>Building from source</a></li>
<ul>
    <li><a href='#Sampleapplications-Downloadingthesourcecode'>Downloading the
source code</a></li>
    <li><a href='#Sampleapplications-Buildingthesamples'>Building the samples</a></li>
    <li><a href='#Sampleapplications-DeployingthebuiltsamplesasJavaEEartifacts'>Deploying
the built samples as Java EE artifacts</a></li>
<ul>
    <li><a href='#Sampleapplications-Withthesampledatasourceinstalledasaplugin'>With
the sample datasource installed as a plugin</a></li>
    <li><a href='#Sampleapplications-Makinglifeevenharderforyourself'>Making life
even harder for yourself</a></li>
<ul>
    <li><a href='#Sampleapplications-InstallingthesampledatasourceasaJavaEEartifact'>Installing
the sample datasource as a Java EE artifact</a></li>
    <li><a href='#Sampleapplications-Installingthesampledatasourcethroughtheadminconsoledatabasewizard'>Installing
the sample datasource through the admin console database wizard</a></li>
    <li><a href='#Sampleapplications-Manuallyinitializingthedatabase.'>Manually
initializing the database.</a></li>
</ul>
</ul>
</ul>
    <li><a href='#Sampleapplications-MavenGeneratedSiteforviewingjavadocorsourcexref'>Maven
Generated Site for viewing javadoc or source xref</a></li>
    <li><a href='#Sampleapplications-AvailableSampleApplications'>Available Sample
Applications</a></li>
</ul></div>

<h1><a name="Sampleapplications-Installingasprebuiltplugins"></a>Installing
as prebuilt plugins</h1>

<p>The recommended practice for Geronimo is to set up a workflow using Geronimo plugins
and maven from development through test and production. To demonstrate this, the samples are
built into plugins suitable for the Jetty and Tomcat Web containers in Geronimo.  Many samples
require database access.  This is encapsulated into a separate plugin (sample-datasource).</p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>TODO: Demonstrate how
to swap databases using plugins; see also the roller plugin</p></td></tr></table></div>

<p>In any case, to install samples as plugins you need to build them first.</p>

<p>For installation you need a Geronimo server with a Web container installed, such
as the geronimo-jetty-minimal or geronimo-jetty6-javaee5 servers (or the equivalent Tomcat
variations).</p>

<h2><a name="Sampleapplications-Installingthroughtheadministrativeconsole"></a>Installing
through the administrative console</h2>

<p>If you are using one of the Java EE 5 server assemblies you can use the administrative
console to install the plugins. Go to the plugins page, push the <b>Show Plugins</b>
button, find the sample(s) you want to install, and click <b>Install</b>.  Be
sure to select only plugins for the Web container you have installed (e.g. jetty plugins for
the Jetty web container).  Any necessary dependencies such as the sample-datasource plugin
will be installed automatically.  There are equivalent command line functions (described next
under <a href="#Sampleapplications-InstallingthroughGShell">Installing through GShell</a>)
if you are using one of the minimal assemblies that does not include the administrative console.</p>

<h2><a name="Sampleapplications-InstallingthroughGShell"></a>Installing
through GShell</h2>

<p>For this you can use any Geronimo server such as one of the minimal assemblies or
even the framework assembly.  After starting geronimo, run <tt>./bin/gsh</tt>
<tt>deploy/list-plugins</tt> in another terminal window and follow the instructions.
Installing a sample plugin will install the sample-datasource plugin and all other dependencies.
 Alternatively if you build using</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn clean install -Pit
</pre>
</div></div>

<p>you can find a server with the sample installed in directories such as</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;sample&gt;/&lt;sample&gt;-jetty/target/geronimo-framework-&lt;version&gt;/.
</pre>
</div></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>&#45;Pit is currently
only available in the samples branches/2.2 (2.2.1-SNAPSHOT) and trunk (3.0-SNAPSHOT), not
in branches/2.1 (2.1.3-SNAPSHOT) or tags/samples-parent-2.1.2 (2.1.2)</p></td></tr></table></div>

<h1><a name="Sampleapplications-Buildingfromsource"></a>Building from source</h1>

<h2><a name="Sampleapplications-Downloadingthesourcecode"></a>Downloading
the source code</h2>

<p>The first time building samples it is required that you build from the top level
directory.  After the initial build, you can do subsequent builds of specific samples as necessary.</p>

<p>You need svn and maven installed on your system.</p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>Maven v 2.2.1 or later
is required for building Geronimo 2.2 samples.</p></td></tr></table></div>


<p>To check out the 2.2 samples:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>svn co https://svn.apache.org/repos/asf/geronimo/samples/tags/samples-parent-2.2/
samples-parent-2.2
</pre>
</div></div>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>Alternatively, you could
choose to work with the active 2.2 branch of samples.  This will allow you to work with the
latest changes in samples but will also expose you to a branch that is under active development
and so things may be in flux from day to day:<br/>
svn co <a href="https://svn.apache.org/repos/asf/geronimo/samples/branches/2.2" rel="nofollow">https://svn.apache.org/repos/asf/geronimo/samples/branches/2.2</a>
gsamples-2.2</p></td></tr></table></div>
<p>Depending on when you look you may find earlier or released versions of the samples
under samples/branches and samples/tags.  You can browse in any web browser to see what's
there.  The trunk for samples always contains samples for the highest level version under
development <a href="https://svn.apache.org/repos/asf/geronimo/samples/trunk" rel="nofollow">https://svn.apache.org/repos/asf/geronimo/samples/trunk</a></p>


<h2><a name="Sampleapplications-Buildingthesamples"></a>Building the samples</h2>

<p>Build the samples using this command:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn clean install
</pre>
</div></div>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>If you run into the "Could
not scan module for TLD files...Filename too long" problem when using Windows platform, please
check out samples to a short directory (14 characters or less).</p></td></tr></table></div>

<p>There are minimal integration tests to assure that the sample plugins can be installed
on the framework server.  To run this tests use this command:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>mvn clean install -Pit
</pre>
</div></div>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>The integration tests
are not available prior to Geronimo Samples 2.2</p></td></tr></table></div>

<h2><a name="Sampleapplications-DeployingthebuiltsamplesasJavaEEartifacts"></a>Deploying
the built samples as Java EE artifacts</h2>

<h3><a name="Sampleapplications-Withthesampledatasourceinstalledasaplugin"></a>With
the sample datasource installed as a plugin</h3>

<p>After building the sample projects you can find suitable geronimo plans for a sample
&lt;sample&gt; in</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;sample&gt;/&lt;sample&gt;-jetty/target/resources/META-INF/plan.xml
</pre>
</div></div>
<p>(or the equivalent &#45;tomcat directory).  For most samples you will have to
install the sample-datasource plugin first.  Samples can be deployed from the administrative
console "deploy new" on a suitable server or using GShell <tt>./bin/gsh</tt> <tt>deploy/deploy</tt>.
 Note that in this case you have to start with a server with all the required bits already
installed, not the framework server.  Since this installation method is not tested automatically
it is more likely to be broken than the plugin method.</p>

<h3><a name="Sampleapplications-Makinglifeevenharderforyourself"></a>Making
life even harder for yourself</h3>

<p>You can also install the sample datasource as a javaee artifact using the plan we
generate when building the plugin, install the sample datasource using the administrative
console using the database wizard, and run the sql by hand rather than relying on the geronimo
<b>DBInitializationGBean</b>.</p>

<h4><a name="Sampleapplications-InstallingthesampledatasourceasaJavaEEartifact"></a>Installing
the sample datasource as a Java EE artifact</h4>

<p>Before you install any sample applications, deploy the <tt>org.tranql/tranql-connector-derby-embed-xa/1.4/rar</tt>
connector located in the geronimo repo at <tt>org/tranql/tranql-connector-derby-embed-xa/1.4/tranql-connector-derby-embed-xa-1.4.rar</tt>
with the plan at <tt>sample-datasource/target/resources/META-INF/plan.xml</tt>
using the admin console "deploy new" or GShell.  This will have exactly the same effect as
installing the sample-datasource plugin.</p>

<h4><a name="Sampleapplications-Installingthesampledatasourcethroughtheadminconsoledatabasewizard"></a>Installing
the sample datasource through the admin console database wizard</h4>

<p>Create a new datasource using the admin console database wizard, selecting the derby-embed-xa
type and naming the database "SampleDatabase" and the datasource "SampleTxDatasource".  The
admin console will come up with a module Id different from what the samples need, so you have
to map them in var/config/artifact_aliases.properties.  Insert a line like this:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>org.apache.geronimo.samples/sample-datasource/2.2/car=console.dbpool/SampleDatabase/1.0/car
</pre>
</div></div>
<p>replacing 2.2 with the appropriate sample version and adjusting the right hand side
as necessary.  Be sure geronimo is stopped when you edit artifact_aliases.properties.</p>

<h4><a name="Sampleapplications-Manuallyinitializingthedatabase."></a>Manually
initializing the database.</h4>

<p>Samples that need database connectivity have the database initialized by default
by using a DBInitializationGBean to run an sql script. Alternatively here we describe how
to initialize the database by hand. In a production scenario most likely your db will be set
up by a DBA rather than either of these methods.</p>
<ol>
	<li>Remove the DBInitializationGBean from the sample plan</li>
	<li>In the console DB Manager page, use the Create DB function to create a database
named SampleDatabase.</li>
	<li>In the console DB Manager page select the SampleDatabase in Use DB, paste the script
found in the sql file located in the project (ear or war) that builds the top level javaee
artifact into the text box, and run it.</li>
	<li>Deploy and run the application using the modified plan.</li>
</ol>


<h1><a name="Sampleapplications-MavenGeneratedSiteforviewingjavadocorsourcexref"></a>Maven
Generated Site for viewing javadoc or source xref</h1>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><p>Geronimo Samples 2.2
release did not generate the maven site for javadoc and source xref view. Cause Geronimo site
scheme for 2.2 has some problem.</p></td></tr></table></div>

<p>There is a maven generated site for samples which can be used to view javadoc and
source. It can be found here:</p>

<p><a href="http://geronimo.apache.org/maven/geronimo-samples/2.2" rel="nofollow">Geronimo
Samples 2.2</a></p>

<p>To navigate to javadoc and source code (xref) for each sample do the following:</p>
<ol>
	<li>select "Geronimo Samples :: Samples" under Modules in the left-hand navigation</li>
	<li>select a specific sample from the left-hand navigation under Modules</li>
	<li>to view javadoc or source (xref) you must navigate down to a module that includes
source such as a war or ejb.  For example, if you are interested in viewing the servlets associated
with the bank sample you would choose the following modules:
	<ol>
		<li>under Modules select "Geronimo Samples :: bank"</li>
		<li>under Modules select "Geronimo Samples :: bank :: WAR"</li>
	</ol>
	</li>
	<li>once you are at a module that contains source you can then select "Project Reports"
and from the information provided choose either JavaDocs or Source Xref.</li>
</ol>


<h1><a name="Sampleapplications-AvailableSampleApplications"></a>Available
Sample Applications</h1>
<ul><li><a href="/confluence/display/GMOxDOC22/app-per-port+-+Running+multiple+web+apps+on+different+ports"
title="app-per-port - Running multiple web apps on different ports">app-per-port - Running
multiple web apps on different ports</a></li><li><a href="/confluence/display/GMOxDOC22/bank+-+EJB+sample+application"
title="bank - EJB sample application">bank - EJB sample application</a></li><li><a
href="/confluence/display/GMOxDOC22/calculator-+Using+EJB+3.0+Functions" title="calculator-
Using EJB 3.0 Functions">calculator- Using EJB 3.0 Functions</a></li><li><a
href="/confluence/display/GMOxDOC22/csa-activemq+-+A+demo+to+assembly+a+server+using+car-maven-plugin"
title="csa-activemq - A demo to assembly a server using car-maven-plugin">csa-activemq
- A demo to assembly a server using car-maven-plugin</a></li><li><a href="/confluence/display/GMOxDOC22/Customer+Simple+ejb+application+with+a+JPA+entity"
title="Customer Simple ejb application with a JPA entity">Customer Simple ejb application
with a JPA entity</a></li><li><a href="/confluence/display/GMOxDOC22/daytrader+-+a+more+complex+application"
title="daytrader - a more complex application">daytrader - a more complex application</a></li><li><a
href="/confluence/display/GMOxDOC22/dbtester+-+DB+Pool+Testing+sample+application" title="dbtester
- DB Pool Testing sample application">dbtester - DB Pool Testing sample application</a></li><li><a
href="/confluence/display/GMOxDOC22/inventory+-+Simple+Database+Access+Application" title="inventory
- Simple Database Access Application">inventory - Simple Database Access Application</a></li><li><a
href="/confluence/display/GMOxDOC22/jaxws-calculator+-+Simple+Web+Service+with+JAX-WS" title="jaxws-calculator
- Simple Web Service with JAX-WS">jaxws-calculator - Simple Web Service with JAX-WS</a></li><li><a
href="/confluence/display/GMOxDOC22/jms-mdb+-+JMS+and+MDB+Sample+Application" title="jms-mdb
- JMS and MDB Sample Application">jms-mdb - JMS and MDB Sample Application</a></li><li><a
href="/confluence/display/GMOxDOC22/ldap-sample-app+-+LDAP+Sample+Application" title="ldap-sample-app
- LDAP Sample Application">ldap-sample-app - LDAP Sample Application</a></li><li><a
href="/confluence/display/GMOxDOC22/myphonebook+-+Very+Simple+Entity+EJB+Example" title="myphonebook
- Very Simple Entity EJB Example">myphonebook - Very Simple Entity EJB Example</a></li><li><a
href="/confluence/display/GMOxDOC22/mytime+-+Very+Simple+Session+EJB+Example" title="mytime
- Very Simple Session EJB Example">mytime - Very Simple Session EJB Example</a></li><li><a
href="/confluence/display/GMOxDOC22/not-in-svn+-+Inbound+JCA+example" title="not-in-svn -
Inbound JCA example">not-in-svn - Inbound JCA example</a></li><li><a
href="/confluence/display/GMOxDOC22/sendmail+-+Using+Geronimo%27s+Default+JavaMail+Session"
title="sendmail - Using Geronimo's Default JavaMail Session">sendmail - Using Geronimo's
Default JavaMail Session</a></li><li><a href="/confluence/display/GMOxDOC22/timereport+-+Web+Application+Security+Sample"
title="timereport - Web Application Security Sample">timereport - Web Application Security
Sample</a></li></ul>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/GMOxDOC22/Sample+applications">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=93276&revisedVersion=28&originalVersion=27">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/GMOxDOC22/Sample+applications?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message