diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator |
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/samples/PHPCalculator')
60 files changed, 3345 insertions, 0 deletions
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/Makefile.am new file mode 100644 index 0000000000..3277f97e6e --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/Makefile.am @@ -0,0 +1,22 @@ +# 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)/PHPCalculator/deploy +# SUBDIRS = sample.calculator sample.calculator.client +SUBDIRS = sample.calculator +EXTRA_DIST = *.composite +deploy_DATA = *.composite diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/README b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/README new file mode 100644 index 0000000000..d91c958763 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/README @@ -0,0 +1,122 @@ +Tuscany SCA for C++ Samples - PHP Calculator Sample +=================================================== + +This is a simple sample to show how an SCA composite can wire together +a number of components to implement a Calculator service and expose that service as +to a number of different tpyes of client. The sample components are implemented in various +ways to demonstrate the different features of the PHP SCA extension. + +There are three sub projects in this workspace: + - sample.calculator + This contains the source code and SCDL artifacts for the SCA Calculator + composite implementing the sample Calculator + + - sample.calculator.client + A sample client which does a local call to the Calculator service + + - sample.calculator.wsclient + A sample PHP SCA Web Service client which calls the Calculator Web service. + +Additionally, there is the sample.calculator.app.composite file. This +describes the configuration of the SCA Calculator composite deployed to the +SCA runtime. + +(See the README.html file for instructions to build and run this sample - TODO) + +The file phpcalculator.png is a picture of the sample. Given the restrictions on the +current PHP extension (see TODOs in the PHP Extension README) some parts of this +have not been tested yet. + +The path that has been tested is as follows: + +Local CPP client -> CPP Calculator -> PHP Divide -> PHP Add ------> PHP Log + |-------> PHP Subtract -> PHP Log + |-------> PHP Multiple -> PHP Log + |-------> PHP Divide ---> PHP Log + +The local CPP client is used because + - the work to enable PHP to host SCA is not done yet + - running with the axis service causes missing symbols errors on my box + +The CPP Calculator component is used because + - The local CPP client can only talk directly to a CPP component + +To run the sample in this configuration use the CalculatorClient.cpp found in the +sample.calculator.client directory + +Windows +======= + +Hasn't yet been tests on windows in this configuration so ignore the following + +I use the following bat file to start the stand alone axis server and include +appropriate references to PHP dependencies. This needs turning into a proper +run script but I haven't got to this yet + +set TUSCANY_SCACPP_LOGGING=9 +set AXIS2C_HOME=C:\axis2c-bin-0.95-win32 +set PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SDOCPP%\bin;%TUSCANY_SCACPP%\extensions\php\bin;%AXIS2C_HOME%\lib;c:\libxml2-2.6.23.win32\bin;c:\apps\iconv-1.9.1.win32\bin;c:\apps\zlib-1.2.3.win32\bin;C:\php-5.2.0\ +set TUSCANY_SCACPP_ROOT=%TUSCANY_SCACPP%\samples\PHPCalculator +rem set TUSCANY_SCACPP_DEFAULT_COMPONENT=sample.calculator.CalculatorComponent + +%AXIS2C_HOME%\bin\axis2_http_server.exe -l 9 + +I then + +cd %TUSCANY_SCACPP%\samples\PHPCalculator\samples.calculator.wsclient +runwsclient.bat + +This has the effect of runing a PHP/SCA client (no C++ SCA content at all) +to generate a web service request to the C++ SCA runtime hosting the calculator +application. + +Currently this doesn't run all the way through due to a WSDL bug in PHP SCA +(http://pecl.php.net/bugs/bug.php?id=9572). But it gets 99% of the way there. +You will see the server doing all of its stuff and returning the correct result. + +Linux +===== + +I find the following environment variables useful when running PHP embedded inside of +Tuscany SCA. + +# the library path use to locate shared libraries +export LD_LIBRARY_PATH=$LIBXML2_LIB:\ +$AXIS2C_HOME/lib:\ +$PHP_LIB:\ +$TUSCANY_SDOCPP/lib:\ +$TUSCANY_SCACPP/lib:\ +$TUSCANY_SCACPP/extensions/cpp/lib:\ +$TUSCANY_SCACPP/extensions/php/lib:\ +$TUSCANY_SCACPP/extensions/ws/lib:\ +$TUSCANY_SCACPP/samples/PHPCalculator/deploy/sample.calculator:\ +$PHP_SCA_SDO_LIB + +# tell PHP specifically where to find php.ini rather than relying on the default +set PHPRC=/usr/local/lib + +# tell Tuscany SCA which composite appplication to run +export TUSCANY_SCACPP_ROOT=/usr/local/tuscany/cpp/sca/deploy/samples/PHPCalculator + +# tell Tuscany SCA which is the default component in this composite +export TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent + +# turn on logging so you can see what's going on +export TUSCANY_SCACPP_LOGGING=9 + +There is an env.sh file that can be edited and used to set your environment. One edited +to reflect your environment do: + +source env.sh + +The CPP client currently has an independent Makefile due to build problems with the automake +build on my box. If you have your environment configured as above you should be able to do: + +make + +This will produce a.out which can be run using the provided script. + +runclient_cpp.sh + + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/Build/Build.vcproj b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/Build/Build.vcproj new file mode 100644 index 0000000000..c33437a8cd --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/Build/Build.vcproj @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Build"
+ ProjectGUID="{4D8888D4-CC80-4008-B3B4-6772A0CA9010}"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Build.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Build.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/PHPCalculator.sln b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/PHPCalculator.sln new file mode 100644 index 0000000000..899bb2c713 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/PHPCalculator.sln @@ -0,0 +1,36 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Build", "Build\Build.vcproj", "{4D8888D4-CC80-4008-B3B4-6772A0CA9010}"
+ ProjectSection(ProjectDependencies) = postProject
+ {8DD6E7A7-912D-49DD-9517-A91E8FB040D3} = {8DD6E7A7-912D-49DD-9517-A91E8FB040D3}
+ {799C40A9-9DDB-4DCD-806D-50205508AE0E} = {799C40A9-9DDB-4DCD-806D-50205508AE0E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample.calculator", "sample.calculator\sample.calculator.vcproj", "{8DD6E7A7-912D-49DD-9517-A91E8FB040D3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample.calculator.client", "sample.calculator.client\sample.calculator.client.vcproj", "{799C40A9-9DDB-4DCD-806D-50205508AE0E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4D8888D4-CC80-4008-B3B4-6772A0CA9010}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4D8888D4-CC80-4008-B3B4-6772A0CA9010}.Debug|Win32.Build.0 = Debug|Win32
+ {4D8888D4-CC80-4008-B3B4-6772A0CA9010}.Release|Win32.ActiveCfg = Release|Win32
+ {4D8888D4-CC80-4008-B3B4-6772A0CA9010}.Release|Win32.Build.0 = Release|Win32
+ {8DD6E7A7-912D-49DD-9517-A91E8FB040D3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8DD6E7A7-912D-49DD-9517-A91E8FB040D3}.Debug|Win32.Build.0 = Debug|Win32
+ {8DD6E7A7-912D-49DD-9517-A91E8FB040D3}.Release|Win32.ActiveCfg = Release|Win32
+ {8DD6E7A7-912D-49DD-9517-A91E8FB040D3}.Release|Win32.Build.0 = Release|Win32
+ {799C40A9-9DDB-4DCD-806D-50205508AE0E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {799C40A9-9DDB-4DCD-806D-50205508AE0E}.Debug|Win32.Build.0 = Debug|Win32
+ {799C40A9-9DDB-4DCD-806D-50205508AE0E}.Release|Win32.ActiveCfg = Release|Win32
+ {799C40A9-9DDB-4DCD-806D-50205508AE0E}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/sample.calculator.client/sample.calculator.client.vcproj b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/sample.calculator.client/sample.calculator.client.vcproj new file mode 100644 index 0000000000..efc9194822 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/sample.calculator.client/sample.calculator.client.vcproj @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sample.calculator.client"
+ ProjectGUID="{799C40A9-9DDB-4DCD-806D-50205508AE0E}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Client.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\sample.calculator;"$(TUSCANY_SDOCPP)/include";"$(TUSCANY_SCACPP)/include";"$(TUSCANY_SCACPP)/extensions/cpp/include";"$(PHP_HOME)/main";"$(PHP_HOME)/sapi/embed";"$(PHP_HOME)";"$(PHP_HOME)/zend";"$(PHP_HOME)/TSRM";"$(PHP_SCA_SDO_HOME)""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ZEND_WIN32;PHP_WIN32;ZTS;ZEND_DEBUG=0"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/Client.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib tuscany_sca.lib tuscany_sca_cpp.lib $(NOINHERIT)"
+ OutputFile="Debug/calculator_client.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(TUSCANY_SDOCPP)/lib,$(TUSCANY_SCACPP)/lib,$(TUSCANY_SCACPP)/extensions/cpp/lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/calculator_client.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/Client.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="call ..\..\deployclient.bat ..\..\ Debug
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Client.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\sample.calculator;"$(TUSCANY_SDOCPP)/include";"$(TUSCANY_SCACPP)/include";"$(TUSCANY_SCACPP)/extensions/cpp/include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/Client.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib tuscany_sca.lib tuscany_sca_cpp.lib $(NOINHERIT)"
+ OutputFile="Release/calculator_client.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(TUSCANY_SDOCPP)/lib,$(TUSCANY_SCACPP)/lib,$(TUSCANY_SCACPP)/extensions/cpp/lib"
+ ProgramDatabaseFile=".\Release/calculator_client.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/Client.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="call ..\..\deployclient.bat ..\..\ Release
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\sample.calculator.client\CalculatorClient.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/sample.calculator/sample.calculator.vcproj b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/sample.calculator/sample.calculator.vcproj new file mode 100644 index 0000000000..939c25e991 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/VSExpress/sample.calculator/sample.calculator.vcproj @@ -0,0 +1,294 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sample.calculator"
+ ProjectGUID="{8DD6E7A7-912D-49DD-9517-A91E8FB040D3}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="..\..\..\scagen.bat ..\..\sample.calculator"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/Calculator.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(TUSCANY_SDOCPP)/include,$(TUSCANY_SCACPP)/include,$(TUSCANY_SCACPP)/extensions/cpp/include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CALCULATOR_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/Calculator.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sca_cpp.lib tuscany_sca.lib tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile=".\Debug/Calculator.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(TUSCANY_SDOCPP)/lib,$(TUSCANY_SCACPP)/lib,$(TUSCANY_SCACPP)/extensions/cpp/lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/Calculator.pdb"
+ ImportLibrary=".\Debug/Calculator.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/Calculator.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="call ..\..\deploy.bat "
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="..\..\..\scagen.bat ..\..\sample.calculator"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/Calculator.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="$(TUSCANY_SDOCPP)/include,$(TUSCANY_SCACPP)/include,$(TUSCANY_SCACPP)/extensions/cpp/include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CALCULATOR_EXPORTS"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/Calculator.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sca_cpp.lib tuscany_sca.lib tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile=".\Release/Calculator.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(TUSCANY_SDOCPP)/lib,$(TUSCANY_SCACPP)/lib,$(TUSCANY_SCACPP)/extensions/cpp/lib"
+ ProgramDatabaseFile=".\Release/Calculator.pdb"
+ ImportLibrary=".\Release/Calculator.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/Calculator.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="call ..\..\deploy.bat ..\..\ Release"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl_CalculatorService_Proxy.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl_CalculatorService_Wrapper.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl_divideService_Proxy.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\DivideImpl.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\DivideImpl_DivideService_Proxy.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\DivideImpl_DivideService_Wrapper.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\sample.calculator\Calculator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl_CalculatorService_Proxy.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl_CalculatorService_Wrapper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\CalculatorImpl_divideService_Proxy.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\Divide.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\DivideImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\DivideImpl_DivideService_Proxy.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\sample.calculator\DivideImpl_DivideService_Wrapper.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/deploy.bat b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/deploy.bat new file mode 100644 index 0000000000..fd1d8773d1 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/deploy.bat @@ -0,0 +1,59 @@ +@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. + +rem Will copy the correct files from the source tree for packaging and deployment of the +rem SCA sample. +setlocal +set currentPath=%~d0%~p0 +set sourcePath=%currentPath% + +set deploydir=%TUSCANY_SCACPP% +set samplesdir=%deploydir%\samples +set calcdir=%samplesdir%\PHPCalculator + +if . == %1. ( +set destinationPath=%calcdir%\deploy +) ELSE ( +set destinationPath=%1 +) + +if not exist %samplesdir% mkdir %samplesdir% +if not exist %calcdir% mkdir %calcdir% +if not exist %destinationPath% mkdir %destinationPath% +if not exist %destinationPath%\sample.calculator mkdir %destinationPath%\sample.calculator +copy %sourcePath%\sample.calculator\*.composite %destinationPath%\sample.calculator +copy %sourcePath%\sample.calculator\*.componentType %destinationPath%\sample.calculator +copy %sourcePath%\sample.calculator\*.php %destinationPath%\sample.calculator +copy %sourcePath%\sample.calculator\Calculator.wsdl %destinationPath%\sample.calculator +copy %sourcePath%\sample.calculator\runwsserver.bat %destinationPath%\sample.calculator + +if not exist %destinationPath%\sample.calculator.client mkdir %destinationPath%\sample.calculator.client +copy %sourcePath%\sample.calculator.client\CalculatorClient.php %destinationPath%\sample.calculator.client +copy %sourcePath%\sample.calculator.client\runclient.bat %destinationPath%\sample.calculator.client + +if not exist %destinationPath%\sample.calculator.wsclient mkdir %destinationPath%\sample.calculator.wsclient +copy %sourcePath%\sample.calculator.wsclient\CalculatorWSClient.php %destinationPath%\sample.calculator.wsclient +copy %sourcePath%\sample.calculator.wsclient\Calculator.wsdl %destinationPath%\sample.calculator.wsclient +copy %sourcePath%\sample.calculator.wsclient\runwsclient.bat %destinationPath%\sample.calculator.wsclient + +copy %sourcePath%\*.composite %destinationPath% + +copy Debug\Calculator.dll %destinationPath%\sample.calculator +copy Debug\Calculator.pdb %destinationPath%\sample.calculator + +endlocal diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/deployclient.bat b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/deployclient.bat new file mode 100644 index 0000000000..5e20b30de5 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/deployclient.bat @@ -0,0 +1,64 @@ +@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.
+
+rem Will copy the correct files from the source tree for packaging and
+rem deployment of the SCA Calculator sample.
+
+setlocal
+
+if . == .%1 (
+echo source path not specified
+goto usage
+)
+set srcdir=%1
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+set package=sample.calculator.client
+
+set deploydir=%TUSCANY_SCACPP%
+set samplesdir=%deploydir%\samples
+set calcdir=%samplesdir%\PHPCalculator
+set calcdeploydir=%calcdir%\deploy
+set clientdir=%calcdeploydir%\%package%
+
+if not exist %samplesdir% mkdir %samplesdir%
+if not exist %calcdir% mkdir %calcdir%
+if not exist %calcdeploydir% mkdir %calcdeploydir%
+if not exist %clientdir% mkdir %clientdir%
+
+set clientdirsrc=%srcdir%\%package%
+copy %clientdirsrc%\runclient_php.bat %clientdir%
+copy %clientdirsrc%\runclient_cpp.bat %clientdir%
+
+set library=calculator_client
+copy %inpath%\%library%.exe %clientdir%
+
+if exist %inpath%\%library%.pdb copy %inpath%\%library%.pdb %clientdir%
+
+goto end
+:usage
+echo Usage: deploy <sample-src> <build-output>
+:end
+
+endlocal
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/phpcalculator.png b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/phpcalculator.png Binary files differnew file mode 100644 index 0000000000..c251364548 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/phpcalculator.png diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.app.composite b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.app.composite new file mode 100644 index 0000000000..1450ad687b --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.app.composite @@ -0,0 +1,33 @@ +<?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> + +<!-- + <component name="sample.calculator.CalculatorWSClientComponent"> + <implementation.composite name="sample.calculator.wsclient" /> + </component> +--> +</composite> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/CalculatorClient.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/CalculatorClient.cpp new file mode 100644 index 0000000000..e72b52f87e --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/CalculatorClient.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$ */ + +// some strangeness in the build that causes +// WinSock.h and WinSock2.h to be included leading to redefinitions +//#define _WINSOCKAPI_ + + +#include <iostream> + +#include <php_embed.h> + +#include <string> + +#include "commonj/sdo/SDO.h" + +#include "osoa/sca/sca.h" + +#include "Calculator.h" + + +using namespace std; +using namespace commonj::sdo; +using namespace osoa::sca; + + +int main (int argc, char** argv) +{ + + try + { + CompositeContext myContext = CompositeContext::getCurrent(); + Calculator *calcService = (Calculator*) myContext.locateService("CalculatorCPPComponent/CalculatorService"); + float result = calcService->div(10, 2); + cout << "calculator_client: div(10,2) = " << result << endl; + } + catch (...) + { + printf("Got and exception"); + } + + return 0; +} diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/CalculatorClient.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/CalculatorClient.php new file mode 100644 index 0000000000..7a512260ae --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/CalculatorClient.php @@ -0,0 +1,32 @@ +<?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'; + +// Get a proxy to the local Calculator.php +$service = SCA::getService('../sample.calculator/Calculator.php'); + +// Call the local service and write out the response +echo "add(1.23, 4.56) = " . $service->add(1.23, 4.56) . "\n"; +echo "sub(1.23, 4.56) = " . $service->sub(1.23, 4.56) . "\n"; +echo "mul(1.23, 4.56) = " . $service->mul(1.23, 4.56) . "\n"; +echo "div(1.23, 4.56) = " . $service->div(1.23, 4.56) . "\n"; + +?> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/Makefile b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/Makefile new file mode 100644 index 0000000000..c335defb89 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/Makefile @@ -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.
+
+INCLUDES = \
+-I/usr/local/include/php \
+-I/usr/local/include/php/sapi/embed \
+-I/usr/local/include/php/Zend \
+-I/usr/local/include/php/main \
+-I/usr/local/include/php/TSRM \
+-I${TUSCANY_SDOCPP}/include \
+-I${TUSCANY_SCACPP}/include \
+-I${TUSCANY_SCACPP}/extensions/cpp/include \
+-I${TUSCANY_SCACPP}/samples/CppCalculator/sample.calculator
+
+FLAGS = \
+-g \
+-O2 \
+-MD \
+-MP \
+-fPIC \
+-DPIC
+
+LIBS = \
+-L${LIBXML2_LIB} \
+-L${$AXIS2C_HOME}/lib \
+-L${PHP_LIB} \
+-L${TUSCANY_SDOCPP}/lib \
+-L${TUSCANY_SCACPP}/lib \
+-L${TUSCANY_SCACPP}/extensions/cpp/lib \
+-L${TUSCANY_SCACPP}/extensions/php/lib \
+-L${TUSCANY_SCACPP}/extensions/ws/lib \
+-lphp5 \
+-ltuscany_sdo \
+-ltuscany_sca \
+-ltuscany_sca_cpp
+
+phpembedtest:
+ g++ $(INCLUDES) $(FLAGS) $(LIBS) CalculatorClient.cpp
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/env.sh b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/env.sh new file mode 100755 index 0000000000..a2fa6eadc3 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/env.sh @@ -0,0 +1,29 @@ +export AXIS2C_HOME=/home/slaws/apps/axis2c-bin-0.96-linux + +export LIBXML2_LIB=/usr/lib +export LIBXML2_INCLUDE=/usr/include/libxml2 + +export PHP_LIB=/usr/local/lib +export PHP_INCLUDE=/usr/local/include/php + +export PHP_SCA_SDO_INCLUDE=/home/slaws/phpbuild-5-2/pecl/SDO +export PHP_SCA_SDO_LIB=$PHP_LIB/php/extensions/no-debug-zts-20060613/ + +export TUSCANY_SDOCPP=/sdo/deploy +export TUSCANY_SCACPP=/usr/local/tuscany/cpp/sca/deploy + +export LD_LIBRARY_PATH=$LIBXML2_LIB:\ +$AXIS2C_HOME/lib:\ +$PHP_LIB:\ +$TUSCANY_SDOCPP/lib:\ +$TUSCANY_SCACPP/lib:\ +$TUSCANY_SCACPP/extensions/cpp/lib:\ +$TUSCANY_SCACPP/extensions/php/lib:\ +$TUSCANY_SCACPP/extensions/ws/lib:\ +$TUSCANY_SCACPP/samples/PHPCalculator/deploy/sample.calculator:\ +$PHP_SCA_SDO_LIB + +export TUSCANY_SCACPP_LOGGING=9 +export TUSCANY_SCACPP_ROOT=/usr/local/tuscany/cpp/sca/deploy/samples/PHPCalculator + +export PATH=.:$PATH diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_cpp.bat b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_cpp.bat new file mode 100644 index 0000000000..655cef9ceb --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_cpp.bat @@ -0,0 +1,7 @@ +set TUSCANY_SCACPP_ROOT=%TUSCANY_SCACPP%\samples\PHPCalculator\deploy
+set TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent
+set TUSCANY_SCACPP_LOGGING=9
+set PHRC=C:\simon\Projects\Tuscany\php\php-5.2.0\Debug_TS
+
+calculator_client.exe
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_cpp.sh b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_cpp.sh new file mode 100755 index 0000000000..e98e06c73f --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_cpp.sh @@ -0,0 +1,7 @@ +export TUSCANY_SCACPP_ROOT=/usr/local/tuscany/cpp/sca/deploy/samples/PHPCalculator +export TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent + +a.out +# gdb a.out +# strace a.out &> strace.txt +# valgrind a.out diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_php.bat b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_php.bat new file mode 100644 index 0000000000..815c4fb58e --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.client/runclient_php.bat @@ -0,0 +1,25 @@ +@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 + +php TuscanyTest.php + +:end +endlocal diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/Calculator.wsdl b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/Calculator.wsdl new file mode 100644 index 0000000000..4d6904b687 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/Calculator.wsdl @@ -0,0 +1,173 @@ +<?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. +--> + +<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://sample/calculator" + targetNamespace="http://sample/calculator"> + <types> + <xs:schema targetNamespace="http://sample/calculator" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://sample/calculator" elementFormDefault="qualified"> + + <xs:element name="add"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="sub"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="mul"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="div"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="addResponse"> + <xs:complexType> + <xs:sequence> + <xs:element name="addReturn" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="result"> + <xs:complexType> + <xs:sequence> + <xs:element name="data" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + </xs:schema> + </types> + + <message name="addRequestMsg"> + <part name="body" element="tns:add" /> + </message> + <message name="addResponseMsg"> + <part name="body" element="tns:addResponse" /> + </message> + <message name="subRequestMsg"> + <part name="body" element="tns:sub" /> + </message> + <message name="mulRequestMsg"> + <part name="body" element="tns:mul" /> + </message> + <message name="divRequestMsg"> + <part name="body" element="tns:div" /> + </message> + + <message name="calculatorResponseMsg"> + <part name="body" element="tns:result" /> + </message> + + <portType name="Calculator"> + <operation name="add"> + <input message="tns:addRequestMsg" /> + <output message="tns:addResponseMsg" /> + </operation> + <operation name="sub"> + <input message="tns:subRequestMsg" /> + <output message="tns:calculatorResponseMsg" /> + </operation> + <operation name="mul"> + <input message="tns:mulRequestMsg" /> + <output message="tns:calculatorResponseMsg" /> + </operation> + <operation name="div"> + <input message="tns:divRequestMsg" /> + <output message="tns:calculatorResponseMsg" /> + </operation> + </portType> + + <binding name="CalculatorBinding" + type="tns:Calculator"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <operation name="add"> + <soap:operation soapAction="CalculatorService#add" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="sub"> + <soap:operation soapAction="CalculatorService#sub" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="mul"> + <soap:operation soapAction="CalculatorService#mul" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="div"> + <soap:operation soapAction="CalculatorService#div" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + </binding> + + <service name="CalculatorService"> + <port name="CalculatorPort" + binding="tns:CalculatorBinding"> + <soap:address location="http://localhost:9090/axis2/services/sample.calculator.CalculatorComponent/CalculatorService" /> + </port> + </service> +</definitions> +<!-- this line identifies this file as WSDL generated by SCA for PHP. Do not remove --> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/CalculatorWSClient.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/CalculatorWSClient.php new file mode 100644 index 0000000000..82faf1ef19 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/CalculatorWSClient.php @@ -0,0 +1,31 @@ +<?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'; + +// Get a proxy to the local Calculator.php +$service = SCA::getService('Calculator.wsdl'); + +// Call the local service and write out the response +//echo "add(1.23, 4.56) = " . $service->add(1.23, 4.56) . "\n"; +//echo "sub(1.23, 4.56) = " . $service->sub(1.23, 4.56) . "\n"; +//echo "mul(1.23, 4.56) = " . $service->mul(1.23, 4.56) . "\n"; +echo "div(1.23, 4.56) = " . $service->div(1.23, 4.56) . "\n"; + +?> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/runwsclient.bat b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/runwsclient.bat new file mode 100644 index 0000000000..a1482be5db --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator.wsclient/runwsclient.bat @@ -0,0 +1,25 @@ +@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 + +php CalculatorWSClient.php + +:end +endlocal diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.componentType new file mode 100644 index 0000000000..aca0b2a6e4 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.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="AddService"> + <interface.cpp header="Add.h"/> + </service> + + <reference name="log_service"> + <interface.cpp header="Log.h"/> + </reference> +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.h new file mode 100644 index 0000000000..4abfe9af6b --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.h @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + + +#ifndef sample_add_h +#define sample_add_h + +class Add +{ + public: + virtual float add(float num1, float num2) = 0; +}; + +#endif // sample_add_h + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.php new file mode 100644 index 0000000000..4b5747e10f --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Add.php @@ -0,0 +1,32 @@ +<?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'; + +$num1 = $_REQUEST[0]; +$num2 = $_REQUEST[1]; + +$result = $num1 + $num2; + +$log_proxy = SCA::getService("log_service"); +$log_proxy->log_message($result); + +echo $result; +?> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.componentType new file mode 100644 index 0000000000..7767c663bf --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.componentType @@ -0,0 +1,43 @@ +<?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.cpp header="Calculator.h"/> + </service> + + <reference name="add_service"> + <interface.cpp header="Add.h"/> + </reference> + + <reference name="sub_service"> + <interface.cpp header="Subtract.h"/> + </reference> + + <reference name="mul_service"> + <interface.cpp header="Multiply.h"/> + </reference> + + <reference name="div_service"> + <interface.cpp header="Divide.h"/> + </reference> + +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.h new file mode 100644 index 0000000000..90e97b5319 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.h @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#ifndef sample_calculator_h +#define sample_calculator_h + +class Calculator +{ +public: + virtual float add(float arg1, float arg2) = 0; + virtual float sub(float arg1, float arg2) = 0; + virtual float mul(float arg1, float arg2) = 0; + virtual float div(float arg1, float arg2) = 0; +}; + +#endif // sample_calculator_h diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.php new file mode 100644 index 0000000000..ce8f7899da --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.php @@ -0,0 +1,97 @@ +<?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 Add.php + */ + public $add_service; + + /** + * @reference + * @binding.php Subtract.php + */ + public $sub_service; + + /** + * @reference + * @binding.php Multiply.php + */ + public $mul_service; + + /** + * @reference + * @binding.ws Divide.wsdl + */ + public $div_service; + + /** + * Addition + * + * @param float $num1 (the first number) + * @param float $num2 (the second number) + * @return float The result + */ + function add($num1, $num2) { + return $this->mul_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 $this->mul_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/samples/PHPCalculator/sample.calculator/Calculator.wsdl b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.wsdl new file mode 100644 index 0000000000..331b996ba2 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Calculator.wsdl @@ -0,0 +1,161 @@ +<?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. +--> + +<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://sample/calculator" + targetNamespace="http://sample/calculator"> + <types> + <xs:schema targetNamespace="http://sample/calculator" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://sample/calculator" elementFormDefault="qualified"> + + <xs:element name="add"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="sub"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="mul"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="div"> + <xs:complexType> + <xs:sequence> + <xs:element name="param1" type="xs:float"/> + <xs:element name="param2" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="result"> + <xs:complexType> + <xs:sequence> + <xs:element name="data" type="xs:float"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + </xs:schema> + </types> + + <message name="addRequestMsg"> + <part name="body" element="tns:add" /> + </message> + <message name="subRequestMsg"> + <part name="body" element="tns:sub" /> + </message> + <message name="mulRequestMsg"> + <part name="body" element="tns:mul" /> + </message> + <message name="divRequestMsg"> + <part name="body" element="tns:div" /> + </message> + + <message name="calculatorResponseMsg"> + <part name="body" element="tns:result" /> + </message> + + <portType name="Calculator"> + <operation name="add"> + <input message="tns:addRequestMsg" /> + <output message="tns:calculatorResponseMsg" /> + </operation> + <operation name="sub"> + <input message="tns:subRequestMsg" /> + <output message="tns:calculatorResponseMsg" /> + </operation> + <operation name="mul"> + <input message="tns:mulRequestMsg" /> + <output message="tns:calculatorResponseMsg" /> + </operation> + <operation name="div"> + <input message="tns:divRequestMsg" /> + <output message="tns:calculatorResponseMsg" /> + </operation> + </portType> + + <binding name="CalculatorBinding" + type="tns:Calculator"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <operation name="add"> + <soap:operation soapAction="CalculatorService#add" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="sub"> + <soap:operation soapAction="CalculatorService#sub" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="mul"> + <soap:operation soapAction="CalculatorService#mul" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + <operation name="div"> + <soap:operation soapAction="CalculatorService#div" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + </binding> + + <service name="CalculatorService"> + <port name="CalculatorPort" + binding="tns:CalculatorBinding"> + <soap:address location="http://localhost:9090/axis2/services/sample.calculator.CalculatorComponent/CalculatorService" /> + </port> + </service> +</definitions> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.componentType new file mode 100644 index 0000000000..e2799af955 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.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.cpp header="Calculator.h"/> + </service> + + <reference name="divideService"> + <interface.cpp header="Divide.h"/> + </reference> + +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.cpp new file mode 100644 index 0000000000..2d880de72d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.cpp @@ -0,0 +1,90 @@ +/* + * 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 <stdio.h> + +#include "osoa/sca/ComponentContext.h" +#include "osoa/sca/ServiceRuntimeException.h" + +#include "CalculatorImpl.h" +#include "Divide.h" + +CalculatorImpl::CalculatorImpl() +{ +} + +CalculatorImpl::~CalculatorImpl() +{ +} + +// Calculator interface +float CalculatorImpl::add(float arg1, float arg2) +{ + float result = arg1 + arg2; + + printf("CalculatorImpl::add %f + %f = %f\n", arg1, arg2, result); + return result; +} + +float CalculatorImpl::sub(float arg1, float arg2) +{ + float result = arg1 - arg2; + printf("CalculatorImpl::sub %f - %f = %f\n", arg1, arg2, result); + return result; +} + +float CalculatorImpl::mul(float arg1, float arg2) +{ + float result = arg1 * arg2; + printf("CalculatorImpl::mul %f * %f = %f\n", arg1, arg2, result); + return result; +} + +float CalculatorImpl::div(float arg1, float arg2) +{ + float result = 0; + + // This method shows how to invoke a service on a different component from within a component + + // First, get the current ComponentContext + osoa::sca::ComponentContext myContext = osoa::sca::ComponentContext::getCurrent(); + + try + { + // Find the required service, as referenced in CalculatorImpl.componentType + Divide* divideService = (Divide*)myContext.getService("divideService"); + + // Finally, invoke the service + result = divideService->div(arg1, arg2); + + printf("CalculatorImpl::div Divide returned result: %f\n", result); + + } + catch (osoa::sca::ServiceRuntimeException& e) + { + // Print out error message and carry on + printf("CalculatorImpl::div Error whilst invoking Divide: %s", e.getMessageText()); + } + + return result; +} + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.h new file mode 100644 index 0000000000..af8a5eeab1 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl.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 sample_calculatorimpl_h +#define sample_calculatorimpl_h + +#include "Calculator.h" + +class CalculatorImpl : public Calculator +{ +public: + CalculatorImpl(); + virtual ~CalculatorImpl(); + + // Calculator interface + virtual float add(float arg1, float arg2); + virtual float sub(float arg1, float arg2); + virtual float mul(float arg1, float arg2); + virtual float div(float arg1, float arg2); +}; + +#endif // sample_calculatorimpl_h + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Proxy.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Proxy.cpp new file mode 100644 index 0000000000..084e6fbf2f --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Proxy.cpp @@ -0,0 +1,98 @@ +/* + * 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 "CalculatorImpl_CalculatorService_Proxy.h" + +#include "osoa/sca/sca.h" + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + CalculatorImpl_CalculatorService_Proxy* CalculatorImpl_CalculatorService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) + { + return new CalculatorImpl_CalculatorService_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void CalculatorImpl_CalculatorService_Proxy_Destructor(void* proxy) + { + delete (CalculatorImpl_CalculatorService_Proxy*)proxy; + } +} + +CalculatorImpl_CalculatorService_Proxy::CalculatorImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) +{ +} + +CalculatorImpl_CalculatorService_Proxy::~CalculatorImpl_CalculatorService_Proxy() +{ + if (target) + delete target; +} + +float CalculatorImpl_CalculatorService_Proxy::add( float arg0, float arg1) +{ + tuscany::sca::Operation operation("add"); + operation.addParameter("arg1", &arg0); + operation.addParameter("arg2", &arg1); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return *(float*)operation.getReturnValue(); +} + +float CalculatorImpl_CalculatorService_Proxy::sub( float arg0, float arg1) +{ + tuscany::sca::Operation operation("sub"); + operation.addParameter("arg1", &arg0); + operation.addParameter("arg2", &arg1); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return *(float*)operation.getReturnValue(); +} + +float CalculatorImpl_CalculatorService_Proxy::mul( float arg0, float arg1) +{ + tuscany::sca::Operation operation("mul"); + operation.addParameter("arg1", &arg0); + operation.addParameter("arg2", &arg1); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return *(float*)operation.getReturnValue(); +} + +float CalculatorImpl_CalculatorService_Proxy::div( float arg0, float arg1) +{ + tuscany::sca::Operation operation("div"); + operation.addParameter("arg1", &arg0); + operation.addParameter("arg2", &arg1); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return *(float*)operation.getReturnValue(); +} + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Proxy.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Proxy.h new file mode 100644 index 0000000000..700a060636 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Proxy.h @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#ifndef CalculatorImpl_CalculatorService_Proxy_h +#define CalculatorImpl_CalculatorService_Proxy_h + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "Calculator.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class CalculatorImpl_CalculatorService_Proxy : public Calculator +{ +public: + CalculatorImpl_CalculatorService_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~CalculatorImpl_CalculatorService_Proxy(); + virtual float add( float arg1, float arg2); + virtual float sub( float arg1, float arg2); + virtual float mul( float arg1, float arg2); + virtual float div( float arg1, float arg2); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // CalculatorImpl_CalculatorService_Proxy_h + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Wrapper.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Wrapper.cpp new file mode 100644 index 0000000000..82114b4d6d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Wrapper.cpp @@ -0,0 +1,135 @@ +/* + * 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 "CalculatorImpl_CalculatorService_Wrapper.h" + +#include "osoa/sca/sca.h" + + + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + CalculatorImpl_CalculatorService_Wrapper* CalculatorImpl_CalculatorService_Wrapper_Factory(tuscany::sca::model::Service* target) + { + return new CalculatorImpl_CalculatorService_Wrapper(target); + } +} + +CalculatorImpl_CalculatorService_Wrapper::CalculatorImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) +{ + impl = (CalculatorImpl*)getImplementation(); +} + +CalculatorImpl_CalculatorService_Wrapper::~CalculatorImpl_CalculatorService_Wrapper() +{ + releaseImplementation(); +} + +void* CalculatorImpl_CalculatorService_Wrapper::newImplementation() +{ + return new CalculatorImpl; +} + +void CalculatorImpl_CalculatorService_Wrapper::deleteImplementation() +{ + delete impl; +} + +void CalculatorImpl_CalculatorService_Wrapper::invokeService(tuscany::sca::Operation& operation) +{ + const std::string& operationName = operation.getName(); + + if (operationName == "add") + { + float& p0 = *( float*)operation.getParameterValue(0); + float& p1 = *( float*)operation.getParameterValue(1); + + if(operation.getReturnValue() != NULL) + { + *(float*)operation.getReturnValue() = impl->add(p0, p1); + } + else + { + float* ret = new float; + *ret = impl->add(p0, p1); + operation.setReturnValue((const float*)ret); + } + return; + } + if (operationName == "sub") + { + float& p0 = *( float*)operation.getParameterValue(0); + float& p1 = *( float*)operation.getParameterValue(1); + + if(operation.getReturnValue() != NULL) + { + *(float*)operation.getReturnValue() = impl->sub(p0, p1); + } + else + { + float* ret = new float; + *ret = impl->sub(p0, p1); + operation.setReturnValue((const float*)ret); + } + return; + } + if (operationName == "mul") + { + float& p0 = *( float*)operation.getParameterValue(0); + float& p1 = *( float*)operation.getParameterValue(1); + + if(operation.getReturnValue() != NULL) + { + *(float*)operation.getReturnValue() = impl->mul(p0, p1); + } + else + { + float* ret = new float; + *ret = impl->mul(p0, p1); + operation.setReturnValue((const float*)ret); + } + return; + } + if (operationName == "div") + { + float& p0 = *( float*)operation.getParameterValue(0); + float& p1 = *( float*)operation.getParameterValue(1); + + if(operation.getReturnValue() != NULL) + { + *(float*)operation.getReturnValue() = impl->div(p0, p1); + } + else + { + float* ret = new float; + *ret = impl->div(p0, p1); + operation.setReturnValue((const float*)ret); + } + return; + } + + + throw osoa::sca::ServiceRuntimeException("Invalid operation"); + +} + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Wrapper.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Wrapper.h new file mode 100644 index 0000000000..63bae2f75c --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_CalculatorService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * 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. + */ + +#ifndef CalculatorImpl_CalculatorService_Wrapper_h +#define CalculatorImpl_CalculatorService_Wrapper_h + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "CalculatorImpl.h" +#include "tuscany/sca/cpp/CPPServiceWrapper.h" + +class CalculatorImpl_CalculatorService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper +{ +public: + CalculatorImpl_CalculatorService_Wrapper(tuscany::sca::model::Service* target); + virtual ~CalculatorImpl_CalculatorService_Wrapper(); + virtual void invokeService(tuscany::sca::Operation& operation); + virtual void* newImplementation(); + virtual void deleteImplementation(); +private: + CalculatorImpl* impl; +}; + +#endif // CalculatorImpl_CalculatorService_Wrapper_h + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_divideService_Proxy.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_divideService_Proxy.cpp new file mode 100644 index 0000000000..510069c331 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_divideService_Proxy.cpp @@ -0,0 +1,65 @@ +/* + * 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 "CalculatorImpl_divideService_Proxy.h" + +#include "osoa/sca/sca.h" + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + CalculatorImpl_divideService_Proxy* CalculatorImpl_divideService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) + { + return new CalculatorImpl_divideService_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void CalculatorImpl_divideService_Proxy_Destructor(void* proxy) + { + delete (CalculatorImpl_divideService_Proxy*)proxy; + } +} + +CalculatorImpl_divideService_Proxy::CalculatorImpl_divideService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) +{ +} + +CalculatorImpl_divideService_Proxy::~CalculatorImpl_divideService_Proxy() +{ + if (target) + delete target; +} + +float CalculatorImpl_divideService_Proxy::div( float arg0, float arg1) +{ + tuscany::sca::Operation operation("div"); + operation.addParameter("num1", &arg0); + operation.addParameter("num2", &arg1); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return *(float*)operation.getReturnValue(); +} + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_divideService_Proxy.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_divideService_Proxy.h new file mode 100644 index 0000000000..0459e70f33 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/CalculatorImpl_divideService_Proxy.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. + */ + +#ifndef CalculatorImpl_divideService_Proxy_h +#define CalculatorImpl_divideService_Proxy_h + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "Divide.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class CalculatorImpl_divideService_Proxy : public Divide +{ +public: + CalculatorImpl_divideService_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~CalculatorImpl_divideService_Proxy(); + virtual float div( float num1, float num2); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // CalculatorImpl_divideService_Proxy_h + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.componentType new file mode 100644 index 0000000000..428d19f8bc --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.componentType @@ -0,0 +1,41 @@ +<?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.cpp header="Divide.h"/> + </service> + + <reference name="cppDivideService"> + <interface.cpp header="Divide.h"/> + </reference> + + <reference name="add_service"> + <interface.cpp header="Add.h"/> + </reference> + + <reference name="subtract_service"> + <interface.cpp header="Subtract.h"/> + </reference> + + <reference name="multiply_service"> + <interface.cpp header="Multiply.h"/> + </reference> +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.h new file mode 100644 index 0000000000..c2ab3b816c --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.h @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + + +#ifndef sample_divide_h +#define sample_divide_h + +class Divide +{ + public: + virtual float div(float num1, float num2) = 0; +}; + +#endif // sample_divide_h + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.php new file mode 100644 index 0000000000..c2e9adda70 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Divide.php @@ -0,0 +1,71 @@ +<?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.ws + */ +class Divide { + + /** + * @reference + * @binding.tuscany cppDivideService + */ + public $another_divide; + + /** + * @reference + * @binding.tuscany add_service + */ + public $add_service; + + /** + * @reference + * @binding.tuscany subtract_service + */ + public $subtract_service; + + /** + * @reference + * @binding.tuscany multiply_service + */ + public $multiply_service; + + /** + * Division + * + * @param float $num1 (the first number) + * @param float $num2 (the second number) + * @return float The result + */ + function div($num1, $num2) { + + //$this->add_service->add(12.0, 27.0); + //$this->subtract_service->sub(12.0, 27.0); + $this->multiply_service->mul(12.0, 27.0); + + $result = $this->another_divide->div($num1, $num2); + + return $result; + } + +} + +?> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.componentType new file mode 100644 index 0000000000..d7369e3ff0 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.componentType @@ -0,0 +1,27 @@ +<?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.cpp header="Divide.h"/> + </service> + +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.cpp new file mode 100644 index 0000000000..88b9065171 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.cpp @@ -0,0 +1,48 @@ +/* + * 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 <stdio.h> + +#include "DivideImpl.h" + +DivideImpl::DivideImpl() +{ +} + +DivideImpl::~DivideImpl() +{ +} + +// Divide interface +float DivideImpl::div(float arg1, float arg2) +{ + if(arg2 == 0.0) + { + printf("DivideImpl::div %f / %f !! Cannot divide by zero, so returning 0\n", arg1, arg2); + return 0; + } + + float result = arg1 / arg2; + printf("DivideImpl::div %f / %f = %f\n", arg1, arg2, result); + return result; +} + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.h new file mode 100644 index 0000000000..42cf47b1d4 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl.h @@ -0,0 +1,39 @@ +/* + * 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 sample_divideimpl_h +#define sample_divideimpl_h + +#include "Divide.h" + +class DivideImpl : public Divide +{ +public: + DivideImpl(); + virtual ~DivideImpl(); + + // Divide interface + virtual float div(float arg1, float arg2); +}; + +#endif // sample_divideimpl_h + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Proxy.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Proxy.cpp new file mode 100644 index 0000000000..e8dbeb2e0d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Proxy.cpp @@ -0,0 +1,65 @@ +/* + * 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 "DivideImpl_DivideService_Proxy.h" + +#include "osoa/sca/sca.h" + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + DivideImpl_DivideService_Proxy* DivideImpl_DivideService_Proxy_Factory(tuscany::sca::ServiceWrapper* target) + { + return new DivideImpl_DivideService_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void DivideImpl_DivideService_Proxy_Destructor(void* proxy) + { + delete (DivideImpl_DivideService_Proxy*)proxy; + } +} + +DivideImpl_DivideService_Proxy::DivideImpl_DivideService_Proxy(tuscany::sca::ServiceWrapper* targ) : target(targ) +{ +} + +DivideImpl_DivideService_Proxy::~DivideImpl_DivideService_Proxy() +{ + if (target) + delete target; +} + +float DivideImpl_DivideService_Proxy::div( float arg0, float arg1) +{ + tuscany::sca::Operation operation("div"); + operation.addParameter("num1", &arg0); + operation.addParameter("num2", &arg1); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return *(float*)operation.getReturnValue(); +} + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Proxy.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Proxy.h new file mode 100644 index 0000000000..d66cde1c06 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Proxy.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. + */ + +#ifndef DivideImpl_DivideService_Proxy_h +#define DivideImpl_DivideService_Proxy_h + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "Divide.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class DivideImpl_DivideService_Proxy : public Divide +{ +public: + DivideImpl_DivideService_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~DivideImpl_DivideService_Proxy(); + virtual float div( float num1, float num2); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // DivideImpl_DivideService_Proxy_h + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Wrapper.cpp b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Wrapper.cpp new file mode 100644 index 0000000000..9c6f2101fe --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Wrapper.cpp @@ -0,0 +1,84 @@ +/* + * 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 "DivideImpl_DivideService_Wrapper.h" + +#include "osoa/sca/sca.h" + + + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + DivideImpl_DivideService_Wrapper* DivideImpl_DivideService_Wrapper_Factory(tuscany::sca::model::Service* target) + { + return new DivideImpl_DivideService_Wrapper(target); + } +} + +DivideImpl_DivideService_Wrapper::DivideImpl_DivideService_Wrapper(tuscany::sca::model::Service* target) : tuscany::sca::cpp::CPPServiceWrapper(target) +{ + impl = (DivideImpl*)getImplementation(); +} + +DivideImpl_DivideService_Wrapper::~DivideImpl_DivideService_Wrapper() +{ + releaseImplementation(); +} + +void* DivideImpl_DivideService_Wrapper::newImplementation() +{ + return new DivideImpl; +} + +void DivideImpl_DivideService_Wrapper::deleteImplementation() +{ + delete impl; +} + +void DivideImpl_DivideService_Wrapper::invokeService(tuscany::sca::Operation& operation) +{ + const std::string& operationName = operation.getName(); + + if (operationName == "div") + { + float& p0 = *( float*)operation.getParameterValue(0); + float& p1 = *( float*)operation.getParameterValue(1); + + if(operation.getReturnValue() != NULL) + { + *(float*)operation.getReturnValue() = impl->div(p0, p1); + } + else + { + float* ret = new float; + *ret = impl->div(p0, p1); + operation.setReturnValue((const float*)ret); + } + return; + } + + + throw osoa::sca::ServiceRuntimeException("Invalid operation"); + +} + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Wrapper.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Wrapper.h new file mode 100644 index 0000000000..5cd10f5188 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/DivideImpl_DivideService_Wrapper.h @@ -0,0 +1,43 @@ +/* + * 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. + */ + +#ifndef DivideImpl_DivideService_Wrapper_h +#define DivideImpl_DivideService_Wrapper_h + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "DivideImpl.h" +#include "tuscany/sca/cpp/CPPServiceWrapper.h" + +class DivideImpl_DivideService_Wrapper : public tuscany::sca::cpp::CPPServiceWrapper +{ +public: + DivideImpl_DivideService_Wrapper(tuscany::sca::model::Service* target); + virtual ~DivideImpl_DivideService_Wrapper(); + virtual void invokeService(tuscany::sca::Operation& operation); + virtual void* newImplementation(); + virtual void deleteImplementation(); +private: + DivideImpl* impl; +}; + +#endif // DivideImpl_DivideService_Wrapper_h + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Log.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Log.componentType new file mode 100644 index 0000000000..0b4423300d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/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.cpp header="Log.h"/> + </service> +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Log.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Log.h new file mode 100644 index 0000000000..c21da1bddf --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Log.h @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + + +#ifndef sample_log_h +#define sample_log_h + +class Log +{ + public: + virtual void div(char *message) = 0; +}; + +#endif // sample_log_h + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Log.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Log.php new file mode 100644 index 0000000000..0a955f36d3 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/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/samples/PHPCalculator/sample.calculator/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Makefile.am new file mode 100644 index 0000000000..84567a5add --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Makefile.am @@ -0,0 +1,56 @@ +# 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)/PHPCalculator/deploy +compositedir=$(deploydir)/sample.calculator + +BUILT_SOURCES = scagen + +noinst_HEADERS = *.h + +scagen: + java -jar $(TUSCANY_SCACPP)/bin/scagen.jar -dir . -output . + +composite_SCRIPTS = runwsserver.sh + +composite_LTLIBRARIES = libCalculator.la +composite_DATA = *.composite *.componentType *.wsdl *.php +EXTRA_DIST = *.composite *.componentType *.wsdl *.php runwsserver.sh + +dist_libCalculator_la_SOURCES = \ +CalculatorImpl.cpp \ +DivideImpl.cpp + +nodist_libCalculator_la_SOURCES = \ +CalculatorImpl_CalculatorService_Proxy.cpp \ +CalculatorImpl_CalculatorService_Wrapper.cpp \ +CalculatorImpl_divideService_Proxy.cpp \ +DivideImpl_DivideService_Proxy.cpp \ +DivideImpl_DivideService_Wrapper.cpp + + +libCalculator_la_LIBADD = \ +-L${TUSCANY_SCACPP}/lib \ + -ltuscany_sca \ +-L${TUSCANY_SCACPP}/extensions/cpp/lib \ + -ltuscany_sca_cpp + +INCLUDES = \ +-I$(TUSCANY_SCACPP)/extensions/cpp/include \ +-I$(TUSCANY_SCACPP)/include \ +-I${TUSCANY_SDOCPP}/include + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.componentType new file mode 100644 index 0000000000..af1631518a --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.componentType @@ -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. +--> + +<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <service name="MultiplyService"> + <interface.cpp header="Multiply.h"/> + </service> + <reference name="log_service"> + <interface.cpp header="Log.h"/> + </reference> +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.h new file mode 100644 index 0000000000..94de825f62 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.h @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + + +#ifndef sample_multiply_h +#define sample_multiply_h + +class Multiply +{ + public: + virtual float mul(float num1, float num2) = 0; +}; + +#endif // sample_multiply_h + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.php new file mode 100644 index 0000000000..8ffe02675d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Multiply.php @@ -0,0 +1,33 @@ +<?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 { + function mul($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/samples/PHPCalculator/sample.calculator/Subtract.componentType b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.componentType new file mode 100644 index 0000000000..35dab8bb9b --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.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="SubtractService"> + <interface.cpp header="Subtract.h"/> + </service> + + <reference name="log_service"> + <interface.cpp header="Log.h"/> + </reference> +</componentType> diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.h b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.h new file mode 100644 index 0000000000..a50b79ccc6 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.h @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + + +#ifndef sample_subtract_h +#define sample_subtract_h + +class Subtract +{ + public: + virtual float sub(float num1, float num2) = 0; +}; + +#endif // sample_subtract_h + + diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.php b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.php new file mode 100644 index 0000000000..8d3a1b3ddf --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/Subtract.php @@ -0,0 +1,30 @@ +<?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'; + +function sub($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/samples/PHPCalculator/sample.calculator/runwsserver.bat b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/runwsserver.bat new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/runwsserver.bat diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/runwsserver.sh b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/runwsserver.sh new file mode 100755 index 0000000000..069d734fea --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/runwsserver.sh @@ -0,0 +1,45 @@ +#!/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$AXIS2C_HOME = x ]; then +echo "AXIS2C_HOME not set" +exit; +fi +echo "Using Axis2C installed at $AXIS2C_HOME" + +export LD_LIBRARY_PATH=$TUSCANY_SCACPP/lib:$TUSCANY_SCACPP/extensions/cpp/lib:$TUSCANY_SDOCPP/lib:$AXIS2C_HOME/lib:$LD_LIBRARY_PATH + +export TUSCANY_SCACPP_ROOT=$APFULLDIR/../ + +cd $AXIS2C_HOME/bin +./axis2_http_server diff --git a/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/sample.calculator.composite b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/sample.calculator.composite new file mode 100644 index 0000000000..09b7070fb8 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/sample.calculator.composite @@ -0,0 +1,81 @@ +<?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"> +<!-- + <service name="CalculatorService"> + <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/> + <binding.ws/> + <reference>CalculatorCPPComponent</reference> + </service> +--> + + <component name="CalculatorCPPComponent"> + <implementation.cpp library="Calculator" header="CalculatorImpl.h"/> + <reference name="divideService">DivideComponent/DivideService</reference> + </component> + + <component name="CalculatorPHPComponent"> + <implementation.php module="Calculator" scope="composite"/> + <reference name="add_service">AddComponent</reference> + <reference name="sub_service">SubtractComponent</reference> + <reference name="mul_service">MultiplyComponent</reference> + <reference name="div_service">DivideComponent</reference> + </component> + + <component name="AddComponent"> + <implementation.php module="Add" scope="composite"/> + <reference name="log_service">LogComponent</reference> + </component> + + <component name="SubtractComponent"> + <implementation.php module="Subtract" scope="composite"/> + <reference name="log_service">LogComponent</reference> + </component> + + <component name="MultiplyComponent"> + <implementation.php module="Multiply" class="Multiply" scope="composite"/> + <reference name="log_service">LogComponent</reference> + </component> + + <component name="DivideComponent"> + <implementation.php module="Divide" class="Divide" scope="composite"/> + <reference name="cppDivideService">DivideCPPComponent/DivideService</reference> + <reference name="add_service">AddComponent</reference> + <reference name="multiply_service">MultiplyComponent</reference> + <reference name="subtract_service">SubtractComponent</reference> + <reference name="add_service">AddComponent</reference> + </component> + + <component name="DivideCPPComponent"> + <implementation.cpp library="Calculator" header="DivideImpl.h"/> + </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/samples/PHPCalculator/sample.calculator/sample.calculator.composite.back b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/sample.calculator.composite.back new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3-RC4/samples/PHPCalculator/sample.calculator/sample.calculator.composite.back |