You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2010/12/27 06:59:32 UTC
svn commit: r1053004 - in /tuscany/sca-cpp/trunk: ./ modules/wsgi/ samples/
samples/relay-gae/ samples/relay-gae/htdocs/
Author: jsdelfino
Date: Mon Dec 27 05:59:31 2010
New Revision: 1053004
URL: http://svn.apache.org/viewvc?rev=1053004&view=rev
Log:
Port REST support improvements to AppEngine Python integration scripts and add a sample.
Added:
tuscany/sca-cpp/trunk/samples/relay-gae/
tuscany/sca-cpp/trunk/samples/relay-gae/Makefile.am (contents, props changed)
- copied, changed from r1053003, tuscany/sca-cpp/trunk/modules/wsgi/http-test
tuscany/sca-cpp/trunk/samples/relay-gae/app.yaml (contents, props changed)
- copied, changed from r1053003, tuscany/sca-cpp/trunk/modules/wsgi/http-test
tuscany/sca-cpp/trunk/samples/relay-gae/domain.composite
tuscany/sca-cpp/trunk/samples/relay-gae/htdocs/
tuscany/sca-cpp/trunk/samples/relay-gae/htdocs/index.html
tuscany/sca-cpp/trunk/samples/relay-gae/relay.py
- copied, changed from r1053003, tuscany/sca-cpp/trunk/samples/Makefile.am
tuscany/sca-cpp/trunk/samples/relay-gae/start (contents, props changed)
- copied, changed from r1053003, tuscany/sca-cpp/trunk/samples/Makefile.am
tuscany/sca-cpp/trunk/samples/relay-gae/stop (contents, props changed)
- copied, changed from r1053003, tuscany/sca-cpp/trunk/samples/Makefile.am
Modified:
tuscany/sca-cpp/trunk/configure.ac
tuscany/sca-cpp/trunk/modules/wsgi/atomutil.py
tuscany/sca-cpp/trunk/modules/wsgi/composite.py
tuscany/sca-cpp/trunk/modules/wsgi/http-test
tuscany/sca-cpp/trunk/modules/wsgi/httputil.py
tuscany/sca-cpp/trunk/modules/wsgi/util.py
tuscany/sca-cpp/trunk/modules/wsgi/xmlutil.py
tuscany/sca-cpp/trunk/samples/Makefile.am
Modified: tuscany/sca-cpp/trunk/configure.ac
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/configure.ac?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/configure.ac (original)
+++ tuscany/sca-cpp/trunk/configure.ac Mon Dec 27 05:59:31 2010
@@ -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
Modified: tuscany/sca-cpp/trunk/modules/wsgi/atomutil.py
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/wsgi/atomutil.py?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/atomutil.py (original)
+++ tuscany/sca-cpp/trunk/modules/wsgi/atomutil.py Mon Dec 27 05:59:31 2010
@@ -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))))
Modified: tuscany/sca-cpp/trunk/modules/wsgi/composite.py
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/wsgi/composite.py?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/composite.py (original)
+++ tuscany/sca-cpp/trunk/modules/wsgi/composite.py Mon Dec 27 05:59:31 2010
@@ -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 != "":
Modified: tuscany/sca-cpp/trunk/modules/wsgi/http-test
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/wsgi/http-test?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/http-test (original)
+++ tuscany/sca-cpp/trunk/modules/wsgi/http-test Mon Dec 27 05:59:31 2010
@@ -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
Modified: tuscany/sca-cpp/trunk/modules/wsgi/httputil.py
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/wsgi/httputil.py?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/httputil.py (original)
+++ tuscany/sca-cpp/trunk/modules/wsgi/httputil.py Mon Dec 27 05:59:31 2010
@@ -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)
+
Modified: tuscany/sca-cpp/trunk/modules/wsgi/util.py
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/wsgi/util.py?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/util.py (original)
+++ tuscany/sca-cpp/trunk/modules/wsgi/util.py Mon Dec 27 05:59:31 2010
@@ -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 == ():
Modified: tuscany/sca-cpp/trunk/modules/wsgi/xmlutil.py
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/wsgi/xmlutil.py?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/xmlutil.py (original)
+++ tuscany/sca-cpp/trunk/modules/wsgi/xmlutil.py Mon Dec 27 05:59:31 2010
@@ -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,)
Modified: tuscany/sca-cpp/trunk/samples/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/Makefile.am?rev=1053004&r1=1053003&r2=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/Makefile.am Mon Dec 27 05:59:31 2010
@@ -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
Copied: tuscany/sca-cpp/trunk/samples/relay-gae/Makefile.am (from r1053003, tuscany/sca-cpp/trunk/modules/wsgi/http-test)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/relay-gae/Makefile.am?p2=tuscany/sca-cpp/trunk/samples/relay-gae/Makefile.am&p1=tuscany/sca-cpp/trunk/modules/wsgi/http-test&r1=1053003&r2=1053004&rev=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/http-test (original)
+++ tuscany/sca-cpp/trunk/samples/relay-gae/Makefile.am Mon Dec 27 05:59:31 2010
@@ -1,5 +1,3 @@
-#!/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
@@ -17,23 +15,26 @@
# 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
-sleep 2
-
-# Test JSON-RPC
-here=`readlink -f $0`; here=`dirname $here`
-python_prefix=`cat $here/../python/python.prefix`
-$python_prefix/bin/python http-test.py
-rc=$?
-
-# Cleanup
-./wsgi-stop target 8090
-sleep 2
-return $rc
+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
Copied: tuscany/sca-cpp/trunk/samples/relay-gae/app.yaml (from r1053003, tuscany/sca-cpp/trunk/modules/wsgi/http-test)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/relay-gae/app.yaml?p2=tuscany/sca-cpp/trunk/samples/relay-gae/app.yaml&p1=tuscany/sca-cpp/trunk/modules/wsgi/http-test&r1=1053003&r2=1053004&rev=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/wsgi/http-test (original)
+++ tuscany/sca-cpp/trunk/samples/relay-gae/app.yaml Mon Dec 27 05:59:31 2010
@@ -1,39 +1,50 @@
-#!/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.
-
-uri=$1
-if [ "$uri" = "" ]; then
- uri="http://localhost:8090"
-fi
-
-# Setup
-mkdir -p tmp
-./wsgi-start target 8090 2>/dev/null
-sleep 2
-
-# Test JSON-RPC
-here=`readlink -f $0`; here=`dirname $here`
-python_prefix=`cat $here/../python/python.prefix`
-$python_prefix/bin/python http-test.py
-rc=$?
-
-# Cleanup
-./wsgi-stop target 8090
-sleep 2
-return $rc
+# 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
+
Added: tuscany/sca-cpp/trunk/samples/relay-gae/domain.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/relay-gae/domain.composite?rev=1053004&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/relay-gae/domain.composite (added)
+++ tuscany/sca-cpp/trunk/samples/relay-gae/domain.composite Mon Dec 27 05:59:31 2010
@@ -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>
Added: tuscany/sca-cpp/trunk/samples/relay-gae/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/relay-gae/htdocs/index.html?rev=1053004&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/samples/relay-gae/htdocs/index.html (added)
+++ tuscany/sca-cpp/trunk/samples/relay-gae/htdocs/index.html Mon Dec 27 05:59:31 2010
@@ -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>
Copied: tuscany/sca-cpp/trunk/samples/relay-gae/relay.py (from r1053003, tuscany/sca-cpp/trunk/samples/Makefile.am)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/relay-gae/relay.py?p2=tuscany/sca-cpp/trunk/samples/relay-gae/relay.py&p1=tuscany/sca-cpp/trunk/samples/Makefile.am&r1=1053003&r2=1053004&rev=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/relay-gae/relay.py Mon Dec 27 05:59:31 2010
@@ -15,8 +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
-
-sample_DATA = README
-sampledir=$(prefix)/samples
+# Relay implementation
+def get(id, target):
+ return target.get(id)
Copied: tuscany/sca-cpp/trunk/samples/relay-gae/start (from r1053003, tuscany/sca-cpp/trunk/samples/Makefile.am)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/relay-gae/start?p2=tuscany/sca-cpp/trunk/samples/relay-gae/start&p1=tuscany/sca-cpp/trunk/samples/Makefile.am&r1=1053003&r2=1053004&rev=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/relay-gae/start Mon Dec 27 05:59:31 2010
@@ -1,3 +1,5 @@
+#!/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
@@ -15,8 +17,4 @@
# 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
-
-sample_DATA = README
-sampledir=$(prefix)/samples
-
+../../modules/wsgi/gae-start target 8090
Propchange: tuscany/sca-cpp/trunk/samples/relay-gae/start
------------------------------------------------------------------------------
svn:executable = *
Copied: tuscany/sca-cpp/trunk/samples/relay-gae/stop (from r1053003, tuscany/sca-cpp/trunk/samples/Makefile.am)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/samples/relay-gae/stop?p2=tuscany/sca-cpp/trunk/samples/relay-gae/stop&p1=tuscany/sca-cpp/trunk/samples/Makefile.am&r1=1053003&r2=1053004&rev=1053004&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/samples/Makefile.am (original)
+++ tuscany/sca-cpp/trunk/samples/relay-gae/stop Mon Dec 27 05:59:31 2010
@@ -1,3 +1,5 @@
+#!/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
@@ -15,8 +17,4 @@
# 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
-
-sample_DATA = README
-sampledir=$(prefix)/samples
-
+../../modules/wsgi/gae-stop target 8090
Propchange: tuscany/sca-cpp/trunk/samples/relay-gae/stop
------------------------------------------------------------------------------
svn:executable = *