summaryrefslogtreecommitdiffstats
path: root/sca-cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 09:50:12 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 09:50:12 +0000
commitfe93d86e5572870b2e4004c7788da8320a28de3d (patch)
tree95d45d6e22dd51af2b9fe0db5231f592b1396913 /sca-cpp
parent73d5d5ee4452d4eb44938a1a0556a4312e94e135 (diff)
Refactor and cleanup some of the config scripts. Add a sample using mod_proxy_balancer to distribute requests across three servers.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp')
-rwxr-xr-xsca-cpp/trunk/components/log/scribed-central-conf2
-rwxr-xr-xsca-cpp/trunk/components/log/scribed-client-conf2
-rwxr-xr-xsca-cpp/trunk/components/webservice/axis2-conf1
-rw-r--r--sca-cpp/trunk/configure.ac1
-rw-r--r--sca-cpp/trunk/modules/http/Makefile.am6
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-conf43
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-ssl-conf68
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-conf40
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-member-conf33
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-ssl-conf70
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-ssl-member-conf33
-rwxr-xr-xsca-cpp/trunk/modules/http/proxy-test37
-rwxr-xr-xsca-cpp/trunk/modules/http/ssl-ca-conf1
-rwxr-xr-xsca-cpp/trunk/modules/http/ssl-cert-conf6
-rwxr-xr-xsca-cpp/trunk/modules/http/ssl-ls25
-rwxr-xr-xsca-cpp/trunk/modules/http/vhost-conf47
-rwxr-xr-xsca-cpp/trunk/modules/http/vhost-ssl-conf49
-rwxr-xr-xsca-cpp/trunk/modules/java/java-conf1
-rw-r--r--sca-cpp/trunk/modules/openid/htdocs/logout/index.html3
-rwxr-xr-xsca-cpp/trunk/modules/openid/openid-conf8
-rwxr-xr-xsca-cpp/trunk/modules/openid/openid-step2-conf10
-rwxr-xr-xsca-cpp/trunk/modules/openid/start-test4
-rwxr-xr-xsca-cpp/trunk/modules/python/python-conf1
-rwxr-xr-xsca-cpp/trunk/modules/server/cpp-conf1
-rw-r--r--sca-cpp/trunk/modules/server/mod-eval.hpp6
-rwxr-xr-xsca-cpp/trunk/modules/server/scheme-conf1
-rwxr-xr-xsca-cpp/trunk/modules/server/server-conf51
-rw-r--r--sca-cpp/trunk/samples/Makefile.am2
-rw-r--r--sca-cpp/trunk/samples/store-cluster/Makefile.am36
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/currency-converter.py29
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py30
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py75
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/store.composite69
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/store.py40
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/currency-converter.py29
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py30
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py75
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/store.composite69
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/joe/store.py40
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html157
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html157
-rw-r--r--sca-cpp/trunk/samples/store-cluster/htdocs/index.html34
-rwxr-xr-xsca-cpp/trunk/samples/store-cluster/server-test62
-rwxr-xr-xsca-cpp/trunk/samples/store-cluster/ssl-start113
-rwxr-xr-xsca-cpp/trunk/samples/store-cluster/start83
-rwxr-xr-xsca-cpp/trunk/samples/store-cluster/stop25
-rwxr-xr-xsca-cpp/trunk/samples/store-cpp/ssl-start2
-rwxr-xr-xsca-cpp/trunk/samples/store-java/ssl-start2
-rwxr-xr-xsca-cpp/trunk/samples/store-nosql/ssl-start2
-rwxr-xr-xsca-cpp/trunk/samples/store-python/redirect5
-rwxr-xr-xsca-cpp/trunk/samples/store-python/ssl-start2
-rwxr-xr-xsca-cpp/trunk/samples/store-python/uec2-start6
-rwxr-xr-xsca-cpp/trunk/samples/store-scheme/ssl-start2
-rwxr-xr-xsca-cpp/trunk/samples/store-sql/ssl-start2
-rwxr-xr-xsca-cpp/trunk/samples/store-vhost/ssl-start6
-rwxr-xr-xsca-cpp/trunk/samples/store-vhost/start3
-rwxr-xr-xsca-cpp/trunk/samples/store-vhost/uec2-start10
-rw-r--r--sca-cpp/trunk/ubuntu/Makefile.am2
-rwxr-xr-xsca-cpp/trunk/ubuntu/ip-redirect25
-rwxr-xr-xsca-cpp/trunk/ubuntu/ip-redirect-all26
-rwxr-xr-xsca-cpp/trunk/ubuntu/uec2-bin-all-image23
-rwxr-xr-xsca-cpp/trunk/ubuntu/uec2-dev-all-image23
62 files changed, 1735 insertions, 111 deletions
diff --git a/sca-cpp/trunk/components/log/scribed-central-conf b/sca-cpp/trunk/components/log/scribed-central-conf
index 458cbdebca..3bb9c29c85 100755
--- a/sca-cpp/trunk/components/log/scribed-central-conf
+++ b/sca-cpp/trunk/components/log/scribed-central-conf
@@ -19,6 +19,7 @@
# Generate a Scribe central conf
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
mkdir -p $root/scribe/conf
@@ -26,6 +27,7 @@ mkdir -p $root/scribe/logs/central
mkdir -p $root/scribe/logs/central-secondary
cat >$root/scribe/conf/scribe-central.conf <<EOF
+# Generated by: scribed-central-conf $*
# Scribe central configuration
port=1463
max_msg_per_second=2000000
diff --git a/sca-cpp/trunk/components/log/scribed-client-conf b/sca-cpp/trunk/components/log/scribed-client-conf
index c813f21ced..3300e4e5ec 100755
--- a/sca-cpp/trunk/components/log/scribed-client-conf
+++ b/sca-cpp/trunk/components/log/scribed-client-conf
@@ -19,6 +19,7 @@
# Generate a Scribe client conf
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
central=$2
@@ -26,6 +27,7 @@ mkdir -p $root/scribe/conf
mkdir -p $root/scribe/logs/client-secondary
cat >$root/scribe/conf/scribe-client.conf <<EOF
+# Generated by: scribed-client-conf $*
# Scribe client configuration
port=1464
max_msg_per_second=2000000
diff --git a/sca-cpp/trunk/components/webservice/axis2-conf b/sca-cpp/trunk/components/webservice/axis2-conf
index 2194144ae0..77c5b2cca0 100755
--- a/sca-cpp/trunk/components/webservice/axis2-conf
+++ b/sca-cpp/trunk/components/webservice/axis2-conf
@@ -42,6 +42,7 @@ cp $here/axis2.xml $root/axis2c/axis2.xml
# Configure HTTPD Axis2 module
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: axis2-conf $*
# Support for Web Services
SCASetEnv AXIS2C_HOME $root/axis2c
LoadModule axis2_module $root/axis2c/lib/libmod_axis2.so
diff --git a/sca-cpp/trunk/configure.ac b/sca-cpp/trunk/configure.ac
index b94e540e51..e5c66254e8 100644
--- a/sca-cpp/trunk/configure.ac
+++ b/sca-cpp/trunk/configure.ac
@@ -860,6 +860,7 @@ AC_CONFIG_FILES([Makefile
samples/store-sql/Makefile
samples/store-nosql/Makefile
samples/store-vhost/Makefile
+ samples/store-cluster/Makefile
doc/Makefile
doc/Doxyfile
ubuntu/Makefile
diff --git a/sca-cpp/trunk/modules/http/Makefile.am b/sca-cpp/trunk/modules/http/Makefile.am
index f25ef170c9..17fd8ac3c7 100644
--- a/sca-cpp/trunk/modules/http/Makefile.am
+++ b/sca-cpp/trunk/modules/http/Makefile.am
@@ -20,7 +20,7 @@ INCLUDES = -I${HTTPD_INCLUDE}
incl_HEADERS = *.hpp
incldir = $(prefix)/include/modules/http
-dist_mod_SCRIPTS = httpd-conf httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf httpd-ssl-conf
+dist_mod_SCRIPTS = httpd-conf httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf httpd-ssl-conf proxy-conf proxy-ssl-conf proxy-member-conf proxy-ssl-member-conf vhost-conf vhost-ssl-conf
moddir=$(prefix)/modules/http
curl_test_SOURCES = curl-test.cpp
@@ -43,7 +43,7 @@ httpd-modules.prefix: $(top_builddir)/config.status
curl.prefix: $(top_builddir)/config.status
echo ${CURL_PREFIX} >curl.prefix
-dist_noinst_SCRIPTS = httpd-test http-test
+dist_noinst_SCRIPTS = httpd-test http-test proxy-test
noinst_PROGRAMS = curl-test curl-get
-TESTS = httpd-test http-test
+TESTS = httpd-test http-test proxy-test
diff --git a/sca-cpp/trunk/modules/http/httpd-conf b/sca-cpp/trunk/modules/http/httpd-conf
index 70c0b295af..149bc56c4d 100755
--- a/sca-cpp/trunk/modules/http/httpd-conf
+++ b/sca-cpp/trunk/modules/http/httpd-conf
@@ -19,6 +19,7 @@
# Generate a minimal HTTPD configuration
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
host=$2
port=`echo $3 | awk -F "/" '{ print $1 }'`
@@ -26,19 +27,20 @@ pport=`echo $3 | awk -F "/" '{ print $2 }'`
if [ "$pport" = "" ]; then
pport=$port
fi
+mkdir -p $4
htdocs=`readlink -f $4`
user=`id -un`
group=`id -gn`
modules_prefix=`cat $here/httpd-modules.prefix`
-vhost=$5
mkdir -p $root
mkdir -p $root/logs
mkdir -p $root/conf
cat >$root/conf/httpd.conf <<EOF
+# Generated by: httpd-conf $*
# Apache HTTPD server configuration
-# Set server name
+# Main server name
ServerName http://$host:$pport
PidFile $root/logs/httpd.pid
@@ -114,37 +116,40 @@ Allow from all
# Allow access to service components
<Location />
Options FollowSymLinks
+Order deny,allow
Allow from all
</Location>
-# Setup HTTP virtual hosts
+# Setup HTTP virtual host
Listen $port
<VirtualHost *:$port>
ServerName http://$host:$pport
-UseCanonicalName Off
+
+Include conf/svhost.conf
</VirtualHost>
EOF
-# Generate mass dynamic virtual hosting configuration
-if [ "$vhost" = "vhost" ]; then
-
-cat >>$root/conf/httpd.conf <<EOF
-# Setup mass dynamic virtual hosting
-NameVirtualHost *:$port
-
-<VirtualHost *:$port>
-ServerName http://vhost.$host:$pport
-ServerAlias *.$host
+# Generate vhost configuration
+cat >$root/conf/vhost.conf <<EOF
+# Generated by: httpd-conf $*
+# Virtual host configuration
UseCanonicalName Off
-VirtualDocumentRoot $htdocs/domains/%1/
-</VirtualHost>
-# Isolate virtual host based requests
-MaxRequestsPerChild 1
+EOF
+
+cat >$root/conf/svhost.conf <<EOF
+# Generated by: httpd-conf $*
+# Static virtual host configuration
+Include conf/vhost.conf
EOF
-fi
+cat >$root/conf/dvhost.conf <<EOF
+# Generated by: httpd-conf $*
+# Mass dynamic virtual host configuration
+Include conf/vhost.conf
+
+EOF
diff --git a/sca-cpp/trunk/modules/http/httpd-ssl-conf b/sca-cpp/trunk/modules/http/httpd-ssl-conf
index 118ed708be..f2f8b01614 100755
--- a/sca-cpp/trunk/modules/http/httpd-ssl-conf
+++ b/sca-cpp/trunk/modules/http/httpd-ssl-conf
@@ -20,21 +20,24 @@
# Generate a minimal HTTPD SSL configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
-host=$2
-sslport=`echo $3 | awk -F "/" '{ print $1 }'`
-sslpport=`echo $3 | awk -F "/" '{ print $2 }'`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
+port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
+sslport=`echo $2 | awk -F "/" '{ print $1 }'`
+sslpport=`echo $2 | awk -F "/" '{ print $2 }'`
if [ "$sslpport" = "" ]; then
sslpport=$sslport
fi
-htdocs=`readlink -f $4`
+htdocs=`echo $conf | awk '{ print $8 }'`
+htdocs=`readlink -f $htdocs`
httpd_prefix=`cat $here/httpd.prefix`
-vhost=$5
# Extract organization name from our CA certificate
org=`openssl x509 -noout -subject -nameopt multiline -in $root/conf/ca.crt | grep organizationName | awk -F "= " '{ print $2 }'`
# Generate HTTPD configuration
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: httpd-ssl-conf $*
# Redirect all HTTP traffic to HTTPS
<Location />
RewriteEngine on
@@ -52,27 +55,20 @@ SSLMutex "file:$root/logs/ssl_mutex"
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
-# Setup HTTPS virtual hosts
+# Setup HTTPS virtual host
Listen $sslport
-SSLCACertificateFile "$root/conf/ca.crt"
-SSLCertificateFile "$root/conf/server.crt"
-SSLCertificateKeyFile "$root/conf/server.key"
-
<VirtualHost *:$sslport>
ServerName https://$host:$sslpport
-UseCanonicalName Off
-# Enable SSL
-Include conf/ssl-vhost.conf
+Include conf/ssl-svhost.conf
# Allow the server admin to view the server status
<Location /server-status>
SetHandler server-status
HostnameLookups on
Deny from All
-Allow from localhost
-Allow from $host
+Allow from all
Require user admin
</Location>
@@ -81,13 +77,14 @@ Require user admin
# Report extended server status
ExtendedStatus On
-# Route all wiring through HTTPS
-SCAWiringServerName https://$host:$sslpport
-
EOF
-# Generate VirtualHost SSL configuration
+# Generate HTTPS vhost configuration
cat >$root/conf/ssl-vhost.conf <<EOF
+# Generated by: httpd-ssl-conf $*
+# Virtual host configuration
+UseCanonicalName Off
+
# Enable SSL
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
@@ -119,31 +116,32 @@ Require valid-user
EOF
-# Generate mass dynamic virtual hosting configuration
-if [ "$vhost" = "vhost" ]; then
+cat >$root/conf/ssl-svhost.conf <<EOF
+# Generated by: httpd-ssl-conf $*
+# Static virtual host configuration
+Include conf/ssl-vhost.conf
-cat >>$root/conf/httpd.conf <<EOF
-# Setup mass dynamic virtual hosting
-NameVirtualHost *:$sslport
-SSLStrictSNIVHostCheck Off
+# Configure SSL certificates
+SSLCACertificateFile "$root/conf/ca.crt"
+SSLCertificateChainFile "$root/conf/ca.crt"
+SSLCertificateFile "$root/conf/server.crt"
+SSLCertificateKeyFile "$root/conf/server.key"
-<VirtualHost *:$sslport>
-ServerName https://vhost.$host:$sslpport
-ServerAlias *.$host
-UseCanonicalName Off
-VirtualDocumentRoot $htdocs/domains/%1/
+EOF
-# Enable SSL
+cat >$root/conf/ssl-dvhost.conf <<EOF
+# Mass dynamic virtual host configuration
+# Generated by: httpd-ssl-conf $*
+Include conf/ssl-vhost.conf
+
+# Configure SSL certificates
SSLCACertificateFile "$root/conf/ca.crt"
+SSLCertificateChainFile "$root/conf/ca.crt"
SSLCertificateFile "$root/conf/vhost.crt"
SSLCertificateKeyFile "$root/conf/vhost.key"
-Include conf/ssl-vhost.conf
-</VirtualHost>
EOF
-fi
-
# Create test users for HTTP basic authentication
$httpd_prefix/bin/htpasswd -bc $root/conf/httpd.passwd test test 2>/dev/null
$httpd_prefix/bin/htpasswd -b $root/conf/httpd.passwd admin admin 2>/dev/null
diff --git a/sca-cpp/trunk/modules/http/proxy-conf b/sca-cpp/trunk/modules/http/proxy-conf
new file mode 100755
index 0000000000..4970950623
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-conf
@@ -0,0 +1,40 @@
+#!/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.
+
+# Generate a minimal HTTPD proxy balancer configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+
+cat >>$root/conf/vhost.conf <<EOF
+# Generated by: proxy-conf $*
+# Configure HTTP proxy and balancer
+ProxyRequests Off
+ProxyPreserveHost On
+ProxyStatus On
+
+ProxyPass / balancer://cluster/
+
+<Proxy balancer://cluster>
+Order deny,allow
+Allow from all
+ProxySet lbmethod=byrequests
+</Proxy>
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-member-conf b/sca-cpp/trunk/modules/http/proxy-member-conf
new file mode 100755
index 0000000000..73c448c065
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-member-conf
@@ -0,0 +1,33 @@
+#!/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.
+
+# Add a proxy balancer member
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+host=$2
+port=`echo $3 | awk -F "/" '{ print $1 }'`
+
+cat >>$root/conf/vhost.conf <<EOF
+# Generated by: proxy-member-conf $*
+# Add proxy balancer member
+BalancerMember balancer://cluster http://$host:$port
+ProxyPassReverse / http://$host:$port/
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-ssl-conf b/sca-cpp/trunk/modules/http/proxy-ssl-conf
new file mode 100755
index 0000000000..bc1b63fc7d
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-ssl-conf
@@ -0,0 +1,70 @@
+#!/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.
+
+# Generate a minimal HTTPD proxy balancer configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+
+cat >>$root/conf/ssl-vhost.conf <<EOF
+# Generated by: proxy-ssl-conf $*
+# Enable SSL proxy
+SSLProxyEngine on
+SSLProxyCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+
+# Configure proxy and balancer
+ProxyRequests Off
+ProxyPreserveHost On
+ProxyStatus On
+
+ProxyPass /balancer-manager !
+ProxyPass / balancer://sslcluster/
+
+<Proxy balancer://sslcluster>
+Order deny,allow
+Allow from all
+ProxySet lbmethod=byrequests
+</Proxy>
+
+# Enable balancer manager
+<Location /balancer-manager>
+SetHandler balancer-manager
+HostnameLookups on
+Deny from all
+Allow from all
+Require user admin
+</Location>
+
+EOF
+
+cat >>$root/conf/ssl-svhost.conf <<EOF
+# Generated by: proxy-ssl-conf $*
+# Setup SSL proxy certificates
+SSLProxyCACertificateFile "$root/conf/ca.crt"
+SSLProxyMachineCertificateFile "$root/conf/server.pem"
+
+EOF
+
+cat >>$root/conf/ssl-dvhost.conf <<EOF
+# Generated by: proxy-ssl-conf $*
+# Setup SSL proxy certificates
+SSLProxyCACertificateFile "$root/conf/ca.crt"
+SSLProxyMachineCertificateFile "$root/conf/server.pem"
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-ssl-member-conf b/sca-cpp/trunk/modules/http/proxy-ssl-member-conf
new file mode 100755
index 0000000000..9f20933e35
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-ssl-member-conf
@@ -0,0 +1,33 @@
+#!/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.
+
+# Add a proxy balancer member
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+host=$2
+sslport=`echo $3 | awk -F "/" '{ print $1 }'`
+
+cat >>$root/conf/ssl-vhost.conf <<EOF
+# Generated by: proxy-ssl-member-conf $*
+# Add proxy balancer member
+BalancerMember balancer://sslcluster https://$host:$sslport
+ProxyPassReverse / https://$host:$sslport/
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/proxy-test b/sca-cpp/trunk/modules/http/proxy-test
new file mode 100755
index 0000000000..b6c9a6a0d9
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/proxy-test
@@ -0,0 +1,37 @@
+#!/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.
+
+# Setup
+./httpd-conf tmp localhost 8091/8090 htdocs
+./httpd-start tmp
+./httpd-conf tmp/proxy localhost 8090 tmp/proxy/htdocs
+./proxy-conf tmp/proxy
+./proxy-member-conf tmp/proxy localhost 8091
+./httpd-start tmp/proxy
+sleep 2
+
+# Test
+./curl-test
+rc=$?
+
+# Cleanup
+./httpd-stop tmp/proxy
+./httpd-stop tmp
+sleep 2
+return $rc
diff --git a/sca-cpp/trunk/modules/http/ssl-ca-conf b/sca-cpp/trunk/modules/http/ssl-ca-conf
index c5a3f8e894..b3c6dbbfa0 100755
--- a/sca-cpp/trunk/modules/http/ssl-ca-conf
+++ b/sca-cpp/trunk/modules/http/ssl-ca-conf
@@ -19,6 +19,7 @@
# Generate a test certification authority certificate
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
host=$2
diff --git a/sca-cpp/trunk/modules/http/ssl-cert-conf b/sca-cpp/trunk/modules/http/ssl-cert-conf
index a7a1103d1a..959b5059e1 100755
--- a/sca-cpp/trunk/modules/http/ssl-cert-conf
+++ b/sca-cpp/trunk/modules/http/ssl-cert-conf
@@ -19,6 +19,7 @@
# Generate a test certificate
here=`readlink -f $0`; here=`dirname $here`
+mkdir -p $1
root=`readlink -f $1`
host=$2
if [ "$3" != "" ]; then
@@ -61,3 +62,8 @@ openssl ca -batch -config $root/conf/openssl-ca.conf -out $root/conf/$certname.c
# Export it to PKCS12 format, that's the format Web browsers want to import
openssl pkcs12 -export -passout pass: -out $root/conf/$certname.p12 -inkey $root/conf/$certname.key -in $root/conf/$certname.crt -certfile $root/conf/ca.crt
+# Convert the certificate to PEM format and concatenate the key to it, for use
+# by mod_proxy
+openssl x509 -in $root/conf/$certname.crt -out $root/conf/$certname.pem
+cat $root/conf/$certname.key >> $root/conf/$certname.pem
+
diff --git a/sca-cpp/trunk/modules/http/ssl-ls b/sca-cpp/trunk/modules/http/ssl-ls
new file mode 100755
index 0000000000..71d40719ca
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/ssl-ls
@@ -0,0 +1,25 @@
+#!/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.
+
+# Generate a test certification authority certificate
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+
+ls $root/conf/*.crt $root/conf/*.key $root/conf/*.pem $root/conf/*.p12 2>/dev/null
+
diff --git a/sca-cpp/trunk/modules/http/vhost-conf b/sca-cpp/trunk/modules/http/vhost-conf
new file mode 100755
index 0000000000..e49a1cd415
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/vhost-conf
@@ -0,0 +1,47 @@
+#!/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.
+
+# Generate mass dynamic virtual hosting configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
+port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
+pport=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $2 }'`
+if [ "$pport" = "" ]; then
+ pport=$port
+fi
+htdocs=`echo $conf | awk '{ print $8 }'`
+htdocs=`readlink -f $htdocs`
+
+cat >>$root/conf/httpd.conf <<EOF
+# Generated by: vhost-conf $*
+# Setup mass dynamic virtual hosting
+NameVirtualHost *:$port
+
+<VirtualHost *:$port>
+ServerName http://vhost.$host:$pport
+ServerAlias *.$host
+VirtualDocumentRoot $htdocs/domains/%1/
+
+Include conf/dvhost.conf
+</VirtualHost>
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/http/vhost-ssl-conf b/sca-cpp/trunk/modules/http/vhost-ssl-conf
new file mode 100755
index 0000000000..8a660278a3
--- /dev/null
+++ b/sca-cpp/trunk/modules/http/vhost-ssl-conf
@@ -0,0 +1,49 @@
+#!/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.
+
+# Generate mass dynamic virtual hosting configuration
+here=`readlink -f $0`; here=`dirname $here`
+root=`readlink -f $1`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
+sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
+sslport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $1 }'`
+sslpport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $2 }'`
+if [ "$sslpport" = "" ]; then
+ sslpport=$sslport
+fi
+htdocs=`echo $conf | awk '{ print $8 }'`
+htdocs=`readlink -f $htdocs`
+
+cat >>$root/conf/httpd.conf <<EOF
+# Generated by: vhost-ssl-conf $*
+# Setup mass dynamic virtual hosting
+NameVirtualHost *:$sslport
+SSLStrictSNIVHostCheck Off
+
+<VirtualHost *:$sslport>
+ServerName https://vhost.$host:$sslpport
+ServerAlias *.$host
+VirtualDocumentRoot $htdocs/domains/%1/
+
+Include conf/ssl-dvhost.conf
+</VirtualHost>
+
+EOF
+
diff --git a/sca-cpp/trunk/modules/java/java-conf b/sca-cpp/trunk/modules/java/java-conf
index 4c03035ca4..e0690d50ec 100755
--- a/sca-cpp/trunk/modules/java/java-conf
+++ b/sca-cpp/trunk/modules/java/java-conf
@@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: java-conf $*
# Support for Java SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_java.so
diff --git a/sca-cpp/trunk/modules/openid/htdocs/logout/index.html b/sca-cpp/trunk/modules/openid/htdocs/logout/index.html
index 6c7a9393cc..55cbfac110 100644
--- a/sca-cpp/trunk/modules/openid/htdocs/logout/index.html
+++ b/sca-cpp/trunk/modules/openid/htdocs/logout/index.html
@@ -20,11 +20,10 @@
<html><body>
<h1>Sign out</h1>
-<form name="signout" action="/" method="GET">
+<form name="signout" action="/login" method="GET">
<script type="text/javascript">
function submitSignout() {
document.cookie = 'open_id_session_id=;expires=' + new Date(1970,01,01).toGMTString() + ';path=/';
- document.signout.action = "/login";
document.signout.submit();
return true;
}
diff --git a/sca-cpp/trunk/modules/openid/openid-conf b/sca-cpp/trunk/modules/openid/openid-conf
index b98b4030c4..206281db38 100755
--- a/sca-cpp/trunk/modules/openid/openid-conf
+++ b/sca-cpp/trunk/modules/openid/openid-conf
@@ -20,17 +20,11 @@
# Generate an OpenID server conf
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
-host=$2
-port=`echo $3 | awk -F "/" '{ print $1 }'`
-pport=`echo $3 | awk -F "/" '{ print $2 }'`
-if [ "$pport" = "" ]; then
- pport=$port
-fi
-htdocs=`readlink -f $4`
openid_prefix=`cat openid.prefix`
# Configure HTTPD mod_auth_openid module
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: openid-conf $*
# Support for OpenID authentication
LoadModule authopenid_module $openid_prefix/modules/mod_auth_openid.so
diff --git a/sca-cpp/trunk/modules/openid/openid-step2-conf b/sca-cpp/trunk/modules/openid/openid-step2-conf
index 4ca4150483..5e46f82d6a 100755
--- a/sca-cpp/trunk/modules/openid/openid-step2-conf
+++ b/sca-cpp/trunk/modules/openid/openid-step2-conf
@@ -20,16 +20,12 @@
# Generate an OpenID Step2 server conf
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
-host=$2
-port=`echo $3 | awk -F "/" '{ print $1 }'`
-pport=`echo $3 | awk -F "/" '{ print $2 }'`
-if [ "$pport" = "" ]; then
- pport=$port
-fi
-htdocs=`readlink -f $4`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
# Configure HTTPD to serve OpenID XRDS and LRDD documents
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: openid-step2-conf $*
# Serve OpenID XRDS document
Alias /openid $root/conf/openid.xrds
<Location /openid>
diff --git a/sca-cpp/trunk/modules/openid/start-test b/sca-cpp/trunk/modules/openid/start-test
index 11a0d0b511..b9d3191b11 100755
--- a/sca-cpp/trunk/modules/openid/start-test
+++ b/sca-cpp/trunk/modules/openid/start-test
@@ -19,8 +19,8 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 htdocs
-./openid-conf tmp localhost 8090 htdocs
-./openid-step2-conf tmp localhost 8090 htdocs
+./openid-conf tmp
+./openid-step2-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/python/python-conf b/sca-cpp/trunk/modules/python/python-conf
index 983679db4d..d4bad3a6d2 100755
--- a/sca-cpp/trunk/modules/python/python-conf
+++ b/sca-cpp/trunk/modules/python/python-conf
@@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: python-conf $*
# Support for Python SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_python.so
diff --git a/sca-cpp/trunk/modules/server/cpp-conf b/sca-cpp/trunk/modules/server/cpp-conf
index bc014ac979..0421e6bf12 100755
--- a/sca-cpp/trunk/modules/server/cpp-conf
+++ b/sca-cpp/trunk/modules/server/cpp-conf
@@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: cpp-conf $*
# Support for C++ SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_eval.so
diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp
index 829edef387..857fd0a1e1 100644
--- a/sca-cpp/trunk/modules/server/mod-eval.hpp
+++ b/sca-cpp/trunk/modules/server/mod-eval.hpp
@@ -769,9 +769,9 @@ const command_rec commands[] = {
AP_INIT_TAKE1("SCAVirtualContribution", (const char*(*)())confVirtualContribution, NULL, RSRC_CONF, "SCA virtual host contribution location"),
AP_INIT_TAKE1("SCAVirtualComposite", (const char*(*)())confVirtualComposite, NULL, RSRC_CONF, "SCA virtual composite location"),
AP_INIT_TAKE12("SCASetEnv", (const char*(*)())confEnv, NULL, OR_FILEINFO, "Environment variable name and optional value"),
- AP_INIT_TAKE1("SSLCACertificateFile", (const char*(*)())confCAFile, NULL, RSRC_CONF, "SSL CA certificate file"),
- AP_INIT_TAKE1("SSLCertificateFile", (const char*(*)())confCertFile, NULL, RSRC_CONF, "SSL certificate file"),
- AP_INIT_TAKE1("SSLCertificateKeyFile", (const char*(*)())confCertKeyFile, NULL, RSRC_CONF, "SSL certificate key file"),
+ AP_INIT_TAKE1("SCAWiringSSLCACertificateFile", (const char*(*)())confCAFile, NULL, RSRC_CONF, "SCA wiring SSL CA certificate file"),
+ AP_INIT_TAKE1("SCAWiringSSLCertificateFile", (const char*(*)())confCertFile, NULL, RSRC_CONF, "SCA wiring SSL certificate file"),
+ AP_INIT_TAKE1("SCAWiringSSLCertificateKeyFile", (const char*(*)())confCertKeyFile, NULL, RSRC_CONF, "SCA wiring SSL certificate key file"),
{NULL, NULL, NULL, 0, NO_ARGS, NULL}
};
diff --git a/sca-cpp/trunk/modules/server/scheme-conf b/sca-cpp/trunk/modules/server/scheme-conf
index fc5f2b3ac8..8c3b26625b 100755
--- a/sca-cpp/trunk/modules/server/scheme-conf
+++ b/sca-cpp/trunk/modules/server/scheme-conf
@@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: scheme-conf $*
# Support for Scheme SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_eval.so
diff --git a/sca-cpp/trunk/modules/server/server-conf b/sca-cpp/trunk/modules/server/server-conf
index 359a8ebc16..4a318c6fce 100755
--- a/sca-cpp/trunk/modules/server/server-conf
+++ b/sca-cpp/trunk/modules/server/server-conf
@@ -21,12 +21,63 @@
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
+conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
+host=`echo $conf | awk '{ print $6 }'`
+port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
+pport=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $2 }'`
+if [ "$pport" = "" ]; then
+ pport=$port
+fi
+servername="http://$host:$pport"
+
+sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
+if [ "$sslconf" != "" ]; then
+ sslport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $1 }'`
+ sslpport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $2 }'`
+ if [ "$sslpport" = "" ]; then
+ sslpport=$sslport
+ fi
+ servername="https://$host:$sslpport"
+fi
+
cat >>$root/conf/httpd.conf <<EOF
+# Generated by: server-conf $*
# Support for SCA component wiring
LoadModule mod_tuscany_wiring $here/libmod_tuscany_wiring.so
+# Route all wiring through the configured server name
+SCAWiringServerName $servername
+
# Serve HTTP binding JavaScript client code
Alias /js/tuscany-ref.js $here/htdocs/js/tuscany-ref.js
EOF
+ssl=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
+if [ "$ssl" != "" ]; then
+ cat >>$root/conf/httpd.conf <<EOF
+# Configure SSL certificates
+SCAWiringSSLCACertificateFile "$root/conf/ca.crt"
+SCAWiringSSLCertificateFile "$root/conf/server.crt"
+SCAWiringSSLCertificateKeyFile "$root/conf/server.key"
+
+EOF
+
+fi
+
+vhost=`cat $root/conf/httpd.conf | grep VirtualDocumentRoot`
+proxy=`cat $root/conf/httpd.conf | grep ProxyPass`
+
+vhost=`cat $root/conf/httpd.conf | grep "# Generated by: vhost-conf"`
+if [ "$vhost" != "" ]; then
+ proxy=`cat $root/conf/httpd.conf | grep "# Generated by: proxy-conf"`
+ if [ "$proxy" = "" ]; then
+ cat >>$root/conf/httpd.conf <<EOF
+# Isolate requests from different virtual hosts
+MaxRequestsPerChild 1
+
+EOF
+
+ fi
+fi
+
diff --git a/sca-cpp/trunk/samples/Makefile.am b/sca-cpp/trunk/samples/Makefile.am
index ff212b7eab..7eb6c7727a 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
+SUBDIRS = store-scheme store-cpp store-python store-java store-gae store-sql store-nosql store-vhost store-cluster
sample_DATA = README
sampledir=$(prefix)/samples
diff --git a/sca-cpp/trunk/samples/store-cluster/Makefile.am b/sca-cpp/trunk/samples/store-cluster/Makefile.am
new file mode 100644
index 0000000000..d1c8ca7915
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/Makefile.am
@@ -0,0 +1,36 @@
+# 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_SQLDB
+if WANT_OPENID
+if WANT_LOG
+if WANT_QUEUE
+
+dist_sample_SCRIPTS = start stop ssl-start
+sampledir = $(prefix)/samples/store-cluster
+
+nobase_dist_sample_DATA = htdocs/*.html htdocs/domains/*/*.html domains/*/*.py domains/*/*.composite
+
+dist_noinst_SCRIPTS = server-test
+#TESTS = server-test
+
+endif
+endif
+endif
+endif
+endif
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/currency-converter.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/currency-converter.py
new file mode 100644
index 0000000000..2fded8f616
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/currency-converter.py
@@ -0,0 +1,29 @@
+# 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.
+
+# Currency converter implementation
+
+def convert(fr, to, amount):
+ if to == "EUR":
+ return amount * 0.70
+ return amount
+
+def symbol(currency):
+ if currency == "EUR":
+ return "E"
+ return "$"
+
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py
new file mode 100644
index 0000000000..3d108f42eb
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/fruits-catalog.py
@@ -0,0 +1,30 @@
+# 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.
+
+# Catalog implementation
+
+def getcatalog(converter, currencyCode):
+ code = currencyCode()
+ def convert(price):
+ return converter("convert", "USD", code, price)
+ symbol = converter("symbol", code)
+ return (
+ (("'javaClass", "services.Item"), ("'name", "Passion"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))),
+ (("'javaClass", "services.Item"), ("'name", "Mango"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))),
+ (("'javaClass", "services.Item"), ("'name", "Pineapple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(1.55)))
+ )
+
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py
new file mode 100644
index 0000000000..405adb85bf
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py
@@ -0,0 +1,75 @@
+# 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.
+
+# Shopping cart implementation
+import uuid
+import sys
+
+cartId = "1234"
+
+# Get the shopping cart from the cache
+# Return an empty cart if not found
+def getcart(id, cache):
+ cart = cache("get", (id,))
+ if cart is None:
+ return ()
+ return cart
+
+# Post a new item to the cart, create a new cart if necessary
+def post(collection, item, cache):
+ id = str(uuid.uuid1())
+ cart = ((item[0], id, item[2]),) + getcart(cartId, cache)
+ cache("put", (cartId,), cart)
+ return (id,)
+
+
+# Find an item in the cart
+def find(id, cart):
+ if cart == ():
+ return ("Item", "0", ())
+ elif id == cart[0][1]:
+ return cart[0]
+ else:
+ return find(id, cart[1:])
+
+# Get items from the cart
+def get(id, cache):
+ if id == ():
+ return ("Your Cart", cartId) + getcart(cartId, cache)
+ return find(id[0], getcart(cartId, cache))
+
+# Delete items from the cart
+def delete(id, cache):
+ if id == ():
+ return cache("delete", (cartId,))
+ return True
+
+# Return the price of an item
+def price(item):
+ return float(filter(lambda x: x[0] == "'price", item[2])[0][1])
+
+# Sum the prices of a list of items
+def sum(items):
+ if items == ():
+ return 0
+ return price(items[0]) + sum(items[1:])
+
+# Return the total price of the items in the cart
+def gettotal(cache):
+ cart = getcart(cartId, cache)
+ return sum(cart)
+
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/store.composite b/sca-cpp/trunk/samples/store-cluster/domains/jane/store.composite
new file mode 100644
index 0000000000..893b4f0ed4
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/store.composite
@@ -0,0 +1,69 @@
+<?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://store"
+ name="store">
+
+ <component name="Store">
+ <t:implementation.python script="store.py"/>
+ <service name="Widget">
+ <t:binding.http uri="store"/>
+ </service>
+ <reference name="catalog" target="Catalog"/>
+ <reference name="shoppingCart" target="ShoppingCart/Cart"/>
+ <reference name="shoppingTotal" target="ShoppingCart/Total"/>
+ </component>
+
+ <component name="Catalog">
+ <t:implementation.python script="fruits-catalog.py"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc uri="catalog"/>
+ </service>
+ <reference name="currencyConverter" target="CurrencyConverter"/>
+ </component>
+
+ <component name="ShoppingCart">
+ <t:implementation.python script="shopping-cart.py"/>
+ <service name="ShoppingCart">
+ <t:binding.atom uri="shoppingCart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc uri="total"/>
+ </service>
+ <reference name="cache" target="Cache"/>
+ </component>
+
+ <component name="CurrencyConverter">
+ <t:implementation.python script="currency-converter.py"/>
+ <service name="CurrencyConverter">
+ <t:binding.jsonrpc uri="currencyConverter"/>
+ </service>
+ </component>
+
+ <component name="Cache">
+ <implementation.cpp path="../../../../components/cache" library="libmemcache"/>
+ <service name="Cache">
+ <t:binding.atom uri="cache"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/store.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/store.py
new file mode 100644
index 0000000000..0b4e0f72fd
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/store.py
@@ -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.
+
+# Store implementation
+
+def post(item, catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("post", item)
+
+def getall(catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("getall")
+
+def get(id, catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("get", id)
+
+def getcatalog(catalog, shoppingCart, shoppingTotal):
+ return catalog("getcatalog")
+
+def gettotal(catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("gettotal")
+
+def deleteall(catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("deleteall")
+
+def delete(id, catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("delete", id)
+
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/currency-converter.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/currency-converter.py
new file mode 100644
index 0000000000..2fded8f616
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/currency-converter.py
@@ -0,0 +1,29 @@
+# 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.
+
+# Currency converter implementation
+
+def convert(fr, to, amount):
+ if to == "EUR":
+ return amount * 0.70
+ return amount
+
+def symbol(currency):
+ if currency == "EUR":
+ return "E"
+ return "$"
+
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py
new file mode 100644
index 0000000000..2a6d726fdc
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/fruits-catalog.py
@@ -0,0 +1,30 @@
+# 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.
+
+# Catalog implementation
+
+def getcatalog(converter, currencyCode):
+ code = currencyCode()
+ def convert(price):
+ return converter("convert", "USD", code, price)
+ symbol = converter("symbol", code)
+ return (
+ (("'javaClass", "services.Item"), ("'name", "Apple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))),
+ (("'javaClass", "services.Item"), ("'name", "Orange"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))),
+ (("'javaClass", "services.Item"), ("'name", "Pear"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(1.55)))
+ )
+
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py
new file mode 100644
index 0000000000..405adb85bf
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py
@@ -0,0 +1,75 @@
+# 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.
+
+# Shopping cart implementation
+import uuid
+import sys
+
+cartId = "1234"
+
+# Get the shopping cart from the cache
+# Return an empty cart if not found
+def getcart(id, cache):
+ cart = cache("get", (id,))
+ if cart is None:
+ return ()
+ return cart
+
+# Post a new item to the cart, create a new cart if necessary
+def post(collection, item, cache):
+ id = str(uuid.uuid1())
+ cart = ((item[0], id, item[2]),) + getcart(cartId, cache)
+ cache("put", (cartId,), cart)
+ return (id,)
+
+
+# Find an item in the cart
+def find(id, cart):
+ if cart == ():
+ return ("Item", "0", ())
+ elif id == cart[0][1]:
+ return cart[0]
+ else:
+ return find(id, cart[1:])
+
+# Get items from the cart
+def get(id, cache):
+ if id == ():
+ return ("Your Cart", cartId) + getcart(cartId, cache)
+ return find(id[0], getcart(cartId, cache))
+
+# Delete items from the cart
+def delete(id, cache):
+ if id == ():
+ return cache("delete", (cartId,))
+ return True
+
+# Return the price of an item
+def price(item):
+ return float(filter(lambda x: x[0] == "'price", item[2])[0][1])
+
+# Sum the prices of a list of items
+def sum(items):
+ if items == ():
+ return 0
+ return price(items[0]) + sum(items[1:])
+
+# Return the total price of the items in the cart
+def gettotal(cache):
+ cart = getcart(cartId, cache)
+ return sum(cart)
+
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/store.composite b/sca-cpp/trunk/samples/store-cluster/domains/joe/store.composite
new file mode 100644
index 0000000000..893b4f0ed4
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/store.composite
@@ -0,0 +1,69 @@
+<?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://store"
+ name="store">
+
+ <component name="Store">
+ <t:implementation.python script="store.py"/>
+ <service name="Widget">
+ <t:binding.http uri="store"/>
+ </service>
+ <reference name="catalog" target="Catalog"/>
+ <reference name="shoppingCart" target="ShoppingCart/Cart"/>
+ <reference name="shoppingTotal" target="ShoppingCart/Total"/>
+ </component>
+
+ <component name="Catalog">
+ <t:implementation.python script="fruits-catalog.py"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc uri="catalog"/>
+ </service>
+ <reference name="currencyConverter" target="CurrencyConverter"/>
+ </component>
+
+ <component name="ShoppingCart">
+ <t:implementation.python script="shopping-cart.py"/>
+ <service name="ShoppingCart">
+ <t:binding.atom uri="shoppingCart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc uri="total"/>
+ </service>
+ <reference name="cache" target="Cache"/>
+ </component>
+
+ <component name="CurrencyConverter">
+ <t:implementation.python script="currency-converter.py"/>
+ <service name="CurrencyConverter">
+ <t:binding.jsonrpc uri="currencyConverter"/>
+ </service>
+ </component>
+
+ <component name="Cache">
+ <implementation.cpp path="../../../../components/cache" library="libmemcache"/>
+ <service name="Cache">
+ <t:binding.atom uri="cache"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/store.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/store.py
new file mode 100644
index 0000000000..0b4e0f72fd
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/store.py
@@ -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.
+
+# Store implementation
+
+def post(item, catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("post", item)
+
+def getall(catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("getall")
+
+def get(id, catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("get", id)
+
+def getcatalog(catalog, shoppingCart, shoppingTotal):
+ return catalog("getcatalog")
+
+def gettotal(catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("gettotal")
+
+def deleteall(catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("deleteall")
+
+def delete(id, catalog, shoppingCart, shoppingTotal):
+ return shoppingCart("delete", id)
+
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html
new file mode 100644
index 0000000000..9fc3247e22
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/jane/index.html
@@ -0,0 +1,157 @@
+<!--
+ * 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>Store</title>
+
+<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+
+}
+
+function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var content = entries[i].getElementsByTagName("content")[0];
+ var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
+ var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
+ list += name + ' - ' + price + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ document.getElementById('total').innerHTML = total;
+}
+
+function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+}
+
+function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + catalogItems[i].price + '</price>' +
+ '</item>' +
+ '</content></entry>';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+}
+function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+}
+function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+}
+
+function init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Jane's Store</h1>
+<div id="store">
+<h2>Catalog</h2>
+<form name="catalogForm">
+<div id="catalog" ></div>
+<br>
+<input type="button" onClick="addToCart()" value="Add to Cart">
+</form>
+<br>
+
+<h2>Your Shopping Cart</h2>
+<form name="shoppingCartForm">
+<div id="shoppingCart"></div>
+<br>
+<div id="total"></div>
+<br>
+<input type="button" onClick="checkoutCart()" value="Checkout">
+<input type="button" onClick="deleteCart()" value="Empty">
+<a href="shoppingCart/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html
new file mode 100644
index 0000000000..e8b722d0d6
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/htdocs/domains/joe/index.html
@@ -0,0 +1,157 @@
+<!--
+ * 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>Store</title>
+
+<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+
+}
+
+function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var content = entries[i].getElementsByTagName("content")[0];
+ var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
+ var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
+ list += name + ' - ' + price + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ document.getElementById('total').innerHTML = total;
+}
+
+function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+}
+
+function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + catalogItems[i].price + '</price>' +
+ '</item>' +
+ '</content></entry>';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+}
+function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+}
+function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+}
+
+function init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Joe's Store</h1>
+<div id="store">
+<h2>Catalog</h2>
+<form name="catalogForm">
+<div id="catalog" ></div>
+<br>
+<input type="button" onClick="addToCart()" value="Add to Cart">
+</form>
+<br>
+
+<h2>Your Shopping Cart</h2>
+<form name="shoppingCartForm">
+<div id="shoppingCart"></div>
+<br>
+<div id="total"></div>
+<br>
+<input type="button" onClick="checkoutCart()" value="Checkout">
+<input type="button" onClick="deleteCart()" value="Empty">
+<a href="shoppingCart/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
diff --git a/sca-cpp/trunk/samples/store-cluster/htdocs/index.html b/sca-cpp/trunk/samples/store-cluster/htdocs/index.html
new file mode 100644
index 0000000000..21e32d7efc
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/htdocs/index.html
@@ -0,0 +1,34 @@
+<!--
+ * 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>Store</title>
+</head>
+
+<body>
+<h1>Store</h1>
+<p>For this sample to work, add the sample domain to your /etc/hosts as follows:<br/>
+127.0.0.1 sca-store.com jane.sca-store.com joe.sca-store.com</p>
+
+<p/>
+<p>Jane's store at <a href="http://jane.sca-store.com/">jane.sca-store.com</a>
+<br/>Joe's store at <a href="http://joe.sca-store.com/">joe.sca-store.com</a></p>
+
+</body>
+</html>
diff --git a/sca-cpp/trunk/samples/store-cluster/server-test b/sca-cpp/trunk/samples/store-cluster/server-test
new file mode 100755
index 0000000000..2f657c4ce5
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/server-test
@@ -0,0 +1,62 @@
+#!/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.
+
+echo "Testing..."
+here=`readlink -f $0`; here=`dirname $here`
+curl_prefix=`cat $here/../../modules/http/curl.prefix`
+
+# Setup
+./start
+sleep 2
+
+# For this test to work, add the test domain to your etc/hosts as follows:
+# 127.0.0.1 sca-store.com joe.sca-store.com joe.sca-store.com
+# then run ../../ubuntu/ip-redirect-all 80 8091
+
+# Test HTTP GET
+$curl_prefix/bin/curl http://joe.sca-store.com/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/domains/joe/index.html
+rc=$?
+
+# Test Catalog
+if [ "$rc" = "0" ]; then
+ $curl_prefix/bin/curl http://joe.sca-store.com/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null
+ diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt
+ rc=$?
+fi
+
+# Test Shopping Cart
+if [ "$rc" = "0" ]; then
+ $curl_prefix/bin/curl http://joe.sca-store.com/references/Store/shoppingCart -X POST -H "Content-type: application/atom+xml" --data @../store-cpp/htdocs/test/shopping-cart-entry.xml 2>/dev/null
+ rc=$?
+fi
+if [ "$rc" = "0" ]; then
+ $curl_prefix/bin/curl http://joe.sca-store.com/references/Store/shoppingCart >tmp/shopping-cart-feed.xml 2>/dev/null
+ grep "3.55" tmp/shopping-cart-feed.xml >/dev/null
+ rc=$?
+fi
+
+# Cleanup
+./stop
+sleep 2
+
+if [ "$rc" = "0" ]; then
+ echo "OK"
+fi
+return $rc
diff --git a/sca-cpp/trunk/samples/store-cluster/ssl-start b/sca-cpp/trunk/samples/store-cluster/ssl-start
new file mode 100755
index 0000000000..4acd41bc2d
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/ssl-start
@@ -0,0 +1,113 @@
+#!/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.
+
+# Generate SSL certificates
+../../modules/http/ssl-ca-conf tmp/ssl sca-store.com
+../../modules/http/ssl-cert-conf tmp/ssl sca-store.com server
+../../modules/http/ssl-cert-conf tmp/ssl *.sca-store.com vhost
+
+# Start three identical app servers
+../../modules/http/httpd-conf tmp/server1 sca-store.com 8101/80 htdocs
+../../modules/http/vhost-conf tmp/server1
+cp `../../modules/http/ssl-ls tmp/ssl` tmp/server1/conf
+../../modules/http/httpd-ssl-conf tmp/server1 8441/443
+../../modules/http/vhost-ssl-conf tmp/server1
+../../modules/server/server-conf tmp/server1
+../../modules/python/python-conf tmp/server1
+cat >>tmp/server1/conf/httpd.conf <<EOF
+# Configure SCA Composite for mass dynamic virtual hosting
+SCAVirtualContribution `pwd`/domains/
+SCAVirtualComposite store.composite
+
+EOF
+../../modules/http/httpd-start tmp/server1
+
+../../modules/http/httpd-conf tmp/server2 sca-store.com 8102/80 htdocs
+../../modules/http/vhost-conf tmp/server2
+cp `../../modules/http/ssl-ls tmp/ssl` tmp/server2/conf
+../../modules/http/httpd-ssl-conf tmp/server2 8442/443
+../../modules/http/vhost-ssl-conf tmp/server2
+../../modules/server/server-conf tmp/server2
+../../modules/python/python-conf tmp/server2
+cat >>tmp/server2/conf/httpd.conf <<EOF
+# Configure SCA Composite for mass dynamic virtual hosting
+SCAVirtualContribution `pwd`/domains/
+SCAVirtualComposite store.composite
+
+EOF
+../../modules/http/httpd-start tmp/server2
+
+../../modules/http/httpd-conf tmp/server3 sca-store.com 8103/80 htdocs
+../../modules/http/vhost-conf tmp/server3
+cp `../../modules/http/ssl-ls tmp/ssl` tmp/server3/conf
+../../modules/http/httpd-ssl-conf tmp/server3 8443/443
+../../modules/http/vhost-ssl-conf tmp/server3
+../../modules/server/server-conf tmp/server3
+../../modules/python/python-conf tmp/server3
+cat >>tmp/server3/conf/httpd.conf <<EOF
+# Configure SCA Composite for mass dynamic virtual hosting
+SCAVirtualContribution `pwd`/domains/
+SCAVirtualComposite store.composite
+
+EOF
+../../modules/http/httpd-start tmp/server3
+
+# Start two identical proxy balancers
+../../modules/http/httpd-conf tmp/proxy1 sca-store.com 8091/80 tmp/proxy1/htdocs
+../../modules/http/vhost-conf tmp/proxy1
+../../modules/http/proxy-conf tmp/proxy1 sca-store.com 8091/80 tmp/proxy1/htdocs
+cp `../../modules/http/ssl-ls tmp/ssl` tmp/proxy1/conf
+../../modules/http/httpd-ssl-conf tmp/proxy1 8093/443
+../../modules/http/vhost-ssl-conf tmp/proxy1
+../../modules/http/proxy-ssl-conf tmp/proxy1
+../../modules/http/proxy-member-conf tmp/proxy1 localhost 8101
+../../modules/http/proxy-ssl-member-conf tmp/proxy1 localhost 8441
+../../modules/http/proxy-member-conf tmp/proxy1 localhost 8102
+../../modules/http/proxy-ssl-member-conf tmp/proxy1 localhost 8442
+../../modules/http/proxy-member-conf tmp/proxy1 localhost 8103
+../../modules/http/proxy-ssl-member-conf tmp/proxy1 localhost 8443
+../../modules/http/httpd-start tmp/proxy1
+
+../../modules/http/httpd-conf tmp/proxy2 sca-store.com 8092/80 tmp/proxy2/htdocs
+../../modules/http/vhost-conf tmp/proxy2
+../../modules/http/proxy-conf tmp/proxy2 sca-store.com 8092/80 tmp/proxy2/htdocs
+cp `../../modules/http/ssl-ls tmp/ssl` tmp/proxy2/conf
+../../modules/http/httpd-ssl-conf tmp/proxy2 8094/443
+../../modules/http/vhost-ssl-conf tmp/proxy2
+../../modules/http/proxy-ssl-conf tmp/proxy2
+../../modules/http/proxy-member-conf tmp/proxy2 localhost 8101
+../../modules/http/proxy-ssl-member-conf tmp/proxy2 localhost 8441
+../../modules/http/proxy-member-conf tmp/proxy2 localhost 8102
+../../modules/http/proxy-ssl-member-conf tmp/proxy2 localhost 8442
+../../modules/http/proxy-member-conf tmp/proxy2 localhost 8103
+../../modules/http/proxy-ssl-member-conf tmp/proxy2 localhost 8443
+../../modules/http/httpd-start tmp/proxy2
+
+# Start a shared memcached
+# Todo change to one per server
+../../components/cache/memcached-start
+
+# Redirect traffic from port 80 to 8091 and use proxy1
+#../../ubuntu/ip-redirect-all 80 8091
+#../../ubuntu/ip-redirect-all 443 8093
+
+# Redirect traffic from port 80 to 8092 and use proxy2
+#../../ubuntu/ip-redirect-all 80 8092
+#../../ubuntu/ip-redirect-all 443 8094
+
diff --git a/sca-cpp/trunk/samples/store-cluster/start b/sca-cpp/trunk/samples/store-cluster/start
new file mode 100755
index 0000000000..809e9edad9
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/start
@@ -0,0 +1,83 @@
+#!/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.
+
+# Start three identical app servers
+../../modules/http/httpd-conf tmp/server1 sca-store.com 8101/80 htdocs
+../../modules/http/vhost-conf tmp/server1
+../../modules/server/server-conf tmp/server1
+../../modules/python/python-conf tmp/server1
+cat >>tmp/server1/conf/httpd.conf <<EOF
+# Configure SCA Composite for mass dynamic virtual hosting
+SCAVirtualContribution `pwd`/domains/
+SCAVirtualComposite store.composite
+
+EOF
+../../modules/http/httpd-start tmp/server1
+
+../../modules/http/httpd-conf tmp/server2 sca-store.com 8102/80 htdocs
+../../modules/http/vhost-conf tmp/server2
+../../modules/server/server-conf tmp/server2
+../../modules/python/python-conf tmp/server2
+cat >>tmp/server2/conf/httpd.conf <<EOF
+# Configure SCA Composite for mass dynamic virtual hosting
+SCAVirtualContribution `pwd`/domains/
+SCAVirtualComposite store.composite
+
+EOF
+../../modules/http/httpd-start tmp/server2
+
+../../modules/http/httpd-conf tmp/server3 sca-store.com 8103/80 htdocs
+../../modules/http/vhost-conf tmp/server3
+../../modules/server/server-conf tmp/server3
+../../modules/python/python-conf tmp/server3
+cat >>tmp/server3/conf/httpd.conf <<EOF
+# Configure SCA Composite for mass dynamic virtual hosting
+SCAVirtualContribution `pwd`/domains/
+SCAVirtualComposite store.composite
+
+EOF
+../../modules/http/httpd-start tmp/server3
+
+# Start two identical proxy balancers
+../../modules/http/httpd-conf tmp/proxy1 sca-store.com 8091/80 tmp/proxy1/htdocs
+../../modules/http/vhost-conf tmp/proxy1
+../../modules/http/proxy-conf tmp/proxy1
+../../modules/http/proxy-member-conf tmp/proxy1 localhost 8101
+../../modules/http/proxy-member-conf tmp/proxy1 localhost 8102
+../../modules/http/proxy-member-conf tmp/proxy1 localhost 8103
+../../modules/http/httpd-start tmp/proxy1
+
+../../modules/http/httpd-conf tmp/proxy2 sca-store.com 8092/80 tmp/proxy2/htdocs
+../../modules/http/vhost-conf tmp/proxy2
+../../modules/http/proxy-conf tmp/proxy2
+../../modules/http/proxy-member-conf tmp/proxy2 localhost 8101
+../../modules/http/proxy-member-conf tmp/proxy2 localhost 8102
+../../modules/http/proxy-member-conf tmp/proxy2 localhost 8103
+../../modules/http/httpd-start tmp/proxy2
+
+# Start a shared memcached
+# Todo change to one per server
+../../components/cache/memcached-start
+
+# Redirect traffic from port 80 to 8091 and use proxy1
+#../../ubuntu/ip-redirect-all 80 8091
+
+# Redirect traffic from port 80 to 8092 and use proxy2
+#../../ubuntu/ip-redirect-all 80 8092
+
diff --git a/sca-cpp/trunk/samples/store-cluster/stop b/sca-cpp/trunk/samples/store-cluster/stop
new file mode 100755
index 0000000000..375e5de698
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cluster/stop
@@ -0,0 +1,25 @@
+#!/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/server1
+../../modules/http/httpd-stop tmp/server2
+../../modules/http/httpd-stop tmp/server3
+../../modules/http/httpd-stop tmp/proxy1
+../../modules/http/httpd-stop tmp/proxy2
+../../components/cache/memcached-stop
diff --git a/sca-cpp/trunk/samples/store-cpp/ssl-start b/sca-cpp/trunk/samples/store-cpp/ssl-start
index 87622e48b0..831fe878f8 100755
--- a/sca-cpp/trunk/samples/store-cpp/ssl-start
+++ b/sca-cpp/trunk/samples/store-cpp/ssl-start
@@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
+../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/cpp-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-java/ssl-start b/sca-cpp/trunk/samples/store-java/ssl-start
index 2573e5189a..1da5038102 100755
--- a/sca-cpp/trunk/samples/store-java/ssl-start
+++ b/sca-cpp/trunk/samples/store-java/ssl-start
@@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
+../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/java/java-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-nosql/ssl-start b/sca-cpp/trunk/samples/store-nosql/ssl-start
index 9dd9ce11bb..4fd9392ca7 100755
--- a/sca-cpp/trunk/samples/store-nosql/ssl-start
+++ b/sca-cpp/trunk/samples/store-nosql/ssl-start
@@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
+../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-python/redirect b/sca-cpp/trunk/samples/store-python/redirect
index 6430a6b274..f73b342bf8 100755
--- a/sca-cpp/trunk/samples/store-python/redirect
+++ b/sca-cpp/trunk/samples/store-python/redirect
@@ -18,7 +18,6 @@
# under the License.
# Redirect ports 80 and 443
-intf=$1
-../../ubuntu/ip-redirect 80 8090 $intf
-../../ubuntu/ip-redirect 443 8453 $intf
+../../ubuntu/ip-redirect-all 80 8090
+../../ubuntu/ip-redirect-all 443 8453
diff --git a/sca-cpp/trunk/samples/store-python/ssl-start b/sca-cpp/trunk/samples/store-python/ssl-start
index fa3efcbe14..8f83508578 100755
--- a/sca-cpp/trunk/samples/store-python/ssl-start
+++ b/sca-cpp/trunk/samples/store-python/ssl-start
@@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
+../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-python/uec2-start b/sca-cpp/trunk/samples/store-python/uec2-start
index 57f8c5ef22..af98e1ac7f 100755
--- a/sca-cpp/trunk/samples/store-python/uec2-start
+++ b/sca-cpp/trunk/samples/store-python/uec2-start
@@ -25,13 +25,13 @@ else
fi
# Ports 80, 443, 8090, 8453 need to be open
-sudo ../../ubuntu/ip-redirect 80 8090
-sudo ../../ubuntu/ip-redirect 443 8453
+sudo ../../ubuntu/ip-redirect-all 80 8090
+sudo ../../ubuntu/ip-redirect-all 443 8453
../../modules/http/ssl-ca-conf tmp $host
../../modules/http/ssl-cert-conf tmp $host
../../modules/http/httpd-conf tmp $host 8090/80 htdocs
-../../modules/http/httpd-ssl-conf tmp $host 8453/443 htdocs
+../../modules/http/httpd-ssl-conf tmp 8453/443
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-scheme/ssl-start b/sca-cpp/trunk/samples/store-scheme/ssl-start
index 5060137cd5..f50c16bc39 100755
--- a/sca-cpp/trunk/samples/store-scheme/ssl-start
+++ b/sca-cpp/trunk/samples/store-scheme/ssl-start
@@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
+../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-sql/ssl-start b/sca-cpp/trunk/samples/store-sql/ssl-start
index ea60c527c4..46e46dd32c 100755
--- a/sca-cpp/trunk/samples/store-sql/ssl-start
+++ b/sca-cpp/trunk/samples/store-sql/ssl-start
@@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
+../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-vhost/ssl-start b/sca-cpp/trunk/samples/store-vhost/ssl-start
index 368a664674..b4e51e0be4 100755
--- a/sca-cpp/trunk/samples/store-vhost/ssl-start
+++ b/sca-cpp/trunk/samples/store-vhost/ssl-start
@@ -23,8 +23,10 @@
../../modules/http/ssl-ca-conf tmp sca-store.com
../../modules/http/ssl-cert-conf tmp sca-store.com server
../../modules/http/ssl-cert-conf tmp *.sca-store.com vhost
-../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs vhost
-../../modules/http/httpd-ssl-conf tmp sca-store.com 8453 htdocs vhost
+../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs
+../../modules/http/vhost-conf tmp
+../../modules/http/httpd-ssl-conf tmp 8453
+../../modules/http/vhost-ssl-conf tmp
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-vhost/start b/sca-cpp/trunk/samples/store-vhost/start
index 01173e68b7..9f218807f9 100755
--- a/sca-cpp/trunk/samples/store-vhost/start
+++ b/sca-cpp/trunk/samples/store-vhost/start
@@ -17,7 +17,8 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs vhost
+../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs
+../../modules/http/vhost-conf tmp
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/samples/store-vhost/uec2-start b/sca-cpp/trunk/samples/store-vhost/uec2-start
index ddf70975ef..c4720cafd5 100755
--- a/sca-cpp/trunk/samples/store-vhost/uec2-start
+++ b/sca-cpp/trunk/samples/store-vhost/uec2-start
@@ -26,14 +26,16 @@ else
fi
# Ports 80, 443, 8090, 8453 need to be open
-sudo ../../ubuntu/ip-redirect 80 8090
-sudo ../../ubuntu/ip-redirect 443 8453
+sudo ../../ubuntu/ip-redirect-all 80 8090
+sudo ../../ubuntu/ip-redirect-all 443 8453
../../modules/http/ssl-ca-conf tmp $host
../../modules/http/ssl-cert-conf tmp $host server
../../modules/http/ssl-cert-conf tmp "*.$host" vhost
-../../modules/http/httpd-conf tmp $host 8090/80 htdocs vhost
-../../modules/http/httpd-ssl-conf tmp $host 8453/443 htdocs vhost
+../../modules/http/httpd-conf tmp $host 8090/80 htdocs
+../../modules/http/vhost-conf tmp
+../../modules/http/httpd-ssl-conf tmp 8453/443
+../../modules/http/vhost-ssl-conf tmp
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/ubuntu/Makefile.am b/sca-cpp/trunk/ubuntu/Makefile.am
index 3e81baa328..c65569fbef 100644
--- a/sca-cpp/trunk/ubuntu/Makefile.am
+++ b/sca-cpp/trunk/ubuntu/Makefile.am
@@ -15,5 +15,5 @@
# specific language governing permissions and limitations
# under the License.
-dist_noinst_SCRIPTS = ubuntu-bin-image ubuntu-dev-image ubuntu-gcc-4.5 ubuntu-install ubuntu-install-all uec2-bin-image uec2-conf uec2-setenv uec2-start uec2-status uec2-stop
+dist_noinst_SCRIPTS = ip-redirect ip-redirect-all ubuntu-bin-image ubuntu-bin-all-image ubuntu-dev-image ubuntu-dev-all-image ubuntu-gcc-4.5 ubuntu-install ubuntu-install-all uec2-bin-image uec2-bin-all-image uec2-dev-image uec2-dev-all-image uec2-conf uec2-setenv uec2-ssh uec2-start uec2-status uec2-stop
diff --git a/sca-cpp/trunk/ubuntu/ip-redirect b/sca-cpp/trunk/ubuntu/ip-redirect
index fa18a7c353..93c60ccfb7 100755
--- a/sca-cpp/trunk/ubuntu/ip-redirect
+++ b/sca-cpp/trunk/ubuntu/ip-redirect
@@ -15,18 +15,19 @@
# specific language governing permissions and limitations
# under the License.
-# Redirect TCP/IP traffic from one port to another port, useful to handle
-# incoming traffic on standard reserved ports like 80 or 443 for example
-# in an unprivileged user server process bound to a non-reserved port
-# Example: ip-redirect 80 8090 eth0
+# Redirect TCP/IP traffic to a particular IP address from one port to another
+# port. This is useful to handle incoming traffic on a standard reserved port
+# like 80 or 443 for example in an unprivileged user process bound to a non
+# reserved port.
+# Example: ip-redirect 80 8090 10.1.1.1
-source=$1
-target=$2
-if [ "$3" != "" ]; then
- intf=$3
-else
- intf="eth0"
-fi
+sport=$1
+tport=$2
+dest=$3
-sudo /sbin/iptables -t nat -A PREROUTING -i $intf -p tcp --dport $source -j REDIRECT --to-port $target
+# Redirect external incoming traffic
+sudo /sbin/iptables -t nat -A PREROUTING --destination $dest -p tcp --dport $sport -j REDIRECT --to-port $tport
+
+# Redirect local traffic as well
+sudo /sbin/iptables -t nat -A OUTPUT --destination $dest -p tcp --dport $sport -j REDIRECT --to-port $tport
diff --git a/sca-cpp/trunk/ubuntu/ip-redirect-all b/sca-cpp/trunk/ubuntu/ip-redirect-all
new file mode 100755
index 0000000000..aba5bc15ae
--- /dev/null
+++ b/sca-cpp/trunk/ubuntu/ip-redirect-all
@@ -0,0 +1,26 @@
+# 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.
+
+# Redirect TCP/IP traffic to all local addresses from one port to another
+# Example: ip-redirect 80 8090
+
+here=`readlink -f $0`; here=`dirname $here`
+sport=$1
+tport=$2
+
+/sbin/ifconfig | grep "inet addr:" | awk -F ":" '{ print $2 }' | awk '{ print $1 }' | xargs -i $here/ip-redirect $sport $tport {}
+
diff --git a/sca-cpp/trunk/ubuntu/uec2-bin-all-image b/sca-cpp/trunk/ubuntu/uec2-bin-all-image
new file mode 100755
index 0000000000..10e9efa241
--- /dev/null
+++ b/sca-cpp/trunk/ubuntu/uec2-bin-all-image
@@ -0,0 +1,23 @@
+# 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.
+
+# Install a Tuscany image on an EC2 instance
+host=$1
+
+# Download and execute Tuscany SCA install script
+ssh -i $HOME/.ec2/ec2-tuscany-keypair.pem ubuntu@$host "wget http://svn.apache.org/repos/asf/tuscany/sca-cpp/trunk/ubuntu/ubuntu-bin-all-image; chmod 700 ./ubuntu-bin-all-image; ./ubuntu-bin-all-image"
+
diff --git a/sca-cpp/trunk/ubuntu/uec2-dev-all-image b/sca-cpp/trunk/ubuntu/uec2-dev-all-image
new file mode 100755
index 0000000000..f8ec8e5164
--- /dev/null
+++ b/sca-cpp/trunk/ubuntu/uec2-dev-all-image
@@ -0,0 +1,23 @@
+# 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.
+
+# Build a Tuscany image on an EC2 instance
+host=$1
+
+# Download and execute Tuscany SCA install script
+ssh -i $HOME/.ec2/ec2-tuscany-keypair.pem ubuntu@$host "wget http://svn.apache.org/repos/asf/tuscany/sca-cpp/trunk/ubuntu/ubuntu-dev-all-image; chmod 700 ./ubuntu-dev-all-image; ./ubuntu-dev-all-image"
+