diff options
Diffstat (limited to 'sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts')
36 files changed, 2288 insertions, 0 deletions
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataService.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataService.h new file mode 100644 index 0000000000..1603ed2ccb --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataService.h @@ -0,0 +1,62 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "commonj/sdo/SDO.h" + +namespace com +{ + namespace bigbank + { + namespace account + { + + /* + * AccountDataService C interface + */ + + class AccountDataService { + + public: + + // CheckingAccount is a data object containing + // String "accountNumber" + // float balance + + virtual commonj::sdo::DataObjectPtr /* CheckingAccount*/ getCheckingAccount( + const char *id) = 0; + + // SavingsAccount is a data object containing + // String accountNumber + // float balance + + virtual commonj::sdo::DataObjectPtr /* SavingsAccount */ getSavingsAccount( + const char *id) = 0; + + // StockAccount is a data object containing + // String accountNumber + // String symbol + // int quantity + + virtual commonj::sdo::DataObjectPtr /* StockAccount */ getStockAccount ( + const char* id) = 0; + + + }; + +} +} +} // namespace; diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.componentType b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.componentType new file mode 100644 index 0000000000..740f9b01d6 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.componentType @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
+
+ <service name="AccountDataService">
+ <interface.cpp header="AccountDataService.h">
+ </interface.cpp>
+ </service>
+
+</componentType>
+
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.cpp new file mode 100644 index 0000000000..ec72b4d5b9 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.cpp @@ -0,0 +1,140 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "commonj/sdo/SDO.h" + +#include "AccountDataServiceImpl.h" + +using namespace commonj::sdo; + +namespace com +{ + namespace bigbank + { + namespace account + { + + DataObjectPtr /* CheckingAccount*/ AccountDataServiceImpl::getCheckingAccount( + const char *id) + { + try { + + DataFactoryPtr factory = DataFactory::getDataFactory(); + + XSDHelperPtr helper = HelperProvider::getXSDHelper(factory); + + helper->defineFile("AccountService.wsdl"); + + DataObjectPtr newaccount = + factory->create("http://www.bigbank.com/AccountService","CheckingAccount"); + + char* name = new char[strlen(id) + 10]; + strcpy(name,id); + strcat(name,"_CHA12345"); + + newaccount->setCString("accountNumber",name); + + delete name; + + newaccount->setFloat("balance",1500.0f); + + return newaccount; + + } + catch (SDORuntimeException e) + { + return 0; + } + } + + + + DataObjectPtr /* SavingsAccount */ AccountDataServiceImpl::getSavingsAccount( + const char *id) + { + try { + + DataFactoryPtr factory = DataFactory::getDataFactory(); + + XSDHelperPtr helper = HelperProvider::getXSDHelper(factory); + + helper->defineFile("AccountService.wsdl"); + + DataObjectPtr newaccount = + factory->create("http://www.bigbank.com/AccountService","SavingsAccount"); + + char* name = new char[strlen(id) + 10]; + strcpy(name,id); + strcat(name,"_SAA12345"); + + newaccount->setCString("accountNumber",name); + + delete name; + + newaccount->setFloat("balance",1500.0f); + + return newaccount; + + } + catch (SDORuntimeException e) + { + return 0; + } + } + + + DataObjectPtr /* StockAccount */ AccountDataServiceImpl::getStockAccount ( + const char* id) + { + try { + + DataFactoryPtr factory = DataFactory::getDataFactory(); + + XSDHelperPtr helper = HelperProvider::getXSDHelper(factory); + + helper->defineFile("AccountService.wsdl"); + + DataObjectPtr newaccount = + factory->create("http://www.bigbank.com/AccountService","StockAccount"); + + char* name = new char[strlen(id) + 10]; + strcpy(name,id); + strcat(name,"_STA12345"); + + newaccount->setCString("accountNumber",name); + + delete name; + + newaccount->setCString("symbol","IBM"); + + newaccount->setInteger("quantity",100); + + return newaccount; + + } + catch (SDORuntimeException e) + { + return 0; + } + } + } + } +}
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.h new file mode 100644 index 0000000000..6423c58795 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl.h @@ -0,0 +1,61 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "AccountDataService.h" + + +namespace com +{ + namespace bigbank + { + namespace account + { + + /* + * AccountDataService C interface + */ + + class AccountDataServiceImpl : public AccountDataService { + + public: + // CheckingAccount is a data object containing + // String "accountNumber" + // float balance + + virtual DataObjectPtr /* CheckingAccount*/ getCheckingAccount( + const char *id); + + // SavingsAccount is a data object containing + // String accountNumber + // float balance + + virtual DataObjectPtr /* SavingsAccount */ getSavingsAccount( + const char *id); + + // StockAccount is a data object containing + // String accountNumber + // String symbol + // int quantity + + virtual DataObjectPtr /* StockAccount */ getStockAccount ( + const char* id); + + }; + } + } +} diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Proxy.cpp new file mode 100644 index 0000000000..dbc1588881 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Proxy.cpp @@ -0,0 +1,87 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "AccountDataServiceImpl_AccountDataService_Proxy.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + AccountDataServiceImpl_AccountDataService_Proxy* AccountDataServiceImpl_AccountDataService_Proxy_Factory(ServiceWrapper* target) + { + return new AccountDataServiceImpl_AccountDataService_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void AccountDataServiceImpl_AccountDataService_Proxy_Destructor(void* proxy) + { + delete (AccountDataServiceImpl_AccountDataService_Proxy*)proxy; + } +} + +AccountDataServiceImpl_AccountDataService_Proxy::AccountDataServiceImpl_AccountDataService_Proxy(ServiceWrapper* targ) : target(targ) +{ +} + +AccountDataServiceImpl_AccountDataService_Proxy::~AccountDataServiceImpl_AccountDataService_Proxy() +{ + if (target) + delete target; +} + +commonj::sdo::DataObjectPtr AccountDataServiceImpl_AccountDataService_Proxy::getCheckingAccount(const char* arg0) +{ + Operation operation("getCheckingAccount"); + operation.addParameter(&arg0); + commonj::sdo::DataObjectPtr ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + +commonj::sdo::DataObjectPtr AccountDataServiceImpl_AccountDataService_Proxy::getSavingsAccount(const char* arg0) +{ + Operation operation("getSavingsAccount"); + operation.addParameter(&arg0); + commonj::sdo::DataObjectPtr ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + +commonj::sdo::DataObjectPtr AccountDataServiceImpl_AccountDataService_Proxy::getStockAccount(const char* arg0) +{ + Operation operation("getStockAccount"); + operation.addParameter(&arg0); + commonj::sdo::DataObjectPtr ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Proxy.h new file mode 100644 index 0000000000..c86af7e128 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Proxy.h @@ -0,0 +1,36 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AccountDataServiceImpl_AccountDataService_Proxy_h +#define AccountDataServiceImpl_AccountDataService_Proxy_h + +#include "AccountDataService.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class AccountDataServiceImpl_AccountDataService_Proxy : public com::bigbank::account::AccountDataService +{ +public: + AccountDataServiceImpl_AccountDataService_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~AccountDataServiceImpl_AccountDataService_Proxy(); + virtual commonj::sdo::DataObjectPtr getCheckingAccount(const char* id); + virtual commonj::sdo::DataObjectPtr getSavingsAccount(const char* id); + virtual commonj::sdo::DataObjectPtr getStockAccount(const char* id); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // AccountDataServiceImpl_AccountDataService_Proxy_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Wrapper.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Wrapper.cpp new file mode 100644 index 0000000000..424ea7fdfb --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Wrapper.cpp @@ -0,0 +1,86 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "AccountDataServiceImpl_AccountDataService_Wrapper.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + AccountDataServiceImpl_AccountDataService_Wrapper* AccountDataServiceImpl_AccountDataService_Wrapper_Factory(tuscany::sca::model::Service* target) + { + return new AccountDataServiceImpl_AccountDataService_Wrapper(target); + } +} + +AccountDataServiceImpl_AccountDataService_Wrapper::AccountDataServiceImpl_AccountDataService_Wrapper(Service* target) : ComponentServiceWrapper(target) +{ + impl = (com::bigbank::account::AccountDataServiceImpl*)getImplementation(); +} + +AccountDataServiceImpl_AccountDataService_Wrapper::~AccountDataServiceImpl_AccountDataService_Wrapper() +{ + releaseImplementation(); +} + +void* AccountDataServiceImpl_AccountDataService_Wrapper::newImplementation() +{ + return new com::bigbank::account::AccountDataServiceImpl; +} + +void AccountDataServiceImpl_AccountDataService_Wrapper::deleteImplementation() +{ + delete impl; +} + +void AccountDataServiceImpl_AccountDataService_Wrapper::invokeService(Operation& operation) +{ + const string& operationName = operation.getName(); + + if (operationName == "getCheckingAccount") + { + const char* p0 = *(const char**)operation.getParameterValue(0); + *(commonj::sdo::DataObjectPtr*)operation.getReturnValue() = impl->getCheckingAccount(p0); + return; + } + if (operationName == "getSavingsAccount") + { + const char* p0 = *(const char**)operation.getParameterValue(0); + *(commonj::sdo::DataObjectPtr*)operation.getReturnValue() = impl->getSavingsAccount(p0); + return; + } + if (operationName == "getStockAccount") + { + const char* p0 = *(const char**)operation.getParameterValue(0); + *(commonj::sdo::DataObjectPtr*)operation.getReturnValue() = impl->getStockAccount(p0); + return; + } + + + throw ServiceRuntimeException("Invalid operation"); + +} + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Wrapper.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Wrapper.h new file mode 100644 index 0000000000..af43114af0 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountDataServiceImpl_AccountDataService_Wrapper.h @@ -0,0 +1,36 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AccountDataServiceImpl_AccountDataService_Wrapper_h +#define AccountDataServiceImpl_AccountDataService_Wrapper_h + +#include "AccountDataServiceImpl.h" +#include "tuscany/sca/core/ComponentServiceWrapper.h" + +class AccountDataServiceImpl_AccountDataService_Wrapper : public tuscany::sca::ComponentServiceWrapper +{ +public: + AccountDataServiceImpl_AccountDataService_Wrapper(tuscany::sca::model::Service* target); + virtual ~AccountDataServiceImpl_AccountDataService_Wrapper(); + virtual void invokeService(tuscany::sca::Operation& operation); + virtual void* newImplementation(); + virtual void deleteImplementation(); +private: + com::bigbank::account::AccountDataServiceImpl* impl; +}; + +#endif // AccountDataServiceImpl_AccountDataService_Wrapper_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountService.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountService.h new file mode 100644 index 0000000000..eb1a585c52 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountService.h @@ -0,0 +1,58 @@ +/* + * + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * AccountService.h + * + */ + + +#include <commonj/sdo/SDO.h> + + +namespace com +{ + namespace bigbank + { + namespace account + { + + /* + * AccountService C interface + */ + + class AccountService { + + public: + + //The account report data object has one many-valued + // property "accountSummaries". + // This had properties + // String accountNumber + // String accountType + // Float balance. + + virtual commonj::sdo::DataObjectPtr /*AccountReport*/ + getAccountReport(DataObjectPtr cid) = 0; + + + }; + + } + } +} // namespaces +
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountService.wsdl b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountService.wsdl new file mode 100644 index 0000000000..9362ab56c0 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountService.wsdl @@ -0,0 +1,97 @@ +<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+xmlns:tns="http://www.bigbank.com/AccountService"
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+targetNamespace="http://www.bigbank.com/AccountService"
+name="AccountService" >
+
+<wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.bigbank.com/AccountService"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:complexType name="cid">
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="customerID" type="tns:cid" />
+
+ <xsd:element name="getAccountReportResponse" type="tns:AccountReport" />
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="checking" type="tns:CheckingAccount"
+ maxOccurs="unbounded"/>
+ <xsd:element name="savings" type="tns:SavingsAccount"
+ maxOccurs="unbounded"/>
+ <xsd:element name="stocks" type="tns:StockAccount"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="StockAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string"/>
+ <xsd:element name="symbol" type="xsd:string"/>
+ <xsd:element name="quantity" type="xsd:integer"/>
+ <xsd:element name="balance" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="CheckingAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string"/>
+ <xsd:element name="balance" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="SavingsAccount">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string"/>
+ <xsd:element name="balance" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+</wsdl:types>
+
+<wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:customerID" name="getAccountReportRequest" />
+</wsdl:message>
+
+<wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:AccountReport"
+ name="getAccountReportResponse" />
+</wsdl:message>
+
+<wsdl:portType name="AccountService">
+ SCA Sample Application 16 November 2005
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest" />
+ <wsdl:output message="tns:getAccountReportResponse" />
+ </wsdl:operation>
+</wsdl:portType>
+
+<wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/AccountService/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+</wsdl:binding>
+
+<wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location="http://localhost:9090/axis2/services/Account" />
+ </wsdl:port>
+</wsdl:service>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.componenttype b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.componenttype new file mode 100644 index 0000000000..7ab7736069 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.componenttype @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <service name="AccountService">
+ <interface.cpp header="AccountService.h">
+ </interface.cpp>
+ </service>
+
+ <reference name="AccountDataService">
+ <interface.cpp header="AccountDataService.h">
+ </interface.cpp>
+ </reference>
+
+ <reference name="stockQuote">
+ <interface.cpp header="StockQuoteService.h">
+ </interface.cpp>
+ </reference>
+
+ <property name="currency" type="xs:string"/>
+
+</componentType>
+
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.cpp new file mode 100644 index 0000000000..c78b5963bf --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.cpp @@ -0,0 +1,186 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "AccountServiceImpl.h" +#include "StockQuoteService.h" +#include "AccountDataService.h" + +#include "osoa/sca/sca.h" + +using namespace osoa::sca; + + +namespace com +{ + namespace bigbank + { + namespace account + { + + AccountServiceImpl::AccountServiceImpl() + { + initialized = false; + // Note - cannot use the component context within the constructor - need to move this + // code out to lazy init on first use. + + //ComponentContext myContext = ComponentContext::getCurrent(); + + //dataService = + // (AccountDataService*)myContext.getService("AccountDataService"); + + //stockService = + // (StockQuoteService*)myContext.getService("StockQuoteService"); + + } + + //void AccountServiceImpl::lazyGetDependencies() + //{ + // cant do this either - the context cannot be instantiated + // resolve the references on call only + + //theContext = ComponentContext::getCurrent(); + + //dataService = + // (AccountDataService*)theContext.getService("AccountDataService"); + + //stockService = + // (StockQuoteService*)theContext.getService("stockQuote"); + + //initialized = true; + //} + + AccountServiceImpl::~AccountServiceImpl() + { + } + + DataObjectPtr /*AccountReport**/ + AccountServiceImpl::getAccountReport(DataObjectPtr cid) + { + try { + + commonj::sdo::DataFactoryPtr factory = + commonj::sdo::DataFactory::getDataFactory(); + + commonj::sdo::XSDHelperPtr helper = + commonj::sdo::HelperProvider::getXSDHelper(factory); + + helper->defineFile("AccountService.wsdl"); + + const char* id = cid->getCString("customerID"); + + commonj::sdo::DataObjectPtr newReport = + factory->create("http://www.bigbank.com/AccountService","AccountReport"); + + ComponentContext theContext = ComponentContext::getCurrent(); + + com::bigbank::account::AccountDataService *dataService = + (com::bigbank::account::AccountDataService*)theContext.getService("AccountDataService"); + + if (dataService == 0) + { + std::cout << "No Account Data Service registered" << std::endl; + return newReport; + } + + // would be better to return a list of accounts - this only + // gets the first of each. + + commonj::sdo::DataObjectPtr checking = + dataService->getCheckingAccount(id); + + if (checking != 0) + { + commonj::sdo::DataObjectList& dl = newReport->getList("checking"); + checking->setFloat("balance", + fromUSDollarToCurrency(checking->getFloat("balance"))); + dl.append(checking); + } + + commonj::sdo::DataObjectPtr savings = dataService->getSavingsAccount(id); + + if (savings != 0) + { + commonj::sdo::DataObjectList& dl = newReport->getList("savings"); + savings->setFloat("balance", + fromUSDollarToCurrency(savings->getFloat("balance"))); + dl.append(savings); + } + + com::bigbank::stockquote::StockQuoteService* stockService = + (StockQuoteService*)theContext.getService("stockQuote"); + + if (stockService == 0) + { + std::cout << "No Stock Quote Data Service registered" << std::endl; + return newReport; + } + + commonj::sdo::DataObjectPtr stocks = dataService->getStockAccount(id); + + if (stocks != 0) + { + commonj::sdo::DataObjectList& dl = newReport->getList("stocks"); + + float value = 10.0f; + try { + value = stockService->getQuote( + stocks->getCString("symbol")); + } + catch (ServiceRuntimeException& e) + { + std::cout << "Fault from stock quote service" << e << std::endl; + } + stocks->setFloat("balance", + fromUSDollarToCurrency(stocks->getInteger("quantity") * + value)); + dl.append(stocks); + } + return newReport; + } + catch (SDORuntimeException& e) + { + std::cout << "Error from SDO: " << e << std::endl; + return 0; + } + } + + + float AccountServiceImpl::fromUSDollarToCurrency(float value) + { + // get the property "currency" + ComponentContext myContext = ComponentContext::getCurrent(); + + commonj::sdo::DataObjectInstance properties = myContext.getProperties(); + if (properties) + { + const char* currency = properties->getCString("currency"); + if (currency != 0) + { + std::cout << "Currency is : " << currency << std::endl; + if (!strcmp(currency,"USD")) return value; + if (!strcmp(currency,"EURO")) return 0.8f * value; + } + } + return 0.0f; + } + } + } +} // namespaces diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.h new file mode 100644 index 0000000000..1e506f1ed1 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl.h @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AccountService.h" + + +namespace com +{ + namespace bigbank + { + namespace account + { + +class AccountServiceImpl: public AccountService + { + + public: + + + AccountServiceImpl(); + virtual ~AccountServiceImpl(); + + // public API + + virtual DataObjectPtr /*AccountReport*/ + getAccountReport(DataObjectPtr cid); + + + //virtual void lazyGetDependencies(); + +private: + + + float fromUSDollarToCurrency(float value); + + bool initialized; + +}; + +} +} +} // namespaces + +using namespace com::bigbank::account; diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountDataService_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountDataService_Proxy.cpp new file mode 100644 index 0000000000..a0441b213a --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountDataService_Proxy.cpp @@ -0,0 +1,87 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "AccountServiceImpl_AccountDataService_Proxy.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + AccountServiceImpl_AccountDataService_Proxy* AccountServiceImpl_AccountDataService_Proxy_Factory(ServiceWrapper* target) + { + return new AccountServiceImpl_AccountDataService_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void AccountServiceImpl_AccountDataService_Proxy_Destructor(void* proxy) + { + delete (AccountServiceImpl_AccountDataService_Proxy*)proxy; + } +} + +AccountServiceImpl_AccountDataService_Proxy::AccountServiceImpl_AccountDataService_Proxy(ServiceWrapper* targ) : target(targ) +{ +} + +AccountServiceImpl_AccountDataService_Proxy::~AccountServiceImpl_AccountDataService_Proxy() +{ + if (target) + delete target; +} + +commonj::sdo::DataObjectPtr AccountServiceImpl_AccountDataService_Proxy::getCheckingAccount(const char* arg0) +{ + Operation operation("getCheckingAccount"); + operation.addParameter(&arg0); + commonj::sdo::DataObjectPtr ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + +commonj::sdo::DataObjectPtr AccountServiceImpl_AccountDataService_Proxy::getSavingsAccount(const char* arg0) +{ + Operation operation("getSavingsAccount"); + operation.addParameter(&arg0); + commonj::sdo::DataObjectPtr ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + +commonj::sdo::DataObjectPtr AccountServiceImpl_AccountDataService_Proxy::getStockAccount(const char* arg0) +{ + Operation operation("getStockAccount"); + operation.addParameter(&arg0); + commonj::sdo::DataObjectPtr ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountDataService_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountDataService_Proxy.h new file mode 100644 index 0000000000..ff5c6e6d87 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountDataService_Proxy.h @@ -0,0 +1,40 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#ifndef AccountServiceImpl_AccountDataService_Proxy_h +#define AccountServiceImpl_AccountDataService_Proxy_h + +#include "AccountDataService.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class AccountServiceImpl_AccountDataService_Proxy : public com::bigbank::account::AccountDataService +{ +public: + AccountServiceImpl_AccountDataService_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~AccountServiceImpl_AccountDataService_Proxy(); + virtual commonj::sdo::DataObjectPtr getCheckingAccount(const char* id); + virtual commonj::sdo::DataObjectPtr getSavingsAccount(const char* id); + virtual commonj::sdo::DataObjectPtr getStockAccount(const char* id); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // AccountServiceImpl_AccountDataService_Proxy_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Proxy.cpp new file mode 100644 index 0000000000..1684266b3e --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Proxy.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "AccountServiceImpl_AccountService_Proxy.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + AccountServiceImpl_AccountService_Proxy* AccountServiceImpl_AccountService_Proxy_Factory(ServiceWrapper* target) + { + return new AccountServiceImpl_AccountService_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void AccountServiceImpl_AccountService_Proxy_Destructor(void* proxy) + { + delete (AccountServiceImpl_AccountService_Proxy*)proxy; + } +} + +AccountServiceImpl_AccountService_Proxy::AccountServiceImpl_AccountService_Proxy(ServiceWrapper* targ) : target(targ) +{ +} + +AccountServiceImpl_AccountService_Proxy::~AccountServiceImpl_AccountService_Proxy() +{ + if (target) + delete target; +} + +commonj::sdo::DataObjectPtr AccountServiceImpl_AccountService_Proxy::getAccountReport( DataObjectPtr arg0) +{ + Operation operation("getAccountReport"); + operation.addParameter(&arg0); + commonj::sdo::DataObjectPtr ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Proxy.h new file mode 100644 index 0000000000..3b5df16198 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Proxy.h @@ -0,0 +1,34 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AccountServiceImpl_AccountService_Proxy_h +#define AccountServiceImpl_AccountService_Proxy_h + +#include "AccountService.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class AccountServiceImpl_AccountService_Proxy : public com::bigbank::account::AccountService +{ +public: + AccountServiceImpl_AccountService_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~AccountServiceImpl_AccountService_Proxy(); + virtual commonj::sdo::DataObjectPtr getAccountReport( DataObjectPtr cid); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // AccountServiceImpl_AccountService_Proxy_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Wrapper.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Wrapper.cpp new file mode 100644 index 0000000000..1b97e5c4d0 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Wrapper.cpp @@ -0,0 +1,73 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "AccountServiceImpl_AccountService_Wrapper.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + AccountServiceImpl_AccountService_Wrapper* AccountServiceImpl_AccountService_Wrapper_Factory(tuscany::sca::model::Service* target) + { + return new AccountServiceImpl_AccountService_Wrapper(target); + } +} + +AccountServiceImpl_AccountService_Wrapper::AccountServiceImpl_AccountService_Wrapper(Service* target) : ComponentServiceWrapper(target) +{ + impl = (AccountServiceImpl*)getImplementation(); +} + +AccountServiceImpl_AccountService_Wrapper::~AccountServiceImpl_AccountService_Wrapper() +{ + releaseImplementation(); +} + +void* AccountServiceImpl_AccountService_Wrapper::newImplementation() +{ + return new AccountServiceImpl; +} + +void AccountServiceImpl_AccountService_Wrapper::deleteImplementation() +{ + delete impl; +} + +void AccountServiceImpl_AccountService_Wrapper::invokeService(Operation& operation) +{ + const string& operationName = operation.getName(); + + if (operationName == "getAccountReport") + { + DataObjectPtr& p0 = *(DataObjectPtr*)operation.getParameterValue(0); *(commonj::sdo::DataObjectPtr*)operation.getReturnValue() = impl->getAccountReport(p0); + return; + } + + + throw ServiceRuntimeException("Invalid operation"); + +} + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Wrapper.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Wrapper.h new file mode 100644 index 0000000000..9dce3fd05d --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_AccountService_Wrapper.h @@ -0,0 +1,36 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AccountServiceImpl_AccountService_Wrapper_h +#define AccountServiceImpl_AccountService_Wrapper_h + +#include "AccountServiceImpl.h" +#include "tuscany/sca/core/ComponentServiceWrapper.h" + +class AccountServiceImpl_AccountService_Wrapper : public tuscany::sca::ComponentServiceWrapper +{ +public: + AccountServiceImpl_AccountService_Wrapper(tuscany::sca::model::Service* target); + virtual ~AccountServiceImpl_AccountService_Wrapper(); + virtual void invokeService(tuscany::sca::Operation& operation); + virtual void* newImplementation(); + virtual void deleteImplementation(); +private: + AccountServiceImpl* impl; +}; + +#endif // AccountServiceImpl_AccountService_Wrapper_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_stockQuote_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_stockQuote_Proxy.cpp new file mode 100644 index 0000000000..be1b432353 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_stockQuote_Proxy.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "AccountServiceImpl_stockQuote_Proxy.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + AccountServiceImpl_stockQuote_Proxy* AccountServiceImpl_stockQuote_Proxy_Factory(ServiceWrapper* target) + { + return new AccountServiceImpl_stockQuote_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void AccountServiceImpl_stockQuote_Proxy_Destructor(void* proxy) + { + delete (AccountServiceImpl_stockQuote_Proxy*)proxy; + } +} + +AccountServiceImpl_stockQuote_Proxy::AccountServiceImpl_stockQuote_Proxy(ServiceWrapper* targ) : target(targ) +{ +} + +AccountServiceImpl_stockQuote_Proxy::~AccountServiceImpl_stockQuote_Proxy() +{ + if (target) + delete target; +} + +float AccountServiceImpl_stockQuote_Proxy::getQuote(const char* arg0) +{ + Operation operation("getQuote"); + operation.addParameter(&arg0); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_stockQuote_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_stockQuote_Proxy.h new file mode 100644 index 0000000000..d63d507bf4 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/AccountServiceImpl_stockQuote_Proxy.h @@ -0,0 +1,34 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AccountServiceImpl_stockQuote_Proxy_h +#define AccountServiceImpl_stockQuote_Proxy_h + +#include "StockQuoteService.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class AccountServiceImpl_stockQuote_Proxy : public com::bigbank::stockquote::StockQuoteService +{ +public: + AccountServiceImpl_stockQuote_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~AccountServiceImpl_stockQuote_Proxy(); + virtual float getQuote(const char* symbol); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // AccountServiceImpl_stockQuote_Proxy_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/Accounts.dsp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/Accounts.dsp new file mode 100644 index 0000000000..52c450a2bd --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/Accounts.dsp @@ -0,0 +1,250 @@ +# Microsoft Developer Studio Project File - Name="Accounts" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=Accounts - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Accounts.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Accounts.mak" CFG="Accounts - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Accounts - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Accounts - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Accounts - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACCOUNTS_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACCOUNTS_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "Accounts - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACCOUNTS_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(TUSCANY_SCACPP)\include" /I "$(TUSCANY_SDOCPP)\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACCOUNTS_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tuscany_sca.lib tuscany_sdo.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"$(TUSCANY_SCACPP)/lib" /libpath:"$(TUSCANY_SDOCPP)/lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Accounts - Win32 Release"
+# Name "Accounts - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AccountDataServiceImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountDataServiceImpl_AccountDataService_Proxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountDataServiceImpl_AccountDataService_Wrapper.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_AccountDataService_Proxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_AccountDataService_Proxy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_AccountService_Proxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_AccountService_Wrapper.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_stockQuote_Proxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl_StockQuoteExternal_Proxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl_StockQuoteService_Proxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl_StockQuoteService_Wrapper.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\AccountDataService.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountDataServiceImpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountDataServiceImpl_AccountDataService_Proxy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountDataServiceImpl_AccountDataService_Wrapper.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountService.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_AccountService_Proxy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_AccountService_Wrapper.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl_stockQuote_Proxy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteExternalService.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteService.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl_StockQuoteExternal_Proxy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl_StockQuoteService_Proxy.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl_StockQuoteService_Wrapper.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=..\WSAccountClient\services.xml
+# End Source File
+# Begin Source File
+
+SOURCE="..\WSAccountClient\Tuscany-model.config"
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\AccountDataServiceImpl.componentType
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountService.wsdl
+# End Source File
+# Begin Source File
+
+SOURCE=.\AccountServiceImpl.componenttype
+# End Source File
+# Begin Source File
+
+SOURCE=.\sca.module
+# End Source File
+# Begin Source File
+
+SOURCE=.\sca.subsystem
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteService.wsdl
+# End Source File
+# Begin Source File
+
+SOURCE=.\StockQuoteServiceImpl.componentType
+# End Source File
+# End Target
+# End Project
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteExternalService.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteExternalService.h new file mode 100644 index 0000000000..d8df90651d --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteExternalService.h @@ -0,0 +1,24 @@ +#include "commonj/sdo/SDO.h" +using namespace commonj::sdo; + + +namespace com +{ + namespace bigbank + { + namespace stockquote + { + + /* + * AccountsService C interface + */ + + class StockQuoteExternalService { + public: + virtual const char* GetQuote(const char* symbol) = 0; + + }; + + } + } +} // namespace; diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteService.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteService.h new file mode 100644 index 0000000000..cd61d4c4d2 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteService.h @@ -0,0 +1,24 @@ + + +namespace com +{ + namespace bigbank + { + namespace stockquote + { + + /* + * AccountsService C interface + */ + + class StockQuoteService { + public: + virtual float getQuote(const char* symbol) = 0; + + }; + + } + } +} // namespace; + +using namespace com::bigbank::stockquote; diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteService.wsdl b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteService.wsdl new file mode 100644 index 0000000000..ba6caff22c --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteService.wsdl @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?>
+
+<wsdl:definitions
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.quickstockquote.com/StockQuoteService/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.quickstockquote.com/StockQuoteService/"
+ name="StockQuoteService">
+
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.quickstockquote.com/StockQuoteService/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="getQuote">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getQuoteResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="quote" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getQuote">
+ <wsdl:part element="tns:getQuote" name="getQuote" />
+ </wsdl:message>
+ <wsdl:message name="getQuoteResponse">
+ <wsdl:part element="tns:getQuoteResponse" name="getQuoteResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="StockQuoteService">
+ <wsdl:operation name="getQuote">
+ <wsdl:input message="tns:getQuote" />
+ <wsdl:output message="tns:getQuoteResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="StockQuoteServiceSOAP"
+ type="tns:StockQuoteService">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getQuote">
+ <soap:operation
+ soapAction="http://www.quickstockquote.com/StockQuoteService/getQuote" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StockQuoteService">
+ <wsdl:port binding="tns:StockQuoteServiceSOAP"
+ name="StockQuoteServiceSOAP">
+ <soap:address location="http://www.quickstockquote.com/services/StockQuoteService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.componentType b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.componentType new file mode 100644 index 0000000000..92e46f2638 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.componentType @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
+
+ <service name="StockQuoteService">
+ <interface.cpp header="StockQuoteService.h">
+ </interface.cpp>
+ </service>
+
+ <reference name="StockQuoteExternal">
+ <interface.cpp header="StockQuoteExternalService.h">
+ </interface.cpp>
+ </reference>
+
+
+</componentType>
+
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.cpp new file mode 100644 index 0000000000..8ce6d410c2 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.cpp @@ -0,0 +1,63 @@ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "StockQuoteServiceImpl.h" +#include "StockQuoteExternalService.h" + +#include "osoa/sca/sca.h" +#include "commonj/sdo/SDO.h" + +using namespace osoa::sca; +using namespace commonj::sdo; + +namespace com{ + namespace bigbank{ + namespace stockquote { + + + float StockQuoteServiceImpl::getQuote(const char *symbol) + { + ComponentContext myContext = ComponentContext::getCurrent(); + + // Use an SCA reference to get the stock price + StockQuoteExternalService* stockQuoteExternalService = + (StockQuoteExternalService*)myContext. + getService("StockQuoteExternal"); + + if (stockQuoteExternalService == 0) + { + std::cout << "unable to find external stock quote service" << std::endl; + return 0.1f; + } + + // Create a data object representing the requests (use dynamic API until static is available) + DataObjectPtr requestDO; + + // Invoke the service + const char* result = stockQuoteExternalService->GetQuote(symbol); + + //std::cout << result<< std::endl; + + float stockPrice = 0.0f; + + try + { + XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(myContext.getDataFactory()); + XMLDocumentPtr stockDoc = xmlHelper->load(result); + if (stockDoc->getRootDataObject()) + { + stockPrice=stockDoc->getRootDataObject()->getFloat("Stock.0/Last"); + } + } + catch (SDORuntimeException e) + { + std::cout << e << std::endl; + return 0.0f; + } + return stockPrice; + } + } + } +}
\ No newline at end of file diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.h new file mode 100644 index 0000000000..7611984e4e --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.h @@ -0,0 +1,25 @@ + +#include "StockQuoteService.h" + + +namespace com +{ + namespace bigbank + { + namespace stockquote + { + + /* + * AccountsService C interface + */ + + class StockQuoteServiceImpl : public StockQuoteService { + public: + virtual float getQuote(const char* symbol); + + }; + + +} +} +} // namespace; diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteExternal_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteExternal_Proxy.cpp new file mode 100644 index 0000000000..b618dd4a33 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteExternal_Proxy.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "StockQuoteServiceImpl_StockQuoteExternal_Proxy.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + StockQuoteServiceImpl_StockQuoteExternal_Proxy* StockQuoteServiceImpl_StockQuoteExternal_Proxy_Factory(ServiceWrapper* target) + { + return new StockQuoteServiceImpl_StockQuoteExternal_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void StockQuoteServiceImpl_StockQuoteExternal_Proxy_Destructor(void* proxy) + { + delete (StockQuoteServiceImpl_StockQuoteExternal_Proxy*)proxy; + } +} + +StockQuoteServiceImpl_StockQuoteExternal_Proxy::StockQuoteServiceImpl_StockQuoteExternal_Proxy(ServiceWrapper* targ) : target(targ) +{ +} + +StockQuoteServiceImpl_StockQuoteExternal_Proxy::~StockQuoteServiceImpl_StockQuoteExternal_Proxy() +{ + if (target) + delete target; +} + +const char* StockQuoteServiceImpl_StockQuoteExternal_Proxy::GetQuote(const char* arg0) +{ + Operation operation("GetQuote"); + operation.addParameter(&arg0); + const char* ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteExternal_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteExternal_Proxy.h new file mode 100644 index 0000000000..45469174ce --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteExternal_Proxy.h @@ -0,0 +1,34 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef StockQuoteServiceImpl_StockQuoteExternal_Proxy_h +#define StockQuoteServiceImpl_StockQuoteExternal_Proxy_h + +#include "StockQuoteExternalService.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class StockQuoteServiceImpl_StockQuoteExternal_Proxy : public com::bigbank::stockquote::StockQuoteExternalService +{ +public: + StockQuoteServiceImpl_StockQuoteExternal_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~StockQuoteServiceImpl_StockQuoteExternal_Proxy(); + virtual const char* GetQuote(const char* symbol); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // StockQuoteServiceImpl_StockQuoteExternal_Proxy_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Proxy.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Proxy.cpp new file mode 100644 index 0000000000..43dabb5307 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Proxy.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "StockQuoteServiceImpl_StockQuoteService_Proxy.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + StockQuoteServiceImpl_StockQuoteService_Proxy* StockQuoteServiceImpl_StockQuoteService_Proxy_Factory(ServiceWrapper* target) + { + return new StockQuoteServiceImpl_StockQuoteService_Proxy(target); + } + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + void StockQuoteServiceImpl_StockQuoteService_Proxy_Destructor(void* proxy) + { + delete (StockQuoteServiceImpl_StockQuoteService_Proxy*)proxy; + } +} + +StockQuoteServiceImpl_StockQuoteService_Proxy::StockQuoteServiceImpl_StockQuoteService_Proxy(ServiceWrapper* targ) : target(targ) +{ +} + +StockQuoteServiceImpl_StockQuoteService_Proxy::~StockQuoteServiceImpl_StockQuoteService_Proxy() +{ + if (target) + delete target; +} + +float StockQuoteServiceImpl_StockQuoteService_Proxy::getQuote(const char* arg0) +{ + Operation operation("getQuote"); + operation.addParameter(&arg0); + float ret; + operation.setReturnValue(&ret); + target->invoke(operation); + return ret; +} + + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Proxy.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Proxy.h new file mode 100644 index 0000000000..e1b0ad1807 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Proxy.h @@ -0,0 +1,34 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef StockQuoteServiceImpl_StockQuoteService_Proxy_h +#define StockQuoteServiceImpl_StockQuoteService_Proxy_h + +#include "StockQuoteService.h" +#include "tuscany/sca/core/ServiceWrapper.h" + +class StockQuoteServiceImpl_StockQuoteService_Proxy : public com::bigbank::stockquote::StockQuoteService +{ +public: + StockQuoteServiceImpl_StockQuoteService_Proxy(tuscany::sca::ServiceWrapper*); + virtual ~StockQuoteServiceImpl_StockQuoteService_Proxy(); + virtual float getQuote(const char* symbol); +private: + tuscany::sca::ServiceWrapper* target; +}; + +#endif // StockQuoteServiceImpl_StockQuoteService_Proxy_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Wrapper.cpp b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Wrapper.cpp new file mode 100644 index 0000000000..00ac26c784 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Wrapper.cpp @@ -0,0 +1,74 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined(WIN32) || defined (_WINDOWS) +#pragma warning(disable: 4786) +#endif + +#include "StockQuoteServiceImpl_StockQuoteService_Wrapper.h" + +#include "osoa/sca/sca.h" +using namespace osoa::sca; +using namespace tuscany::sca; + +extern "C" +{ + + #if defined(WIN32) || defined(_WINDOWS) + __declspec(dllexport) + #endif + StockQuoteServiceImpl_StockQuoteService_Wrapper* StockQuoteServiceImpl_StockQuoteService_Wrapper_Factory(tuscany::sca::model::Service* target) + { + return new StockQuoteServiceImpl_StockQuoteService_Wrapper(target); + } +} + +StockQuoteServiceImpl_StockQuoteService_Wrapper::StockQuoteServiceImpl_StockQuoteService_Wrapper(Service* target) : ComponentServiceWrapper(target) +{ + impl = (StockQuoteServiceImpl*)getImplementation(); +} + +StockQuoteServiceImpl_StockQuoteService_Wrapper::~StockQuoteServiceImpl_StockQuoteService_Wrapper() +{ + releaseImplementation(); +} + +void* StockQuoteServiceImpl_StockQuoteService_Wrapper::newImplementation() +{ + return new StockQuoteServiceImpl; +} + +void StockQuoteServiceImpl_StockQuoteService_Wrapper::deleteImplementation() +{ + delete impl; +} + +void StockQuoteServiceImpl_StockQuoteService_Wrapper::invokeService(Operation& operation) +{ + const string& operationName = operation.getName(); + + if (operationName == "getQuote") + { + const char* p0 = *(const char**)operation.getParameterValue(0); + *(float*)operation.getReturnValue() = impl->getQuote(p0); + return; + } + + + throw ServiceRuntimeException("Invalid operation"); + +} + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Wrapper.h b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Wrapper.h new file mode 100644 index 0000000000..a6d8580e5e --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/StockQuoteServiceImpl_StockQuoteService_Wrapper.h @@ -0,0 +1,36 @@ +/* + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef StockQuoteServiceImpl_StockQuoteService_Wrapper_h +#define StockQuoteServiceImpl_StockQuoteService_Wrapper_h + +#include "StockQuoteServiceImpl.h" +#include "tuscany/sca/core/ComponentServiceWrapper.h" + +class StockQuoteServiceImpl_StockQuoteService_Wrapper : public tuscany::sca::ComponentServiceWrapper +{ +public: + StockQuoteServiceImpl_StockQuoteService_Wrapper(tuscany::sca::model::Service* target); + virtual ~StockQuoteServiceImpl_StockQuoteService_Wrapper(); + virtual void invokeService(tuscany::sca::Operation& operation); + virtual void* newImplementation(); + virtual void deleteImplementation(); +private: + StockQuoteServiceImpl* impl; +}; + +#endif // StockQuoteServiceImpl_StockQuoteService_Wrapper_h + diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/sca.module b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/sca.module new file mode 100644 index 0000000000..8560a3cb72 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/sca.module @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="AccountModule">
+
+ <component name="AccountServiceComponent">
+ <implementation.cpp dll="Accounts.dll" header="AccountServiceImpl.h"/>
+ <references>
+ <AccountDataService>AccountDataServiceComponent</AccountDataService>
+ <stockQuote>StockQuoteServiceComponent</stockQuote>
+ </references>
+ <properties>
+ <v:currency>EURO</v:currency>
+ </properties>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.cpp dll="Accounts.dll" header="AccountDataServiceImpl.h"/>
+ </component>
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.cpp dll="Accounts.dll" header="StockQuoteServiceImpl.h"/>
+ <references>
+ <StockQuoteExternal>StockQuoteExternalService</StockQuoteExternal>
+ </references>
+ </component>
+
+ <externalService name="StockQuoteExternalService">
+ <interface.cpp header="StockQuoteExternalService.h"/>
+ <binding.ws port="http://www.webserviceX.NET/#wsdl.endpoint(StockQuote/StockQuoteSoap)"/>
+ </externalService>
+
+ <entryPoint name="WSAccountEntrypoint" multiplicity="1..1">
+ <interface.wsdl interface="AccountService.wsdl" callbackInterface=""></interface.wsdl>
+ <binding.ws port="http://www.bigbank.com/AccountService#wsdl.endpoint(AccountService/AccountServiceSOAP)"></binding.ws>
+ <reference>AccountServiceComponent</reference>
+ </entryPoint>
+
+</module>
diff --git a/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/sca.subsystem b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/sca.subsystem new file mode 100644 index 0000000000..faaa828bf9 --- /dev/null +++ b/sca-cpp/branches/cpp-M1/sca/samples/BigBank/Accounts/sca.subsystem @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<subsystem xmlns="http://www.osoa.org/xmlns/sca/0.9"
+
+ name="AccountSubsystem">
+
+ <moduleComponent name="Account" module="AccountModule">
+
+ </moduleComponent>
+
+</subsystem>
+
\ No newline at end of file |