Adds initial state of tutorial branch safepoint_03_persistence
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..c6456e9 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,7 @@
 		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"/> --> 
-	                                                                  
+	<!-- TODO 3.1 Deactivate mock -->
+	<osgi:service interface="greenpages.Directory" ref="directory"/>
+  
 </beans>
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..95b8098
--- /dev/null
+++ b/greenpages/greenpages.db/src/main/java/greenpages/db/internal/SqlCommandProvider.java
@@ -0,0 +1,34 @@
+package greenpages.db.internal;
+
+import org.springframework.jdbc.core.JdbcOperations;
+import org.springframework.util.StringUtils;
+
+/**
+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, " ");
+		this.jdbcTemplate.execute(sql);
+	}
+
+	public int queryForInt(String[] args) {
+		String sql = StringUtils.arrayToDelimitedString(args, " ");
+		return this.jdbcTemplate.queryForInt(sql);
+	}
+}
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..d50d08a 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
@@ -8,5 +8,12 @@
 	 		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" />
+
+	<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..213355e 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
@@ -6,5 +6,19 @@
 	xmlns:osgi="http://www.springframework.org/schema/osgi">
 

 	<osgi:service ref="dataSource" interface="javax.sql.DataSource"/>

+
+	<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">
+					<value>execute</value>
+					<value>queryForInt</value>
+				</array>
+			</entry>
+		</osgi:service-properties>
+	</osgi:service>
 

 </beans>
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
index 3fc3b2a..936957c 100644
--- 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
@@ -60,6 +60,6 @@
 		EntityManager will be auto-injected due to @PersistenceContext.
 		PersistenceExceptions will be auto-translated due to @Repository.
 	-->
-	<bean id="directory" class="greenpages.jpa.JpaDirectory"/>
-	 
+	<!-- TODO 3.1 Declare JpaDirectory as bean "directory" -->
+
 </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
index c527d76..07f5eb1 100644
--- 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
@@ -5,12 +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">
 
-	<!-- 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"/>
-
+	<!-- TODO 3.1 Wire OSGi services -->
 
 </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..dcf965c 100644
--- a/greenpages/greenpages.web/pom.xml
+++ b/greenpages/greenpages.web/pom.xml
@@ -95,12 +95,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..24e2b5c 100644
--- a/greenpages/pom.xml
+++ b/greenpages/pom.xml
@@ -16,6 +16,5 @@
 		<module>greenpages.core</module>
 		<module>greenpages.jpa</module>
 		<module>greenpages.web</module>
-		<module>greenpages.par</module>
 	</modules>
 </project>