summaryrefslogtreecommitdiffstats
path: root/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue')
-rw-r--r--tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/Makefile.am34
-rwxr-xr-xtags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValue.h34
-rwxr-xr-xtags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.componentType39
-rwxr-xr-xtags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.cpp147
-rwxr-xr-xtags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.h37
-rwxr-xr-xtags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.wsdl84
-rwxr-xr-xtags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.xsd42
7 files changed, 417 insertions, 0 deletions
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/Makefile.am b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/Makefile.am
new file mode 100644
index 0000000000..d695ed9db9
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/Makefile.am
@@ -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.
+
+lib_LTLIBRARIES = libMyValue.la
+
+libMyValue_la_SOURCES = \
+MyValueImpl.cpp \
+MyValueImpl_customerInfo_Proxy.cpp \
+MyValueImpl_MyValueService_Proxy.cpp \
+MyValueImpl_MyValueService_Wrapper.cpp \
+MyValueImpl_stockQuote_Proxy.cpp
+
+libMyValue_la_LIBADD = -L$(top_builddir)/runtime/core/src -ltuscany_sca \
+ -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo
+
+INCLUDES = -I.. \
+ -I$(top_builddir)/runtime/core/src \
+ -I${TUSCANY_SDOCPP}/include
+
+install: \ No newline at end of file
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValue.h b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValue.h
new file mode 100755
index 0000000000..615f62bde5
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValue.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 MyValue_h
+#define MyValue_h
+
+#include "commonj/sdo/SDO.h"
+using commonj::sdo::DataObjectPtr;
+
+class MyValue
+{
+public:
+ virtual DataObjectPtr getMyValue(DataObjectPtr inDataObject) = 0;
+};
+
+#endif
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.componentType b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.componentType
new file mode 100755
index 0000000000..b03760247b
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.componentType
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
+
+ <service name="MyValueService">
+ <interface.cpp header="MyValue/MyValue.h">
+ </interface.cpp>
+ </service>
+
+ <reference name="customerInfo">
+ <interface.cpp header="CustomerInfo/CustomerInfo.h">
+ </interface.cpp>
+ </reference>
+
+ <reference name="stockQuote">
+ <interface.cpp header="StockQuoteService/StockQuoteService.h">
+ </interface.cpp>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.cpp b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.cpp
new file mode 100755
index 0000000000..5c0d5506d3
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.cpp
@@ -0,0 +1,147 @@
+/*
+ * 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$ */
+
+//
+// MyValueImpl.cpp: implementation of the MyValueImpl class.
+//
+
+#include "commonj/sdo/HelperProvider.h"
+#include "commonj/sdo/SDO.h"
+#include "osoa/sca/sca.h"
+#include "MyValueImpl.h"
+#include "CustomerInfo/CustomerInfo.h"
+#include "StockQuoteService/StockQuoteService.h"
+#include <iostream>
+
+using namespace std;
+using namespace osoa::sca;
+using namespace commonj::sdo;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+MyValueImpl::MyValueImpl()
+{
+ cout << "Construct MyValueImpl" << endl;
+
+}
+
+MyValueImpl::~MyValueImpl()
+{
+ cout << "Destroy MyValueImpl" << endl;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Other methods
+//////////////////////////////////////////////////////////////////////
+DataObjectPtr MyValueImpl::getMyValue(DataObjectPtr inDataObject)
+{
+ DataObjectPtr responseDO = 0;
+
+ string customerID = inDataObject->getCString("customerID");
+ cout << "In getMyValue with customerid: " << customerID << endl;
+
+ // Get the CustomerInfo service.
+ ComponentContext myContext = ComponentContext::getCurrent();
+ CustomerInfo* customerInfoService = (CustomerInfo*)myContext.getService("customerInfo");
+
+ if (customerInfoService == 0)
+ {
+ cout << "Unable to find customer info service" << endl;
+
+ return responseDO;
+ }
+
+ // Get the name of the stock for customer 'customerID' from the customerInfoService.
+ const char * stock;
+ try
+ {
+ stock = customerInfoService->getCustomerInformation(customerID.c_str());
+ }
+ catch(const char* x)
+ {
+ cout << "Exception caught: " << x <<endl;
+ throw;
+ }
+
+
+ // Check that we get the same stock back when iterating over the customerInfo services.
+ ServiceList serviceList = myContext.getServices("customerInfo");
+ for (int i=0; i<serviceList.size();i++)
+ {
+ CustomerInfo* service = (CustomerInfo*)(serviceList[i]);
+ stock = service->getCustomerInformation(customerID.c_str());
+ cout << "Stock from getServices " << i << " : " << stock <<endl;
+
+ }
+
+ // Use a second SCA reference to get the stock price for the customer's stock.
+ StockQuoteService* stockQuoteService = (StockQuoteService*)myContext.getService("stockQuote");
+
+ if (stockQuoteService == 0)
+ {
+ cout << "Unable to find stock quote service" << endl;
+
+ return responseDO;
+ }
+
+ // Create a data object representing the requests (use dynamic API until static is available)
+ DataObjectPtr stockQuoteRequestDO;
+ DataFactoryPtr factory;
+ try
+ {
+ // Create the request DO for the StockQuoteService.
+ factory = myContext.getDataFactory();
+ stockQuoteRequestDO = factory->create("http://swanandmokashi.com", "GetQuotes");
+ stockQuoteRequestDO->setCString("QuoteTicker", stock);
+
+ // Invoke the StockQuoteService
+ DataObjectPtr stockQuoteResponseDO = stockQuoteService->GetStockQuotes(stockQuoteRequestDO);
+
+ // DEBUG (Print the response from the StockQuoteService)
+ XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(factory);;
+ XMLDocumentPtr responseDoc =
+ xmlHelper->createDocument(stockQuoteResponseDO, "http://swanandmokashi.com", "GetQuotesResponse");
+ responseDoc->setXMLDeclaration(false);
+ char *responseXML = xmlHelper->save(responseDoc);
+ cout << "Response XML from StockQuoteService = " << endl;
+ cout << responseXML << endl;
+ cout << endl;
+ // DEBUG
+
+ // Create the MyValueService response DataObject using the results of the StockQuoteService.
+ responseDO = factory->create("http://www.myvalue.org/MyValueService/", "getMyValueResponse");
+ DataObjectPtr getQuotesResultDO = stockQuoteResponseDO->getDataObject("GetQuotesResult");
+ DataObjectList& quoteList = getQuotesResultDO->getList("Quote");
+ float fQuote = quoteList[0]->getFloat("StockQuote");
+
+ responseDO->setFloat("myValue", fQuote);
+ }
+ catch (SDORuntimeException sdoE)
+ {
+ cout << sdoE;
+ }
+
+ return responseDO;
+
+}
+
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.h b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.h
new file mode 100755
index 0000000000..6380dac5e0
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueImpl.h
@@ -0,0 +1,37 @@
+/*
+ * 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 MyValueImpl_h
+#define MyValueImpl_h
+
+#include "MyValue.h"
+
+
+class MyValueImpl : public MyValue
+{
+public:
+ MyValueImpl();
+ virtual ~MyValueImpl();
+ virtual DataObjectPtr getMyValue(DataObjectPtr inDataObject);
+};
+
+#endif
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.wsdl b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.wsdl
new file mode 100755
index 0000000000..6ea196e311
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.wsdl
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.myvalue.org/MyValueService/"
+ targetNamespace="http://www.myvalue.org/MyValueService/">
+ <types>
+ <xs:schema targetNamespace="http://www.myvalue.org/MyValueService/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.myvalue.org/MyValueService/"
+ elementFormDefault="qualified">
+
+ <xs:element name="getMyValue">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="customerID" type="xs:string" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="getMyValueResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="myValue" type="xs:float" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ </xs:schema>
+ </types>
+
+ <message name="getMyValueRequestMsg">
+ <part name="body" element="tns:getMyValue"/>
+ </message>
+
+ <message name="getMyValueResponseMsg">
+ <part name="body" element="tns:getMyValueResponse"/>
+ </message>
+
+ <portType name="MyValueServicePortType">
+ <operation name="getMyValue">
+ <input message="tns:getMyValueRequestMsg"/>
+ <output message="tns:getMyValueResponseMsg"/>
+ </operation>
+ </portType>
+
+ <binding name="MyValueServiceBinding" type="tns:MyValueServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="getMyValue">
+ <soap:operation soapAction="MyValueService#getMyValue"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="MyValueService">
+ <port name="MyValueServicePort" binding="tns:MyValueServiceBinding">
+ <soap:address location="http://localhost/axis/MyValueService"/>
+ </port>
+ </service>
+</definitions>
diff --git a/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.xsd b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.xsd
new file mode 100755
index 0000000000..ab2f25a826
--- /dev/null
+++ b/tags/cpp-1.0-incubating-M2-RC2/sca/samples/MyValue/MyValueComposite/MyValue/MyValueService.xsd
@@ -0,0 +1,42 @@
+<?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.
+-->
+
+<xs:schema targetNamespace="http://www.myvalue.org/MyValueService/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.myvalue.org/MyValueService/"
+ elementFormDefault="qualified">
+
+ <xs:element name="getMyValue">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="customerID" type="xs:string" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="getMyValueResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="myValue" type="xs:float" minOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>