You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2007/03/07 13:28:59 UTC
svn commit: r515550 - in
/incubator/tuscany/cpp/sca/runtime/extensions/php/samples: ./
PHPCalculator/ PHPCalculator/sample.calculator.client/
PHPCalculator/sample.calculator/
Author: robbinspg
Date: Wed Mar 7 04:28:58 2007
New Revision: 515550
URL: http://svn.apache.org/viewvc?view=rev&rev=515550
Log:
Add simplified sample to php extension
Added:
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/Makefile.am (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/Makefile.am (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/README (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am (with props)
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php
incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/Makefile.am?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/Makefile.am Wed Mar 7 04:28:58 2007
@@ -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
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/Makefile.am
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/Makefile.am?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/Makefile.am Wed Mar 7 04:28:58 2007
@@ -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
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/Makefile.am
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/README?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/README (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/README Wed Mar 7 04:28:58 2007
@@ -0,0 +1,122 @@
+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 three 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
+
+ - sample.calculator.wsclient
+ A sample PHP SCA Web Service client which calls the Calculator Web service.
+
+Additionally, there is the sample.calculator.app.composite file. This
+describes the configuration of the SCA Calculator composite deployed to the
+SCA runtime.
+
+(See the README.html file for instructions to build and run this sample - TODO)
+
+The file phpcalculator.png is a picture of the sample. Given the restrictions on the
+current PHP extension (see TODOs in the PHP Extension README) some parts of this
+have not been tested yet.
+
+The path that has been tested is as follows:
+
+Local CPP client -> CPP Calculator -> PHP Divide -> PHP Add ------> PHP Log
+ |-------> PHP Subtract -> PHP Log
+ |-------> PHP Multiple -> PHP Log
+ |-------> PHP Divide ---> PHP Log
+
+The local CPP client is used because
+ - the work to enable PHP to host SCA is not done yet
+ - running with the axis service causes missing symbols errors on my box
+
+The CPP Calculator component is used because
+ - The local CPP client can only talk directly to a CPP component
+
+To run the sample in this configuration use the CalculatorClient.cpp found in the
+sample.calculator.client directory
+
+Windows
+=======
+
+Hasn't yet been tests on windows in this configuration so ignore the following
+
+I use the following bat file to start the stand alone axis server and include
+appropriate references to PHP dependencies. This needs turning into a proper
+run script but I haven't got to this yet
+
+set TUSCANY_SCACPP_LOGGING=9
+set AXIS2C_HOME=C:\axis2c-bin-0.95-win32
+set PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SDOCPP%\bin;%TUSCANY_SCACPP%\extensions\php\bin;%AXIS2C_HOME%\lib;c:\libxml2-2.6.23.win32\bin;c:\apps\iconv-1.9.1.win32\bin;c:\apps\zlib-1.2.3.win32\bin;C:\php-5.2.0\
+set TUSCANY_SCACPP_ROOT=%TUSCANY_SCACPP%\samples\PHPCalculator
+rem set TUSCANY_SCACPP_DEFAULT_COMPONENT=sample.calculator.CalculatorComponent
+
+%AXIS2C_HOME%\bin\axis2_http_server.exe -l 9
+
+I then
+
+cd %TUSCANY_SCACPP%\samples\PHPCalculator\samples.calculator.wsclient
+runwsclient.bat
+
+This has the effect of runing a PHP/SCA client (no C++ SCA content at all)
+to generate a web service request to the C++ SCA runtime hosting the calculator
+application.
+
+Currently this doesn't run all the way through due to a WSDL bug in PHP SCA
+(http://pecl.php.net/bugs/bug.php?id=9572). But it gets 99% of the way there.
+You will see the server doing all of its stuff and returning the correct result.
+
+Linux
+=====
+
+I find the following environment variables useful when running PHP embedded inside of
+Tuscany SCA.
+
+# the library path use to locate shared libraries
+export LD_LIBRARY_PATH=$LIBXML2_LIB:\
+$AXIS2C_HOME/lib:\
+$PHP_LIB:\
+$TUSCANY_SDOCPP/lib:\
+$TUSCANY_SCACPP/lib:\
+$TUSCANY_SCACPP/extensions/cpp/lib:\
+$TUSCANY_SCACPP/extensions/php/lib:\
+$TUSCANY_SCACPP/extensions/ws/lib:\
+$TUSCANY_SCACPP/samples/PHPCalculator/deploy/sample.calculator:\
+$PHP_SCA_SDO_LIB
+
+# tell PHP specifically where to find php.ini rather than relying on the default
+set PHPRC=/usr/local/lib
+
+# tell Tuscany SCA which composite appplication to run
+export TUSCANY_SCACPP_ROOT=/usr/local/tuscany/cpp/sca/deploy/samples/PHPCalculator
+
+# tell Tuscany SCA which is the default component in this composite
+export TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent
+
+# turn on logging so you can see what's going on
+export TUSCANY_SCACPP_LOGGING=9
+
+There is an env.sh file that can be edited and used to set your environment. One edited
+to reflect your environment do:
+
+source env.sh
+
+The CPP client currently has an independent Makefile due to build problems with the automake
+build on my box. If you have your environment configured as above you should be able to do:
+
+make
+
+This will produce a.out which can be run using the provided script.
+
+runclient_cpp.sh
+
+
+
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/README
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite Wed Mar 7 04:28:58 2007
@@ -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>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am Wed Mar 7 04:28:58 2007
@@ -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
+
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py Wed Mar 7 04:28:58 2007
@@ -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
+
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh Wed Mar 7 04:28:58 2007
@@ -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
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh
------------------------------------------------------------------------------
svn:executable =
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType Wed Mar 7 04:28:58 2007
@@ -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>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php Wed Mar 7 04:28:58 2007
@@ -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);
+ }
+}
+
+?>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType Wed Mar 7 04:28:58 2007
@@ -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>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php Wed Mar 7 04:28:58 2007
@@ -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;
+
+ }
+
+}
+
+?>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType Wed Mar 7 04:28:58 2007
@@ -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>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php Wed Mar 7 04:28:58 2007
@@ -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);
+ }
+}
+
+?>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am Wed Mar 7 04:28:58 2007
@@ -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
+
Propchange: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php Wed Mar 7 04:28:58 2007
@@ -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;
+ }
+}
+
+?>
Added: incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite?view=auto&rev=515550
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite (added)
+++ incubator/tuscany/cpp/sca/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite Wed Mar 7 04:28:58 2007
@@ -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>
+
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org