Creating an application with dm Server

GreenPages: a demonstration

Christopher Frost

Ben Hale

Rob Harrop

Glyn Normington

Steve Powell

Andy Wilkinson

dm Server



Spring application programmers are introduced to SpringSource® dm Server™ by installing dm Server and developing a small application called GreenPages. 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.

Copyright 2009, SpringSource.

Licensed Under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License.

You may obtain a copy of the License at .

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Trademarks. SpringSource and dm Server are trademarks or registered trademarks of SpringSource, Inc.

Java, Sun, and Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.

OSGi is a trademark or a registered trademark of the OSGi Alliance in the United States, other countries, or both.

Eclipse is a trademark of Eclipse Foundation, Inc.

UNIX is a registered trademark of The Open Group.

Windows is a registered trademark of Microsoft Corporation in the United States and other countries.

Mac and Mac OS are trademarks of Apple Inc., registered in the U.S. and other countries.

Table of Contents

1. Concepts
1.1. OSGi concepts
1.2. Spring DM concepts
1.3. dm Server concepts
2. Installation
2.1. Pre-requisites
2.2. Installing dm Server
2.3. Installing Eclipse
2.4. Installing dm Server Tools
2.5. Installing Q for Eclipse
2.6. Installing Apache Maven
3. Installing GreenPages
3.1. Introduction
3.2. Obtaining GreenPages
3.3. Building and installing GreenPages
3.4. Browsing the GreenPages application
3.5. Running GreenPages from Eclipse
4. The Web Module
4.1. Introduction
4.2. GreenPages set up
4.3. Creating a controller
4.4. Deploying a bundle
4.5. Creating a PAR
4.6. Referencing an OSGi Service
4.7. Publishing an OSGi Service
5. The Middle Tier
5.1. Introduction
5.2. Creating the DataSource project
5.3. Building the JPA module
5.4. Trying out the JPA middle tier
5.5. Applying best practices to the middle tier
6. Testing Greenpages
6.1. Introduction
6.2. Single bundle integration testing
6.3. Contributing OSGi sourced dependencies
6.4. Multi bundle integration testing
7. Automated Build
7.1. Introduction
7.2. Setting up for Automated Build
7.3. Create POM
7.4. Adding the par plugin
7.5. Adding the dependency plugin
7.6. Deploying the application
A. Further Resources
A.1. Projects
A.2. Documentation