Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgreenpages/db/data.bat5
-rwxr-xr-xgreenpages/db/data.sh4
-rwxr-xr-xgreenpages/db/h2.bat9
-rwxr-xr-xgreenpages/db/h2.sh13
-rwxr-xr-xgreenpages/db/run.bat5
-rwxr-xr-xgreenpages/db/run.sh5
-rw-r--r--greenpages/greenpages.core/src/main/resources/META-INF/spring/osgi-context.xml4
-rw-r--r--greenpages/greenpages.db/pom.xml78
-rw-r--r--greenpages/greenpages.db/src/main/resources/META-INF/MANIFEST.MF11
-rw-r--r--greenpages/greenpages.db/src/main/resources/META-INF/spring/module-context.xml12
-rw-r--r--greenpages/greenpages.db/src/main/resources/META-INF/spring/osgi-context.xml10
-rw-r--r--greenpages/greenpages.jpa/pom.xml132
-rw-r--r--greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaDirectory.java52
-rw-r--r--greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaListing.java61
-rw-r--r--greenpages/greenpages.jpa/src/main/resources/META-INF/orm.xml25
-rw-r--r--greenpages/greenpages.jpa/src/main/resources/META-INF/persistence.xml10
-rw-r--r--greenpages/greenpages.jpa/src/main/resources/META-INF/spring/module-context.xml65
-rw-r--r--greenpages/greenpages.jpa/src/main/resources/META-INF/spring/osgi-context.xml16
-rw-r--r--greenpages/greenpages.jpa/src/test/java/greenpages/jpa/JpaDirectorySpringContextTests.java47
-rw-r--r--greenpages/greenpages.jpa/src/test/java/greenpages/jpa/TestDataPopulator.java96
-rw-r--r--greenpages/greenpages.jpa/src/test/resources/META-INF/spring/test-context.xml17
-rw-r--r--greenpages/greenpages.par/META-INF/MANIFEST.MF5
-rw-r--r--greenpages/greenpages.par/com.springsource.org.h2-1.0.71.jarbin1060309 -> 0 bytes
-rw-r--r--greenpages/greenpages.par/pom.xml122
-rw-r--r--greenpages/greenpages.par/src/main/resources/.gitignore0
-rw-r--r--greenpages/greenpages.web/pom.xml14
-rw-r--r--greenpages/greenpages.web/src/main/java/greenpages/web/GreenPagesController.java15
-rw-r--r--greenpages/greenpages.web/src/main/webapp/WEB-INF/applicationContext.xml3
-rw-r--r--greenpages/greenpages.web/src/main/webapp/WEB-INF/web.xml4
-rw-r--r--greenpages/pom.xml3
30 files changed, 14 insertions, 829 deletions
diff --git a/greenpages/db/data.bat b/greenpages/db/data.bat
deleted file mode 100755
index 69b814f..0000000
--- a/greenpages/db/data.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@echo off
-setlocal
-
-call h2
-java -cp "%H2CP%" org.h2.tools.RunScript -url jdbc:h2:tcp://localhost/~/greenpages-db/greenpages -user greenpages -password pass -script db.sql \ No newline at end of file
diff --git a/greenpages/db/data.sh b/greenpages/db/data.sh
deleted file mode 100755
index 7744e9d..0000000
--- a/greenpages/db/data.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-. ./h2.sh
-
-java -cp $CLASSPATH org.h2.tools.RunScript -url jdbc:h2:tcp://localhost/~/greenpages-db/greenpages -user greenpages -password pass -script ./db.sql
diff --git a/greenpages/db/h2.bat b/greenpages/db/h2.bat
deleted file mode 100755
index 1ba3fc3..0000000
--- a/greenpages/db/h2.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-for /r "%HOMEDRIVE%%HOMEPATH%\.m2" %%X in (*h2*.jar) do (set H2CP=%H2CP%;%%X)
-
-if "%H2CP%" == "" (goto h2NotFound) else goto end
-
-:h2NotFound
-echo Cannot find H2 jars in .m2 Maven repository
-exit /b -1s
-
-:end
diff --git a/greenpages/db/h2.sh b/greenpages/db/h2.sh
deleted file mode 100755
index e83c106..0000000
--- a/greenpages/db/h2.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-JARS=`find $HOME/.m2 -iname "com.springsource.org.h2*"`
-
-for JAR in $JARS
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-if [ -z $CLASSPATH ]
-then
- echo "Cannot find H2 jars in .m2 Maven repository"
- exit -1
-fi \ No newline at end of file
diff --git a/greenpages/db/run.bat b/greenpages/db/run.bat
deleted file mode 100755
index 57a0394..0000000
--- a/greenpages/db/run.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@echo off
-setlocal
-
-call h2
-start java -cp "%H2CP%" org.h2.tools.Server \ No newline at end of file
diff --git a/greenpages/db/run.sh b/greenpages/db/run.sh
deleted file mode 100755
index c3403e4..0000000
--- a/greenpages/db/run.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-. ./h2.sh
-
-java -cp $CLASSPATH org.h2.tools.Server
-
diff --git a/greenpages/greenpages.core/src/main/resources/META-INF/spring/osgi-context.xml b/greenpages/greenpages.core/src/main/resources/META-INF/spring/osgi-context.xml
index 0dab573..21a0a13 100644
--- a/greenpages/greenpages.core/src/main/resources/META-INF/spring/osgi-context.xml
+++ b/greenpages/greenpages.core/src/main/resources/META-INF/spring/osgi-context.xml
@@ -5,8 +5,6 @@
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"
xmlns:osgi="http://www.springframework.org/schema/osgi">
- <!-- uncomment the line below to publish the mock Directory into the OSGi service registry -->
-
- <!-- <osgi:service interface="greenpages.Directory" ref="directory"/> -->
+ <osgi:service interface="greenpages.Directory" ref="directory"/>
</beans>
diff --git a/greenpages/greenpages.db/pom.xml b/greenpages/greenpages.db/pom.xml
deleted file mode 100644
index 3d993e9..0000000
--- a/greenpages/greenpages.db/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.parent</artifactId>
- <version>3.0.0.RELEASE</version>
- <relativePath>../greenpages.parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>greenpages.db</artifactId>
- <name>GreenPages DataSource</name>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <includes>
- <include>META-INF/spring/*</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Bundle>
- com.springsource.org.eclipse.persistence.jpa;version="[2, 3)"
- </Import-Bundle>
- <Import-Package>
- org.h2;version="[1.0.71,2)",
- *
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>com.springsource.javax.persistence</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.spring-library</artifactId>
- <type>libd</type>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>com.springsource.org.eclipse.persistence</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>com.springsource.org.eclipse.persistence.jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.dbcp</artifactId>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>com.springsource.org.h2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>com.springsource.org.aspectj.weaver</artifactId>
- </dependency>
- </dependencies>
-
-</project> \ No newline at end of file
diff --git a/greenpages/greenpages.db/src/main/resources/META-INF/MANIFEST.MF b/greenpages/greenpages.db/src/main/resources/META-INF/MANIFEST.MF
deleted file mode 100644
index 698edc1..0000000
--- a/greenpages/greenpages.db/src/main/resources/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,11 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Vendor: SpringSource
-Bundle-Classpath: .
-Bundle-Version: 3.0.0
-Tool: Bundlor 1.1.2.RELEASE
-Bundle-Name: GreenPages DataSource
-Bundle-ManifestVersion: 2
-Import-Package: javax.sql;version="0",org.apache.commons.dbcp;version=
- "[1.2.2.osgi, 1.2.2.osgi]",org.h2;version="[1.0.71, 1.0.71]"
-Bundle-SymbolicName: greenpages.db
-
diff --git a/greenpages/greenpages.db/src/main/resources/META-INF/spring/module-context.xml b/greenpages/greenpages.db/src/main/resources/META-INF/spring/module-context.xml
deleted file mode 100644
index 5337e8a..0000000
--- a/greenpages/greenpages.db/src/main/resources/META-INF/spring/module-context.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
- xmlns:p="http://www.springframework.org/schema/p">
-
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
- p:driverClassName="org.h2.Driver" p:url="jdbc:h2:~/greenpages-db/greenpages"
- p:username="greenpages" p:password="pass"
- init-method="createDataSource" destroy-method="close"/>
-
-</beans>
diff --git a/greenpages/greenpages.db/src/main/resources/META-INF/spring/osgi-context.xml b/greenpages/greenpages.db/src/main/resources/META-INF/spring/osgi-context.xml
deleted file mode 100644
index 92962cd..0000000
--- a/greenpages/greenpages.db/src/main/resources/META-INF/spring/osgi-context.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"
- xmlns:osgi="http://www.springframework.org/schema/osgi">
-
- <osgi:service ref="dataSource" interface="javax.sql.DataSource"/>
-
-</beans>
diff --git a/greenpages/greenpages.jpa/pom.xml b/greenpages/greenpages.jpa/pom.xml
deleted file mode 100644
index 1340dbb..0000000
--- a/greenpages/greenpages.jpa/pom.xml
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.parent</artifactId>
- <version>3.0.0.RELEASE</version>
- <relativePath>../greenpages.parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>greenpages.jpa</artifactId>
- <name>GreenPages JPA</name>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <includes>
- <include>META-INF/spring/*</include>
- <include>META-INF/*</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Bundle>
- com.springsource.org.eclipse.persistence;version="[2.0.0,
- 2.1.0)",
- com.springsource.org.eclipse.persistence.jpa;version="[2.0.0,
- 2.1.0)"
- </Import-Bundle>
- <Import-Package>
- org.springframework.context.weaving;version="[3,
- 4)",
- org.springframework.transaction.aspectj;version="[3.0, 3.5)",
- javax.persistence.criteria;version="[2, 2.1)",
- javax.persistence;version="[2, 2.1)",
- javax.sql;version="0",
- *
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.spring-library</artifactId>
- <type>libd</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0.2</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>javax.persistence</artifactId>
- <version>2.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>com.springsource.org.eclipse.persistence.internal.libraries.antlr</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>com.springsource.org.eclipse.persistence</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>com.springsource.org.eclipse.persistence.jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.junit</groupId>
- <artifactId>com.springsource.org.junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.instrument</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.aspects</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.dbcp</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>com.springsource.org.apache.commons.logging</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>com.springsource.org.h2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>com.springsource.org.aspectj.weaver</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaDirectory.java b/greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaDirectory.java
deleted file mode 100644
index c51200d..0000000
--- a/greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaDirectory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package greenpages.jpa;
-
-import greenpages.Directory;
-import greenpages.Listing;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Implementation of {@link Directory} that uses JPA for persistence.<p />
- *
- * This class is marked as {@link Transactional}. The Spring configuration for this module, enables AspectJ weaving for
- * adding transaction demarcation to classes annotated with <code>@Transactional</code>.
- */
-@Transactional
-@Repository
-final class JpaDirectory implements Directory {
-
- private static final String SEARCH_QUERY = "select l from Listing l where upper(l.lastName) like :term";
-
- /**
- * Spring will inject a managed JPA {@link EntityManager} into this field.
- */
- @PersistenceContext
- private EntityManager em;
-
- public Listing findListing(int id) {
- return em.find(JpaListing.class, id);
- }
-
- @SuppressWarnings("unchecked")
- public List<Listing> search(String term) {
- return em.createQuery(SEARCH_QUERY).setParameter("term", "%" + term.toUpperCase() + "%").getResultList();
- }
-
-}
diff --git a/greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaListing.java b/greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaListing.java
deleted file mode 100644
index 1965495..0000000
--- a/greenpages/greenpages.jpa/src/main/java/greenpages/jpa/JpaListing.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package greenpages.jpa;
-
-import greenpages.Listing;
-
-/**
- * Basic implementation of {@link Listing} that is configured as a persistent type in JPA.
- */
-public class JpaListing implements Listing {
-
- private Integer listingNumber;
-
- private String firstName;
-
- private String lastName;
-
- private String emailAddress;
-
- public Integer getListingNumber() {
- return listingNumber;
- }
-
- public void setListingNumber(Integer listingNumber) {
- this.listingNumber = listingNumber;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
-}
diff --git a/greenpages/greenpages.jpa/src/main/resources/META-INF/orm.xml b/greenpages/greenpages.jpa/src/main/resources/META-INF/orm.xml
deleted file mode 100644
index 66352f0..0000000
--- a/greenpages/greenpages.jpa/src/main/resources/META-INF/orm.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
- version="1.0">
- <package>greenpages.jpa</package>
- <entity class="greenpages.jpa.JpaListing" name="Listing">
- <table name="LISTING"/>
- <attributes>
- <id name="listingNumber">
- <column name="LISTING_NUMBER"/>
- <generated-value strategy="TABLE"/>
- </id>
- <basic name="firstName">
- <column name="FIRST_NAME"/>
- </basic>
- <basic name="lastName">
- <column name="LAST_NAME"/>
- </basic>
- <basic name="emailAddress">
- <column name="EMAIL_ADDRESS"/>
- </basic>
- </attributes>
- </entity>
-</entity-mappings> \ No newline at end of file
diff --git a/greenpages/greenpages.jpa/src/main/resources/META-INF/persistence.xml b/greenpages/greenpages.jpa/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index df42af5..0000000
--- a/greenpages/greenpages.jpa/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
- version="1.0">
-
- <persistence-unit name="GreenPages" transaction-type="RESOURCE_LOCAL">
- <class>greenpages.jpa.JpaListing</class>
- </persistence-unit>
-
-</persistence>
diff --git a/greenpages/greenpages.jpa/src/main/resources/META-INF/spring/module-context.xml b/greenpages/greenpages.jpa/src/main/resources/META-INF/spring/module-context.xml
deleted file mode 100644
index 3fc3b2a..0000000
--- a/greenpages/greenpages.jpa/src/main/resources/META-INF/spring/module-context.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Application context definition for GreenPages JPA.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
-
- <!-- ========================= RESOURCE DEFINITIONS ========================= -->
-
- <!--
- Activates a load-time weaver for the context. Any bean within the context that
- implements LoadTimeWeaverAware (such as LocalContainerEntityManagerFactoryBean)
- will receive a reference to the autodetected load-time weaver.
- -->
- <context:load-time-weaver aspectj-weaving="on"/>
-
- <!-- JPA EntityManagerFactory -->
- <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:dataSource-ref="dataSource">
- <property name="jpaVendorAdapter">
- <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter"
- p:databasePlatform="org.eclipse.persistence.platform.database.HSQLPlatform" p:showSql="true"/>
- </property>
- </bean>
-
- <!-- Transaction manager for a single JPA EntityManagerFactory (alternative to JTA) -->
- <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
- p:entityManagerFactory-ref="entityManagerFactory"/>
-
-
- <!-- ========================= BUSINESS OBJECT DEFINITIONS ========================= -->
-
- <!--
- Activates various annotations to be detected in bean classes: Spring's
- @Required and @Autowired, as well as JSR 250's @PostConstruct,
- @PreDestroy and @Resource (if available) and JPA's @PersistenceContext
- and @PersistenceUnit (if available).
- -->
- <context:annotation-config/>
-
- <!--
- Instruct Spring to perform declarative transaction management
- automatically on annotated classes.
- -->
- <tx:annotation-driven mode="aspectj"/>
-
- <!--
- Post-processor to perform exception translation on @Repository classes (from native
- exceptions such as JPA PersistenceExceptions to Spring's DataAccessException hierarchy).
- -->
- <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
-
- <!--
- Will automatically be transactional due to @Transactional.
- EntityManager will be auto-injected due to @PersistenceContext.
- PersistenceExceptions will be auto-translated due to @Repository.
- -->
- <bean id="directory" class="greenpages.jpa.JpaDirectory"/>
-
-</beans>
diff --git a/greenpages/greenpages.jpa/src/main/resources/META-INF/spring/osgi-context.xml b/greenpages/greenpages.jpa/src/main/resources/META-INF/spring/osgi-context.xml
deleted file mode 100644
index c527d76..0000000
--- a/greenpages/greenpages.jpa/src/main/resources/META-INF/spring/osgi-context.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"
- xmlns:osgi="http://www.springframework.org/schema/osgi">
-
- <!-- import the DataSource from OSGi -->
- <osgi:reference id="dataSource" interface="javax.sql.DataSource"/>
-
-
- <!-- export the directory bean to OSGi under the Directory interface -->
- <osgi:service ref="directory" interface="greenpages.Directory"/>
-
-
-</beans>
diff --git a/greenpages/greenpages.jpa/src/test/java/greenpages/jpa/JpaDirectorySpringContextTests.java b/greenpages/greenpages.jpa/src/test/java/greenpages/jpa/JpaDirectorySpringContextTests.java
deleted file mode 100644
index 7ecd706..0000000
--- a/greenpages/greenpages.jpa/src/test/java/greenpages/jpa/JpaDirectorySpringContextTests.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package greenpages.jpa;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import greenpages.Directory;
-import greenpages.Listing;
-
-import java.util.List;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.TestExecutionListeners;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = { "classpath:/META-INF/spring/module-context.xml", "classpath:/META-INF/spring/test-context.xml" })
-@TestExecutionListeners(value = DependencyInjectionTestExecutionListener.class)
-public class JpaDirectorySpringContextTests {
-
- @Autowired
- private Directory directory;
-
- @Test
- public void search() {
- List<Listing> results = this.directory.search("johnson");
- assertNotNull(results);
- assertEquals(1, results.size());
-
- Listing listing = results.get(0);
- assertNotNull(listing);
- assertEquals("Johnson", listing.getLastName());
- }
-}
diff --git a/greenpages/greenpages.jpa/src/test/java/greenpages/jpa/TestDataPopulator.java b/greenpages/greenpages.jpa/src/test/java/greenpages/jpa/TestDataPopulator.java
deleted file mode 100644
index 24f779b..0000000
--- a/greenpages/greenpages.jpa/src/test/java/greenpages/jpa/TestDataPopulator.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package greenpages.jpa;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import javax.sql.DataSource;
-
-import org.springframework.core.io.Resource;
-
-/**
- * A class that populates a datasource with test data
- */
-public class TestDataPopulator {
-
- private final DataSource dataSource;
-
- private final Resource testDataLocation;
-
- public TestDataPopulator(DataSource dataSource, Resource testDataLocation) {
- this.dataSource = dataSource;
- this.testDataLocation = testDataLocation;
- }
-
- public void populate() {
- Connection connection = null;
- try {
- connection = dataSource.getConnection();
- insertTestData(connection);
- } catch (SQLException e) {
- throw new RuntimeException("SQL exception occurred acquiring connection", e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- }
- }
- }
- }
-
- private void insertTestData(Connection connection) {
- try {
- String sql = parseSqlIn(testDataLocation);
- executeSql(sql, connection);
- } catch (IOException e) {
- throw new RuntimeException("I/O exception occurred accessing the test data file", e);
- } catch (SQLException e) {
- throw new RuntimeException("SQL exception occurred loading test data", e);
- }
- }
-
- private String parseSqlIn(Resource resource) throws IOException {
- InputStream is = null;
- try {
- is = resource.getInputStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-
- StringWriter sw = new StringWriter();
- BufferedWriter writer = new BufferedWriter(sw);
-
- for (int c = reader.read(); c != -1; c = reader.read()) {
- writer.write(c);
- }
- writer.flush();
- return sw.toString();
-
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- private void executeSql(String sql, Connection connection) throws SQLException {
- Statement statement = connection.createStatement();
- statement.execute(sql);
- }
-}
diff --git a/greenpages/greenpages.jpa/src/test/resources/META-INF/spring/test-context.xml b/greenpages/greenpages.jpa/src/test/resources/META-INF/spring/test-context.xml
deleted file mode 100644
index bc0e415..0000000
--- a/greenpages/greenpages.jpa/src/test/resources/META-INF/spring/test-context.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
- p:driverClassName="org.h2.Driver" p:url="jdbc:h2:.~/greenpages-db/greenpages"
- p:username="greenpages" p:password="pass"
- init-method="createDataSource" destroy-method="close"/>
-
- <bean class="greenpages.jpa.TestDataPopulator" init-method="populate">
- <constructor-arg ref="dataSource"/>
- <constructor-arg value="file:../db/db.sql"/>
- </bean>
-
-</beans>
diff --git a/greenpages/greenpages.par/META-INF/MANIFEST.MF b/greenpages/greenpages.par/META-INF/MANIFEST.MF
deleted file mode 100644
index db1a5d7..0000000
--- a/greenpages/greenpages.par/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Application-SymbolicName: greenpages
-Application-Version: 3.0.0.RELEASE
-Application-Name: Greenpages PAR
-
diff --git a/greenpages/greenpages.par/com.springsource.org.h2-1.0.71.jar b/greenpages/greenpages.par/com.springsource.org.h2-1.0.71.jar
deleted file mode 100644
index 41dc982..0000000
--- a/greenpages/greenpages.par/com.springsource.org.h2-1.0.71.jar
+++ /dev/null
Binary files differ
diff --git a/greenpages/greenpages.par/pom.xml b/greenpages/greenpages.par/pom.xml
deleted file mode 100644
index 86780a2..0000000
--- a/greenpages/greenpages.par/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.parent</artifactId>
- <version>3.0.0.RELEASE</version>
- <relativePath>../greenpages.parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>greenpages.par</artifactId>
- <name>greenpages.par</name>
- <description>GreenPages PAR</description>
- <packaging>par</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.jpa</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.db</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.web</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- Needs to be included in the PAR so that its classes are loadable via the PAR's synthetic context class loader -->
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>com.springsource.org.h2</artifactId>
- </dependency>
- <!-- Required for the web bundle as dependencies are not propagated up from war build types -->
- <dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>com.springsource.freemarker</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-par-plugin</artifactId>
- <version>1.0.0.RELEASE</version>
- <configuration>
- <applicationSymbolicName>greenpages</applicationSymbolicName>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <configuration>
- <outputDirectory>${project.build.directory}/par-provided</outputDirectory>
- <overWriteIfNewer>true</overWriteIfNewer>
- <excludeGroupIds>org.eclipse.virgo,org.apache.log4j,com.h2database</excludeGroupIds>
- </configuration>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.apache.maven.plugins
- </groupId>
- <artifactId>
- maven-dependency-plugin
- </artifactId>
- <versionRange>
- [2.1,)
- </versionRange>
- <goals>
- <goal>
- copy-dependencies
- </goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
-</project>
diff --git a/greenpages/greenpages.par/src/main/resources/.gitignore b/greenpages/greenpages.par/src/main/resources/.gitignore
deleted file mode 100644
index e69de29..0000000
--- a/greenpages/greenpages.par/src/main/resources/.gitignore
+++ /dev/null
diff --git a/greenpages/greenpages.web/pom.xml b/greenpages/greenpages.web/pom.xml
index 890dc5d..aedc803 100644
--- a/greenpages/greenpages.web/pom.xml
+++ b/greenpages/greenpages.web/pom.xml
@@ -41,14 +41,12 @@
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
- <Web-ContextPath>greenpages</Web-ContextPath>
+ <!-- TODO 1.0 Add Web-ContextPath greenpages
+ <Web-ContextPath></Web-ContextPath>
+ -->
<Import-Library>
org.springframework.spring;version="[3.1, 3.5)"
</Import-Library>
- <Import-Bundle>
- com.springsource.org.eclipse.persistence;version="[2.0.0, 2.1.0)",
- com.springsource.org.eclipse.persistence.jpa;version="[2.0.0, 2.1.0)"
- </Import-Bundle>
<Import-Package>
javax.servlet.jsp.jstl.core;version="[1.2.0, 2)",
javax.servlet;version="[3.0.0, 3.1)",
@@ -95,12 +93,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.virgo</groupId>
- <artifactId>greenpages.jpa</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.junit</groupId>
<artifactId>com.springsource.org.junit</artifactId>
<scope>test</scope>
diff --git a/greenpages/greenpages.web/src/main/java/greenpages/web/GreenPagesController.java b/greenpages/greenpages.web/src/main/java/greenpages/web/GreenPagesController.java
index 56463fc..296f782 100644
--- a/greenpages/greenpages.web/src/main/java/greenpages/web/GreenPagesController.java
+++ b/greenpages/greenpages.web/src/main/java/greenpages/web/GreenPagesController.java
@@ -14,9 +14,9 @@ package greenpages.web;
import greenpages.Directory;
import greenpages.Listing;
+import java.util.Collections;
import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -33,25 +33,22 @@ import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class GreenPagesController {
- /**
- * This field is injected automatically by Spring. For this injection to be satisfied, the greenpages.web module
- * must either declare a bean of type {@link Directory} or it must import a <code>Directory</code> from OSGi.
- */
- @Autowired
+ // TODO 1.4 @Autowired directory
private Directory directory;
-
@RequestMapping("/home.htm")
public void home() {
}
@RequestMapping("/search.htm")
public List<Listing> search(@RequestParam("query") String query) {
- return this.directory.search(query);
+ // TODO 1.5 Implement web endpoint
+ return Collections.emptyList();
}
@RequestMapping("/entry.htm")
public Listing entry(@RequestParam("id") int id) {
- return this.directory.findListing(id);
+ // TODO 1.5 Implement web endpoint
+ throw new UnsupportedOperationException();
}
}
diff --git a/greenpages/greenpages.web/src/main/webapp/WEB-INF/applicationContext.xml b/greenpages/greenpages.web/src/main/webapp/WEB-INF/applicationContext.xml
index 36b743e..a739f96 100644
--- a/greenpages/greenpages.web/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/greenpages/greenpages.web/src/main/webapp/WEB-INF/applicationContext.xml
@@ -7,7 +7,6 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <!-- import a service from OSGi implementing the Directory interface and make available as a bean called directory -->
- <osgi:reference id="directory" interface="greenpages.Directory" />
+ <!-- TODO 1.3 Import OSGi service and publish as "directory" bean -->
</beans>
diff --git a/greenpages/greenpages.web/src/main/webapp/WEB-INF/web.xml b/greenpages/greenpages.web/src/main/webapp/WEB-INF/web.xml
index f5a6641..da38c1c 100644
--- a/greenpages/greenpages.web/src/main/webapp/WEB-INF/web.xml
+++ b/greenpages/greenpages.web/src/main/webapp/WEB-INF/web.xml
@@ -13,6 +13,8 @@
<!-- CONFIGURE A PARENT APPLICATION CONTEXT -->
+ <!-- TODO 1.0 Set OSGi aware contextClass and add ContextLoaderListener -->
+ <!--
<context-param>
<param-name>contextClass</param-name>
<param-value>org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext</param-value>
@@ -21,7 +23,7 @@
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
-
+ -->
<!-- DISPATCHER SERVLET CONFIG -->
<servlet>
diff --git a/greenpages/pom.xml b/greenpages/pom.xml
index ec58208..3048cb0 100644
--- a/greenpages/pom.xml
+++ b/greenpages/pom.xml
@@ -12,10 +12,7 @@
<packaging>pom</packaging>
<modules>
<module>greenpages.parent</module>
- <module>greenpages.db</module>
<module>greenpages.core</module>
- <module>greenpages.jpa</module>
<module>greenpages.web</module>
- <module>greenpages.par</module>
</modules>
</project>

Back to the top