Adds initial state of tutorial branch safepoint_02_datasource
diff --git a/greenpages/greenpages.db/pom.xml b/greenpages/greenpages.db/pom.xml
index 3d993e9..dac8577 100644
--- a/greenpages/greenpages.db/pom.xml
+++ b/greenpages/greenpages.db/pom.xml
@@ -30,9 +30,6 @@
<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)",
*
@@ -45,23 +42,11 @@
<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>
diff --git a/greenpages/greenpages.db/src/main/java/greenpages/db/internal/SqlCommandProvider.java b/greenpages/greenpages.db/src/main/java/greenpages/db/internal/SqlCommandProvider.java
new file mode 100644
index 0000000..bf4171e
--- /dev/null
+++ b/greenpages/greenpages.db/src/main/java/greenpages/db/internal/SqlCommandProvider.java
@@ -0,0 +1,36 @@
+package greenpages.db.internal;
+
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.util.StringUtils;
+
+/**
+ * TODO 2.5 Insert test data via OSGi console
+sql:execute DROP TABLE IF EXISTS LISTING
+
+sql:execute CREATE TABLE LISTING(LISTING_NUMBER INT PRIMARY KEY, FIRST_NAME VARCHAR(255), LAST_NAME VARCHAR(255), EMAIL_ADDRESS VARCHAR(255))
+
+sql:execute INSERT INTO LISTING VALUES(1, \'Markus\', \'Knauer\', \'mknauer@eclipsesource.com\')
+sql:execute INSERT INTO LISTING VALUES(2, \'Johannes\', \'Eickhold\', \'jeick@eclipsesource.com\')
+sql:execute INSERT INTO LISTING VALUES(3, \'Florian\', \'Waibel\', \'fwaibel@eclipsesource.com\')
+
+sql:queryForInt SELECT COUNT(*) FROM LISTING
+ */
+public class SqlCommandProvider {
+
+ private JdbcOperations jdbcTemplate;
+
+ public void setJdbcTemplate(JdbcOperations jdbcTemplate) {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
+ public void execute(String[] args) {
+ String sql = StringUtils.arrayToDelimitedString(args, " ");
+ // TODO 2.3 Implement SQL commands
+ }
+
+ public int queryForInt(String[] args) {
+ String sql = StringUtils.arrayToDelimitedString(args, " ");
+ // TODO 2.3 Implement SQL commands
+ return -1;
+ }
+}
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
index 5337e8a..86508a1 100644
--- 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
@@ -4,9 +4,18 @@
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"/>
+ <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 id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
+ p:dataSource-ref="dataSource" />
+
+ <!-- TODO 2.4 Add OSGi Console Commands
+ <bean id="sqlCommandProvider"
+ class="greenpages.db.internal.SqlCommandProvider"
+ p:jdbcTemplate-ref="jdbcTemplate" />
+ -->
</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
index 92962cd..909c283 100644
--- 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
@@ -4,7 +4,21 @@
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"/>
-
+
+ <!-- TODO 2.1 export spring bean "dataSource" with interface "javax.sql.DataSource" -->
+
+ <!-- TODO 2.2 add OSGi console commands "execute" and "queryForInt"
+ <osgi:service ref="sqlCommandProvider" auto-export="all-classes">
+ <osgi:service-properties>
+ <entry key="osgi.command.scope">
+ <value>sql</value>
+ </entry>
+ <entry key="osgi.command.function">
+ <array value-type="java.lang.String">
+ </array>
+ </entry>
+ </osgi:service-properties>
+ </osgi:service>
+ -->
+
</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..7f5669a 100644
--- a/greenpages/greenpages.web/pom.xml
+++ b/greenpages/greenpages.web/pom.xml
@@ -45,10 +45,6 @@
<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 +91,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/pom.xml b/greenpages/pom.xml
index ec58208..6cac630 100644
--- a/greenpages/pom.xml
+++ b/greenpages/pom.xml
@@ -14,8 +14,6 @@
<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>