summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/.classpath45
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/.project33
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/.settings/com.google.appengine.eclipse.core.prefs3
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/.settings/org.eclipse.jdt.core.prefs5
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/META-INF/MANIFEST.MF17
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/build-appengine.xml97
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/pom.xml163
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceImpl.java92
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/MemcacheDocumentServiceImpl.java90
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/Customer.java51
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceTestCase.java27
-rw-r--r--sandbox/sca-cloud-tutorial/cloud-google/src/test/resources/org/apache/tuscany/sca/cloud/data/impl/datastore.composite29
12 files changed, 652 insertions, 0 deletions
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/.classpath b/sandbox/sca-cloud-tutorial/cloud-google/.classpath
new file mode 100644
index 0000000000..a88cb23515
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/.classpath
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry excluding="**/*.java" including="LICENSE|NOTICE|README|META-INF/**/*|OSGI-INF/**/*" kind="src" path=""/>
+ <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/ws/jaxws-api/2.1/jaxws-api-2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/jws/jsr181-api/1.0-MR1/jsr181-api-1.0-MR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/asm/asm/3.1/asm-3.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/cglib/cglib/2.2/cglib-2.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/1.0.1/geronimo-stax-api_1.0_spec-1.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.5/junit-4.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-assembly/2.0-SNAPSHOT/tuscany-assembly-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-assembly-xml/2.0-SNAPSHOT/tuscany-assembly-xml-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-assembly-xsd/2.0-SNAPSHOT/tuscany-assembly-xsd-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-binding-sca-runtime/2.0-SNAPSHOT/tuscany-binding-sca-runtime-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-builder/2.0-SNAPSHOT/tuscany-builder-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="src" path="/tuscany-cloud-api"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-common-java/2.0-SNAPSHOT/tuscany-common-java-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-common-xml/2.0-SNAPSHOT/tuscany-common-xml-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-contribution/2.0-SNAPSHOT/tuscany-contribution-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-core/2.0-SNAPSHOT/tuscany-core-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-core-databinding/2.0-SNAPSHOT/tuscany-core-databinding-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-core-spi/2.0-SNAPSHOT/tuscany-core-spi-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-data-api/2.0-SNAPSHOT/tuscany-data-api-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-databinding/2.0-SNAPSHOT/tuscany-databinding-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-databinding-jaxb/2.0-SNAPSHOT/tuscany-databinding-jaxb-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-extensibility/2.0-SNAPSHOT/tuscany-extensibility-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-interface-java/2.0-SNAPSHOT/tuscany-interface-java-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-interface-java-jaxws/2.0-SNAPSHOT/tuscany-interface-java-jaxws-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-monitor/2.0-SNAPSHOT/tuscany-monitor-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-node-api/2.0-SNAPSHOT/tuscany-node-api-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-node-impl/2.0-SNAPSHOT/tuscany-node-impl-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-sca-api/2.0-SNAPSHOT/tuscany-sca-api-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tuscany/sca/tuscany-xsd/2.0-SNAPSHOT/tuscany-xsd-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/wstx-asl/3.2.4/wstx-asl-3.2.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ws/commons/schema/XmlSchema/1.4.2/XmlSchema-1.4.2.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/.project b/sandbox/sca-cloud-tutorial/cloud-google/.project
new file mode 100644
index 0000000000..1e89800840
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>tuscany-cloud-google</name>
+ <comment>The Apache Software Foundation provides support for the Apache community of open-source software projects.
+ The Apache projects are characterized by a collaborative, consensus based development process, an open and
+ pragmatic software license, and a desire to create high quality software that leads the way in its field.
+ We consider ourselves not simply a group of projects sharing a server, but rather a community of developers
+ and users.</comment>
+ <projects>
+ <project>tuscany-cloud-api</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.google.appengine.eclipse.core.enhancerbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.google.appengine.eclipse.core.projectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>com.google.appengine.eclipse.core.gaeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/.settings/com.google.appengine.eclipse.core.prefs b/sandbox/sca-cloud-tutorial/cloud-google/.settings/com.google.appengine.eclipse.core.prefs
new file mode 100644
index 0000000000..8db2065553
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/.settings/com.google.appengine.eclipse.core.prefs
@@ -0,0 +1,3 @@
+#Wed Oct 14 15:34:49 PDT 2009
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/.settings/org.eclipse.jdt.core.prefs b/sandbox/sca-cloud-tutorial/cloud-google/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..1cb4877dc0
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+#Wed Oct 14 14:08:11 PDT 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/META-INF/MANIFEST.MF b/sandbox/sca-cloud-tutorial/cloud-google/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..22a14da904
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Export-Package: org.apache.tuscany.sca.cloud.data.impl
+Tool: Bnd-0.0.357
+Bundle-Name: Apache Tuscany SCA Cloud API - Google Implementation
+Created-By: 1.6.0_15 (Apple Inc.)
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bnd-LastModified: 1256186081729
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA Cloud API
+Import-Package: org.apache.tuscany.sca.cloud.data;version="2.0",org.ap
+ ache.tuscany.sca.cloud.user;version="2.0",org.apache.tuscany.sca.data
+ .collection;version="2.0"
+Bundle-SymbolicName: org.apache.tuscany.sca.cloud.google
+Bundle-DocURL: http://www.apache.org/
+
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/build-appengine.xml b/sandbox/sca-cloud-tutorial/cloud-google/build-appengine.xml
new file mode 100644
index 0000000000..1472279a1f
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/build-appengine.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<project name="AppEngineSDKInstaller">
+
+
+ <property name="appengine.version" value="1.2.6"/>
+ <property name="appengine.distribution.location" value="http://googleappengine.googlecode.com/files/appengine-java-sdk-${appengine.version}.zip" />
+ <property name="unpack.location" value="${basedir}/target/appengine-java-sdk-${appengine.version}"/>
+
+ <property name="appengine.tools.api" value="${basedir}/target/appengine-java-sdk-${appengine.version}/lib/appengine-tools-api.jar"/>
+ <property name="appengine.api" value="${basedir}/target/appengine-java-sdk-${appengine.version}/lib/impl/appengine-api.jar"/>
+ <property name="appengine.local.runtime.shared" value="${basedir}/target/appengine-java-sdk-${appengine.version}/lib/shared/appengine-local-runtime-shared.jar"/>
+
+ <target name="check-installed">
+ <condition property="already.installed" >
+ <available file="${localRepository}/com/google/appengine-java-sdk/${appengine.version}/appengine-java-sdk-${appengine.version}.zip"/>
+ </condition>
+ <condition property="maven.suffix" value="">
+ <os family="unix"/>
+ </condition>
+ <condition property="maven.suffix" value=".bat">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+
+ <target name="check-unpacked">
+ <condition property="already.unpacked" >
+ <available file="${unpack.location}"/>
+ </condition>
+ </target>
+
+ <target name="install" depends="check-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/appengine-download/"/>
+ <get src="${appengine.distribution.location}"
+ dest="${basedir}/target/appengine-download/appengine-java-sdk-${appengine.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=com.google -DartifactId=appengine-java-sdk -Dversion=${appengine.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/appengine-download/appengine-java-sdk-${appengine.version}.zip"/>
+ </exec>
+
+ <antcall target="unpack-appengine-sdk"/>
+
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-tools -Dversion=${appengine.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${appengine.tools.api}"/>
+ </exec>
+
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-api -Dversion=${appengine.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${appengine.api}"/>
+ </exec>
+
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-local-runtime-shared -Dversion=${appengine.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${appengine.local.runtime.shared}"/>
+ </exec>
+
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-tools -Dversion=${appengine.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${appengine.tools.api}"/>
+ </exec>
+
+ </target>
+
+ <target name="unpack-appengine-sdk" depends="check-installed, check-unpacked" unless="already.unpacked">
+ <fail message="AppEngine SDK zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/appengine-unpack-temp/"/>
+ <unzip src="${localRepository}/com/google/appengine-java-sdk/${appengine.version}/appengine-java-sdk-${appengine.version}.zip"
+ dest="${basedir}/target/appengine-unpack-temp/"
+ overwrite="false">
+ </unzip>
+ <move todir="${unpack.location}">
+ <fileset dir="${basedir}/target/appengine-unpack-temp/appengine-java-sdk-${appengine.version}"/>
+ </move>
+ <delete dir="${basedir}/target/appengine-unpack-temp/"/>
+ </target>
+
+
+ <target name="clean-appengine-files">
+ <delete dir="${unpack.location}"/>
+ </target>
+</project>
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/pom.xml b/sandbox/sca-cloud-tutorial/cloud-google/pom.xml
new file mode 100644
index 0000000000..8e95e02356
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/pom.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-cloud-google</artifactId>
+ <name>Apache Tuscany SCA Cloud API Google AppEngine Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-cloud-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.appengine</groupId>
+ <artifactId>appengine-tools</artifactId>
+ <version>1.2.6</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.appengine</groupId>
+ <artifactId>appengine-api</artifactId>
+ <version>1.2.6</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.appengine</groupId>
+ <artifactId>appengine-local-runtime-shared</artifactId>
+ <version>1.2.6</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>2.0.0</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.cloud.api.google</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.cloud*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <projectnatures>
+ <projectnature>org.eclipse.jdt.core.javanature</projectnature>
+ <projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
+ <projectnature>com.google.gdt.eclipse.core.webAppNature</projectnature>
+ </projectnatures>
+ <buildcommands>
+ <buildCommand>org.eclipse.jdt.core.javabuilder</buildCommand>
+ <buildCommand>com.google.appengine.eclipse.core.enhancerbuilder</buildCommand>
+ <buildCommand>com.google.appengine.eclipse.core.projectValidator> </buildCommand>
+ <buildCommand>com.google.gdt.eclipse.core.webAppProjectValidator> </buildCommand>
+ </buildcommands>
+ <classpathContainers>
+ <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+ <classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
+ </classpathContainers>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <!-- version>1.1</version -->
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>install-appengine</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-appengine.xml" target="install">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>clean-appengine-files</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-appengine.xml" target="clean-appengine-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+
+</project>
+
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceImpl.java b/sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceImpl.java
new file mode 100644
index 0000000000..05a11f0338
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceImpl.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.tuscany.sca.cloud.data.impl;
+
+import java.util.UUID;
+
+import org.apache.tuscany.sca.cloud.data.DocumentService;
+import org.apache.tuscany.sca.data.collection.Entry;
+import org.apache.tuscany.sca.data.collection.NotFoundException;
+import org.oasisopen.sca.annotation.Init;
+
+import com.google.appengine.api.datastore.DatastoreService;
+import com.google.appengine.api.datastore.DatastoreServiceFactory;
+import com.google.appengine.api.datastore.Entity;
+import com.google.appengine.api.datastore.EntityNotFoundException;
+import com.google.appengine.api.datastore.Key;
+import com.google.appengine.api.datastore.KeyFactory;
+
+public class DatastoreDocumentServiceImpl implements DocumentService<Key, Entity> {
+ private DatastoreService googleDataStoreService;
+
+ @Init
+ public void init() {
+ googleDataStoreService = DatastoreServiceFactory.getDatastoreService();
+ }
+
+ public Entry<Key, Entity>[] getAll() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Entity get(Key key) throws NotFoundException {
+ Entity entity = null;
+
+ try {
+ entity = googleDataStoreService.get(key);
+ } catch(EntityNotFoundException nf) {
+ throw new NotFoundException(nf);
+ }
+
+ return entity;
+ }
+
+
+ public Key post(Key key, Entity entity) {
+
+ if( key == null ) {
+ key = KeyFactory.createKey("key", UUID.randomUUID().toString());
+ }
+
+ return googleDataStoreService.put(entity);
+ }
+
+ public void put(Key key, Entity entity) throws NotFoundException {
+ if( get(key) == null) {
+ throw new NotFoundException("Could not find entity with key '" + key.toString() +"'");
+ }
+
+ googleDataStoreService.put(entity);
+ }
+
+ public void delete(Key key) throws NotFoundException {
+ googleDataStoreService.delete(key);
+
+ }
+
+ public void delete(Key... keys) throws NotFoundException {
+ googleDataStoreService.delete(keys);
+
+ }
+
+ public Entry<Key, Entity>[] query(String query) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/MemcacheDocumentServiceImpl.java b/sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/MemcacheDocumentServiceImpl.java
new file mode 100644
index 0000000000..890747f4aa
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/src/main/java/org/apache/tuscany/sca/cloud/data/impl/MemcacheDocumentServiceImpl.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.tuscany.sca.cloud.data.impl;
+
+import java.util.UUID;
+
+import org.apache.tuscany.sca.cloud.data.DocumentService;
+import org.apache.tuscany.sca.data.collection.Entry;
+import org.apache.tuscany.sca.data.collection.NotFoundException;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Property;
+
+import com.google.appengine.api.memcache.Expiration;
+import com.google.appengine.api.memcache.MemcacheService;
+import com.google.appengine.api.memcache.MemcacheServiceFactory;
+
+public class MemcacheDocumentServiceImpl implements DocumentService<Object, Object> {
+ private MemcacheService googleMemecacheService;
+
+ @Property(required=false)
+ protected Expiration defaultExpiration = Expiration.byDeltaSeconds(3600); // 1hr
+
+ @Init
+ public void init() {
+ googleMemecacheService = MemcacheServiceFactory.getMemcacheService();
+ }
+
+ public Entry<Object, Object>[] getAll() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object get(Object key) throws NotFoundException {
+ Object entity = null;
+
+ entity = googleMemecacheService.get(key);
+
+ if(entity == null) {
+ throw new NotFoundException("Could not find object with key '" + key.toString() + "'");
+ }
+
+ return entity;
+ }
+
+ public Object post(Object key, Object entity) {
+ if( key == null ) {
+ key = UUID.randomUUID().toString();
+ }
+
+ googleMemecacheService.put(key, entity, defaultExpiration);
+
+ return entity;
+ }
+
+ public void put(Object key, Object entity) throws NotFoundException {
+ if( get(key) == null) {
+ throw new NotFoundException("Could not find entity with key '" + key.toString() +"'");
+ }
+
+ googleMemecacheService.put(key, entity, defaultExpiration);
+ }
+
+ public void delete(Object key) throws NotFoundException {
+ googleMemecacheService.delete(key);
+ }
+
+ public void delete(Object... keys) throws NotFoundException {
+ googleMemecacheService.delete(keys);
+ }
+
+ public Entry<Object, Object>[] query(String query) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/Customer.java b/sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/Customer.java
new file mode 100644
index 0000000000..3958be61ef
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/Customer.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.tuscany.sca.cloud.data.impl;
+
+import java.io.Serializable;
+
+
+public class Customer implements Serializable {
+
+ private static final long serialVersionUID = 3465788478651204747L;
+
+ private String id;
+ private String name;
+ private String creditCard;
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getCreditCard() {
+ return creditCard;
+ }
+ public void setCreditCard(String creditCard) {
+ this.creditCard = creditCard;
+ }
+}
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceTestCase.java b/sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceTestCase.java
new file mode 100644
index 0000000000..55c851b99b
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/src/test/java/org/apache/tuscany/sca/cloud/data/impl/DatastoreDocumentServiceTestCase.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.tuscany.sca.cloud.data.impl;
+
+import org.junit.Ignore;
+
+@Ignore("Nothing to do here")
+public class DatastoreDocumentServiceTestCase {
+
+}
diff --git a/sandbox/sca-cloud-tutorial/cloud-google/src/test/resources/org/apache/tuscany/sca/cloud/data/impl/datastore.composite b/sandbox/sca-cloud-tutorial/cloud-google/src/test/resources/org/apache/tuscany/sca/cloud/data/impl/datastore.composite
new file mode 100644
index 0000000000..986b491e91
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/cloud-google/src/test/resources/org/apache/tuscany/sca/cloud/data/impl/datastore.composite
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://google"
+ name="datastore">
+
+ <component name="DataStoreDocumentServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.cloud.data.impl.DatastoreDocumentServiceImpl"/>
+ </component>
+
+</composite>