GreenPages is a simple application that allows users to search an online email address directory. Each listing in the directory details the relevant email addresses and the name of the owner. GreenPages has only three screens: the search screen, the results screen and the listing detail screen.
In the search screen, users can enter search criteria to be matched against the listings in the directory. The result screen displays any listings that match the criteria entered by the user. The listing detail screen shows all the data known about a given listing.
Despite its simplicity, GreenPages is designed to demonstrate many different dm Server features and to act as a template from which other modular applications can be built. In particular, GreenPages demonstrates:
module dependencies with Import-Package
,
load-time weaving with JPA and AspectJ,
bundle classpath scanning, and
service export, lookup and injection.
In addition to demonstrating common dm Server features, GreenPages demonstrates integration with:
Spring Framework 3.0;
FreeMarker 2.3;
EclipseLink 1.0.0;
H2 1.0.71; and
Commons DBCP 1.2.2.
The GreenPages application is packaged as a PAR file containing four modules.
The greenpages.db
module provides access to an external database and publishes a
javax.sql.DataSource
service.
The greenpages.app
module exports a greenpages
package containing
Directory
and Listing
interfaces.
The greenpages.jpa
module imports the greenpages
package and
uses the javax.sql.DataSource
service to
access the external database and publishes its contents as a greenpages.Directory
service.
The greenpages.web
module imports the greenpages
package and uses the
greenpages.Directory
service to respond to web requests.
This document provides step-by-step instructions for building the GreenPages application with dm Server and the SpringSource Tools Suite. In addition, the complete application is available and can be built and installed into dm Server.
To get the completed GreenPages application and the starter projects to build GreenPages by steps:
download the latest ZIP file from
http://dist.springframework.org/release/DMSS/greenpages-2.0.0.RELEASE.zip
extract all the files from the ZIP file to a convenient directory (preserving the directory structure).
To extract the files on Windows:
mkdir c:\springsource\samples cd c:\springsource\samples jar xf c:\path\to\greenpages-2.0.0.RELEASE.zip set GREENPAGES_HOME=c:\springsource\samples\greenpages-2.0.0.RELEASE
To extract the files on Unix systems:
mkdir -p /opt/springsource/samples cd /opt/springsource/samples unzip /path/to/greenpages-2.0.0.RELEASE.zip export GREENPAGES_HOME=/opt/springsource/samples/greenpages-2.0.0.RELEASE
The environment variable GREENPAGES_HOME
set here is not used by the projects, but is used as a shorthand
in the instructions that follow.
The GreenPages zip file contains two main directories called solution
and start
.
The solution
directory contains the completed application which can be built and tested (as described in the next section).
The start
directory contains the initial skeleton of the GreenPages application upon which the step-by-step
creation instructions build.
To follow the step-by-step instructions read Chapter 4, The Web Module.