summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-12-27 05:59:31 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-12-27 05:59:31 +0000
commitc5e532242f6f7f4bcc6938edd79022da2cb14cc3 (patch)
tree5e92e175b1750431855698445b8b7f6e6e5a4ba4
parentfe9add6a09e833eb836325992571e1a874c18b18 (diff)
Port REST support improvements to AppEngine Python integration scripts and add a sample.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1053004 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-cpp/trunk/configure.ac1
-rw-r--r--sca-cpp/trunk/modules/wsgi/atomutil.py2
-rwxr-xr-xsca-cpp/trunk/modules/wsgi/composite.py21
-rwxr-xr-xsca-cpp/trunk/modules/wsgi/http-test5
-rw-r--r--sca-cpp/trunk/modules/wsgi/httputil.py125
-rw-r--r--sca-cpp/trunk/modules/wsgi/util.py13
-rw-r--r--sca-cpp/trunk/modules/wsgi/xmlutil.py6
-rw-r--r--sca-cpp/trunk/samples/Makefile.am2
-rw-r--r--sca-cpp/trunk/samples/relay-gae/Makefile.am40
-rw-r--r--sca-cpp/trunk/samples/relay-gae/app.yaml50
-rw-r--r--sca-cpp/trunk/samples/relay-gae/domain.composite75
-rw-r--r--sca-cpp/trunk/samples/relay-gae/htdocs/index.html31
-rw-r--r--sca-cpp/trunk/samples/relay-gae/relay.py21
-rwxr-xr-xsca-cpp/trunk/samples/relay-gae/start20
-rwxr-xr-xsca-cpp/trunk/samples/relay-gae/stop20
15 files changed, 404 insertions, 28 deletions
diff --git a/sca-cpp/trunk/configure.ac b/sca-cpp/trunk/configure.ac
index 11cc2769f1..fd06b83678 100644
--- a/sca-cpp/trunk/configure.ac
+++ b/sca-cpp/trunk/configure.ac
@@ -920,6 +920,7 @@ AC_CONFIG_FILES([Makefile
samples/store-vhost/Makefile
samples/store-cluster/Makefile
samples/relay-python/Makefile
+ samples/relay-gae/Makefile
doc/Makefile
doc/Doxyfile
ubuntu/Makefile
diff --git a/sca-cpp/trunk/modules/wsgi/atomutil.py b/sca-cpp/trunk/modules/wsgi/atomutil.py
index 1e6a7c31b5..106e69c3c6 100644
--- a/sca-cpp/trunk/modules/wsgi/atomutil.py
+++ b/sca-cpp/trunk/modules/wsgi/atomutil.py
@@ -43,7 +43,7 @@ def readATOMEntry(l):
return ()
return entryElementsToValues(car(e))
-# Convert a list of values representy an ATOM entry to a value
+# Convert a list of values representing an ATOM entry to a value
def entryValue(e):
v = elementsToValues((caddr(e),))
return cons(car(e), (cadr(e), cdr(car(v))))
diff --git a/sca-cpp/trunk/modules/wsgi/composite.py b/sca-cpp/trunk/modules/wsgi/composite.py
index 7044483f70..ffd971fef5 100755
--- a/sca-cpp/trunk/modules/wsgi/composite.py
+++ b/sca-cpp/trunk/modules/wsgi/composite.py
@@ -177,20 +177,25 @@ def application(e, r):
if m == "GET":
v = comp("get", id)
- # Write returned content-type / content pair
- if not isinstance(cadr(v), basestring):
+ # Write content-type / content-list pair
+ if isString(car(v)) and isList(cadr(v)):
return result(e, r, 200, (("Content-type", car(v)),), cadr(v))
# Write an ATOM feed or entry
- if isNil(id):
- return result(e, r, 200, (("Content-type", "application/atom+xml;type=feed"),), writeATOMFeed(feedValuesToElements(v)))
- return result(e, r, 200, (("Content-type", "application/atom+xml;type=entry"),), writeATOMEntry(entryValuesToElements(v)))
+ if isString(car(v)) and isString(cadr(v)):
+ if isNil(id):
+ return result(e, r, 200, (("Content-type", "application/atom+xml;type=feed"),), writeATOMFeed(feedValuesToElements(v)))
+ return result(e, r, 200, (("Content-type", "application/atom+xml;type=entry"),), writeATOMEntry(entryValuesToElements(v)))
+
+ # Write a JSON value
+ return result(e, r, 200, (("Content-type", "application/json"),), writeJSON(valuesToElements(v)))
if m == "POST":
ct = requestContentType(e)
# Handle a JSON-RPC function call
- if ct.find("application/json-rpc") != -1 or ct.find("text/plain") != -1 or ct.find("application/x-www-form-urlencoded") != -1:
+ if contains(ct, "application/json-rpc") or contains(ct, "text/plain") or contains(ct, "application/x-www-form-urlencoded"):
+ print >> stderr, "Handling JSON-RPC request"
json = elementsToValues(readJSON(requestBody(e)))
args = postArgs(json)
jid = cadr(assoc("'id", args))
@@ -200,7 +205,7 @@ def application(e, r):
return result(e, r, 200, (("Content-type", "application/json-rpc"),), jsonResult(jid, v))
# Handle an ATOM entry POST
- if ct.find("application/atom+xml") != -1:
+ if contains(ct, "application/atom+xml"):
ae = entryValue(readATOMEntry(requestBody(e)))
v = comp("post", id, ae)
if isNil(v):
@@ -237,7 +242,7 @@ def main():
# Handle the WSGI request with the WSGI runtime
st = serverType(environ)
- if st.find("App Engine") != -1 or st.find("Development") != -1:
+ if contains(st, "App Engine") or contains(st, "Development"):
from google.appengine.ext.webapp.util import run_wsgi_app
run_wsgi_app(application)
elif st != "":
diff --git a/sca-cpp/trunk/modules/wsgi/http-test b/sca-cpp/trunk/modules/wsgi/http-test
index 6676f6514c..5499399b31 100755
--- a/sca-cpp/trunk/modules/wsgi/http-test
+++ b/sca-cpp/trunk/modules/wsgi/http-test
@@ -17,11 +17,6 @@
# specific language governing permissions and limitations
# under the License.
-uri=$1
-if [ "$uri" = "" ]; then
- uri="http://localhost:8090"
-fi
-
# Setup
mkdir -p tmp
./wsgi-start target 8090 2>/dev/null
diff --git a/sca-cpp/trunk/modules/wsgi/httputil.py b/sca-cpp/trunk/modules/wsgi/httputil.py
index 723e1a7284..ea00f3f9fe 100644
--- a/sca-cpp/trunk/modules/wsgi/httputil.py
+++ b/sca-cpp/trunk/modules/wsgi/httputil.py
@@ -26,8 +26,11 @@ from string import strip
from base64 import b64encode
from sys import stderr
from util import *
-from atomutil import *
-from jsonutil import *
+from elemutil import *
+import atomutil
+import jsonutil
+import rssutil
+import xmlutil
# JSON request id
id = 1
@@ -38,23 +41,116 @@ class client:
self.url = urlparse(url)
def __call__(self, func, *args):
+ print >> stderr, "Client proxy call", func, args
# Connect to the configured URL
- print >> stderr, "Client POST", self.url.geturl()
c, headers = connect(self.url)
- # POST a JSON-RPC request
+ # handle a GET request
+ if func == "get":
+ u = requesturi(self.url, car(args))
+ print >> stderr, "Client GET request", u
+ c.request("GET", u, None, headers)
+ res = c.getresponse()
+ print >> stderr, "Client status", res.status
+ if res.status != 200:
+ return None
+ ct = res.getheader("Content-type", "text/plain")
+ ls = (res.read(),)
+
+ if contains(ct, "application/atom+xml;type=entry"):
+ # Read an ATOM entry
+ v = atomutil.entryValue(atomutil.readATOMEntry(ls))
+ print >> stderr, "Client result", v
+ return v
+
+ if contains(ct, "application/atom+xml;type=feed"):
+ # Read an ATOM feed
+ v = atomutil.feedValues(atomutil.readATOMFeed(ls))
+ print >> stderr, "Client result", v
+ return v
+
+ if contains(ct, "application/rss+xml") or rssutil.isRSSFeed(ls):
+ # Read an RSS feed
+ v = rssutil.feedValues(rssutil.readRSSFeed(ls))
+ print >> stderr, "Client result", v
+ return v
+
+ if contains(ct, "text/javascript") or contains(ct, "application/json") or jsonutil.isJSON(ls):
+ # Read a JSON document
+ v = elementsToValues(jsonutil.readJSON(ls))
+ print >> stderr, "Client result", v
+ return v
+
+ if contains(ct, "text/xml") or contains(ct, "application/xml") or xmlutil.isXML(ls):
+ # Read an XML document
+ v = elementsToValues(xmlutil.readXML(ls))
+ print >> stderr, "Client result", v
+ return v
+
+ # Return the content type and a content list
+ v = (ct, ls)
+ print >> stderr, "Client result", v
+ return v
+
+ # handle a POST request
+ if func == "post":
+ u = requesturi(self.url, car(args))
+ print >> stderr, "Client POST request", u
+ req = StringIO()
+ writeStrings(atomutil.writeATOMEntry(atomutil.entryValuesToElements(cadr(args))), req)
+ headers["Content-type"] = "application/atom+xml"
+ c.request("POST", u, req.getvalue(), headers)
+ res = c.getresponse()
+ print >> stderr, "Client status", res.status
+ if res.status != 200 and res.status != 201:
+ return None
+ loc = res.getheader("Location")
+ if loc == None:
+ return None
+ return loc[(loc.rfind('/') + 1):]
+
+ # handle a PUT request
+ if func == "put":
+ u = requesturi(self.url, car(args))
+ print >> stderr, "Client PUT request", u
+ req = StringIO()
+ writeStrings(atomutil.writeATOMEntry(atomutil.entryValuesToElements(cadr(args))), req)
+ headers["Content-type"] = "application/atom+xml"
+ c.request("PUT", u, req.getvalue(), headers)
+ res = c.getresponse()
+ print >> stderr, "Client status", res.status
+ if res.status != 200:
+ return None
+ return True
+
+ # handle a DELETE request
+ if func == "delete":
+ u = requesturi(self.url, car(args))
+ print >> stderr, "Client DELETE request", u
+ c.request("DELETE", u, None, headers)
+ res = c.getresponse()
+ print >> stderr, "Client status", res.status
+ if res.status != 200:
+ return None
+ return True
+
+ # handle a JSON-RPC request
+ u = requesturi(self.url, ())
+ print >> stderr, "Client JSON-RPC request", u
global id
req = StringIO()
- writeStrings(jsonRequest(id, func, args), req)
+ writeStrings(jsonutil.jsonRequest(id, func, args), req)
id = id + 1
headers["Content-type"] = "application/json-rpc"
- c.request("POST", self.url.path, req.getvalue(), headers)
+ c.request("POST", u, req.getvalue(), headers)
res = c.getresponse()
print >> stderr, "Client status", res.status
if res.status != 200:
return None
- return jsonResultValue((res.read(),))
+ v = jsonutil.jsonResultValue((res.read(),))
+ print >> stderr, "Client result", v
+ return v
def __getattr__(self, name):
if name[0] == '_':
@@ -82,12 +178,19 @@ def connect(url):
else:
c = HTTPSConnection(url.hostname, 443 if url.port == None else url.port)
- # For HTTP basic authentication the user and password are
+ # For HTTP basic authentication the user and password may be
# provided by htpasswd.py
- import htpasswd
- auth = 'Basic ' + b64encode(htpasswd.user + ':' + htpasswd.passwd)
- return c, {"Authorization": auth}
+ try:
+ import htpasswd
+ auth = 'Basic ' + b64encode(htpasswd.user + ':' + htpasswd.passwd)
+ return c, {"Authorization": auth}
+ except:
+ return c, {}
else:
c = HTTPConnection(url.hostname, 80 if url.port == None else url.port)
return c, {}
+# Convert a URL and arg to a request URI
+def requesturi(url, arg):
+ return url.path + path(arg) + ("" if url.query == "" else "?" + url.query)
+
diff --git a/sca-cpp/trunk/modules/wsgi/util.py b/sca-cpp/trunk/modules/wsgi/util.py
index 560101e32d..80bc7db101 100644
--- a/sca-cpp/trunk/modules/wsgi/util.py
+++ b/sca-cpp/trunk/modules/wsgi/util.py
@@ -59,6 +59,9 @@ def isNil(l):
def isSymbol(v):
return isinstance(v, basestring) and v[0:1] == "'"
+def isString(v):
+ return isinstance(v, basestring) and v[0:1] != "'"
+
def isList(v):
if getattr(v, '__iter__', False) == False:
return False
@@ -132,10 +135,20 @@ def assoc(k, l):
def curry(f, *args):
return lambda *a: f(*(args + a))
+# Convert a path represented as a list of values to a string
+def path(p):
+ if isNil(p):
+ return ""
+ return "/" + car(p) + path(cdr(p))
+
# Split a path into a list of segments
def tokens(path):
return tuple(filter(lambda s: len(s) != 0, path.split("/")))
+# Return true if s1 contains s2
+def contains(s1, s2):
+ return s1.find(s2) != -1
+
# Write a list of strings to a stream
def writeStrings(l, os):
if l == ():
diff --git a/sca-cpp/trunk/modules/wsgi/xmlutil.py b/sca-cpp/trunk/modules/wsgi/xmlutil.py
index 35ccb7f803..83b1cf2f92 100644
--- a/sca-cpp/trunk/modules/wsgi/xmlutil.py
+++ b/sca-cpp/trunk/modules/wsgi/xmlutil.py
@@ -31,8 +31,10 @@ def readAttributes(a):
# Read an XML element
def readElement(e):
- l = (element, "'" + e.tag) + readAttributes(tuple(e.items())) + readElements(tuple(e.getchildren()))
- if e.text == None:
+ a = tuple(e.items())
+ c = tuple(e.getchildren())
+ l = (element, "'" + e.tag) + readAttributes(a) + readElements(c)
+ if e.text == None or c != ():
return l
return l + (e.text,)
diff --git a/sca-cpp/trunk/samples/Makefile.am b/sca-cpp/trunk/samples/Makefile.am
index bd161fec30..135674ac94 100644
--- a/sca-cpp/trunk/samples/Makefile.am
+++ b/sca-cpp/trunk/samples/Makefile.am
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-SUBDIRS = store-scheme store-cpp store-python store-java store-gae store-sql store-nosql store-vhost store-cluster relay-python
+SUBDIRS = store-scheme store-cpp store-python store-java store-gae store-sql store-nosql store-vhost store-cluster relay-python relay-gae
sample_DATA = README
sampledir=$(prefix)/samples
diff --git a/sca-cpp/trunk/samples/relay-gae/Makefile.am b/sca-cpp/trunk/samples/relay-gae/Makefile.am
new file mode 100644
index 0000000000..7b24ddde27
--- /dev/null
+++ b/sca-cpp/trunk/samples/relay-gae/Makefile.am
@@ -0,0 +1,40 @@
+# 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.
+
+if WANT_PYTHON
+if WANT_GAE
+
+dist_sample_SCRIPTS = start stop
+sampledir = $(prefix)/samples/relay-gae
+
+BUILT_SOURCES = target.stamp
+target.stamp: app.yaml *.py *.composite $(top_builddir)/modules/wsgi/*.py htdocs/*.html
+ mkdir -p target
+ cp app.yaml *.py *.composite `ls $(top_builddir)/modules/wsgi/*.py | grep -v "\-test"` target
+ mkdir -p target/htdocs
+ cp -R htdocs/* target/htdocs
+ touch target.stamp
+
+clean-local:
+ rm -rf target.stamp target
+
+nobase_sample_DATA = target/app.yaml target/*.py target/*.composite target/htdocs/*.html
+
+EXTRA_DIST = app.yaml *.composite *.py htdocs/*.html
+
+endif
+endif
diff --git a/sca-cpp/trunk/samples/relay-gae/app.yaml b/sca-cpp/trunk/samples/relay-gae/app.yaml
new file mode 100644
index 0000000000..d4e78701bc
--- /dev/null
+++ b/sca-cpp/trunk/samples/relay-gae/app.yaml
@@ -0,0 +1,50 @@
+# 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.
+
+application: sca-relay
+version: 1
+runtime: python
+api_version: 1
+skip_files:
+- ^(.*/)?app\.yaml
+- ^(.*/)?app\.yml
+- ^(.*/)?index\.yaml
+- ^(.*/)?index\.yml
+- ^(.*/)?#.*#
+- ^(.*/)?.*~
+- ^(.*/)?.*\.py[co]
+- ^(.*/)?.*/RCS/.*
+- ^(.*/)?\..*
+- ^(.*/)?.*-test$
+- ^(.*/)?.*\.cpp$
+- ^(.*/)?.*\.o$
+- ^(.*/)?core$
+- ^(.*/)?.*\.out$
+- ^(.*/)?.*\.log$
+- ^(.*/)?Makefile.*
+- ^(.*/)?tmp/.*
+- ^(.*/)?wsgi-start
+- ^(.*/)?wsgi-stop
+
+handlers:
+- url: /(.*\.(html|png))
+ static_files: htdocs/\1
+ upload: htdocs/(.*\.(html|png))
+
+- url: /.*
+ script: composite.py
+
diff --git a/sca-cpp/trunk/samples/relay-gae/domain.composite b/sca-cpp/trunk/samples/relay-gae/domain.composite
new file mode 100644
index 0000000000..7f7302955e
--- /dev/null
+++ b/sca-cpp/trunk/samples/relay-gae/domain.composite
@@ -0,0 +1,75 @@
+<?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/200912"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://relay"
+ name="relay">
+
+ <component name="JSONTwit">
+ <t:implementation.python script="relay.py"/>
+ <service name="Relay">
+ <t:binding.http uri="jsontwit"/>
+ </service>
+ <reference name="target">
+ <t:binding.http uri="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jsdelfino"/>
+ </reference>
+ </component>
+
+ <component name="XMLTwit">
+ <t:implementation.python script="relay.py"/>
+ <service name="Relay">
+ <t:binding.http uri="xmltwit"/>
+ </service>
+ <reference name="target">
+ <t:binding.http uri="http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=jsdelfino"/>
+ </reference>
+ </component>
+
+ <component name="RSSTwit">
+ <t:implementation.python script="relay.py"/>
+ <service name="Relay">
+ <t:binding.http uri="rsstwit"/>
+ </service>
+ <reference name="target">
+ <t:binding.http uri="http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=jsdelfino"/>
+ </reference>
+ </component>
+
+ <component name="HTML">
+ <t:implementation.python script="relay.py"/>
+ <service name="Relay">
+ <t:binding.http uri="html"/>
+ </service>
+ <reference name="target">
+ <t:binding.http uri="http://people.apache.org/~jsdelfino/"/>
+ </reference>
+ </component>
+
+ <component name="JSONFB">
+ <t:implementation.python script="relay.py"/>
+ <service name="Relay">
+ <t:binding.http uri="jsonfb"/>
+ </service>
+ <reference name="target">
+ <t:binding.http uri="https://graph.facebook.com/100001053301307"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-cpp/trunk/samples/relay-gae/htdocs/index.html b/sca-cpp/trunk/samples/relay-gae/htdocs/index.html
new file mode 100644
index 0000000000..2025a5851d
--- /dev/null
+++ b/sca-cpp/trunk/samples/relay-gae/htdocs/index.html
@@ -0,0 +1,31 @@
+<!--
+ * 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.
+-->
+<html>
+<head>
+<title>Relay</title>
+<body>
+
+<p><a href="/html">Sample HTML request</a></p>
+<p><a href="/jsontwit">Sample Twitter JSON request</a></p>
+<p><a href="/xmltwit">Sample Twitter XML request</a></p>
+<p><a href="/rsstwit">Sample Twitter RSS request</a></p>
+<p><a href="/jsonfb">Sample Facebook JSON request</a></p>
+
+</body>
+</html>
diff --git a/sca-cpp/trunk/samples/relay-gae/relay.py b/sca-cpp/trunk/samples/relay-gae/relay.py
new file mode 100644
index 0000000000..5fe99803c1
--- /dev/null
+++ b/sca-cpp/trunk/samples/relay-gae/relay.py
@@ -0,0 +1,21 @@
+# 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.
+
+# Relay implementation
+def get(id, target):
+ return target.get(id)
+
diff --git a/sca-cpp/trunk/samples/relay-gae/start b/sca-cpp/trunk/samples/relay-gae/start
new file mode 100755
index 0000000000..2e219758a8
--- /dev/null
+++ b/sca-cpp/trunk/samples/relay-gae/start
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# 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.
+
+../../modules/wsgi/gae-start target 8090
diff --git a/sca-cpp/trunk/samples/relay-gae/stop b/sca-cpp/trunk/samples/relay-gae/stop
new file mode 100755
index 0000000000..3aff1d5a77
--- /dev/null
+++ b/sca-cpp/trunk/samples/relay-gae/stop
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# 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.
+
+../../modules/wsgi/gae-stop target 8090