incubator-nuvem-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r999519 - in /incubator/nuvem/trunk: store-appengine-webapp/war/ store-assets/src/main/java/services/ store-merger-appengine-webapp/war/
Date Tue, 21 Sep 2010 17:58:37 GMT
Author: lresende
Date: Tue Sep 21 17:58:37 2010
New Revision: 999519

URL: http://svn.apache.org/viewvc?rev=999519&view=rev
Log:
Refactoring catalog interface in store-assets for compatibility with python catalog interface
where get is a reserved rest method name convention

Modified:
    incubator/nuvem/trunk/store-appengine-webapp/war/store.html
    incubator/nuvem/trunk/store-assets/src/main/java/services/Catalog.java
    incubator/nuvem/trunk/store-assets/src/main/java/services/CatalogAggregatorImpl.java
    incubator/nuvem/trunk/store-assets/src/main/java/services/FruitsCatalogImpl.java
    incubator/nuvem/trunk/store-assets/src/main/java/services/VegetablesCatalogImpl.java
    incubator/nuvem/trunk/store-merger-appengine-webapp/war/store.html

Modified: incubator/nuvem/trunk/store-appengine-webapp/war/store.html
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-appengine-webapp/war/store.html?rev=999519&r1=999518&r2=999519&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-appengine-webapp/war/store.html (original)
+++ incubator/nuvem/trunk/store-appengine-webapp/war/store.html Tue Sep 21 17:58:37 2010
@@ -71,7 +71,7 @@
 			catalogItems = items;
 		}
 
-		catalog.get().addCallback(catalogCallback);
+		catalog.items().addCallback(catalogCallback);
 	}
 
 

Modified: incubator/nuvem/trunk/store-assets/src/main/java/services/Catalog.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-assets/src/main/java/services/Catalog.java?rev=999519&r1=999518&r2=999519&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-assets/src/main/java/services/Catalog.java (original)
+++ incubator/nuvem/trunk/store-assets/src/main/java/services/Catalog.java Tue Sep 21 17:58:37
2010
@@ -23,5 +23,5 @@ import org.oasisopen.sca.annotation.Remo
 
 @Remotable
 public interface Catalog {
-	Item[] get();
+	Item[] items();
 }

Modified: incubator/nuvem/trunk/store-assets/src/main/java/services/CatalogAggregatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-assets/src/main/java/services/CatalogAggregatorImpl.java?rev=999519&r1=999518&r2=999519&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-assets/src/main/java/services/CatalogAggregatorImpl.java (original)
+++ incubator/nuvem/trunk/store-assets/src/main/java/services/CatalogAggregatorImpl.java Tue
Sep 21 17:58:37 2010
@@ -43,12 +43,12 @@ public class CatalogAggregatorImpl imple
     @Reference(required=false)
     public Catalog vegetablesCatalog;
 
-    public Item[] get() {
+    public Item[] items() {
         String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
 
         List<Item> catalog = new ArrayList<Item>();
         if(fruitsCatalog != null) {
-        	Item[] fruits = fruitsCatalog.get();
+        	Item[] fruits = fruitsCatalog.items();
 
         	for (Item item: fruits) {
                 double price = item.getPrice();
@@ -58,7 +58,7 @@ public class CatalogAggregatorImpl imple
         }
 
         if(vegetablesCatalog != null) {
-        	Item[] vegetables = vegetablesCatalog.get();
+        	Item[] vegetables = vegetablesCatalog.items();
 
             for (Item item: vegetables) {
                 double price = item.getPrice();

Modified: incubator/nuvem/trunk/store-assets/src/main/java/services/FruitsCatalogImpl.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-assets/src/main/java/services/FruitsCatalogImpl.java?rev=999519&r1=999518&r2=999519&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-assets/src/main/java/services/FruitsCatalogImpl.java (original)
+++ incubator/nuvem/trunk/store-assets/src/main/java/services/FruitsCatalogImpl.java Tue Sep
21 17:58:37 2010
@@ -28,7 +28,7 @@ public class FruitsCatalogImpl implement
         catalog.add(new Item("Pear", currencyCode, currencySymbol, currencyConverter.getConversion("USD",
currencyCode, 1.55)));
     }
 
-    public Item[] get() {
+    public Item[] items() {
         Item[] catalogArray = new Item[catalog.size()];
         catalog.toArray(catalogArray);
         return catalogArray;

Modified: incubator/nuvem/trunk/store-assets/src/main/java/services/VegetablesCatalogImpl.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-assets/src/main/java/services/VegetablesCatalogImpl.java?rev=999519&r1=999518&r2=999519&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-assets/src/main/java/services/VegetablesCatalogImpl.java (original)
+++ incubator/nuvem/trunk/store-assets/src/main/java/services/VegetablesCatalogImpl.java Tue
Sep 21 17:58:37 2010
@@ -44,7 +44,7 @@ public class VegetablesCatalogImpl imple
         catalog.add(new Item("Cauliflower", currencyCode, currencySymbol, currencyConverter.getConversion("USD",
currencyCode, 1.55)));
     }
 
-    public Item[] get() {
+    public Item[] items() {
         Item[] catalogArray = new Item[catalog.size()];
         catalog.toArray(catalogArray);
         return catalogArray;

Modified: incubator/nuvem/trunk/store-merger-appengine-webapp/war/store.html
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/store-merger-appengine-webapp/war/store.html?rev=999519&r1=999518&r2=999519&view=diff
==============================================================================
--- incubator/nuvem/trunk/store-merger-appengine-webapp/war/store.html (original)
+++ incubator/nuvem/trunk/store-merger-appengine-webapp/war/store.html Tue Sep 21 17:58:37
2010
@@ -6,15 +6,15 @@
     * 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.    
+    * under the License.
 -->
 <html>
 <head>
@@ -32,13 +32,13 @@
 <script language="JavaScript">
 
 	var userServices = new dojo.rpc.JsonService("/User?smd");
-	
+
 	var catalog = new dojo.rpc.JsonService("/Catalog?smd");
 
 	var shoppingCart = new dojo.rpc.JsonService("/ShoppingCart?smd");
 
 	var userContext;
-	
+
 	var catalogItems;
 
 	function showHeader() {
@@ -54,24 +54,24 @@
 			}
 
 			document.getElementById('appHeader').innerHTML = html;
-		}		
-			
+		}
+
 		userServices.getUserContext(document.URL, "").addCallback(userContextCallback);
 	}
-	
+
 	function showCatalogs() {
 		var catalogCallback = function(items) {
 			var catalog = "";
 			for (var i=0; i<items.length; i++) {
 				var item = items[i].name + ' - ' + items[i].currencySymbol + items[i].price;
-				catalog += '<input name="items" type="checkbox" value="' + 
+				catalog += '<input name="items" type="checkbox" value="' +
 							item + '">' + item + ' <br>';
 			}
 			document.getElementById('catalog').innerHTML=catalog;
 			catalogItems = items;
 		}
 
-		catalog.get().addCallback(catalogCallback); 
+		catalog.items().addCallback(catalogCallback);
 	}
 
 
@@ -90,7 +90,7 @@
 		}
 		document.getElementById("shoppingCart").innerHTML = list;
 
-		if (items.length != 0) {			
+		if (items.length != 0) {
 			try	{
 				shoppingCart.getTotal().addCallback(shoppingCart_getTotalResponse);
 			}
@@ -99,24 +99,24 @@
 			}
 		}
 	}
-	
+
 	function shoppingCart_getTotalResponse(total,exception) {
-		if(exception) { 
-			alert(exception.message); 
+		if(exception) {
+			alert(exception.message);
 			return;
 		}
 		document.getElementById('total').innerHTML = total;
 	}
-	
+
 	function shoppingCart_postResponse(entry) {
 		shoppingCart.getAll().addCallback(shoppingCart_getResponse);
-	}				
+	}
 
 	function addToCart() {
 		var items  = document.catalogForm.items;
 		var j = 0;
 		for (var i=0; i<items.length; i++)
-			if (items[i].checked) {					
+			if (items[i].checked) {
 				shoppingCart.post("", catalogItems[i]).addCallback(shoppingCart_postResponse);
 				items[i].checked = false;
 			}
@@ -131,31 +131,31 @@
 					document.getElementById('total').innerHTML+
 					'<br>'+
 					'<br>'+
-					'<input type="submit" value="Continue Shopping">'+ 
+					'<input type="submit" value="Continue Shopping">'+
 				'</form>';
 		shoppingCart.delete("");
 	}
 	function deleteCart() {
 		shoppingCart.delete("");
 		document.getElementById('shoppingCart').innerHTML = "";
-		document.getElementById('total').innerHTML = "";	
-	}	
+		document.getElementById('total').innerHTML = "";
+	}
+
 
-	
 
 	function init() {
 		try {
 			showHeader();
 
 			showCatalogs();
-			
+
 			shoppingCart.getAll().addCallback(shoppingCart_getResponse);
 		} catch (e) {
 			alert(e);
 		}
 	}
 
-	
+
 </script>
 
 </head>
@@ -165,8 +165,8 @@
    </div>
 
    <h1>Store</h1>
-   
-   
+
+
 
   <div id="store">
    	<h2>Catalog</h2>
@@ -175,19 +175,19 @@
         <br>
 		<input type="button" onClick="addToCart()"  value="Add to Cart">
    	</form>
- 
+
 
  	<br>
-  
+
    	<h2>Your Shopping Cart</h2>
    	<form name="shoppingCartForm">
 		<div id="shoppingCart"></div>
 		<br>
 		<div id="total"></div>
-		<br>		
-		<input type="button" onClick="checkoutCart()" value="Checkout"> 
+		<br>
+		<input type="button" onClick="checkoutCart()" value="Checkout">
 		<input type="button" onClick="deleteCart()" value="Empty">
-	</form>        
+	</form>
   </div>
 </body>
 



Mime
View raw message