diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-27 05:59:31 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-27 05:59:31 +0000 |
commit | c5e532242f6f7f4bcc6938edd79022da2cb14cc3 (patch) | |
tree | 5e92e175b1750431855698445b8b7f6e6e5a4ba4 /sca-cpp/trunk/samples/relay-gae | |
parent | fe9add6a09e833eb836325992571e1a874c18b18 (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
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/samples/relay-gae/Makefile.am | 40 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/relay-gae/app.yaml | 50 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/relay-gae/domain.composite | 75 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/relay-gae/htdocs/index.html | 31 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/relay-gae/relay.py | 21 | ||||
-rwxr-xr-x | sca-cpp/trunk/samples/relay-gae/start | 20 | ||||
-rwxr-xr-x | sca-cpp/trunk/samples/relay-gae/stop | 20 |
7 files changed, 257 insertions, 0 deletions
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 |