diff options
Diffstat (limited to 'tags/native-sca-1.0.incubating-M3/samples/CppCalculator')
26 files changed, 1806 insertions, 0 deletions
diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/Makefile.am b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/Makefile.am new file mode 100644 index 0000000000..d9d4b499b7 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/Makefile.am @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +deploydir=$(prefix)/CppCalculator/deploy +SUBDIRS = sample.calculator sample.calculator.client +EXTRA_DIST = *.composite README.html +deploy_DATA = *.composite diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/README b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/README new file mode 100644 index 0000000000..b9dedd2da3 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/README @@ -0,0 +1,4 @@ +Tuscany SCA for C++ Samples - C++ Calculator Sample +=================================================== + +See the README.html file for instructions to build and run this sample diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/README.html b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/README.html new file mode 100644 index 0000000000..264ba3d881 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/README.html @@ -0,0 +1,176 @@ + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<HTML> +<HEAD> + <META CONTENT="text/html; charset=iso-8859-1" HTTP-EQUIV="Content-Type"> + <META CONTENT="text/css" HTTP-EQUIV="Content-Style-Type"> + <STYLE MEDIA="all" TYPE="text/css"> +@import url("../../doc/css/maven-base.css"); +@import url("../../doc/css/maven-theme.css"); + </STYLE> + + <LINK HREF="../doc/css/maven-theme.css" MEDIA="print" REL="stylesheet" + TYPE="text/css"> + <TITLE>Tuscany SCA Native Samples - C++ Calculator Sample</TITLE> +</HEAD> + +<BODY> +<DIV ID="bodyColumn"> + <DIV ID="contentBox"> + <DIV CLASS="section"> + <H1>Tuscany SCA Native Samples - C++ Calculator Sample</H1> + + <P>This is a very simple sample to show how an SCA composite can wire + together two C++ components to implement a Calculator service and invoke + the service via a local client. + </P> + <P>There are two sub projects in this workspace:</P> + <UL> + <LI>sample.calculator<BR/> + This contains the source code and SCDL artifacts for the SCA Calculator + composite implementing the sample Calculator. + </LI> + <LI>sample.calculator.client<BR/> + A sample client which does a local call to the Calculator service. + </LI> + </UL> + <P>Additionally, there is the sample.calculator.app.composite file. This + describes the configuration of the SCA Calculator composite deployed to the SCA + runtime. + </P> + </DIV> + + <DIV CLASS="section"> + <H2>Contents</H2> + <OL> + <LI><A HREF="#linuxbld">Building the C++ samples on Linux and Mac OS X</A></LI> + <LI><A HREF="#linuxrun">Running the C++ Calculator sample on Linux and Mac OS X</A></LI> + <LI><A HREF="#winbld">Building the C++ Calculator sample on Windows</A></LI> + <LI><A HREF="#winrun">Running the C++ Calculator sample on Windows</A></LI> + <LI><A HREF="#help">Getting help</A></LI> + </OL> + </DIV> + + + <DIV CLASS="section"> + <A NAME="linuxbld"><H2>Building the C++ samples on Linux and Mac OS X</H2></A> + <P>If using the binary distribution the samples are built and installed in + <tuscany_sca_install_dir>/samples - go directly to <A HREF="#linuxrun">Running the samples on Linux and Mac OS X</A>.</P> + <OL> + <LI>The following environment variables are required: + <UL> + <LI>TUSCANY_SCACPP=<path to installed Tuscany SCA> + <LI>TUSCANY_SDOCPP=<path to installed Tuscany SDO> + </UL></LI> + </LI> + <LI>Build the C++ samples with the following command sequence: + <UL> + <LI>cd <tuscany_sca_install_dir>/samples</LI> + <LI>./configure --prefix=$TUSCANY_SCACPP/samples --enable-static=no</LI> + <LI>make</LI> + <LI>make install</LI> + </UL> + NOTE: If you don't provide the --prefix configure option, it will by default install into + /usr/local/tuscany/sca/samples/CppCalculator</LI> + </OL> + </DIV> + + <DIV CLASS="section"> + <A NAME="linuxrun"><H2>Running the C++ Calculator sample on Linux and Mac OS X</H2></A> + <OL> + <LI>The following environment variables are required: + <UL> + <LI>TUSCANY_SCACPP=<path to installed Tuscany SCA></LI> + <LI>TUSCANY_SDOCPP=<path to installed Tuscany SDO></LI> + </UL> + </LI> + <LI>Run the sample with the following commands: + <UL> + <LI>cd <tuscany_sca_install_dir>/samples/CppCalculator/deploy/sample.calculator.client</LI> + <LI>./runclient.sh</LI> + </UL> + </LI> + </OL> + </DIV> + + <DIV CLASS="section"> + <A NAME="winbld"><H2>Building the C++ Calculator sample on Windows</H2></A> + <P>If using the binary distribution the samples are built and installed in + <tuscany_sca_install_dir>\samples - go directly to <A HREF="#winrun">Running the samples on Windows</A>.</P> + <OL> + <LI>The following environment variables are required: + <UL> + <LI>TUSCANY_SCACPP=<path to installed Tuscany SCA> + <LI>TUSCANY_SDOCPP=<path to installed Tuscany SDO> + </UL></LI> + </LI> + <LI>You must have set up the environment for Microsoft Visual C++ tools. + The build command will call vcvars32 to set the environment. Ensure the + directory containing this is on your path. This will be where you + installed the compiler. + </LI> + <LI>Build the source, either via the Visual Studio Express projects under + <tuscany_sca_install_dir>\samples\CppCalculator\VSExpress\CppCalculator.sln or via the command-line build file + found at <tuscany_sca_install_dir>\samples\CppCalculator\VSExpress\CppCalculator\build.bat + which will build and deploy the samples. + </LI> + </OL> + </DIV> + + <DIV CLASS="section"> + <A NAME="winrun"><H2>Running the C++ Calculator sample on Windows</H2></A> + <OL> + <LI>The following environment variables are required: + <UL> + <LI>TUSCANY_SCACPP=<path to installed Tuscany SCA></LI> + <LI>TUSCANY_SDOCPP=<path to installed Tuscany SDO></LI> + </UL> + </LI> + <LI>Run the sample with the following commands: + <UL> + <LI>cd <tuscany_sca_install_dir>\samples\CppCalculator\deploy\sample.calculator.client</LI> + <LI>runclient.bat</LI> + </UL> + </LI> + </DIV> + + + + <DIV CLASS="section"> + <A NAME="help"><H2>Getting Help</H2></A> + + <P>The first place to look is at the Tuscany SCA FAQ at + <A HREF="http://cwiki.apache.org/confluence/display/TUSCANY/Tuscany+SCA+-+FAQ" + TARGET="_blank">http://cwiki.apache.org/confluence/display/TUSCANY/Tuscany+SCA+-+FAQ</A> </P> + + <P>Any problem with this release can be reported to the Tuscany + <A HREF="http://cwiki.apache.org/TUSCANY/mailing-lists.html" + TARGET="_blank">mailing lists</A> or create a JIRA issue at <A HREF="http://issues.apache.org/jira/browse/Tuscany" + TARGET="_blank">http://issues.apache.org/jira/browse/Tuscany</A>.</P> + + </DIV> + </DIV> +</DIV> +</BODY> + +</HTML> + diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/Build/Build.vcproj b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/Build/Build.vcproj new file mode 100644 index 0000000000..c33437a8cd --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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/samples/CppCalculator/VSExpress/Build/Build.vcproj.user b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/Build/Build.vcproj.user new file mode 100644 index 0000000000..8b18d57ac5 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/Build/Build.vcproj.user @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command="$(TUSCANY_SCACPP)\samples\CppCalculator\deploy\sample.calculator.client\calculator_client.exe"
+ WorkingDirectory="$(TUSCANY_SCACPP)\samples\CppCalculator\deploy\sample.calculator.client"
+ CommandArguments="mul 7 6"
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine=""
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SCACPP%\extensions\cpp\bin;%TUSCANY_SDOCPP%\bin;%AXIS2C_HOME%\lib;%PATH%
TUSCANY_SCACPP_ROOT=%TUSCANY_SCACPP%\samples\CppCalculator\deploy
TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent"
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command="$(TUSCANY_SCACPP)\samples\CppCalculator\deploy\sample.calculator.client\calculator_client.exe"
+ WorkingDirectory="$(TUSCANY_SCACPP)\samples\CppCalculator\deploy\sample.calculator.client"
+ CommandArguments="mul 7 6"
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine=""
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SCACPP%\extensions\cpp\bin;%TUSCANY_SDOCPP%\bin;%AXIS2C_HOME%\lib;%PATH%
TUSCANY_SCACPP_ROOT=%TUSCANY_SCACPP%\samples\CppCalculator\deploy
TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent"
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/CppCalculator.sln b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/CppCalculator.sln new file mode 100644 index 0000000000..941a48a3f7 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/CppCalculator.sln @@ -0,0 +1,39 @@ +
+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
+ {799C40A9-9DDB-4DCD-806D-50205508AE0E} = {799C40A9-9DDB-4DCD-806D-50205508AE0E}
+ {8DD6E7A7-912D-49DD-9517-A91E8FB040D3} = {8DD6E7A7-912D-49DD-9517-A91E8FB040D3}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample.calculator", "sample.calculator\sample.calculator.vcproj", "{8DD6E7A7-912D-49DD-9517-A91E8FB040D3}"
+ ProjectSection(ProjectDependencies) = postProject
+ {799C40A9-9DDB-4DCD-806D-50205508AE0E} = {799C40A9-9DDB-4DCD-806D-50205508AE0E}
+ EndProjectSection
+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/samples/CppCalculator/VSExpress/sample.calculator.client/sample.calculator.client.vcproj b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/sample.calculator.client/sample.calculator.client.vcproj new file mode 100644 index 0000000000..66e62def41 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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""
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ 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/samples/CppCalculator/VSExpress/sample.calculator/sample.calculator.vcproj b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/VSExpress/sample.calculator/sample.calculator.vcproj new file mode 100644 index 0000000000..81493af9aa --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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 ..\..\ Debug"
+ />
+ </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/samples/CppCalculator/build.bat b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/build.bat new file mode 100644 index 0000000000..dc18a451fe --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/build.bat @@ -0,0 +1,50 @@ +@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 + +set config=Release +if .Debug == .%1 ( +echo Building Debug version +set config=Debug +) + +if "%TUSCANY_SDOCPP%" == "" ( +echo "TUSCANY_SDOCPP not set" +goto end +) +echo using Tuscany SCACPP: %TUSCANY_SCACPP% + +if "%TUSCANY_SCACPP%" == "" ( +echo "TUSCANY_SCACPP not set" +goto end +) +echo using Tuscany SCACPP: %TUSCANY_SCACPP% + +if "%AXIS2C_HOME%" == "" ( +echo "AXIS2C_HOME not set" +goto end +) +echo using Axis2C: %AXIS2C_HOME%" + +call vcvars32.bat +cd VSExpress +call vcbuild CppCalculator.sln "%config%|Win32" + +:end +endlocal diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/deploy.bat b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/deploy.bat new file mode 100644 index 0000000000..939086dc97 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/deploy.bat @@ -0,0 +1,67 @@ +@echo off +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +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 + +set deploydir=%TUSCANY_SCACPP% +set samplesdir=%deploydir%\samples +set calcdir=%samplesdir%\CppCalculator +set calcdeploydir=%calcdir%\deploy +set samplecalc=%calcdeploydir%\%package% + +if not exist %samplesdir% mkdir %samplesdir% +if not exist %calcdir% mkdir %calcdir% +if not exist %calcdeploydir% mkdir %calcdeploydir% +if not exist %samplecalc% mkdir %samplecalc% + +set samplecalcsrc=%srcdir%\%package% +copy %srcdir%\*.composite %calcdeploydir% +copy %samplecalcsrc%\*.wsdl %samplecalc% +copy %samplecalcsrc%\*.composite %samplecalc% +copy %samplecalcsrc%\*.componentType %samplecalc% +copy %samplecalcsrc%\runwsserver.bat %samplecalc% + +set library=Calculator +copy %inpath%\%library%.dll %samplecalc% + +if exist %inpath%\%library%.pdb copy %inpath%\%library%.pdb %samplecalc% + +goto end +:usage +echo Usage: deploy <sample-src> <build-output> +:end + +endlocal diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/deployclient.bat b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/deployclient.bat new file mode 100644 index 0000000000..b2361cfe0f --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/deployclient.bat @@ -0,0 +1,63 @@ +@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%\CppCalculator +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.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/samples/CppCalculator/sample.calculator.app.composite b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.app.composite new file mode 100644 index 0000000000..5753b3c593 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.app.composite @@ -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. +--> + +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + name="sample.calculator.app"> + + <component name="sample.calculator.CalculatorComponent"> + <implementation.composite name="sample.calculator" /> + </component> + +</composite> + diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/CalculatorClient.cpp b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/CalculatorClient.cpp new file mode 100644 index 0000000000..37e9d40f66 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/CalculatorClient.cpp @@ -0,0 +1,150 @@ +/* + * 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 <iostream> +#include <stdlib.h> + +#include "osoa/sca/sca.h" + +#include "Calculator.h" + +using namespace std; +using namespace osoa::sca; + + +void usage(); +bool IsNumber(const char *p); + +int main(int argc, char* argv[]) +{ + const char *operation; + float arg1 = 0; + float arg2 = 0; + + if (argc == 4) + { + operation = argv[1]; + + if (!IsNumber(argv[2])) + { + cout << "calculator_client: Argument 1 is not a number" << endl; + usage(); + } + else + { + arg1 = atof(argv[2]); + } + + if (!IsNumber(argv[3])) + { + cout << "calculator_client: Argument 2 is not a number" << endl; + usage(); + } + else + { + arg2 = atof(argv[3]); + } + } + else + { + usage(); + } + + try + { + // Locate a service + CompositeContext myContext = CompositeContext::getCurrent(); + Calculator *calcService = (Calculator*) myContext.locateService("CalculatorComponent/CalculatorService"); + if (calcService == 0) + { + cout << "calculator_client: Unable to find Calculator service" << endl; + } + else + { + float result = 0; + if (strcmp(operation, "add") == 0) + { + result = calcService->add(arg1, arg2); + cout << "calculator_client: add(" << arg1 << "," << arg2 << ") = " << result << endl; + } + else + if (strcmp(operation, "sub") == 0) + { + result = calcService->sub(arg1, arg2); + cout << "calculator_client: sub(" << arg1 << "," << arg2 << ") = " << result << endl; + } + else + if (strcmp(operation, "mul") == 0) + { + result = calcService->mul(arg1, arg2); + cout << "calculator_client: mul(" << arg1 << "," << arg2 << ") = " << result << endl; + } + else + if (strcmp(operation, "div") == 0) + { + result = calcService->div(arg1, arg2); + cout << "calculator_client: div(" << arg1 << "," << arg2 << ") = " << result << endl; + } + else + { + cout << "calculator_client: Unrecognized operation: " << operation << endl; + } + } + } + catch (ServiceRuntimeException& ex) + { + cout << "calculator_client: exception caught: " << ex << endl; + } + return 0; +} + +void usage() +{ + cout << "Usage: calculator_client add|sub|mul|div arg1 arg2" << endl; + exit(1); +} + +bool IsNumber (const char *p) +{ + int len = strlen(p); + int pointcount = 0; + + if (!isdigit (p[0]) && p[0] != '-' && p[0] != '+') + { + return false; + } + for (int i = 1; i < len; i++) + { + if (!isdigit (p[i])) + { + if (p[i] == '.') + { + if (pointcount > 0) return false; + pointcount++; + } + else + { + return false; + } + } + } + return true; +} diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/Makefile.am b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/Makefile.am new file mode 100644 index 0000000000..b51183d193 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/Makefile.am @@ -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. + +deploydir=$(prefix)/CppCalculator/deploy +clientdir=$(deploydir)/sample.calculator.client + +client_PROGRAMS = calculator_client +client_SCRIPTS = runclient.sh +EXTRA_DIST = runclient.sh + +AM_CPPFLAGS = $(CPPFLAGS) +calculator_client_SOURCES = \ +CalculatorClient.cpp + +calculator_client_LDADD = \ +-L${TUSCANY_SCACPP}/lib \ + -ltuscany_sca \ +-L${TUSCANY_SCACPP}/extensions/cpp/lib \ + -ltuscany_sca_cpp \ +-L${TUSCANY_SDOCPP}/lib \ + -ltuscany_sdo + +INCLUDES = \ +-I$(TUSCANY_SCACPP)/extensions/cpp/include \ +-I${TUSCANY_SCACPP}/include \ +-I${TUSCANY_SDOCPP}/include \ +-I../sample.calculator diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/runclient.bat b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/runclient.bat new file mode 100644 index 0000000000..795325ab52 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/runclient.bat @@ -0,0 +1,42 @@ +@echo off + +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. + +setlocal + +if "%TUSCANY_SCACPP%" == "" ( +echo "TUSCANY_SCACPP not set" +goto end +) +echo using SCA installed at %TUSCANY_SCACPP% + +if "%TUSCANY_SDOCPP%" == "" ( +echo "TUSCANY_SDOCPP not set" +goto end +) +echo using SDO installed at %TUSCANY_SDOCPP% + +set PATH=%TUSCANY_SCACPP%\bin;%TUSCANY_SCACPP%\extensions\cpp\bin;%TUSCANY_SDOCPP%\bin;%PATH% + +set TUSCANY_SCACPP_ROOT=%~d0%~p0\..\ +set TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent + +.\calculator_client.exe div 5 2 + +:end +endlocal diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/runclient.sh b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/runclient.sh new file mode 100755 index 0000000000..feae29d557 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator.client/runclient.sh @@ -0,0 +1,39 @@ +#!/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" + +export LD_LIBRARY_PATH=$TUSCANY_SCACPP/extensions/cpp/lib:$TUSCANY_SCACPP/lib:$TUSCANY_SDOCPP/lib:$LD_LIBRARY_PATH + +export TUSCANY_SCACPP_ROOT=$APFULLDIR/../ +export TUSCANY_SCACPP_COMPONENT=sample.calculator.CalculatorComponent + +./calculator_client div 5 2 diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/Calculator.h b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/Calculator.h new file mode 100644 index 0000000000..90e97b5319 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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/samples/CppCalculator/sample.calculator/CalculatorImpl.componentType b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/CalculatorImpl.componentType new file mode 100644 index 0000000000..72fe9842e8 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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>
\ No newline at end of file diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/CalculatorImpl.cpp b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/CalculatorImpl.cpp new file mode 100644 index 0000000000..01dac77c92 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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->divide(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/samples/CppCalculator/sample.calculator/CalculatorImpl.h b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/CalculatorImpl.h new file mode 100644 index 0000000000..af8a5eeab1 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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/samples/CppCalculator/sample.calculator/Divide.h b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/Divide.h new file mode 100644 index 0000000000..6e171ed733 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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 divide(float arg1, float arg2) = 0; +}; + +#endif // sample_divide_h + + diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/DivideImpl.componentType b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/DivideImpl.componentType new file mode 100644 index 0000000000..d7369e3ff0 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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/samples/CppCalculator/sample.calculator/DivideImpl.cpp b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/DivideImpl.cpp new file mode 100644 index 0000000000..f1a927cf4c --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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::divide(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/samples/CppCalculator/sample.calculator/DivideImpl.h b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/DivideImpl.h new file mode 100644 index 0000000000..64045f1899 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/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 divide(float arg1, float arg2); +}; + +#endif // sample_divideimpl_h + diff --git a/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/Makefile.am b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/Makefile.am new file mode 100644 index 0000000000..de6dad787d --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/Makefile.am @@ -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. + +deploydir=$(prefix)/CppCalculator/deploy +compositedir=$(deploydir)/sample.calculator + +BUILT_SOURCES = scagen + +noinst_HEADERS = *.h + +scagen: + java -jar $(TUSCANY_SCACPP)/bin/scagen.jar -dir . -output . + +composite_LTLIBRARIES = libCalculator.la +composite_DATA = *.composite *.componentType +EXTRA_DIST = *.composite *.componentType + +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/samples/CppCalculator/sample.calculator/sample.calculator.composite b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/sample.calculator.composite new file mode 100644 index 0000000000..6903cf21d8 --- /dev/null +++ b/tags/native-sca-1.0.incubating-M3/samples/CppCalculator/sample.calculator/sample.calculator.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"> + + <component name="CalculatorComponent"> + <implementation.cpp library="Calculator" header="CalculatorImpl.h"/> + <reference name="divideService">DivideComponent/DivideService</reference> + </component> + + <component name="DivideComponent"> + <implementation.cpp library="Calculator" header="DivideImpl.h"/> + </component> + +</composite>
\ No newline at end of file |