summaryrefslogtreecommitdiffstats
path: root/sca-cpp/branches/lightweight-sca/samples/relay-python
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/branches/lightweight-sca/samples/relay-python')
-rw-r--r--sca-cpp/branches/lightweight-sca/samples/relay-python/Makefile.am25
-rw-r--r--sca-cpp/branches/lightweight-sca/samples/relay-python/htdocs/index.html35
-rw-r--r--sca-cpp/branches/lightweight-sca/samples/relay-python/relay.composite74
-rw-r--r--sca-cpp/branches/lightweight-sca/samples/relay-python/relay.py21
-rwxr-xr-xsca-cpp/branches/lightweight-sca/samples/relay-python/start31
-rwxr-xr-xsca-cpp/branches/lightweight-sca/samples/relay-python/stop20
6 files changed, 206 insertions, 0 deletions
diff --git a/sca-cpp/branches/lightweight-sca/samples/relay-python/Makefile.am b/sca-cpp/branches/lightweight-sca/samples/relay-python/Makefile.am
new file mode 100644
index 0000000000..57938aff69
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/samples/relay-python/Makefile.am
@@ -0,0 +1,25 @@
+# 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
+
+dist_sample_SCRIPTS = start stop
+sampledir = $(prefix)/samples/relay-python
+
+nobase_dist_sample_DATA = relay.py relay.composite htdocs/*.html
+
+endif
diff --git a/sca-cpp/branches/lightweight-sca/samples/relay-python/htdocs/index.html b/sca-cpp/branches/lightweight-sca/samples/relay-python/htdocs/index.html
new file mode 100644
index 0000000000..ad5f86aa02
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/samples/relay-python/htdocs/index.html
@@ -0,0 +1,35 @@
+<!--
+ * 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>
+<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/>
+<meta name="apple-mobile-web-app-capable" content="yes"/>
+<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
+<link rel="stylesheet" type="text/css" href="/ui-min.css"/>
+<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/branches/lightweight-sca/samples/relay-python/relay.composite b/sca-cpp/branches/lightweight-sca/samples/relay-python/relay.composite
new file mode 100644
index 0000000000..470ac88da1
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/samples/relay-python/relay.composite
@@ -0,0 +1,74 @@
+<?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"
+ targetNamespace="http://relay"
+ name="relay">
+
+ <component name="JSONTwit">
+ <implementation.python script="relay.py"/>
+ <service name="Relay">
+ <binding.http uri="jsontwit"/>
+ </service>
+ <reference name="target">
+ <binding.http uri="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jsdelfino"/>
+ </reference>
+ </component>
+
+ <component name="XMLTwit">
+ <implementation.python script="relay.py"/>
+ <service name="Relay">
+ <binding.http uri="xmltwit"/>
+ </service>
+ <reference name="target">
+ <binding.http uri="http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=jsdelfino"/>
+ </reference>
+ </component>
+
+ <component name="RSSTwit">
+ <implementation.python script="relay.py"/>
+ <service name="Relay">
+ <binding.http uri="rsstwit"/>
+ </service>
+ <reference name="target">
+ <binding.http uri="http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=jsdelfino"/>
+ </reference>
+ </component>
+
+ <component name="HTML">
+ <implementation.python script="relay.py"/>
+ <service name="Relay">
+ <binding.http uri="html"/>
+ </service>
+ <reference name="target">
+ <binding.http uri="http://people.apache.org/~jsdelfino/"/>
+ </reference>
+ </component>
+
+ <component name="JSONFB">
+ <implementation.python script="relay.py"/>
+ <service name="Relay">
+ <binding.http uri="jsonfb"/>
+ </service>
+ <reference name="target">
+ <binding.http uri="https://graph.facebook.com/100001053301307"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-cpp/branches/lightweight-sca/samples/relay-python/relay.py b/sca-cpp/branches/lightweight-sca/samples/relay-python/relay.py
new file mode 100644
index 0000000000..5fe99803c1
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/samples/relay-python/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/branches/lightweight-sca/samples/relay-python/start b/sca-cpp/branches/lightweight-sca/samples/relay-python/start
new file mode 100755
index 0000000000..e9d9d2d51f
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/samples/relay-python/start
@@ -0,0 +1,31 @@
+#!/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/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-event-conf tmp
+../../modules/server/server-conf tmp
+../../modules/python/python-conf tmp
+cat >>tmp/conf/httpd.conf <<EOF
+# Configure SCA Composite
+SCAContribution `pwd`/
+SCAComposite relay.composite
+
+EOF
+
+../../modules/http/httpd-start tmp
diff --git a/sca-cpp/branches/lightweight-sca/samples/relay-python/stop b/sca-cpp/branches/lightweight-sca/samples/relay-python/stop
new file mode 100755
index 0000000000..3b4f46694d
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/samples/relay-python/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/http/httpd-stop tmp