summaryrefslogtreecommitdiffstats
path: root/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples')
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/Makefile.am18
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/Makefile.am21
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/README32
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite28
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am24
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py50
-rwxr-xr-xsca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh48
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType31
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php89
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType29
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php47
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType25
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php36
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am23
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php39
-rw-r--r--sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite44
16 files changed, 584 insertions, 0 deletions
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/Makefile.am b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/Makefile.am
new file mode 100644
index 0000000000..920828ef4f
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/Makefile.am
@@ -0,0 +1,18 @@
+# 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.
+
+SUBDIRS = PHPCalculator \ No newline at end of file
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/Makefile.am b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/Makefile.am
new file mode 100644
index 0000000000..fd34c6442a
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/Makefile.am
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+deploydir=$(prefix)/samples/PHPCalculator/deploy
+SUBDIRS = sample.calculator sample.calculator.client
+EXTRA_DIST = *.composite
+deploy_DATA = *.composite
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/README b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/README
new file mode 100644
index 0000000000..dbee1f5f85
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/README
@@ -0,0 +1,32 @@
+Tuscany SCA for C++ Samples - PHP Calculator Sample
+===================================================
+
+This is a simple sample to show how an SCA composite can wire together
+a number of components to implement a Calculator service and expose that service as
+to a number of different tpyes of client. The sample components are implemented in various
+ways to demonstrate the different features of the PHP SCA extension.
+
+There are two sub projects in this workspace:
+ - sample.calculator
+ This contains the source code and SCDL artifacts for the SCA Calculator
+ composite implementing the sample Calculator
+
+ - sample.calculator.client
+ A sample client which does a local call to the Calculator service
+
+A Python client is used because the work to enable PHP to host SCA is not done yet
+
+Windows
+=======
+tba
+
+Linux
+=====
+
+The make install will deploy this under $TUSCANY_SCACPP/extensions/php/samples
+
+To run the sample
+
+cd $TUSCANY_SCACPP/extensions/php/samples/PHPCalculator/deploy/sample.calculator.client
+./runclient.sh
+
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite
new file mode 100644
index 0000000000..ada4d89a1c
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite
@@ -0,0 +1,28 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+ name="sample.calculator.app">
+
+ <component name="sample.calculator.CalculatorComponent">
+ <implementation.composite name="sample.calculator" />
+ </component>
+
+</composite>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am
new file mode 100644
index 0000000000..548f9bdcb8
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am
@@ -0,0 +1,24 @@
+# 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.
+
+deploydir=$(prefix)/samples/PHPCalculator/deploy
+clientdir=$(deploydir)/sample.calculator.client
+
+client_DATA = *.py
+client_SCRIPTS = runclient.sh
+EXTRA_DIST = *.py *.php runclient.sh
+
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py
new file mode 100644
index 0000000000..d4b37ee2b2
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+#
+#
+# This Python code is a simple sample that provides a Python
+# client for the Calculator sample
+
+
+import sys
+import sca
+
+op = sys.argv[1]
+val1 = sys.argv[2]
+val2 = sys.argv[3]
+
+# Locate the calculator service
+calc = sca.locateservice("CalculatorComponent/CalculatorService")
+
+# Invoke the calculator operations
+if op == 'add':
+ result = calc.add(val1, val2)
+
+elif op == 'sub':
+ result = calc.sub(val1, val2)
+
+elif op == 'mul':
+ result = calc.mul(val1, val2)
+
+elif op == 'div':
+ result = calc.div(val1, val2)
+
+
+print "calculator_client: ",op,"(",val1,",",val2,") = ",result
+
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh
new file mode 100755
index 0000000000..54ebfdbde4
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh
@@ -0,0 +1,48 @@
+#!/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.
+
+APFULLDIR=`pwd`
+
+if [ x$TUSCANY_SCACPP = x ]; then
+echo "TUSCANY_SCACPP not set"
+exit;
+fi
+echo "Using SCA installed at $TUSCANY_SCACPP"
+
+if [ x$TUSCANY_SDOCPP = x ]; then
+echo "TUSCANY_SDOCPP not set"
+exit;
+fi
+echo "Using SDO installed at $TUSCANY_SDOCPP"
+
+if [ x$PYTHON_LIB != x ]; then
+echo "Using Python library installed at $PYTHON_LIB"
+export LD_LIBRARY_PATH=$PYTHON_LIB:$LD_LIBRARY_PATH
+export PATH=$PYTHON_LIB/../bin:$PATH
+fi
+
+export LD_LIBRARY_PATH=$PHP_SCA_SDO_LIB:$TUSCANY_SCACPP/lib:$TUSCANY_SCACPP/extensions/python/lib:$TUSCANY_SDOCPP/lib:$LD_LIBRARY_PATH
+export PYTHONPATH=$TUSCANY_SCACPP/extensions/python/lib:$PYTHONPATH
+
+export TUSCANY_SCACPP_ROOT=$APFULLDIR/../
+export TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent
+export TUSCANY_SCACPP_BASE_URI=http://localhost:9090
+
+cd $TUSCANY_SCACPP_ROOT/sample.calculator.client
+python calculator_client.py mul 7 6
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType
new file mode 100644
index 0000000000..5a6c3a199e
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService">
+ <interface.php/>
+ </service>
+
+ <reference name="div_service">
+ <interface.php/>
+ </reference>
+
+</componentType>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php
new file mode 100644
index 0000000000..f0f35bab56
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php
@@ -0,0 +1,89 @@
+<?php
+# 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.
+#
+#
+include 'SCA/SCA.php';
+
+/**
+ * @service
+ * @binding.ws
+ */
+class Calculator {
+
+
+ /**
+ * @reference
+ * @binding.php Multiply.php
+ */
+ public $mul_service;
+
+ /**
+ * @reference
+ * @binding.tuscany div_service
+ */
+ public $div_service;
+
+ /**
+ * Addition
+ *
+ * @param float $num1 (the first number)
+ * @param float $num2 (the second number)
+ * @return float The result
+ */
+ function add($num1, $num2) {
+ printf("in Calculator::add");
+ return $num1 + $num2;
+// return $this->add_service->add($num1, $num2);
+ }
+
+ /**
+ * Subtraction
+ *
+ * @param float $num1 (the first number)
+ * @param float $num2 (the second number)
+ * @return float The result
+ */
+ function sub($num1, $num2) {
+ return $num1 - $num2;
+// return $this->sub_service->sub($num1, $num2);
+ }
+
+ /**
+ * Multiplication
+ *
+ * @param float $num1 (the first number)
+ * @param float $num2 (the second number)
+ * @return float The result
+ */
+ function mul($num1, $num2) {
+ return $this->mul_service->mul($num1, $num2);
+ }
+
+ /**
+ * Division
+ *
+ * @param float $num1 (the first number)
+ * @param float $num2 (the second number)
+ * @return float The result
+ */
+ function div($num1, $num2) {
+ return $this->div_service->div($num1, $num2);
+ }
+}
+
+?>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType
new file mode 100644
index 0000000000..b50b20d9c6
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="DivideService">
+ <interface.php/>
+ </service>
+
+ <reference name="log_service">
+ <interface.php/>
+ </reference>
+</componentType>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php
new file mode 100644
index 0000000000..5a08e5b063
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php
@@ -0,0 +1,47 @@
+<?php
+# 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.
+#
+#
+
+/**
+ * @service
+ * @binding.php
+ */
+class Divide {
+
+ /**
+ * Division
+ *
+ * @param float $num1 (the first number)
+ * @param float $num2 (the second number)
+ * @return float The result
+ */
+ function div($num1, $num2) {
+
+ $result = $num1 / $num2;
+
+ $log_proxy = SCA::getService("log_service");
+ $log_proxy->log_message($result);
+
+ return $result;
+
+ }
+
+}
+
+?>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType
new file mode 100644
index 0000000000..f945c6af8c
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType
@@ -0,0 +1,25 @@
+<?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.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="LogService">
+ <interface.php/>
+ </service>
+</componentType>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php
new file mode 100644
index 0000000000..0a955f36d3
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php
@@ -0,0 +1,36 @@
+<?php
+# 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.
+#
+#
+
+/**
+ * @service
+ */
+class Log {
+
+ /**
+ * Log
+ *
+ * @param string $message (the message to be logged)
+ */
+ function log_message($message) {
+ SCA::$logger->toLog('>>> ' . $message);
+ }
+}
+
+?>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am
new file mode 100644
index 0000000000..10020c4f03
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am
@@ -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.
+
+deploydir=$(prefix)/samples/PHPCalculator/deploy
+compositedir=$(deploydir)/sample.calculator
+
+composite_DATA = *.composite *.componentType *.php
+EXTRA_DIST = *.composite *.componentType *.php
+
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php
new file mode 100644
index 0000000000..ed2e75edc8
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php
@@ -0,0 +1,39 @@
+<?php
+# 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.
+#
+#
+require 'SCA/SCA.php';
+
+class Multiply {
+
+ /**
+ * @reference
+ * @binding.php Log.php
+ */
+ public $log_service;
+
+ function mul($num1, $num2) {
+ $result = $num1 * $num2;
+
+// $this->log_service->log_message($result);
+
+ return $result;
+ }
+}
+
+?>
diff --git a/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite
new file mode 100644
index 0000000000..f1a82a70db
--- /dev/null
+++ b/sca-cpp/branches/cpp-contrib/contrib/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite
@@ -0,0 +1,44 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+ name="sample.calculator">
+
+ <component name="CalculatorComponent">
+ <implementation.php module="Calculator" class="Calculator" scope="composite"/>
+ <reference name="div_service">DivideComponent</reference>
+ </component>
+
+
+ <component name="DivideComponent">
+ <implementation.php module="Divide" class="Divide" scope="composite"/>
+ <reference name="log_service">LogComponent</reference>
+ </component>
+
+ <component name="LogComponent">
+ <implementation.php module="Log" class="Log" scope="composite"/>
+ </component>
+
+
+
+
+
+</composite>
+