summaryrefslogtreecommitdiffstats
path: root/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php')
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/AUTHORS0
-rwxr-xr-xtags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/COPYING203
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/ChangeLog0
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/INSTALL2
-rwxr-xr-xtags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/LICENSE177
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/Makefile.am24
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NEWS0
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NOTICE5
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/README276
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/VSExpress/tuscany_sca_php.vcproj273
-rwxr-xr-xtags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/autogen.sh31
-rwxr-xr-xtags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/build.sh55
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/configure.ac79
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/deploy.bat67
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/Makefile.am18
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/Makefile.am21
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/README32
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite28
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am24
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py50
-rwxr-xr-xtags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh48
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType31
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php89
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType29
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php47
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType25
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php36
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am23
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php39
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite44
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/Makefile.am59
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp71
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h57
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp73
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h74
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp76
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h74
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp81
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h83
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp504
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h112
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/export.h41
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp85
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h95
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp53
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h77
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp61
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h92
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp58
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h81
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/php_sca.h132
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.cpp517
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.h49
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/xsd/sca-implementation-php.xsd39
54 files changed, 4420 insertions, 0 deletions
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/AUTHORS b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/AUTHORS
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/AUTHORS
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/COPYING b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/COPYING
new file mode 100755
index 0000000000..6b0b1270ff
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/COPYING
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/ChangeLog b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/ChangeLog
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/ChangeLog
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/INSTALL b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/INSTALL
new file mode 100644
index 0000000000..059a43057b
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/INSTALL
@@ -0,0 +1,2 @@
+Please read the GettingStarted.html document for information on
+building and installing Tuscany SCA Native PHP extemstion
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/LICENSE b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/LICENSE
new file mode 100755
index 0000000000..f433b1a53f
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/Makefile.am
new file mode 100644
index 0000000000..fb661fec63
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/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.
+
+SUBDIRS = src samples
+
+datadir=$(prefix)
+
+nobase_data_DATA = xsd/*.xsd
+
+EXTRA_DIST = xsd \ No newline at end of file
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NEWS b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NEWS
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NEWS
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NOTICE b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NOTICE
new file mode 100644
index 0000000000..b240b0a121
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/NOTICE
@@ -0,0 +1,5 @@
+Apache Tuscany SCA Native
+Copyright 2005, 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/) \ No newline at end of file
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/README b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/README
new file mode 100644
index 0000000000..ad96622516
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/README
@@ -0,0 +1,276 @@
+PHP Extension for C++ SCA README
+================================
+
+Overview
+--------
+
+The PHP extension for C++ SCA allows PHP scripts to be used to implement SCA components.
+This is achieved by using the C++ SCA extension API to drive script execution through the
+PHP embedding SAPI. In its current incarnation the PHP Extension requires that a full SCDL
+description is provided for each PHP component, i.e. we are not yet making use of the meta data
+provided by the annotations that can appear in PHP SCA components.
+
+There are various styles of PHP script that are supported. The examples here are taken from
+the PHPCalculator sample and if you look at the SCDL files provided with the sample you can
+see the component type and composite files that tie these components into the working system
+
+SCA Service
+-----------
+
+/**
+ * @service
+ * @binding.ws
+ */
+class Divide {
+
+ /**
+ * @reference
+ * @binding.tuscany cppDivideService
+ */
+ public $another_divide;
+
+ /**
+ * Division
+ *
+ * @param float $num1 (the first number)
+ * @param float $num2 (the second number)
+ * @return float The result
+ */
+ function div($num1, $num2) {
+ return $this->another_divide->div($num1, $num2);
+ }
+
+}
+
+PHP Class
+---------
+
+class Multiply {
+ function mul($num1, $num2) {
+ $result = $num1 * $num2;
+
+ $log_proxy = SCA::getService("log_service");
+ $log_proxy->log_message($result);
+
+ return $result;
+ }
+}
+
+PHP Function
+------------
+
+function sub($num1, $num2){
+ $result = $num1 - $num2;
+
+ $log_proxy = SCA::getService("log_service");
+ $log_proxy->log_message($result);
+
+ return $result;
+}
+
+PHP Script
+----------
+
+$num1 = $_REQUEST[0];
+$num2 = $_REQUEST[1];
+
+$result = $num1 + $num2;
+
+$log_proxy = SCA::getService("log_service");
+$log_proxy->log_message($result);
+
+echo $result;
+
+TODO
+----
+* I struggled for a long time with a missing symbol problem loading sdo.so at runtime on linux.
+ I got round this by creating a standalone Makefile for the CalculatorClient exe. All the
+ shared objects that are loaded are compiled with the normal automake toolchain still but this
+ solves the problem. I need to investigate in detail what's going on here. Having someone
+ else try building with the full automake configuration would be insteresting
+* The problem from above does appear when running SCA behind axis hence I am unable to test with
+ remote clients
+* The SCA_SDO build generates sdo.so and the Tuscany PHP Extension tries to load libsdo.so.
+ One side needs fixing. For now I just copy the library
+* SDO passing in and out of components is coded but not tested
+* Returning values from plain PHP scripts (scripts without classes and functions) is not
+ operating correctly
+* Error handling needs looking at. Many situations are not trapped and those
+ that are may not be reported correctly
+* Reorganize the extension code so that Tuscany SCA can be loaded by PHP running in Apache
+ and accessed through SCA references. This will play the same role as SCA running hosted
+ in Axis2C and will open up the service bindings implemented in PHP SCA_SDO.
+* Implement meta data exchange between the PHP SCA implementation and the Tuscany C++ SCA
+ implementations so that selected parts of the SCDL definition can be omitted.
+* There is a threading issue with the way that we are firing up the PHP embedding SAPI
+ TSRM should solve it fails on the embedding initialization for some reason.
+
+Dependencies
+------------
+PHP5.2.0 source code - - (http://php.net/)
+ The binary release of PHP doesn't ship with the header files required to build
+ against the PHP embedding SAPI and runtime libraries. So go get the PHP source
+ code and build PHP. PHP will need to be configured correctly in order to
+ work properly when embedded in C++ SCA. Here are some sample configuration
+ statements but they will need to be tailored for you specific environment:
+
+ Winodws
+ -------
+ cscript configure.js --with-extra-includes=win32build\include;
+ libxml2-2.6.26.threads\include;
+ iconv-1.9.1.win32\include;
+ libcurl-7.15.4-nossl\include
+ --with-extra-libs=win32build\lib;
+ libxml2-2.6.26.threads\lib;
+ iconv-1.9.1.win32\lib;
+ libcurl-7.15.4-nossl\lib
+ --enable-debug
+ --enable-soap
+ --enable-apache2handler=shared
+ --enable-embed
+ --with-curl=C:\simon\apps\libcurl-7.15.4-nossl
+
+ Note. This configure line is artificially broken across sever lines to aid
+ readability here. You will need to join it all back together on one line to
+ run it.
+
+ Linux
+ -----
+ ./configure --enable-debug \
+ --enable-soap \
+ --enable-fastcgi \
+ --with-zlib \
+ --enable-embed \
+ --with-tsrm-pthreads \
+ --enable-maintainer-zts
+ Note. debug, pthreads, maintainer-zts, fastcgi are not absolute requirements but just
+ represent the environment I was testing with when I wrote this.
+
+SCA_SDO PECL extension AVOCET branch source code - (http://pecl.php.net/package/SCA_SDO)
+ Provides the SCA framework for PHP and the necessary mediation code to translate
+ between Tuscany SCA and PHP SCA. Go get the AVOCET branch from PECL cvs
+
+ export CVSROOT=:pserver:cvsread@cvs.php.net/repository
+ cvs export -r AVOCET pecl/sdo
+
+ The process to build this code varies quite considerably between windows and Linux.
+ Take a look at the instructions in the SCA_SDO manual, follow the documentation link
+ from the projects PECL page (http://uk2.php.net/sdo/).
+
+ Once built you will need to copy the library sdo.so to
+ libsdo.so so that the Tuscany PHPExtension can load it given the makefile
+ configuration as it stands. For example, on linux
+
+ ln -s sdo.so libsdo.so
+
+
+Building on windows
+-------------------
+
+The Visual C++ Express solution provided with C++ SCA includes a project
+to build the PHP extension. This project relies on being able to access the
+PHP include files from the source code directory and the PHP lib files from the
+binary install. Make sure your environment is set as follows before you start
+Visual C++ Express (if you do this after you start Visual C++ Express it will
+not pick up the changes)
+
+PHP_HOME = the root directory of the PHP 5.2.0 source code install
+PATH = ensure that the root directory of the PHP 5.2.0 binary install appears
+
+PHP_SCA_SDO_HOME = the directory in which the SCA_SDO pecl extension source is installed
+
+These changes come over and above the environment changes you need to make
+to build the core C++ SCA software. I have the following set in my environment but
+of course the details depend on where you have the various bits of software installed.
+
+AXIS2C_HOME=c:\axis2c-bin-0.96-win32
+LIBXML2_HOME=c:\libxml2-2.6.26.ein32
+ICONV_HOME=c:\iconv-1.9.2.win32
+ZLIB_HOME=c:\zlib-1.2.3.win32
+TUSCANY_SCACPP=c:\sca\deploy
+TUSCANY_SDOCPP=c:\sdo\deploy
+
+Now compile the PHP extension. Compiling with VC++ Express requires some care
+
+1/ Ensure that the PHP include files are configured correctly for
+ compiling against C++ SCA in Visual C++ express
+
+ See - http://bugs.php.net/bug.php?id=39130
+
+ Comment out two lines in $(PHP_HOME)/main/config.w32.h:
+ #define _USE_32BIT_TIME_T 1
+ #define HAVE_STDLIB_H 1
+
+
+Building on Linux
+-----------------
+
+The PHP extension comes with a set of automake files so that the PHP extension is built
+at the same time as all of the other extensions assuming that appropriate environment
+variables are set. The build.sh script that can be found under the top level sca directory
+checks whether the PHP_LIB and PHP_INCLUDE variables are set and if so enables compilation
+of the PHP extension automatically by adding --enable-php to the configure line.
+
+There are a number of environment variables that the build depends on. I find setting the
+following variables useful.
+
+# the location of libxm2
+export LIBXML2_LIB=/usr/lib
+export LIBXML2_INCLUDE=/usr/include/libxml2
+
+# the location of PHP
+export PHP_LIB=/usr/local/lib
+export PHP_INCLUDE=/usr/local/include/php
+
+# the location of the PHP SCA_SDO extension source
+# the lib location depends oh the configuration options used
+# when building PHP so beware
+export PHP_SCA_SDO_INCLUDE=where ever you install the SCA_SDO package source
+export PHP_SCA_SDO_LIB=$PHP_LIB/php/extensions/no-debug-zts-20060613/
+
+# the location of axis2
+export AXIS2C_HOME=/usr/local/axis2c-bin-0.96-linux
+
+# the install directories for the tuscany sca and sdo projects
+export TUSCANY_SDOCPP=/usr/local/tuscany/cpp/sdo/deploy
+export TUSCANY_SCACPP=/usr/local/tuscany/cpp/sca/deploy
+
+Once these are set running sca/build.sh should compile and install the PHP extension.
+
+Testing the PHP Extension
+-------------------------
+
+In order to run the PHP extension successfully as an embedded component of the
+C++ SCA runtime the PHP environment must be configured correctly. This configuration
+is provided by the php.ini file. The location of this file depends on your installation
+of PHP but by default is as follows.
+
+/usr/local/bin - PHP executables
+/usr/local/lib/php.ini - the ini file that tell PHP where to look for scripts and
+ extension libraries
+/usr/local/lib/php - PHP runtime installation, extension files and tests
+
+As is usually the case your milage may vary but wherever PHP is installed you will find
+a similar set of directories. To force PHP to look in the correct place use the following
+setting
+
+# tell PHP specifically where to find php.ini rather than relying on the default
+set PHPRC=/usr/local/lib
+
+The php.ini file must be configured to load the SCA_SDO extension so you would expect to
+see the following modifications to the file.
+
+; around line 528 you need to set the variable that tells PHP where to
+; load extension libraries from. This varies depending on how PHP has been
+; compiled and installed, for example,
+extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20060613/"
+
+; around line 512 you need to set the variable that tells PHP where to
+; load included scripts from. There are windows and unix versions. Here
+; is a Unix example
+include_path=".:/usr/local/lib/php:/usr/local/lib/php/PEAR:/usr/local/tuscany/cppsca/samples/PHPCalculator/deploy/sample.calculator"
+
+; around line 673 you will find the end of the list of enabled extensions. We need to turn
+; on SDO so add the following line. sdo.so should be found in "extension_dir".
+extension=sdo.so
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/VSExpress/tuscany_sca_php.vcproj b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/VSExpress/tuscany_sca_php.vcproj
new file mode 100644
index 0000000000..1a8f668c19
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/VSExpress/tuscany_sca_php.vcproj
@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="tuscany_sca_php"
+ ProjectGUID="{28E45334-1F59-45CB-93EE-FB787D81B6D2}"
+ RootNamespace="tuscany_sca_php"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../runtime/extensions/php/src;../../../deploy/include;&quot;$(TUSCANY_SDOCPP)/include&quot;;&quot;$(PHP_HOME)/main&quot;;&quot;$(PHP_HOME)/sapi/embed&quot;;&quot;$(PHP_HOME)&quot;;&quot;$(PHP_HOME)/zend&quot;;&quot;$(PHP_HOME)/TSRM&quot;;&quot;$(PHP_SCA_SDO_HOME)&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TUSCANY_SCA_PHP_EXPORTS;ZEND_WIN32;PHP_WIN32;ZTS;ZEND_DEBUG=0"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sca.lib tuscany_sdo.lib php5embed.lib php_sdo.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\..\deploy\lib,$(TUSCANY_SDOCPP)\lib,$(PHP_HOME)\Debug_Ts"
+ IgnoreDefaultLibraryNames="MSVCRT"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\runtime\extensions\php\deploy.bat ..\..\..\ Debug"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TUSCANY_SCA_PHP_EXPORTS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="model"
+ >
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPImplementation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPImplementation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPInterface.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPInterface.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPReferenceBinding.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPReferenceBinding.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPServiceBinding.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\model\PHPServiceBinding.h"
+ >
+ </File>
+ </Filter>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\export.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\php_sca.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPExtension.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPExtension.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPImplementationExtension.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPImplementationExtension.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPInterfaceExtension.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPInterfaceExtension.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPServiceProxy.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPServiceProxy.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPServiceWrapper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\PHPServiceWrapper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\sca.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\extensions\php\src\tuscany\sca\php\sca.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/autogen.sh b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/autogen.sh
new file mode 100755
index 0000000000..af38864985
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/autogen.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# 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.
+
+for i in "libtoolize --force" aclocal autoconf autoheader
+do
+ echo -n "Running $i..."
+ $i || exit 1
+ echo 'done.'
+done
+
+echo -n 'Running automake...'
+automake --add-missing
+echo 'done.'
+exit 0
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/build.sh b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/build.sh
new file mode 100755
index 0000000000..41e96d0565
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/build.sh
@@ -0,0 +1,55 @@
+#!/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.
+
+SCA_PHP_EXTENSION_HOME=`pwd`
+
+if [ x$TUSCANY_SCACPP = x ]; then
+echo "TUSCANY_SCACPP not set"
+exit;
+fi
+
+echo "Using SCA installed at $TUSCANY_SCACPP"
+
+if [ x$PHP_LIB = x ]; then
+echo "PHP_LIB not set."
+exit;
+elif [ x$PHP_INCLUDE = x ]; then
+echo "PHP_INCLUDE not set."
+exit;
+elif [ x$PHP_SCA_SDO_INCLUDE = x ]; then
+echo "PHP_SCA_SDO_INCLUDE not set."
+exit;
+elif [ x$PHP_SCA_SDO_LIB = x ]; then
+echo "PHP_SCA_SDO_LIB not set."
+exit;
+fi
+echo "Building PHP extension with PHP installed at $PHP_LIB, $PHP_INCLUDE"
+echo "and PHP SCA and SDO installed at $PHP_SCA_SDO_LIB, $PHP_SCA_SDO_INCLUDE"
+
+#cd ${TUSCANY_SCACPP_HOME}/samples
+#./autogen.sh
+
+cd ${SCA_PHP_EXTENSION_HOME}
+./autogen.sh
+
+
+./configure --prefix=${TUSCANY_SCACPP}/extensions/php
+make
+make install
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/configure.ac b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/configure.ac
new file mode 100644
index 0000000000..d68d262b78
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/configure.ac
@@ -0,0 +1,79 @@
+# 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.
+
+dnl run autogen.sh to generate the configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(tuscany_sca_php, 1.0-incubator-M3)
+AC_CANONICAL_SYSTEM
+AM_CONFIG_HEADER(tuscany_sca_php_config.h)
+AM_INIT_AUTOMAKE([tar-ustar])
+AC_PREFIX_DEFAULT(/usr/local/tuscany/sca/extensions/php)
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_LIBTOOL
+
+# Check for running on Darwin
+AC_MSG_CHECKING([Checking if running on Darwin])
+UNAME=`uname -s`
+if test "x$UNAME" = "xDarwin"; then
+ AC_DEFINE([IS_DARWIN], [1], [Set to 1 when running on Darwin - Mac OSX])
+ AC_MSG_RESULT(yes)
+ AC_SUBST([libsuffix],[".dylib"])
+ is_darwin=true
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST([libsuffix],[".so"])
+ is_darwin=false
+fi
+AM_CONDITIONAL([DARWIN], [test x$is_darmin = xtrue])
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_CHECK_HEADERS([inttypes.h stdlib.h string.h sys/time.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_C_INLINE
+
+# Checks for library functions.
+AC_FUNC_CLOSEDIR_VOID
+AC_FUNC_STAT
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([getcwd putenv strdup])
+# AC_CONFIG_SUBDIRS([samples])
+
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile
+ samples/Makefile
+ samples/PHPCalculator/Makefile
+ samples/PHPCalculator/sample.calculator/Makefile
+ samples/PHPCalculator/sample.calculator.client/Makefile
+ ])
+AC_OUTPUT
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/deploy.bat b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/deploy.bat
new file mode 100644
index 0000000000..32d8378803
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/deploy.bat
@@ -0,0 +1,67 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sca root not specified
+goto usage
+)
+set rootdir=%1
+set deploydir=%rootdir%\deploy
+set extdir=%deploydir%\extensions
+set phpextdir=%extdir%\php
+set srcdir=%rootdir%\runtime\extensions\php\src
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %extdir% mkdir %extdir%
+if not exist %phpextdir% mkdir %phpextdir%
+if not exist %phpextdir%\module mkdir %phpextdir%\module
+if not exist %phpextdir%\bin mkdir %phpextdir%\bin
+if not exist %phpextdir%\lib mkdir %phpextdir%\lib
+if not exist %phpextdir%\xsd mkdir %phpextdir%\xsd
+
+del %phpextdir%\bin\tuscany_sca_php.*
+del %phpextdir%\lib\*.lib
+
+@ copy %srcdir%\deploy.bat %phpextdir%
+copy %srcdir%\..\xsd\*.* %phpextdir%\xsd
+
+copy %inpath%\tuscany_sca_php.lib %phpextdir%\lib
+copy %inpath%\tuscany_sca_php.dll %phpextdir%\bin\tuscany_sca_php.dll
+copy %inpath%\tuscany_sca_php.dll %phpextdir%\module
+
+if exist %inpath%\tuscany_sca_php.pdb copy %inpath%\tuscany_sca_php.pdb %phpextdir%\bin
+if exist %inpath%\tuscany_sca_php.pdb copy %inpath%\tuscany_sca_php.pdb %phpextdir%\module
+
+goto end
+:usage
+echo "Usage: deploy <sca-root> <build-output>"
+:end
+
+endlocal
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/Makefile.am
new file mode 100644
index 0000000000..920828ef4f
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/Makefile.am
new file mode 100644
index 0000000000..fd34c6442a
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/README b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/README
new file mode 100644
index 0000000000..dbee1f5f85
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.app.composite
new file mode 100644
index 0000000000..ada4d89a1c
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/Makefile.am
new file mode 100644
index 0000000000..548f9bdcb8
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/calculator_client.py
new file mode 100644
index 0000000000..d4b37ee2b2
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator.client/runclient.sh
new file mode 100755
index 0000000000..54ebfdbde4
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.componentType
new file mode 100644
index 0000000000..5a6c3a199e
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Calculator.php
new file mode 100644
index 0000000000..f0f35bab56
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.componentType
new file mode 100644
index 0000000000..b50b20d9c6
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Divide.php
new file mode 100644
index 0000000000..5a08e5b063
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.componentType
new file mode 100644
index 0000000000..f945c6af8c
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Log.php
new file mode 100644
index 0000000000..0a955f36d3
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Makefile.am
new file mode 100644
index 0000000000..10020c4f03
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/Multiply.php
new file mode 100644
index 0000000000..ed2e75edc8
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/samples/PHPCalculator/sample.calculator/sample.calculator.composite
new file mode 100644
index 0000000000..f1a82a70db
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/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>
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/Makefile.am
new file mode 100644
index 0000000000..b3622779e6
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/Makefile.am
@@ -0,0 +1,59 @@
+# 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.
+
+libdir=$(prefix)/lib
+lib_LTLIBRARIES = libtuscany_sca_php.la
+
+noinst_HEADERS = \
+tuscany/sca/php/*.h \
+tuscany/sca/php/model/*.h
+
+libtuscany_sca_php_la_SOURCES = \
+tuscany/sca/php/PHPExtension.cpp \
+tuscany/sca/php/PHPImplementationExtension.cpp \
+tuscany/sca/php/PHPInterfaceExtension.cpp \
+tuscany/sca/php/PHPServiceWrapper.cpp \
+tuscany/sca/php/PHPServiceProxy.cpp \
+tuscany/sca/php/sca.cpp \
+tuscany/sca/php/model/PHPImplementation.cpp \
+tuscany/sca/php/model/PHPInterface.cpp \
+tuscany/sca/php/model/PHPReferenceBinding.cpp \
+tuscany/sca/php/model/PHPServiceBinding.cpp
+
+libtuscany_sca_php_la_LIBADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca \
+ -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo \
+ -L${PHP_LIB} -lphp5 \
+ -L${PHP_SCA_SDO_LIB} -lsdo
+
+INCLUDES = -I${TUSCANY_SCACPP}/include \
+ -I${TUSCANY_SDOCPP}/include \
+ -I${PHP_INCLUDE} \
+ -I${PHP_INCLUDE}/main \
+ -I${PHP_INCLUDE}/Zend \
+ -I${PHP_INCLUDE}/TSRM \
+ -I${PHP_INCLUDE}/sapi/embed \
+ -I${PHP_SCA_SDO_INCLUDE}
+
+AM_CPPFLAGS = $(CPPFLAGS) -D_DEBUG
+
+moduledir=$(prefix)/module
+extension = libtuscany_sca_php$(libsuffix)
+
+install-exec-hook:
+ test -z $(moduledir) || $(mkdir_p) $(moduledir);
+ -rm -f $(moduledir)/$(extension)
+ $(LN_S) $(libdir)/$(extension) $(moduledir)/$(extension) \ No newline at end of file
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
new file mode 100644
index 0000000000..0ffb660139
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/php/PHPExtension.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/php/PHPImplementationExtension.h"
+#include "tuscany/sca/php/PHPInterfaceExtension.h"
+
+
+extern "C"
+{
+#if defined(WIN32) || defined(_WINDOWS)
+ __declspec(dllexport)
+#endif
+ void tuscany_sca_php_initialize()
+ {
+ tuscany::sca::php::PHPExtension::initialize();
+ }
+}
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ // ===================================================================
+ // Constructor for the PHPExtension class.
+ // ===================================================================
+ PHPExtension::PHPExtension()
+ {
+ logentry();
+ }
+
+ // ===================================================================
+ // Destructor for the PHPExtension class.
+ // ===================================================================
+ PHPExtension::~PHPExtension()
+ {
+ logentry();
+ }
+
+ void PHPExtension::initialize()
+ {
+ logentry();
+ SCARuntime::getCurrentRuntime()->registerImplementationExtension(new PHPImplementationExtension());
+ SCARuntime::getCurrentRuntime()->registerInterfaceExtension(new PHPInterfaceExtension());
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h
new file mode 100644
index 0000000000..971ed93c86
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPExtension.h
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_phpextension_h
+#define tuscany_sca_php_phpextension_h
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ class PHPExtension
+ {
+ public:
+ /**
+ * Default constructor
+ */
+ PHPExtension();
+
+ /**
+ * Destructor
+ */
+ virtual ~PHPExtension();
+
+ static void initialize();
+
+ private:
+
+ };
+
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpextension_h
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
new file mode 100644
index 0000000000..101667302f
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.cpp
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/php/PHPImplementationExtension.h"
+#include "tuscany/sca/php/model/PHPImplementation.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/util/Utils.h"
+
+using namespace std;
+using namespace commonj::sdo;
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ // ===================================================================
+ // Constructor for the PHPImplementationExtension class.
+ // ===================================================================
+ PHPImplementationExtension::PHPImplementationExtension()
+ {
+ logentry();
+ }
+
+ // ===================================================================
+ // Destructor for the PHPImplementationExtension class.
+ // ===================================================================
+ PHPImplementationExtension::~PHPImplementationExtension()
+ {
+ logentry();
+ }
+
+ const string PHPImplementationExtension::extensionName("php");
+ const string PHPImplementationExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPImplementation");
+
+ // ===================================================================
+ // loadModelElement - load the info from implementation.php
+ // ===================================================================
+ ComponentType* PHPImplementationExtension::getImplementation(Composite *composite, DataObjectPtr scdlImplementation)
+ {
+ logentry();
+
+ string module = scdlImplementation->getCString("module");
+ string className = scdlImplementation->getCString("class");
+
+ PHPImplementation* phpImpl = new PHPImplementation(composite, module, className);
+
+ return phpImpl;
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h
new file mode 100644
index 0000000000..604c4ea102
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPImplementationExtension.h
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_phpimplementationextension_h
+#define tuscany_sca_php_phpimplementationextension_h
+
+#include "tuscany/sca/extension/ImplementationExtension.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ class PHPImplementationExtension : public ImplementationExtension
+ {
+ public:
+ /**
+ * Default constructor
+ */
+ PHPImplementationExtension();
+
+ /**
+ * Destructor
+ */
+ virtual ~PHPImplementationExtension();
+
+ /**
+ * return the name of the extension
+ */
+ virtual const std::string& getExtensionName() {return extensionName;}
+
+ /**
+ * return the QName of schema element for this implementation extension
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#implementation.phpn")
+ */
+ virtual const std::string& getExtensionTypeQName() {return typeQName;}
+
+ virtual tuscany::sca::model::ComponentType* getImplementation(
+ tuscany::sca::model::Composite* composite,
+ commonj::sdo::DataObjectPtr scdlImplementation);
+
+ private:
+ static const std::string extensionName;
+ static const std::string typeQName;
+
+ };
+
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpimplementationextension_h
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp
new file mode 100644
index 0000000000..a07c499dec
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.cpp
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/php/PHPInterfaceExtension.h"
+#include "tuscany/sca/php/model/PHPInterface.h"
+#include "tuscany/sca/util/Logging.h"
+
+using namespace std;
+using namespace commonj::sdo;
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ // ===================================================================
+ // Constructor for the PHPInterfaceExtension class.
+ // ===================================================================
+ PHPInterfaceExtension::PHPInterfaceExtension()
+ {
+ logentry();
+ }
+
+ // ===================================================================
+ // Destructor for the PHPInterfaceExtension class.
+ // ===================================================================
+ PHPInterfaceExtension::~PHPInterfaceExtension()
+ {
+ logentry();
+ }
+
+ const string PHPInterfaceExtension::extensionName("php");
+ const string PHPInterfaceExtension::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPInterface");
+
+ // ===================================================================
+ // loadModelElement - load the info from interface.php
+ // ===================================================================
+ tuscany::sca::model::Interface* PHPInterfaceExtension::getInterface(Composite* composite, DataObjectPtr scdlInterface)
+ {
+ logentry();
+
+ // Determine the type
+ string ifType = scdlInterface->getType().getName();
+ if (ifType == "PHPInterface")
+ {
+ bool remotable = scdlInterface->getBoolean("remotable");
+ bool conversational = scdlInterface->getBoolean("conversational");
+
+ return new PHPInterface(remotable, conversational);
+ }
+ return 0;
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h
new file mode 100644
index 0000000000..4279376300
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPInterfaceExtension.h
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_phpinterfaceextension_h
+#define tuscany_sca_php_phpinterfaceextension_h
+
+#include "tuscany/sca/extension/InterfaceExtension.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ class PHPInterfaceExtension : public InterfaceExtension
+ {
+ public:
+ /**
+ * Default constructor
+ */
+ PHPInterfaceExtension();
+
+ /**
+ * Destructor
+ */
+ virtual ~PHPInterfaceExtension();
+
+ /**
+ * return the name of the extension
+ */
+ virtual const std::string& getExtensionName() {return extensionName;}
+
+ /**
+ * return the QName of schema elemant for this implementation extension
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#PHPInterface")
+ */
+ virtual const std::string& getExtensionTypeQName() {return typeQName;}
+
+ virtual tuscany::sca::model::Interface* getInterface(
+ tuscany::sca::model::Composite* composite,
+ commonj::sdo::DataObjectPtr scdlInterface);
+
+ private:
+ static const std::string extensionName;
+ static const std::string typeQName;
+
+ };
+
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpinterfaceextension_h
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp
new file mode 100644
index 0000000000..4b66c42a5b
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/php/PHPServiceProxy.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/model/ServiceBinding.h"
+#include "tuscany/sca/php/model/PHPReferenceBinding.h"
+
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ // ============================================
+ // Constructor: Create a proxy from a reference
+ // ============================================
+ PHPServiceProxy::PHPServiceProxy(Reference* reference)
+ : ServiceProxy(reference)
+ {
+ logentry();
+
+ // Get the service wrapper
+ PHPReferenceBinding* referenceBinding = (PHPReferenceBinding*)reference->getBinding();
+ serviceWrapper = referenceBinding->getTargetServiceBinding()->getServiceWrapper();
+ }
+
+ // ==========================================
+ // Constructor: Create a proxy from a service
+ // ==========================================
+ PHPServiceProxy::PHPServiceProxy(Service* service)
+ : ServiceProxy(NULL)
+ {
+ logentry();
+
+ // Get the service wrapper
+ serviceWrapper = service->getBinding()->getServiceWrapper();
+ }
+
+ // ==========
+ // Destructor
+ // ==========
+ PHPServiceProxy::~PHPServiceProxy()
+ {
+ logentry();
+ }
+
+ // =====================================================
+ // invokeService: invoke the service wired to this proxy
+ // =====================================================
+ void PHPServiceProxy::invokeService(Operation& operation)
+ {
+ logentry();
+
+ // Invoke the service
+ serviceWrapper->invoke(operation);
+ }
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h
new file mode 100644
index 0000000000..bddb262617
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceProxy.h
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_phpserviceproxy_h
+#define tuscany_sca_php_phpserviceproxy_h
+
+#include "tuscany/sca/php/export.h"
+#include "tuscany/sca/core/ServiceProxy.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/util/Library.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/model/Service.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ /**
+ * Holds a proxy for a given reference from a component implemented in PHP.
+ */
+ class PHPServiceProxy : public ServiceProxy
+ {
+ public:
+ /**
+ * Create a new service proxy for a reference. The proxy will contain a pointer to
+ * the target ServiceWrapper.
+ * @param reference The reference on the source component.
+ */
+ PHPServiceProxy(tuscany::sca::model::Reference* reference);
+
+ /**
+ * Create a new service proxy for a service. The proxy will contain a pointer to
+ * the target ServiceWrapper.
+ * @param service The service on the target component.
+ */
+ PHPServiceProxy(tuscany::sca::model::Service* service);
+
+ /**
+ * Destructor.
+ */
+ virtual ~PHPServiceProxy();
+
+ /**
+ * Invoke the wired service.
+ */
+ virtual void invokeService(Operation& operation);
+
+ private:
+
+ /**
+ * The target service wrapper
+ */
+ ServiceWrapper* serviceWrapper;
+ };
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpserviceproxy_h
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
new file mode 100644
index 0000000000..0236d3bc7f
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.cpp
@@ -0,0 +1,504 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifdef WIN32
+
+// some strangeness in the build that causes
+// WinSock.h and WinSock2.h to be included leading to redefinitions
+#define _WINSOCKAPI_
+
+// sdo.cpp also includes the math libraries and causes redeclarations
+// of all the math functions
+#define _INC_MATH
+
+#endif //WIN32
+
+#include <iostream>
+#include <sstream>
+
+#include <sapi/embed/php_embed.h>
+
+
+#include "tuscany/sca/php/PHPServiceWrapper.h"
+#include "tuscany/sca/php/PHPServiceProxy.h"
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/core/Exceptions.h"
+#include "tuscany/sca/util/Utils.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Composite.h"
+#include "tuscany/sca/model/ServiceType.h"
+#include "tuscany/sca/model/Interface.h"
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/php/model/PHPImplementation.h"
+
+
+#include "sca.h"
+#include "php_sdo_int.h"
+
+using namespace std;
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ int embedSAPIInitializeCount = 0;
+
+ // Global callbacks used by the PHP engine
+
+ // Callback for SAPI error
+ void php_sapi_error(int type, const char *error_msg, ...)
+ {
+ logwarning("PHP sapi error: %s", error_msg);
+ //TODO - do something sensible with this output
+ zend_bailout();
+ }
+
+ // Callback for log messages
+ void php_log_message(char *message)
+ {
+ loginfo("PHP log: %s", message);
+ //TODO - do something sensible with this output
+ }
+
+ // Callback for unbuffered writes (echo, print etc.)
+ int php_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
+ {
+ logentry();
+ loginfo("PHP Output: %s", str);
+ //TODO - do something sensible with this output
+ return str_length;
+ }
+
+ // Callback for errors
+ void php_error_cb(int type,
+ const char *error_filename,
+ const uint error_lineno,
+ const char *format, va_list args)
+ {
+ logentry();
+
+ char buffer[2048];
+ int len;
+
+ len = snprintf(buffer, 2048, "Error in file %s on line %d: ", error_filename, error_lineno);
+ vsnprintf(buffer + len, (2048 - len), format, args);
+ logwarning("PHP error: %s", buffer);
+ //TODO - do something sensible with this output
+ zend_bailout();
+ }
+
+
+ // ===========
+ // Constructor
+ // ===========
+ PHPServiceWrapper::PHPServiceWrapper(Service* service)
+ : ServiceWrapper(service)
+ {
+ logentry();
+
+ component = service->getComponent();
+ interf = service->getType()->getInterface();
+ remotable = interf->isRemotable();
+
+ // -----------------------------------------------
+ // Get the implementation for the target component
+ // -----------------------------------------------
+ PHPImplementation* impl = (PHPImplementation*)component->getType();
+ if (!impl)
+ {
+ string msg = "Component " + component->getName() + " has no implementation defined";
+ throwException(SystemConfigurationException, msg.c_str());
+ }
+
+ loginfo("Module: %s", impl->getModule().c_str());
+ loginfo("Class: %s", impl->getClass().c_str());
+ }
+
+ // ==========
+ // Destructor
+ // ==========
+ PHPServiceWrapper::~PHPServiceWrapper()
+ {
+ logentry();
+ }
+
+
+ // ======================================================================
+ // invoke: wrapper call to service with setting the component context
+ // ======================================================================
+ void PHPServiceWrapper::invoke(Operation& operation)
+ {
+ zval z_func_name, retval, z_component_name, z_class_name, z_operation_name, z_arg_array;
+ zval *params[5];
+
+ logentry();
+
+ // set the current component in the SCA runtime
+ // so that other things can get at it thorugh this
+ // static class
+ SCARuntime* runtime = SCARuntime::getCurrentRuntime();
+ runtime->setCurrentComponent(component);
+
+ try
+ {
+ // get the component type information
+ PHPImplementation* impl = (PHPImplementation*)component->getType();
+
+ // get the directory containing the component type
+ const string &compositeDir = impl->getComposite()->getRoot();
+
+ // get some useful information that will be used later
+ // when we construct the wrapper script
+ string componentName = component->getName();
+ string className = impl->getClass();
+ string operationName = operation.getName();
+ loginfo("Component %s class %s operation: %s",
+ componentName.c_str(),
+ className.c_str(),
+ operationName.c_str());
+
+ // load the PHP logging and error callback methods
+ php_embed_module.log_message = php_log_message;
+ php_embed_module.ub_write = php_ub_write;
+ php_embed_module.sapi_error = php_sapi_error;
+
+ // would normally use the following macro before the embeded call
+ // but we need to take account of multiple nested calls
+ // and ZTS threading safety is not behaving itself
+ // PHP_EMBED_START_BLOCK(/* argc */ 0, /* argv */ NULL)
+ // =====================================================================
+ {
+#ifdef ZTS
+ static void ***tsrm_ls;
+ loginfo("ZTS enabled");
+#endif
+ printf("tsrm_ls = %x, embedSAPIInitializeCount = %d\n",
+ tsrm_ls, embedSAPIInitializeCount);
+
+ if ( embedSAPIInitializeCount == 0 )
+ {
+ embedSAPIInitializeCount = 1;
+
+ php_embed_init(0, NULL PTSRMLS_CC);
+
+ // load up the sca module that provides the interface between
+ // C++ and user space PHP
+ zend_first_try {
+ zend_startup_module(&sca_module_entry);
+ } zend_end_try();
+ } else {
+ embedSAPIInitializeCount++;
+ }
+
+ zend_try {
+ // set error handler
+ zend_error_cb = php_error_cb;
+
+ /*
+ * Open the include files
+ */
+ // includeFile("SCA/SCA.php" TSRMLS_CC);
+ // includeFile("SCA/Bindings/tuscany/SCA_TuscanyWrapper.php" TSRMLS_CC);
+
+ /* Instantiate a SCA_Tuscany (mediator) object, and
+ * set its operation property
+ */
+ zval z_tuscany_mediator;
+ zval *pz_mediator = &z_tuscany_mediator;
+ INIT_ZVAL(z_tuscany_mediator);
+ zend_class_entry *ce_mediator =
+ zend_fetch_class("SCA_Tuscany", sizeof("SCA_Tuscany") - 1, 0 TSRMLS_CC);
+ object_init_ex(pz_mediator, ce_mediator);
+ z_tuscany_mediator.value.obj.handlers->add_ref(pz_mediator TSRMLS_CC);
+
+ zend_update_property_long(ce_mediator, pz_mediator,
+ "operation", sizeof("operation") - 1, (long)&operation TSRMLS_CC);
+
+ /* get the class info loaded up */
+ zend_eval_string("include 'SCA/SCA.php';",
+ NULL, "Include SCA" TSRMLS_CC);
+ zend_eval_string("include 'SCA/Bindings/tuscany/SCA_TuscanyWrapper.php';",
+ NULL, "Include SCA_TuscanyWrapper" TSRMLS_CC);
+
+ /* Now instantiate an SCA_TuscanyWrapper object and call its constructor */
+ zval z_tuscany_wrapper;
+ zval *pz_tuscany_wrapper = &z_tuscany_wrapper;
+ INIT_ZVAL(z_tuscany_wrapper);
+ object_init_ex(pz_tuscany_wrapper,
+ zend_fetch_class("SCA_TuscanyWrapper", sizeof("SCA_TuscanyWrapper") - 1, 0 TSRMLS_CC));
+ z_tuscany_wrapper.value.obj.handlers->add_ref(pz_tuscany_wrapper TSRMLS_CC);
+
+ ZVAL_STRING(&z_func_name, "__construct", 1);
+ ZVAL_STRING(&z_component_name, (char *)componentName.c_str(), 1);
+ if( &className != NULL && className.size() > 0) {
+ ZVAL_STRING(&z_class_name, (char *)className.c_str(), 1);
+ } else {
+ ZVAL_NULL(&z_class_name);
+ }
+ ZVAL_STRING(&z_operation_name, (char *)operationName.c_str(), 1);
+
+ array_init(&z_arg_array);
+
+ // get the parameters from the operation structure
+ for(unsigned int i = 0; i < operation.getNParms(); i++)
+ {
+ const Operation::Parameter& parm = operation.getParameter(i);
+ //printf("Arg %d type %d\n", i, parm.getType());
+ switch(parm.getType())
+ {
+ case Operation::BOOL:
+ {
+ add_next_index_bool(&z_arg_array, (int)*(bool*)parm.getValue() );
+ break;
+ }
+ case Operation::SHORT:
+ case Operation::USHORT:
+ case Operation::LONG:
+ case Operation::ULONG:
+ {
+ add_next_index_long(&z_arg_array, *(long*)parm.getValue() );
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ add_next_index_double(&z_arg_array,( double)*(float*)parm.getValue() );
+ break;
+ }
+ case Operation::DOUBLE:
+ case Operation::LONGDOUBLE:
+ {
+ add_next_index_double(&z_arg_array, *(double*)parm.getValue() );
+ break;
+ }
+ case Operation::CHARS:
+ {
+ add_next_index_string(&z_arg_array, *(char**)parm.getValue(), 1 );
+ break;
+ }
+ case Operation::STRING:
+ {
+ add_next_index_string(&z_arg_array, (char*)(*(string*)parm.getValue()).c_str(), 1 );
+ break;
+ }
+ case Operation::DATAOBJECT:
+ {
+ // convert the tuscany SDO into a PHP SDO
+
+ // create the object
+ zval *sdo;
+ ALLOC_INIT_ZVAL(sdo);
+ sdo_do_new(sdo, *(DataObjectPtr*)parm.getValue() TSRMLS_CC);
+
+ // add it to the arg array
+ add_next_index_zval(&z_arg_array, sdo);
+ break;
+ }
+ default:
+ {
+ char *class_name;
+ char *space;
+ class_name = get_active_class_name(&space TSRMLS_CC);
+ php_error(E_ERROR,
+ "%s%s%s(): Argument type %d not supported",
+ class_name,
+ space,
+ get_active_function_name(TSRMLS_C),
+ parm.getType());
+ }
+ }
+ }
+
+ params[0] = &z_tuscany_mediator;
+ params[1] = &z_component_name;
+ params[2] = &z_class_name;
+ params[3] = &z_operation_name;
+ params[4] = &z_arg_array;
+
+ call_user_function(EG(function_table),
+ &pz_tuscany_wrapper,
+ &z_func_name,
+ &retval,
+ 5,
+ params TSRMLS_CC);
+
+ zval_dtor(&z_func_name);
+ zval_dtor(&z_component_name);
+ zval_dtor(&z_class_name);
+ zval_dtor(&z_operation_name);
+ zval_dtor(&z_arg_array);
+
+ string script;
+ script = "include '" + compositeDir + "/" + impl->getModule() + ".php';";
+ loginfo("Script: %s", script.c_str());
+
+ // call the dynamically created script
+ // I'm not trapping the return value here
+ // as it seems to prevent any kind of output
+ // being produced. Needs investigation.
+ //zval retval;
+ zend_eval_string((char *) script.c_str(),
+ NULL, //&retval,
+ "Include module" TSRMLS_CC);
+
+ loginfo(">>>> About to call SCA_TuscanyWrapper->invoke()");
+
+ /* Now call SCA_TuscanyWrapper->invoke() ... */
+ ZVAL_STRING(&z_func_name, "invoke", 1);
+ call_user_function(EG(function_table),
+ &pz_tuscany_wrapper, &z_func_name,
+ &retval, 0, NULL TSRMLS_CC);
+
+ loginfo("<<<< Return from SCA_TuscanyWrapper->invoke()");
+
+ zval_dtor(&z_func_name);
+
+ /* ... and copy the return value into the operation */
+ switch(Z_TYPE(retval))
+ {
+ case IS_NULL:
+ {
+ //printf("NULL response");
+ break;
+ }
+ case IS_BOOL:
+ {
+ bool *newBool = new bool;
+ *newBool = ZEND_TRUTH(Z_BVAL(retval));
+ operation.setReturnValue(newBool);
+ break;
+ }
+ case IS_LONG:
+ {
+ long *newLong = new long;
+ *newLong = Z_LVAL(retval);
+ operation.setReturnValue(newLong);
+ break;
+ }
+ case IS_DOUBLE:
+ {
+ //double *newDouble = new double;
+ float *newDouble = new float;
+ *newDouble = (float)Z_DVAL(retval);
+ operation.setReturnValue(newDouble);
+ break;
+ }
+ case IS_STRING:
+ {
+ string newString (Z_STRVAL(retval));
+ operation.setReturnValue(&newString);
+ break;
+ }
+ case IS_OBJECT:
+ {
+ // convert the PHP SDO into a Tuscany SDO
+ DataObjectPtr sdo = sdo_do_get(&retval TSRMLS_CC);
+ operation.setReturnValue(&sdo);
+ break;
+ }
+ default:
+ {
+ char *class_name;
+ char *space;
+ class_name = get_active_class_name(&space TSRMLS_CC);
+ php_error(E_ERROR,
+ "%s%s%s(): Input argument type %d not supported on invoke",
+ class_name,
+ space,
+ get_active_function_name(TSRMLS_C),
+ Z_TYPE(retval));
+ }
+ }
+ } zend_catch {
+ /* int exit_status = EG(exit_status); */
+ }
+ zend_end_try();
+
+ if ( embedSAPIInitializeCount == 1 )
+ {
+ php_embed_shutdown(TSRMLS_C);
+ loginfo("Engine shutdown");
+ }
+ else
+ {
+ embedSAPIInitializeCount--;
+ }
+ }
+ // =====================================================================
+ }
+ catch (...)
+ {
+ runtime->unsetCurrentComponent();
+ throw;
+ }
+ runtime->unsetCurrentComponent();
+
+ }
+
+ // ======================================================================
+ // getServiceWrapper: create a wrapper for the target ComponentService
+ // ======================================================================
+ PHPServiceWrapper* PHPServiceWrapper::getServiceWrapper(Service* service)
+ {
+ logentry();
+ PHPServiceWrapper* serviceWrapper = 0;
+
+ // ---------------------------------
+ // Create an instance of the wrapper
+ // ---------------------------------
+ serviceWrapper = new PHPServiceWrapper(service);
+ if (!serviceWrapper)
+ {
+ string msg = "Could not create new PHPServiceWrapper";
+ throwException(SystemConfigurationException, msg.c_str());
+ }
+
+ return serviceWrapper;
+ }
+
+ /* Not used at the moment
+ * Can find the include file and execute it,
+ * but doesn't make the contents available
+ */
+ void PHPServiceWrapper::includeFile(char *includeFileName TSRMLS_DC)
+ {
+ zend_file_handle include_file_handle;
+
+ include_file_handle.type = ZEND_HANDLE_FP;
+ include_file_handle.filename = includeFileName;
+ include_file_handle.opened_path = NULL;
+ include_file_handle.free_filename = 0;
+ if (!(include_file_handle.handle.fp = php_fopen_with_path(
+ include_file_handle.filename, "rb", PG(include_path),
+ &include_file_handle.opened_path TSRMLS_CC))) {
+ php_error(E_ERROR,
+ "Could not open %s", include_file_handle.filename);
+ return;
+ }
+ php_execute_script(&include_file_handle TSRMLS_CC);
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
new file mode 100644
index 0000000000..be20f34217
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/PHPServiceWrapper.h
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+
+#ifndef tuscany_sca_php_phpservicewrapper_h
+#define tuscany_sca_php_phpservicewrapper_h
+
+#include "tuscany/sca/php/export.h"
+#include "tuscany/sca/core/ServiceWrapper.h"
+#include "tuscany/sca/core/Operation.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Interface.h"
+
+#include <TSRM/TSRM.h>
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ class PHPInterface;
+
+ /**
+ * Wraps the service on a component implementation.
+ * This abstract class is extended by generated code which provides
+ * the implementation of some of the methods.
+ * An instance of this class wraps the actual component implementation which
+ * has been written by a developer of an SCA application.
+ */
+ class SCA_PHP_API PHPServiceWrapper : public ServiceWrapper
+ {
+ public:
+ /**
+ * Factory method to create a new PHPServiceWrapper for a given target
+ * service. This method will provide all the loading of dlls required to
+ * create the target component.
+ * @param target The service on the component for which this wrapper is to be
+ * created.
+ * @return A wrapper that references the given target.
+ */
+ static PHPServiceWrapper* getServiceWrapper(tuscany::sca::model::Service* service);
+
+ /**
+ * Constructor.
+ * @param target The component service to which this wrapper refers.
+ */
+ PHPServiceWrapper(tuscany::sca::model::Service* service);
+
+ /**
+ * Destructor.
+ */
+ virtual ~PHPServiceWrapper();
+
+ /**
+ * All business method calls to the target component go through the invoke method.
+ * @param operation The details of the method, paramaters and return value for the
+ * business method to be called on the target component.
+ */
+ virtual void invoke(Operation& operation);
+
+
+ protected:
+
+
+ private:
+
+ /**
+ * Utility method to execute a script on the include_path.
+ */
+ static void includeFile(char *includeFileName TSRMLS_DC);
+
+ /**
+ * The component to which this wrapper refers.
+ */
+ tuscany::sca::model::Component* component;
+
+ /**
+ * Set to true if the service is remotable.
+ */
+ bool remotable;
+
+ /**
+ * A pointer to the interface which the service exposes.
+ */
+ tuscany::sca::model::Interface* interf;
+
+ };
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_phpservicewrapper_h
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/export.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/export.h
new file mode 100644
index 0000000000..11a9519361
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/export.h
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_export_h
+#define tuscany_sca_php_export_h
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+
+#ifdef TUSCANY_SCA_PHP_EXPORTS
+#define SCA_PHP_API __declspec(dllexport)
+#else
+#define SCA_PHP_API __declspec(dllimport)
+#endif
+
+#else
+#include <sys/time.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#define SCA_PHP_API
+#endif
+
+#endif // tuscany_sca_export_h
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
new file mode 100644
index 0000000000..63f1672ec5
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.cpp
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/php/model/PHPImplementation.h"
+#include "tuscany/sca/php/model/PHPServiceBinding.h"
+#include "tuscany/sca/php/model/PHPReferenceBinding.h"
+#include "tuscany/sca/model/Component.h"
+#include "tuscany/sca/model/Service.h"
+#include "tuscany/sca/model/Reference.h"
+#include "tuscany/sca/util/Utils.h"
+
+using namespace std;
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+
+ namespace php
+ {
+
+ // Constructor
+ PHPImplementation::PHPImplementation(Composite* composite, const string& module, const string& className)
+ : ComponentType(composite, module),
+ module(module), className(className)
+ {
+ logentry();
+ }
+
+ PHPImplementation::~PHPImplementation()
+ {
+ logentry();
+ }
+
+ void PHPImplementation::initializeComponent(Component* component)
+ {
+ logentry();
+ ComponentType::initializeComponent(component);
+
+ // Create PHP bindings for all the services
+ const Component::SERVICE_MAP& services = component->getServices();
+ Component::SERVICE_MAP::const_iterator iter = services.begin();
+ for (unsigned int i=0; i< services.size(); i++)
+ {
+ Service *service = iter->second;
+ PHPServiceBinding* binding = new PHPServiceBinding(service);
+ service->setBinding(binding);
+ iter++;
+ }
+
+ // Create PHP bindings for all the references
+ const Component::REFERENCE_MAP& references = component->getReferences();
+ Component::REFERENCE_MAP::const_iterator refiter = references.begin();
+ for (int ri=0; ri< references.size(); ri++)
+ {
+ Reference *reference = refiter->second;
+ PHPReferenceBinding* binding = new PHPReferenceBinding(reference);
+ reference->setBinding(binding);
+ refiter++;
+ }
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h
new file mode 100644
index 0000000000..78e678dff5
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPImplementation.h
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_model_phpimplementation_h
+#define tuscany_sca_php_model_phpimplementation_h
+
+#include <string>
+
+#include "tuscany/sca/model/ComponentType.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ /**
+ * Holds information about an SCA implementation written in PHP
+ */
+ class PHPImplementation : public tuscany::sca::model::ComponentType
+ {
+
+ public:
+ /**
+ * Constructor.
+ * @param composite Composite containing this implementation.
+ * @param module Name of the module.
+ * @param modulePath Path to the module (could be a blank string
+ * if this is not specified).
+ * @param className Name of the class in the module (could be a blank string
+ * if this is not specified).
+ */
+ PHPImplementation(tuscany::sca::model::Composite* composite, const std::string& module, const std::string& className);
+
+ /**
+ * Destructor
+ */
+ virtual ~PHPImplementation();
+
+ /**
+ * Initialize a component of this type.
+ * @param component The component to initialize.
+ */
+ virtual void initializeComponent(tuscany::sca::model::Component* component);
+
+ /**
+ * Returns the name of the module.
+ * @return The name of the module.
+ */
+ const std::string& getModule() const { return module; }
+
+ /**
+ * Get the name of the class.
+ * @return The class name if specified.
+ */
+ const std::string& getClass() const { return className; }
+
+ private:
+
+ /**
+ * Name of the module.
+ */
+ std::string module;
+
+ /**
+ * Name of the class in the header file declaring the implementation.
+ * May be an empty string if not set in the SCDL file.
+ */
+ std::string className;
+ };
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_model_phpimplementation_h
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp
new file mode 100644
index 0000000000..cbea3f2b71
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/php/export.h"
+#include "tuscany/sca/php/model/PHPInterface.h"
+
+using namespace std;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ const string PHPInterface::typeQName("http://www.osoa.org/xmlns/sca/1.0#PHPInterface");
+
+ // Constructor
+ PHPInterface::PHPInterface(
+ bool remotable,
+ bool conversational)
+ : Interface(remotable, conversational)
+ {
+ logentry();
+ }
+
+ PHPInterface::~PHPInterface()
+ {
+ logentry();
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h
new file mode 100644
index 0000000000..9a4f658eb0
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPInterface.h
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+
+#ifndef tuscany_sca_php_model_phpinterface_h
+#define tuscany_sca_php_model_phpinterface_h
+
+#include <string>
+
+#include "tuscany/sca/php/export.h"
+#include "tuscany/sca/model/Interface.h"
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ /**
+ * Holds information about an interface described using a PHP
+ * header file.
+ */
+ class PHPInterface : public tuscany::sca::model::Interface
+ {
+
+ public:
+ /**
+ * Constuctor.
+ * @param scope The scope of the interface (stateless or composite).
+ * @param remotable True if the interface is remotable.
+ */
+ PHPInterface(
+ bool remotable,
+ bool conversational);
+
+ /**
+ * Destructor.
+ */
+ virtual ~PHPInterface();
+
+ /**
+ * return the QName of the schema type for this interface type
+ * (e.g. "http://www.osoa.org/xmlns/sca/1.0#interface.cpp")
+ */
+ const std::string& getInterfaceTypeQName() { return typeQName; };
+
+ /**
+ * The QName of the schema type for this interface type.
+ */
+ SCA_PHP_API static const std::string typeQName;
+
+ };
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_model_phpinterface_h
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp
new file mode 100644
index 0000000000..8a8d15fe40
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/php/model/PHPReferenceBinding.h"
+#include "tuscany/sca/php/PHPServiceProxy.h"
+
+using namespace std;
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ // Constructor
+ PHPReferenceBinding::PHPReferenceBinding(Reference* reference)
+ : ReferenceBinding(reference, ""), serviceProxy(NULL)
+ {
+ }
+
+ // Destructor
+ PHPReferenceBinding::~PHPReferenceBinding()
+ {
+ }
+
+ ServiceProxy* PHPReferenceBinding::getServiceProxy()
+ {
+ return serviceProxy;
+ }
+
+ void PHPReferenceBinding::configure(ServiceBinding* binding)
+ {
+ targetServiceBinding = binding;
+
+ serviceProxy = new PHPServiceProxy(getReference());
+ }
+
+ } // End namespace
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h
new file mode 100644
index 0000000000..8010752980
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPReferenceBinding.h
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_model_phpreferencebinding_h
+#define tuscany_sca_php_model_phpreferencebinding_h
+
+#include <string>
+
+#include "tuscany/sca/model/ReferenceBinding.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ /**
+ * Information about a PHP service binding for service or a reference.
+ */
+ class PHPReferenceBinding : public tuscany::sca::model::ReferenceBinding
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ PHPReferenceBinding(tuscany::sca::model::Reference* reference);
+
+ /**
+ * Destructor.
+ */
+ virtual ~PHPReferenceBinding();
+
+ /**
+ * Returns the type of binding.
+ */
+ virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PHPImplementationBinding"; };
+
+ /**
+ * Create a proxy representing the reference to the
+ * client component.
+ */
+ virtual ServiceProxy* getServiceProxy();
+
+ /**
+ * Configure this binding from a service binding.
+ */
+ virtual void configure(tuscany::sca::model::ServiceBinding* serviceBinding);
+
+ /**
+ * Returns the target service binding.
+ */
+ tuscany::sca::model::ServiceBinding* getTargetServiceBinding() const { return targetServiceBinding; };
+
+ private:
+
+ /**
+ * The proxy representing the reference to the client
+ * component.
+ */
+ ServiceProxy* serviceProxy;
+
+ /**
+ * The service binding of the target
+ */
+ tuscany::sca::model::ServiceBinding* targetServiceBinding;
+ };
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_model_phpreferencebinding_h
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
new file mode 100644
index 0000000000..4d18424ae2
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#include "tuscany/sca/util/Logging.h"
+#include "tuscany/sca/php/model/PHPServiceBinding.h"
+#include "tuscany/sca/php/PHPServiceWrapper.h"
+
+using namespace std;
+using namespace tuscany::sca::model;
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+
+ // Constructor
+ PHPServiceBinding::PHPServiceBinding(Service* service)
+ : ServiceBinding(service, "")
+ {
+ logentry();
+ serviceWrapper = PHPServiceWrapper::getServiceWrapper(service);
+ }
+
+ // Destructor
+ PHPServiceBinding::~PHPServiceBinding()
+ {
+ logentry();
+ }
+
+ ServiceWrapper* PHPServiceBinding::getServiceWrapper()
+ {
+ logentry();
+ return (ServiceWrapper*)serviceWrapper;
+ }
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h
new file mode 100644
index 0000000000..ef3d6b1604
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/model/PHPServiceBinding.h
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_sca_php_model_phpservicebinding_h
+#define tuscany_sca_php_model_phpservicebinding_h
+
+#include <string>
+
+#include "tuscany/sca/model/ServiceBinding.h"
+
+
+namespace tuscany
+{
+ namespace sca
+ {
+ namespace php
+ {
+ /**
+ * Information about a PHP service binding for service or a reference.
+ */
+ class PHPServiceBinding : public tuscany::sca::model::ServiceBinding
+ {
+ public:
+
+ /**
+ * Constructor.
+ * @param uri The uri of the binding.
+ * @param port The definition of the port to which the entrypoint
+ * or external service is to be bound. This is of the form
+ * "namespace"#endpoint("service"/"port")
+ */
+ PHPServiceBinding(tuscany::sca::model::Service* service);
+
+ /**
+ * Destructor.
+ */
+ virtual ~PHPServiceBinding();
+
+ /**
+ * Returns the type of binding.
+ */
+ virtual std::string getType() { return "http://www.osoa.org/xmlns/sca/1.0#PHPImplementationBinding"; };
+
+ /**
+ * Create a wrapper for the service configured by this
+ * binding.
+ */
+ virtual ServiceWrapper* getServiceWrapper();
+
+ private:
+
+ /**
+ * The wrapper for the service configured by this binding.
+ */
+ ServiceWrapper* serviceWrapper;
+
+ };
+
+ } // End namespace php
+ } // End namespace sca
+} // End namespace tuscany
+
+#endif // tuscany_sca_php_model_phpservicebinding_h
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/php_sca.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/php_sca.h
new file mode 100644
index 0000000000..8aea8dadb2
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/php_sca.h
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+/* $ Id: $ */
+
+#ifndef PHP_SCA_H
+#define PHP_SCA_H
+
+#include "tuscany/sca/core/Operation.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <main/php.h>
+
+#ifdef HAVE_SCA
+
+#include <main/php_ini.h>
+#include <main/SAPI.h>
+#include <ext/standard/info.h>
+#include <Zend/zend_extensions.h>
+#ifdef __cplusplus
+} // extern "C"
+#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//extern zend_module_entry sca_module_entry;
+#define phpext_sca_ptr &sca_module_entry
+
+#ifdef PHP_WIN32
+#define PHP_SCA_API __declspec(dllexport)
+#else
+#define PHP_SCA_API
+#endif
+
+PHP_MINIT_FUNCTION(sca);
+PHP_MSHUTDOWN_FUNCTION(sca);
+PHP_MINFO_FUNCTION(sca);
+
+#ifdef ZTS
+#include "TSRM/TSRM.h"
+#endif
+
+#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource))
+
+#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC)
+
+#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC)
+
+#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC)
+#define PROP_SET_STRINGL(name, s, l) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC)
+
+
+PHP_METHOD(SCA_Tuscany, __construct);
+#if (PHP_MAJOR_VERSION >= 5)
+ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
+ZEND_END_ARG_INFO()
+#else /* PHP 4.x */
+#define SCA_Tuscany____construct_args NULL
+#endif
+
+PHP_METHOD(SCA_Tuscany, invoke);
+#if (PHP_MAJOR_VERSION >= 5)
+ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany__invoke_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4)
+ ZEND_ARG_INFO(0, component_name)
+ ZEND_ARG_INFO(0, reference_name)
+ ZEND_ARG_INFO(0, method_name)
+#if (PHP_MINOR_VERSION > 0)
+ ZEND_ARG_ARRAY_INFO(0, arguments, 1)
+#else
+ ZEND_ARG_INFO(0, arguments)
+#endif
+ZEND_END_ARG_INFO()
+#else /* PHP 4.x */
+#define SCA_Tuscany__invoke_args NULL
+#endif
+
+PHP_METHOD(SCA_Tuscany, getArgArray);
+#if (PHP_MAJOR_VERSION >= 5)
+ZEND_BEGIN_ARG_INFO_EX(SCA_Tuscany__getArgArray_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0)
+ZEND_END_ARG_INFO()
+#else /* PHP 4.x */
+#define SCA_Tuscany__getArgArray_args NULL
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+
+
+#endif /* PHP_HAVE_SCA */
+
+#endif /* PHP_SCA_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.cpp
new file mode 100644
index 0000000000..4078226f63
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.cpp
@@ -0,0 +1,517 @@
+/*
+ * 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.
+ */
+
+/* $ Id: $ */
+
+#ifdef WIN32
+
+// some strangeness in the build that causes
+// WinSock.h and WinSock2.h to be included leading to redefinitions
+#define _WINSOCKAPI_
+
+#endif //WIN32
+
+#include "tuscany/sca/core/SCARuntime.h"
+#include "tuscany/sca/php/PHPServiceProxy.h"
+#include "commonj/sdo/RefCountingPointer.h"
+
+using namespace std;
+using namespace tuscany::sca;
+using namespace tuscany::sca::model;
+using namespace tuscany::sca::php;
+using namespace commonj::sdo;
+
+#define HAVE_SCA 1
+
+
+#include "php_sca.h"
+#include "sca.h"
+
+#if HAVE_SCA
+
+#include "php_sdo.h"
+#include "php_sdo_int.h"
+/* {{{ Class definitions */
+
+/* {{{ Class SCA_Tuscany */
+
+static zend_class_entry * SCA_Tuscany_ce_ptr = NULL;
+
+/* {{{ Methods */
+
+/* {{{ proto void __construct(int operation_handle)
+ */
+PHP_METHOD(SCA_Tuscany, __construct)
+{
+ zval *_this_zval = getThis();
+ zend_class_entry *_this_ce = Z_OBJCE_P(_this_zval);
+
+ long operation_handle = 0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &operation_handle) == FAILURE) {
+ return;
+ }
+
+ if (!operation_handle) {
+ php_error(E_ERROR, "SCA_Tuscany ctor called with NULL operation");
+ }
+
+ PROP_SET_LONG(operation, operation_handle);
+}
+/* }}} __construct */
+
+/* {{{ proto int invoke(string component_name, string reference_name, string method_name, array arguments)
+ Invoke a Tuscany component */
+PHP_METHOD(SCA_Tuscany, invoke)
+{
+ //zval * _this_zval = NULL;
+ const char * component_name = NULL;
+ int component_name_len = 0;
+ const char * reference_name = NULL;
+ int reference_name_len = 0;
+ const char * method_name = NULL;
+ int method_name_len = 0;
+ zval * arguments = NULL;
+ HashTable * arguments_hash = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssa/",
+ &component_name, &component_name_len,
+ &reference_name, &reference_name_len,
+ &method_name, &method_name_len,
+ &arguments) == FAILURE) {
+ return;
+ }
+
+ arguments_hash = HASH_OF(arguments);
+
+ // find the correct service proxy
+ SCARuntime* runtime = SCARuntime::getCurrentRuntime();
+ Component* component = runtime->getCurrentComponent();
+ Reference* ref = component->findReference(reference_name);
+ if(!ref) {
+ char *class_name;
+ char *space;
+ class_name = get_active_class_name(&space TSRMLS_CC);
+ php_error(E_ERROR,
+ "%s%s%s(): Can't find reference %s",
+ class_name,
+ space,
+ get_active_function_name(TSRMLS_C),
+ reference_name);
+ return;
+ }
+
+ ReferenceBinding* refBinding = ref->getBinding();
+ PHPServiceProxy *serviceProxy = (PHPServiceProxy*) refBinding->getServiceProxy();
+
+ // construct an operation structure
+ Operation operation(method_name);
+
+ // add the parameters to the operation
+ for ( zend_hash_internal_pointer_reset(arguments_hash);
+ zend_hash_has_more_elements(arguments_hash) == SUCCESS;
+ zend_hash_move_forward(arguments_hash) )
+ {
+ zval **data;
+
+ if ( zend_hash_get_current_data(arguments_hash,
+ (void**)&data ) == FAILURE )
+ {
+ continue;
+ }
+
+ char *hashKey;
+ uint hashKeyLength;
+ ulong hashIndex;
+ int type;
+
+ type = zend_hash_get_current_key_ex(arguments_hash,
+ &hashKey,
+ &hashKeyLength,
+ &hashIndex,
+ 0,
+ NULL);
+
+ switch(Z_TYPE_PP(data))
+ {
+ case IS_NULL:
+ {
+ //printf("NULL argument");
+ break;
+ }
+ case IS_BOOL:
+ {
+ convert_to_boolean(*data);
+ bool *newBool = new bool;
+ *newBool = ZEND_TRUTH(Z_BVAL_PP(data));
+ operation.addParameter(newBool);
+ break;
+ }
+ case IS_LONG:
+ {
+ convert_to_long(*data);
+ long *newLong = new long;
+ *newLong = Z_LVAL_PP(data);
+ operation.addParameter(newLong);
+ break;
+ }
+ case IS_DOUBLE:
+ {
+ //convert_to_double(*data);
+ //double *newDouble = new double;
+ convert_to_double(*data);
+ float *newDouble = new float;
+ *newDouble = (float)Z_DVAL_PP(data);
+ operation.addParameter(newDouble);
+ break;
+ }
+ case IS_STRING:
+ {
+ convert_to_string(*data);
+ string newString (Z_STRVAL_PP(data));
+ operation.addParameter(&newString);
+ break;
+ }
+ case IS_OBJECT:
+ {
+ // convert the PHP SDO into a Tuscany SDO
+ DataObjectPtr sdo = sdo_do_get(*data TSRMLS_CC);
+ operation.addParameter(&sdo);
+ break;
+ }
+ default:
+ {
+ char *class_name;
+ char *space;
+ class_name = get_active_class_name(&space TSRMLS_CC);
+ php_error(E_ERROR,
+ "%s%s%s(): Input argument type %d not supported on invoke",
+ class_name,
+ space,
+ get_active_function_name(TSRMLS_C),
+ Z_TYPE_PP(data));
+ }
+ }
+ }
+
+ // call the proxy
+ serviceProxy->invokeService(operation);
+
+ switch(operation.getReturnType())
+ {
+ case Operation::BOOL:
+ {
+ ZVAL_BOOL(return_value, *(bool*)operation.getReturnValue());
+ break;
+ }
+ case Operation::SHORT:
+ case Operation::USHORT:
+ case Operation::LONG:
+ case Operation::ULONG:
+ {
+ ZVAL_LONG(return_value, *(long*)operation.getReturnValue());
+ break;
+ }
+ case Operation::FLOAT:
+ case Operation::DOUBLE:
+ case Operation::LONGDOUBLE:
+ {
+ ZVAL_DOUBLE(return_value, (double)*(float*)operation.getReturnValue());
+ break;
+ }
+ case Operation::CHARS:
+ {
+ ZVAL_STRING(return_value, (char*)operation.getReturnValue(), 1);
+ break;
+ }
+ case Operation::STRING:
+ {
+ ZVAL_STRING(return_value, (char*)((string*)operation.getReturnValue())->c_str(), 1);
+ break;
+ }
+ case Operation::VOID_TYPE:
+ {
+ // do nothing
+ break;
+ }
+ case Operation::DATAOBJECT:
+ {
+ // convert the tuscany SDO into a PHP SDO
+ sdo_do_new(return_value, *(DataObjectPtr*)operation.getReturnValue() TSRMLS_CC);
+ break;
+ }
+ default:
+ {
+ char *class_name;
+ char *space;
+ class_name = get_active_class_name(&space TSRMLS_CC);
+ php_error(E_ERROR,
+ "%s%s%s(): Response type %d not supported on invoke",
+ class_name,
+ space,
+ get_active_function_name(TSRMLS_C),
+ operation.getReturnType());
+ }
+ }
+
+}
+/* }}} invoke */
+
+/* {{{ proto array getArgArray()
+ return the arguments for the operation as an array */
+PHP_METHOD(SCA_Tuscany, getArgArray)
+{
+ zval * _this_zval = getThis();
+ zend_class_entry *_this_ce = Z_OBJCE_P(_this_zval);
+
+ if (ZEND_NUM_ARGS() > 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ array_init(return_value);
+
+ // get the operation object from the object properties
+ Operation *operation = (Operation *)PROP_GET_LONG(operation);
+
+ // get the parameters from the operation structure
+ for(unsigned int i = 0; i < operation->getNParms(); i++)
+ {
+ const Operation::Parameter& parm = operation->getParameter(i);
+ //printf("Arg %d type %d\n", i, parm.getType());
+ switch(parm.getType())
+ {
+ case Operation::BOOL:
+ {
+ add_next_index_bool(return_value,(int)*(bool*)parm.getValue() );
+ break;
+ }
+ case Operation::SHORT:
+ case Operation::USHORT:
+ case Operation::LONG:
+ case Operation::ULONG:
+ {
+ add_next_index_long(return_value,*(long*)parm.getValue() );
+ break;
+ }
+ case Operation::FLOAT:
+ {
+ add_next_index_double(return_value,(double)*(float*)parm.getValue() );
+ break;
+ }
+ case Operation::DOUBLE:
+ case Operation::LONGDOUBLE:
+ {
+ add_next_index_double(return_value,*(double*)parm.getValue() );
+ break;
+ }
+ case Operation::CHARS:
+ {
+ add_next_index_string(return_value,*(char**)parm.getValue(), 1 );
+ break;
+ }
+ case Operation::STRING:
+ {
+ add_next_index_string(return_value,(char*)(*(string*)parm.getValue()).c_str(), 1 );
+ break;
+ }
+ case Operation::DATAOBJECT:
+ {
+ // convert the tuscany SDO into a PHP SDO
+
+ // create the object
+ zval *sdo;
+ ALLOC_INIT_ZVAL(sdo);
+ sdo_do_new(sdo, *(DataObjectPtr*)parm.getValue() TSRMLS_CC);
+
+ // add it to the arg array
+ add_next_index_zval(return_value, sdo);
+ break;
+ }
+ default:
+ {
+ char *class_name;
+ char *space;
+ class_name = get_active_class_name(&space TSRMLS_CC);
+ php_error(E_ERROR,
+ "%s%s%s(): Argument type %d not supported",
+ class_name,
+ space,
+ get_active_function_name(TSRMLS_C),
+ parm.getType());
+ }
+ }
+ }
+}
+/* }}} getArgArray */
+
+static zend_function_entry SCA_Tuscany_methods[] = {
+ PHP_ME(SCA_Tuscany, __construct, SCA_Tuscany____construct_args, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME(SCA_Tuscany, invoke, SCA_Tuscany__invoke_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(SCA_Tuscany, getArgArray, SCA_Tuscany__getArgArray_args, ZEND_ACC_PUBLIC)
+ { NULL, NULL, NULL }
+};
+
+/* }}} Methods */
+
+static void class_init_SCA_Tuscany(TSRMLS_D)
+{
+ zend_class_entry ce;
+
+ INIT_CLASS_ENTRY(ce, "SCA_Tuscany", SCA_Tuscany_methods);
+ SCA_Tuscany_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC);
+
+ /* {{{ Property registration */
+
+ zend_declare_property_null(SCA_Tuscany_ce_ptr,
+ "operation", sizeof("operation") -1,
+ ZEND_ACC_PUBLIC TSRMLS_CC);
+
+ /* }}} Property registration */
+
+}
+
+/* }}} Class SCA_Tuscany */
+
+/* }}} Class definitions*/
+
+/* {{{ sca_functions[] */
+function_entry sca_functions[] = {
+ { NULL, NULL, NULL }
+};
+/* }}} */
+
+/* {{{ cross-extension dependencies */
+
+#if ZEND_EXTENSION_API_NO >= 220050617
+static zend_module_dep sca_deps[] = {
+ ZEND_MOD_REQUIRED("sdo")
+ {NULL, NULL, NULL, 0}
+};
+#endif
+/* }}} */
+
+/* {{{ sca_module_entry */
+zend_module_entry sca_module_entry = {
+#if ZEND_EXTENSION_API_NO >= 220050617
+ STANDARD_MODULE_HEADER_EX, NULL,
+ sca_deps,
+#else
+ STANDARD_MODULE_HEADER,
+#endif
+
+ "sca",
+ sca_functions,
+ PHP_MINIT(sca), /* Replace with NULL if there is nothing to do at php startup */
+ PHP_MSHUTDOWN(sca), /* Replace with NULL if there is nothing to do at php shutdown */
+ NULL, /* Replace with NULL if there is nothing to do at request start */
+ NULL, /* Replace with NULL if there is nothing to do at request end */
+ PHP_MINFO(sca),
+ "0.0.1",
+ STANDARD_MODULE_PROPERTIES
+};
+/* }}} */
+
+#ifdef COMPILE_DL_SCA
+extern "C" {
+ZEND_GET_MODULE(sca)
+} // extern "C"
+#endif
+
+
+/* {{{ PHP_MINIT_FUNCTION */
+PHP_MINIT_FUNCTION(sca)
+{
+ /* We use the SDO extension for reference because it is a prereq */
+ zend_module_entry *req_module_entry;
+ char *req_module_name = "libxml";
+ if (zend_hash_find(&module_registry, req_module_name, strlen(req_module_name)+1, (void**)&req_module_entry) == SUCCESS) {
+ if (req_module_entry->zend_debug != ZEND_DEBUG ||
+ req_module_entry->zts != USING_ZTS ||
+ req_module_entry->zend_api != ZEND_MODULE_API_NO) {
+ php_error(E_ERROR,
+ "Cannot initialize module sca.\nModule sca compiled with module API=%d, debug=%d, thread-safety=%d\nModule %n compiled with module API=%d, debug=%d, thread-safety=%d\nThese options need to match",
+ req_module_name,
+ ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS,
+ req_module_entry->zend_api, req_module_entry->zend_debug, req_module_entry->zts);
+ return FAILURE;
+ }
+ } else {
+ /* The dependency checker should already have found this, but to be on the safe side ... */
+ php_error (E_ERROR,
+ "Cannot load module sca because required module %n is not loaded",
+ req_module_name);
+ return FAILURE;
+ }
+
+ class_init_SCA_Tuscany(TSRMLS_C);
+
+ return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
+PHP_MSHUTDOWN_FUNCTION(sca)
+{
+ /*
+ * There is some corruption going on at shutdown.
+ * The following hack eliminates the symptom, but there's probably still
+ * an underlying problem.
+ */
+ free(SCA_Tuscany_ce_ptr->name);
+ SCA_Tuscany_ce_ptr->name = NULL;
+ destroy_zend_class(&SCA_Tuscany_ce_ptr);
+ SCA_Tuscany_ce_ptr = NULL;
+
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_MINFO_FUNCTION */
+PHP_MINFO_FUNCTION(sca)
+{
+ php_info_print_box_start(0);
+ php_printf("<p>SCA Extension</p>\n");
+ php_printf("<p>Version 0.0.1alpha (2007-01-15)</p>\n");
+ php_printf("<p><b>Authors:</b></p>\n");
+ php_printf("<p>Simon Laws &lt;slaws@php.net&gt; (lead)</p>\n");
+ php_printf("<p>Caroline Maynard &lt;cem@php.net&gt; (lead)</p>\n");
+ php_info_print_box_end();
+ php_info_print_table_start();
+ php_info_print_table_header(2, "SCA", "enabled");
+ php_info_print_table_row(2, "SCA Version", "0.0.1");
+ php_info_print_table_end();
+
+}
+/* }}} */
+
+/* Other functions not directly related to implementing the
+ SCA_Tuscany extension */
+
+#endif /* HAVE_SCA */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.h b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.h
new file mode 100644
index 0000000000..5bbc9001dc
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/src/tuscany/sca/php/sca.h
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+/* $ Id: $ */
+
+#ifndef SCA_H
+#define SCA_H
+
+#include "tuscany/sca/core/Operation.h"
+
+#include <main/php.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern zend_module_entry sca_module_entry;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* SCA_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/xsd/sca-implementation-php.xsd b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/xsd/sca-implementation-php.xsd
new file mode 100644
index 0000000000..0f32f120e6
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/php/xsd/sca-implementation-php.xsd
@@ -0,0 +1,39 @@
+<?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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <element name="implementation.php" type="sca:PHPImplementation" substitutionGroup="sca:implementation"/>
+ <complexType name="PHPImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="module" type="NCName" use="required"/>
+ <attribute name="class" type="Name" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>