You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2009/09/26 23:31:38 UTC

svn commit: r819222 - in /tuscany/cpp/sca/samples: ./ store/ store2/

Author: jsdelfino
Date: Sat Sep 26 21:31:37 2009
New Revision: 819222

URL: http://svn.apache.org/viewvc?rev=819222&view=rev
Log:
Added a variant of store that implements the business logic as a set of functions stringed together instead of classes, to help see how that style can help simplify the component assembly process.

Added:
    tuscany/cpp/sca/samples/store2/
    tuscany/cpp/sca/samples/store2/Makefile.am
      - copied, changed from r819221, tuscany/cpp/sca/samples/store/Makefile.am
    tuscany/cpp/sca/samples/store2/cart.hpp
    tuscany/cpp/sca/samples/store2/catalog.hpp
    tuscany/cpp/sca/samples/store2/catalogs.composite
    tuscany/cpp/sca/samples/store2/currency-composite.hpp
    tuscany/cpp/sca/samples/store2/currency.composite
    tuscany/cpp/sca/samples/store2/currency.hpp
    tuscany/cpp/sca/samples/store2/item.hpp
    tuscany/cpp/sca/samples/store2/service.hpp
    tuscany/cpp/sca/samples/store2/store-composite.hpp
    tuscany/cpp/sca/samples/store2/store-solution.hpp
    tuscany/cpp/sca/samples/store2/store-ui.hpp
    tuscany/cpp/sca/samples/store2/store.composite
    tuscany/cpp/sca/samples/store2/store2-test.cpp
Modified:
    tuscany/cpp/sca/samples/Makefile.am
    tuscany/cpp/sca/samples/configure.ac
    tuscany/cpp/sca/samples/store/Makefile.am

Modified: tuscany/cpp/sca/samples/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/Makefile.am?rev=819222&r1=819221&r2=819222&view=diff
==============================================================================
--- tuscany/cpp/sca/samples/Makefile.am (original)
+++ tuscany/cpp/sca/samples/Makefile.am Sat Sep 26 21:31:37 2009
@@ -16,7 +16,7 @@
 #  under the License.
 
 if WANT_ALL_SAMPLES
-  CPP_SAMPLES = CppCalculator CppBigBank store
+  CPP_SAMPLES = CppCalculator CppBigBank store store2
   PYTHON_SAMPLES = PythonCalculator PythonWeatherForecast RestCustomer AlertAggregator
   RUBY_SAMPLES = RubyCalculator RubyBigBank HttpdBigBank RestCalculator
   PYTHON_RUBY_SAMPLES = RestYahoo

Modified: tuscany/cpp/sca/samples/configure.ac
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/configure.ac?rev=819222&r1=819221&r2=819222&view=diff
==============================================================================
--- tuscany/cpp/sca/samples/configure.ac (original)
+++ tuscany/cpp/sca/samples/configure.ac Sat Sep 26 21:31:37 2009
@@ -163,6 +163,7 @@
 
 AC_CONFIG_FILES([Makefile  
                  store/Makefile
+                 store2/Makefile
                  AlertAggregator/Makefile
                  AlertAggregator/sample.alerter/Makefile
                  AlertAggregator/sample.display/Makefile

Modified: tuscany/cpp/sca/samples/store/Makefile.am
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store/Makefile.am?rev=819222&r1=819221&r2=819222&view=diff
==============================================================================
--- tuscany/cpp/sca/samples/store/Makefile.am (original)
+++ tuscany/cpp/sca/samples/store/Makefile.am Sat Sep 26 21:31:37 2009
@@ -15,27 +15,13 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-deploydir=$(prefix)/store/deploy
-EXTRA_DIST = *.composite
-deploy_DATA = *.composite
-
-storedir=$(deploydir)
-
 store_PROGRAMS = store-test
+storedir=$(prefix)/store/deploy
 
-store_test_SOURCES = \
-store-test.cpp
+store_test_SOURCES = store-test.cpp
 
-store_test_LDADD = \
--L${TUSCANY_SCACPP}/lib \
-  -ltuscany_sca \
--L${TUSCANY_SCACPP}/extensions/cpp/lib \
-  -ltuscany_sca_cpp \
--L${TUSCANY_SDOCPP}/lib \
-  -ltuscany_sdo
+INCLUDES = -I. -I${TUSCANY_SCACPP}/include
+store_test_LDADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca
 	
-INCLUDES = \
--I$(TUSCANY_SCACPP)/extensions/cpp/include \
--I${TUSCANY_SCACPP}/include \
--I${TUSCANY_SDOCPP}/include \
--I.
+EXTRA_DIST = *.composite
+store_DATA = *.composite

Copied: tuscany/cpp/sca/samples/store2/Makefile.am (from r819221, tuscany/cpp/sca/samples/store/Makefile.am)
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/Makefile.am?p2=tuscany/cpp/sca/samples/store2/Makefile.am&p1=tuscany/cpp/sca/samples/store/Makefile.am&r1=819221&r2=819222&rev=819222&view=diff
==============================================================================
--- tuscany/cpp/sca/samples/store/Makefile.am (original)
+++ tuscany/cpp/sca/samples/store2/Makefile.am Sat Sep 26 21:31:37 2009
@@ -15,27 +15,13 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-deploydir=$(prefix)/store/deploy
-EXTRA_DIST = *.composite
-deploy_DATA = *.composite
-
-storedir=$(deploydir)
+store2_PROGRAMS = store2-test
+store2dir=$(prefix)/store2/deploy
 
-store_PROGRAMS = store-test
+store2_test_SOURCES = store2-test.cpp
 
-store_test_SOURCES = \
-store-test.cpp
-
-store_test_LDADD = \
--L${TUSCANY_SCACPP}/lib \
-  -ltuscany_sca \
--L${TUSCANY_SCACPP}/extensions/cpp/lib \
-  -ltuscany_sca_cpp \
--L${TUSCANY_SDOCPP}/lib \
-  -ltuscany_sdo
+INCLUDES = -I. -I${TUSCANY_SCACPP}/include
+store2_test_LDADD = -L${TUSCANY_SCACPP}/lib -ltuscany_sca
 	
-INCLUDES = \
--I$(TUSCANY_SCACPP)/extensions/cpp/include \
--I${TUSCANY_SCACPP}/include \
--I${TUSCANY_SDOCPP}/include \
--I.
+EXTRA_DIST = *.composite
+store2_DATA = *.composite

Added: tuscany/cpp/sca/samples/store2/cart.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/cart.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/cart.hpp (added)
+++ tuscany/cpp/sca/samples/store2/cart.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_cart_hpp
+#define tuscany_cart_hpp
+
+#include <string>
+#include "service.hpp"
+#include "item.hpp"
+
+namespace store
+{
+
+const double accumTotal(const double total, const ItemType& item) {
+    return total + itemPrice(item);
+}
+
+tuscany::list<ItemType> cart;
+
+const tuscany::list<ItemType> shoppingCart_getAll() {
+    return cart;
+}
+
+const bool shoppingCart_post(const ItemType& item) {
+    cart = cons(item, cart);
+    return true;
+}
+
+const bool shoppingCart_deleteAll() {
+    cart = tuscany::list<ItemType>();
+    return true;
+}
+
+const double shoppingCart_getTotal() {
+    tuscany::lambda<double(double, ItemType)> a(accumTotal);
+    return reduce(a, 0.0, cart);
+}
+
+const tuscany::value shoppingCart_service(const tuscany::list<tuscany::value>& args) {
+    if (car(args) == "getAll")
+        return shoppingCart_getAll();
+    if (car(args) == "post")
+        return shoppingCart_post(cadr(args));
+    if (car(args) == "deleteAll")
+        return shoppingCart_deleteAll();
+    if (car(args) == "getTotal")
+        return shoppingCart_getTotal();
+    return tuscany::value();
+}
+
+}
+#endif /* tuscany_cart_hpp */

Added: tuscany/cpp/sca/samples/store2/catalog.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/catalog.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/catalog.hpp (added)
+++ tuscany/cpp/sca/samples/store2/catalog.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_catalog_hpp
+#define tuscany_catalog_hpp
+
+#include <string>
+#include "service.hpp"
+#include "currency.hpp"
+#include "item.hpp"
+
+namespace store
+{
+
+std::string catalog_currencyCode = "USD";
+
+double catalog_convert(const service& currencyConverter, const double price) {
+    return currencyConverter(makeList(tuscany::value("convert"), tuscany::value("USD"), tuscany::value(catalog_currencyCode), tuscany::value(price)));
+}
+
+const tuscany::list<ItemType> catalog_get(const service& currencyConverter) {
+    const std::string currencySymbol = currencyConverter_service(makeList(tuscany::value("getSymbol"), tuscany::value(catalog_currencyCode)));
+    return makeList(
+            makeItem("Apple", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 2.99)),
+            makeItem("Orange", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 3.55)),
+            makeItem("Pear", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 1.55)));
+}
+
+const tuscany::value catalog_service(const service& currencyConverter, const tuscany::list<tuscany::value>& args) {
+    if (car(args) == "get")
+        return catalog_get(currencyConverter);
+    return tuscany::value();
+}
+
+}
+#endif /* tuscany_catalog_hpp */

Added: tuscany/cpp/sca/samples/store2/catalogs.composite
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/catalogs.composite?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/catalogs.composite (added)
+++ tuscany/cpp/sca/samples/store2/catalogs.composite Sat Sep 26 21:31:37 2009
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+  xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
+  targetNamespace="http://services"
+  name="catalogs">
+		
+	<component name="FruitsCatalogWebService">
+		<implementation.java class="services.FruitsCatalogImpl"/>
+		<service name="Catalog">
+			<binding.ws/>
+		</service> 
+		<property name="currencyCode">USD</property>
+		<reference name="currencyConverter" target="CurrencyConverterWebService">
+			<binding.ws/>
+		</reference>
+	</component> 
+ 	
+	<component name="VegetablesCatalogWebService">
+		<implementation.java class="services.VegetablesCatalogImpl"/>
+		<service name="Catalog">
+			<binding.ws/>
+		</service> 
+	</component>
+ 	
+</composite>

Added: tuscany/cpp/sca/samples/store2/currency-composite.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/currency-composite.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/currency-composite.hpp (added)
+++ tuscany/cpp/sca/samples/store2/currency-composite.hpp Sat Sep 26 21:31:37 2009
@@ -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 tuscany_currencycomposite_hpp
+#define tuscany_currencycomposite_hpp
+
+#include <string>
+#include "service.hpp"
+#include "currency.hpp"
+
+namespace store
+{
+
+const tuscany::value currency_service(const tuscany::list<tuscany::value>& args) {
+    return currencyConverter_service(args);
+}
+
+}
+#endif /* tuscany_currencycomposite_hpp */

Added: tuscany/cpp/sca/samples/store2/currency.composite
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/currency.composite?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/currency.composite (added)
+++ tuscany/cpp/sca/samples/store2/currency.composite Sat Sep 26 21:31:37 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+  xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
+  targetNamespace="http://services"	
+  name="currency">
+		
+	<component name="CurrencyConverterWebService">
+		<implementation.java class="services.CurrencyConverterImpl"/>
+		<service name="CurrencyConverter">
+			<binding.ws/>
+		</service>
+	</component>
+
+</composite>

Added: tuscany/cpp/sca/samples/store2/currency.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/currency.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/currency.hpp (added)
+++ tuscany/cpp/sca/samples/store2/currency.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_currency_hpp
+#define tuscany_currency_hpp
+
+#include <math.h>
+#include <string>
+#include "service.hpp"
+#include "item.hpp"
+
+namespace store
+{
+
+const double currencyConverter_convert(const std::string& fromCurrencyCode, const std::string& toCurrencyCode, const double amount) {
+    if(toCurrencyCode == "USD")
+        return amount;
+    if(toCurrencyCode == "EUR")
+        return round(amount * 0.7256 * 100) / 100;
+    return amount;
+}
+
+const std::string currencyConverter_getSymbol(const std::string& currencyCode) {
+    if(currencyCode == "USD")
+        return "$";
+    if(currencyCode == "EUR")
+        return "E";
+    return "?";
+}
+
+const tuscany::value currencyConverter_service(const tuscany::list<tuscany::value>& args) {
+    if (car(args) == "convert")
+        return currencyConverter_convert(cadr(args), car(cdr(cdr(args))), car(cdr(cdr(cdr(args)))));
+    if (car(args) == "getSymbol")
+        return currencyConverter_getSymbol(cadr(args));
+    return tuscany::value();
+}
+
+}
+#endif /* tuscany_currency_hpp */

Added: tuscany/cpp/sca/samples/store2/item.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/item.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/item.hpp (added)
+++ tuscany/cpp/sca/samples/store2/item.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_item_hpp
+#define tuscany_item_hpp
+
+#include <string>
+#include "service.hpp"
+
+namespace store
+{
+
+typedef tuscany::value ItemType;
+
+const ItemType makeItem(const std::string& name, const std::string& currencyCode, const std::string& currencySymbol, const double price) {
+    return tuscany::value(makeList(tuscany::value(name), tuscany::value(currencyCode), tuscany::value(currencySymbol), tuscany::value(price)));
+}
+
+const std::string itemName(const ItemType& item) {
+    return car((tuscany::list<tuscany::value>)item);
+}
+
+const std::string itemCurrencyCode(const ItemType& item) {
+    return car(cdr((tuscany::list<tuscany::value>)item));
+}
+
+const std::string itemCurrencySymbol(const ItemType& item) {
+    return car(cdr(cdr((tuscany::list<tuscany::value>)item)));
+}
+
+const double itemPrice(const ItemType& item) {
+    return car(cdr(cdr(cdr((tuscany::list<tuscany::value>)item))));
+}
+
+}
+#endif /* tuscany_item_hpp */

Added: tuscany/cpp/sca/samples/store2/service.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/service.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/service.hpp (added)
+++ tuscany/cpp/sca/samples/store2/service.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_service_hpp
+#define tuscany_service_hpp
+
+#include "tuscany/function.hpp"
+#include "tuscany/list.hpp"
+#include "tuscany/value.hpp"
+
+namespace store
+{
+
+typedef tuscany::lambda<tuscany::value(tuscany::list<tuscany::value>)> service;
+
+}
+#endif /* tuscany_service_hpp */

Added: tuscany/cpp/sca/samples/store2/store-composite.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/store-composite.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/store-composite.hpp (added)
+++ tuscany/cpp/sca/samples/store2/store-composite.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_storecomposite_hpp
+#define tuscany_storecomposite_hpp
+
+#include <string>
+#include "service.hpp"
+#include "currency.hpp"
+#include "currency-composite.hpp"
+#include "item.hpp"
+#include "catalog.hpp"
+#include "cart.hpp"
+#include "store-ui.hpp"
+
+namespace store
+{
+
+const tuscany::value store_service(const service& currency, const tuscany::list<tuscany::value>& args) {
+    const tuscany::lambda<tuscany::value(service, tuscany::list<tuscany::value>)> catalogService(catalog_service);
+    const service catalog(curry(catalogService, currency));
+    const service cart(shoppingCart_service);
+    const tuscany::lambda<tuscany::value(service, service, tuscany::list<tuscany::value>)> storeUIService(storeUI_service);
+    const service configuredStoreUIService(curry(storeUIService, catalog, cart));
+    return configuredStoreUIService(args);
+}
+
+}
+#endif /* tuscany_storecomposite_hpp */

Added: tuscany/cpp/sca/samples/store2/store-solution.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/store-solution.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/store-solution.hpp (added)
+++ tuscany/cpp/sca/samples/store2/store-solution.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_storesolution_hpp
+#define tuscany_storesolution_hpp
+
+#include <string>
+#include "service.hpp"
+#include "store-composite.hpp"
+#include "currency-composite.hpp"
+
+namespace store
+{
+
+const tuscany::value storeSolution_service(const tuscany::list<tuscany::value>& args) {
+    const service currency(currency_service);
+    const tuscany::lambda<tuscany::value(service, tuscany::list<tuscany::value>)> storeService(store_service);
+    const service configuredStoreService(curry(storeService, currency));
+    return configuredStoreService(args);
+}
+
+}
+#endif /* tuscany_storesolution_hpp */

Added: tuscany/cpp/sca/samples/store2/store-ui.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/store-ui.hpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/store-ui.hpp (added)
+++ tuscany/cpp/sca/samples/store2/store-ui.hpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_storeui_hpp
+#define tuscany_storeui_hpp
+
+#include <string>
+#include "service.hpp"
+#include "currency.hpp"
+#include "item.hpp"
+#include "catalog.hpp"
+#include "cart.hpp"
+
+namespace store
+{
+
+const tuscany::list<ItemType> storeUI_getCatalog(const service& catalog) {
+    return catalog(makeList(tuscany::value("get")));
+}
+
+const tuscany::list<ItemType> storeUI_getCart(const service& cart) {
+    return cart(makeList(tuscany::value("getAll")));
+}
+
+const double storeUI_getTotal(const service& cart) {
+    return cart(makeList(tuscany::value("getTotal")));
+}
+
+const bool storeUI_post(const service& cart, const ItemType& item) {
+    return cart(makeList(tuscany::value("post"), tuscany::value(item)));
+}
+
+const tuscany::value storeUI_service(const service& catalog, const service& cart, const tuscany::list<tuscany::value>& args) {
+    if (car(args) == "getCatalog")
+        return storeUI_getCatalog(catalog);
+    if (car(args) == "getCart")
+        return storeUI_getCart(cart);
+    if (car(args) == "getTotal")
+        return storeUI_getTotal(cart);
+    if (car(args) == "post")
+        return storeUI_post(cart, cadr(args));
+    return tuscany::value();
+}
+
+}
+#endif /* STOREUI_HPP_ */

Added: tuscany/cpp/sca/samples/store2/store.composite
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/store.composite?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/store.composite (added)
+++ tuscany/cpp/sca/samples/store2/store.composite Sat Sep 26 21:31:37 2009
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+  xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
+  targetNamespace="http://store"
+  name="store">
+		
+    <component name="Store">
+        <t:implementation.widget location="uiservices/store.html"/>
+        <service name="Widget">
+        	<t:binding.http uri="/ui"/>
+        </service>
+		<reference name="catalog" target="StoreCatalog">
+		 	<t:binding.jsonrpc/>
+		 </reference>
+		 <reference name="shoppingCart" target="StoreShoppingCart/Cart">
+		 	<t:binding.atom/>
+		 </reference>
+		 <reference name="shoppingTotal" target="StoreShoppingCart/Total">
+		 	<t:binding.jsonrpc/>
+		 </reference>
+    </component>
+    
+	<component name="StoreCatalog">
+		<implementation.java class="services.FruitsCatalogImpl"/> 
+		<property name="currencyCode">USD</property>
+		<service name="Catalog">
+			<t:binding.jsonrpc/>
+   		</service>
+		<reference name="currencyConverter" target="StoreCurrencyConverter"/>	
+	</component> 
+ 	
+	<component name="StoreShoppingCart">
+		<implementation.java class="services.ShoppingCartImpl"/>
+		<service name="Cart">
+			<t:binding.atom uri="/ShoppingCart/Cart"/>
+		</service>    	
+		<service name="Total">
+			<t:binding.jsonrpc/>
+		</service>    	
+	</component>
+    
+	<component name="StoreCurrencyConverter">
+		<implementation.java class="services.CurrencyConverterImpl"/>
+	</component>     
+
+</composite>

Added: tuscany/cpp/sca/samples/store2/store2-test.cpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/samples/store2/store2-test.cpp?rev=819222&view=auto
==============================================================================
--- tuscany/cpp/sca/samples/store2/store2-test.cpp (added)
+++ tuscany/cpp/sca/samples/store2/store2-test.cpp Sat Sep 26 21:31:37 2009
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+/**
+ * Store Test case.
+ */
+
+#include <assert.h>
+#include <iostream>
+#include <string>
+#include "store-solution.hpp"
+
+namespace store
+{
+
+bool testComponentAssembly() {
+    const service store(storeSolution_service);
+    assert(length((tuscany::list<tuscany::value>)store(makeList(tuscany::value("getCatalog")))) == 3);
+    return true;
+}
+
+}
+
+int main() {
+
+    std::cout << "Testing..." << std::endl;
+
+    store::testComponentAssembly();
+    std::cout << "OK" << std::endl;
+
+    return 0;
+}