Greenpages Demo for Eclipse Virgo
Java Groovy Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
etc
greenpages-assembly
greenpages.bundles
greenpages.test
src/site
.gitignore
README.md
pom.xml

README.md

Eclipse Virgo GreenPages Demo

This Repository: https://github.com/gordonad/greenpages

This project is a Spring Maven project demonstrating OSGi application configuration for deployment on Eclipse Virgo.

Changes

  • 26-Apr-12

    • Properties externalized for database connection - see solution/etc/properties directory
    • Created plan file for deployment - see solution/etc/plan directory
    • Refactored directory greenpages.app to greenpages.services
  • greenpages-parent-solution pom.xml

  • Spring version 3.0.7 and surefire plugin to use corresponding spring instrument version

  • Dependencies versions specified in dependencyManagement section

  • Fixed Bundlor configuration

  • Corrected inconsistencies between template.mf files

  • Builds in Maven 3

  • Tested in Virgo 3.0.2.RELEASE

  • Does not work in 3.5.0.M3 - unable to find database driver!

TODO

  • Update to Spring 3.1.1
  • Update slf4j to 1.6.4
  • Update logback to 1.0.0
  • Provide DB connection for MySQL/MariaDB
  • JPA 2.0.0
  • EclipseLink 2.0.0(?)
  • Maven Deploy to $VWS_HOME/pickup directory

Project Layout

  • parent - Top level of Maven project
  • web - Web Application
  • jpa - Persistence Bundle
  • db - Database Configuration
  • services - application services
  • greenpages - PAR creation

Structure

  • greenpages-app-build (pom w/ modules)
    • -> parent (pom)
    • -> greenpages.db (jar)
    • -> greenpages.services (jar)
    • -> greenpages.jpa (jar)
    • -> greenpages.web (war)
    • -> greenpages (par)

Unidirectional from child to parent (greenpages)

  • greenpages (parent no modules)
    • -> greenpages-parent
    • -> greenpages-web
    • -> greenpages-jpa
    • -> greenpages-db
    • -> greenpages-services

Virgo Version Configuration

  • Virgo Dependencies

    • Created Spring 3.0.7 libd file
    • Added instrument jar to libd file (not sure if necessary)
    • Replaced Spring 3.0.5 jars with 3.0.7 in $VWS_HOME/repository/ext
  • Virgo Files

    • $VWS_HOME/configuration/org.eclipse.virgo.kernel.userregion.properties

Application Version Configuration

  • When changing dependencies, ONLY change the template.mf file, Maven Bundlor plugin will automatically generate the correct MANIFEST.MF file
  • Updating Application version should be done in all pom.xml and template.mf files

H2 Database

  • Database Location: $USER_HOME/greenpages-db/greenpages
  • Driver JAR: - $USER_HOME/.m2/repository/com/h2database/com.springsource.org.h2/1.0.71/com.springsource.org.h2-1.0.71.jar
  • Driver URL: - jdbc:h2:~/greenpages-db/greenpages
  • Port: 9092
  • Userid: greenpages
  • Password: pass
  • Driver Classname: org.h2.Driver

Versions

  • Spring: 3.1.1
  • EclipseLink: 2.4.0.RC2
  • Logback 1.0.6
  • SLF4j 1.6.6
  • JUnit: 4.10.0
  • JPA: 2.0.0

Installation

From solution directory execute:

$ mvn clean package

Deploy:

  1. Copy services, db, jpa and web jar/war files (declared in the plan file) to $VWS_HOME/repository/usr directory
  2. Copy *.property files from etc/properties directory to $VWS_HOME/repository/usr directory
  3. Copy etc/plans/greenpages.solution.plan to $VWS_HOME/pickup directory

Deploy (old):

  1. Copy the solution/target/greenpages*.par to $VWS_HOME/pickup directory
  2. Copy the solution/target/par-provided/*.jar to $VWS_HOME/repository/usr directory

Manifest Creation

Bundlor

  • Virgo's Bundlor uses the template.mf file to create the manifest in target/classes/META-INF/MANIFEST.MF
  • IMPORTANT - The Maven war configuration MUST reference the generated MANIFEST and ignore the one in src/main/webapp/WEB-INF/
  • Added Bundle-Description to the template.mf and MANIFEST.MF files. Once the packaging is done, the resulting packaged MANIFEST.MF files should be have been generated by the Bundlor.
  • Changed Bundlor to run in the "process-classes" phase to ensure it is done before packaging to avoid inadvertant overwriting by the static MANIFEST.MF file.

Contact Me