summaryrefslogtreecommitdiffstats
path: root/sandbox/sca-cloud-tutorial
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/sca-cloud-tutorial')
-rw-r--r--sandbox/sca-cloud-tutorial/store-appengine-webapp/src/Workaround.java22
-rw-r--r--sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/appengine-web.xml2
-rw-r--r--sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/logging.properties2
-rw-r--r--sandbox/sca-cloud-tutorial/store-appengine-webapp/war/log4j.properties (renamed from sandbox/sca-cloud-tutorial/store-appengine-webapp/src/log4j.properties)0
-rw-r--r--sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.composite (renamed from sandbox/sca-cloud-tutorial/store-appengine-webapp/src/store.composite)0
-rw-r--r--sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.html9
-rw-r--r--sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/CatalogAggregatorImpl.java8
-rw-r--r--sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/FruitsCatalogImpl.java10
-rw-r--r--sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/Item.java28
-rw-r--r--sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/ShoppingCartImpl.java4
-rw-r--r--sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/VegetablesCatalogImpl.java6
-rw-r--r--sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/src/Workaround.java22
-rw-r--r--sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/WEB-INF/appengine-web.xml2
-rw-r--r--sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/catalog.composite (renamed from sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/src/catalog.composite)0
14 files changed, 89 insertions, 26 deletions
diff --git a/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/Workaround.java b/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/Workaround.java
new file mode 100644
index 0000000000..2f345ecedd
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/Workaround.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class Workaround {
+
+}
diff --git a/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/appengine-web.xml b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/appengine-web.xml
index 85626f6b1c..bfec5c4e26 100644
--- a/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/appengine-web.xml
+++ b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/appengine-web.xml
@@ -19,7 +19,7 @@
-->
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>tuscany-store</application>
- <version>4</version>
+ <version>5</version>
<!-- Configure java.util.logging -->
<system-properties>
diff --git a/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/logging.properties b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/logging.properties
index 03808336ec..bd3b8308fc 100644
--- a/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/logging.properties
+++ b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/WEB-INF/logging.properties
@@ -33,5 +33,5 @@
.level = WARNING
#tuscany debug messages
-org.apache.tuscany.level=WARNING
+org.apache.tuscany.level = WARNING
diff --git a/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/log4j.properties b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/log4j.properties
index 036b48afd7..036b48afd7 100644
--- a/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/log4j.properties
+++ b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/log4j.properties
diff --git a/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/store.composite b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.composite
index 8705f9a52a..8705f9a52a 100644
--- a/sandbox/sca-cloud-tutorial/store-appengine-webapp/src/store.composite
+++ b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.composite
diff --git a/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.html b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.html
index 050d451899..0afe661540 100644
--- a/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.html
+++ b/sandbox/sca-cloud-tutorial/store-appengine-webapp/war/store.html
@@ -63,7 +63,7 @@
var catalogCallback = function(items) {
var catalog = "";
for (var i=0; i<items.length; i++) {
- var item = items[i].name + ' - ' + items[i].price;
+ var item = items[i].name + ' - ' + items[i].currencySymbol + items[i].price;
catalog += '<input name="items" type="checkbox" value="' +
item + '">' + item + ' <br>';
}
@@ -84,8 +84,9 @@
var item = items[i].data;
// process its attributes
var name = item.name;
+ var symbol = item.currencySymbol;
var price = item.price
- list += name + ' - ' + price + ' <br>';
+ list += name + ' - ' + symbol + price + ' <br>';
}
document.getElementById("shoppingCart").innerHTML = list;
@@ -132,10 +133,10 @@
'<br>'+
'<input type="submit" value="Continue Shopping">'+
'</form>';
- shoppingCart.del("");
+ shoppingCart.delete("");
}
function deleteCart() {
- shoppingCart.del("");
+ shoppingCart.delete("");
document.getElementById('shoppingCart').innerHTML = "";
document.getElementById('total').innerHTML = "";
}
diff --git a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/CatalogAggregatorImpl.java b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/CatalogAggregatorImpl.java
index 09cae14100..1d4b8fedfa 100644
--- a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/CatalogAggregatorImpl.java
+++ b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/CatalogAggregatorImpl.java
@@ -49,15 +49,15 @@ public class CatalogAggregatorImpl implements Catalog {
Item[] catalog = new Item[fruits.length + vegetables.length];
int i =0;
for (Item item: fruits) {
- double price = Double.valueOf(item.getPrice().substring(1));
+ double price = item.getPrice();
price = currencyConverter.getConversion("USD", currencyCode, price);
- catalog[i++] = new Item(item.getName(), currencySymbol + price);
+ catalog[i++] = new Item(item.getName(), currencyCode, currencySymbol, price);
}
for (Item item: vegetables) {
- double price = Double.valueOf(item.getPrice().substring(1));
+ double price = item.getPrice();
price = currencyConverter.getConversion("USD", currencyCode, price);
- catalog[i++] = new Item(item.getName(), currencySymbol + price);
+ catalog[i++] = new Item(item.getName(), currencyCode, currencySymbol, price);
}
return catalog;
diff --git a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/FruitsCatalogImpl.java b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/FruitsCatalogImpl.java
index 5290623487..c480991ef7 100644
--- a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/FruitsCatalogImpl.java
+++ b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/FruitsCatalogImpl.java
@@ -14,6 +14,7 @@ import org.oasisopen.sca.annotation.Service;
public class FruitsCatalogImpl implements Catalog {
@Property
public String currencyCode = "USD";
+
@Reference
public CurrencyConverter currencyConverter;
@@ -22,12 +23,9 @@ public class FruitsCatalogImpl implements Catalog {
@Init
public void init() {
String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
- catalog.add(new Item("Apple", currencySymbol
- + currencyConverter.getConversion("USD", currencyCode, 2.99)));
- catalog.add(new Item("Orange", currencySymbol
- + currencyConverter.getConversion("USD", currencyCode, 3.55)));
- catalog.add(new Item("Pear", currencySymbol
- + currencyConverter.getConversion("USD", currencyCode, 1.55)));
+ catalog.add(new Item("Apple", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 2.99)));
+ catalog.add(new Item("Orange", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 3.55)));
+ catalog.add(new Item("Pear", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 1.55)));
}
public Item[] get() {
diff --git a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/Item.java b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/Item.java
index 74e7239a20..c4397835ba 100644
--- a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/Item.java
+++ b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/Item.java
@@ -25,13 +25,17 @@ public class Item implements Serializable {
private static final long serialVersionUID = -5847326138627338217L;
private String name;
- private String price;
+ private String currencyCode;
+ private String currencySymbol;
+ private double price;
public Item() {
}
- public Item(String name, String price) {
+ public Item(String name, String currencyCode, String currencySymbol, double price) {
this.name = name;
+ this.currencyCode = currencyCode;
+ this.currencySymbol = currencySymbol;
this.price = price;
}
@@ -43,11 +47,27 @@ public class Item implements Serializable {
this.name = name;
}
- public String getPrice() {
+ public String getCurrencyCode() {
+ return this.currencyCode;
+ }
+
+ public void setCurrencyCode(String currencyCode) {
+ this.currencyCode = currencyCode;
+ }
+
+ public String getCurrencySymbol() {
+ return this.currencySymbol;
+ }
+
+ public void setCurrencySymbol(String currencySymbol) {
+ this.currencySymbol = currencySymbol;
+ }
+
+ public double getPrice() {
return price;
}
- public void setPrice(String price) {
+ public void setPrice(double price) {
this.price = price;
}
}
diff --git a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/ShoppingCartImpl.java b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/ShoppingCartImpl.java
index 000e205948..febcc3a78f 100644
--- a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/ShoppingCartImpl.java
+++ b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/ShoppingCartImpl.java
@@ -99,10 +99,10 @@ public class ShoppingCartImpl implements ShoppingCart {
String currencySymbol = "";
if (!cart.isEmpty()) {
Item item = cart.values().iterator().next();
- currencySymbol = item.getPrice().substring(0, 1);
+ currencySymbol = item.getCurrencySymbol();
}
for (Item item : cart.values()) {
- total += Double.valueOf(item.getPrice().substring(1));
+ total += item.getPrice();
}
return currencySymbol + String.valueOf(total);
}
diff --git a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/VegetablesCatalogImpl.java b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/VegetablesCatalogImpl.java
index 6ca311b42e..e7ae507dd4 100644
--- a/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/VegetablesCatalogImpl.java
+++ b/sandbox/sca-cloud-tutorial/store-assets/src/main/java/services/VegetablesCatalogImpl.java
@@ -39,9 +39,9 @@ public class VegetablesCatalogImpl implements Catalog {
@Init
public void init() {
String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
- catalog.add(new Item("Broccoli", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99)));
- catalog.add(new Item("Asparagus", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55)));
- catalog.add(new Item("Cauliflower", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55)));
+ catalog.add(new Item("Broccoli", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 2.99)));
+ catalog.add(new Item("Asparagus", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 3.55)));
+ catalog.add(new Item("Cauliflower", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 1.55)));
}
public Item[] get() {
diff --git a/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/src/Workaround.java b/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/src/Workaround.java
new file mode 100644
index 0000000000..2f345ecedd
--- /dev/null
+++ b/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/src/Workaround.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class Workaround {
+
+}
diff --git a/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/WEB-INF/appengine-web.xml b/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/WEB-INF/appengine-web.xml
index 276383e283..6f97eebdbd 100644
--- a/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/WEB-INF/appengine-web.xml
+++ b/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/WEB-INF/appengine-web.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>tuscany-store-catalog</application>
- <version>2</version>
+ <version>3</version>
<!-- Configure java.util.logging -->
<system-properties>
diff --git a/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/src/catalog.composite b/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/catalog.composite
index a4276816d6..a4276816d6 100644
--- a/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/src/catalog.composite
+++ b/sandbox/sca-cloud-tutorial/store-catalog-appengine-webapp/war/catalog.composite