<html><head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>5. The Middle Tier</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Creating an application with EclipseRT Virgo Web Server"><link rel="up" href="index.html" title="Creating an application with EclipseRT Virgo Web Server"><link rel="prev" href="ch04s07.html" title="4.7 Publishing an OSGi Service"><link rel="next" href="ch05s02.html" title="5.2 Creating the DataSource project"><!--Begin Google Analytics code--><script type="text/javascript"> | |
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | |
</script><script type="text/javascript"> | |
var pageTracker = _gat._getTracker("UA-2728886-3"); | |
pageTracker._setDomainName("none"); | |
pageTracker._setAllowLinker(true); | |
pageTracker._trackPageview(); | |
</script><!--End Google Analytics code--></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5. The Middle Tier</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s07.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch05s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="middle-tier"></a>5. The Middle Tier</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="middle-tier.introduction"></a>5.1 Introduction</h2></div></div></div><p> | |
GreenPages’ middle-tier provides implementations of the <code class="literal">Directory</code> and <code class="literal">Listing</code> | |
interfaces that can be used by the Web bundle. | |
The implementation will use EclipseLink JPA to access a database via a <code class="literal">DataSource</code> published in the | |
OSGi service registry. | |
</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="middle-tier.introduction.database"></a>The database</h3></div></div></div><p> | |
The GreenPages application uses a very simple database that contains a single table. | |
The table, named <code class="literal">LISTING</code>, consists of four columns: | |
</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 1.0pt solid ; border-bottom: 1.0pt solid ; border-left: 1.0pt solid ; border-right: 1.0pt solid ; "><colgroup><col><col><col><col></colgroup><tbody><tr><td style="border-right: 1.0pt solid ; "><code class="literal">LISTING_NUMBER</code></td><td style="border-right: 1.0pt solid ; "><code class="literal">FIRST_NAME</code></td><td style="border-right: 1.0pt solid ; "><code class="literal">LAST_NAME</code></td><td style=""><code class="literal">EMAIL_ADDRESS</code></td></tr></tbody></table></div><p> | |
Scripts are provided with the sample source code (in <code class="literal">$GREENPAGES_HOME/db</code>) to start, create, and populate the database. | |
These will be used during the creation of the middle tier. | |
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="middle-tier.introduction.jpa"></a>Using JPA</h3></div></div></div><p> | |
The middle tier will provide JPA-based implementations of the <code class="literal">Directory</code> and <code class="literal">Listing</code> interfaces with the four | |
attributes of a <code class="literal">Listing</code> (first name, last name, email address, and id) being mapped to the corresponding columns in the | |
<code class="literal">LISTING</code>. | |
JPA will be used to implement the queries that search the database and return <code class="literal">Listings</code>. | |
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="middle-tier.introduction.structure"></a>Structure</h3></div></div></div><p> | |
The middle tier consists of two bundles, <code class="literal">greenpages.jpa</code> that publishes a <code class="literal">Directory</code> | |
implementation for consumption by the Web bundle, and <code class="literal">greenpages.db</code> to configure and publish the | |
<code class="literal">DataSource</code> used to access the database. | |
</p><div class="mediaobject" align="center"><img src="images/middle-tier/structure.png" align="middle"></div></div></div></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript"> | |
_lf_cid = "LF_48be82fa"; | |
_lf_remora(); | |
</script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s07.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch05s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.7 Publishing an OSGi Service </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 5.2 Creating the DataSource project</td></tr></table></div></body></html> |