summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5/samples/store-android/src/services
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.5/samples/store-android/src/services/Catalog.java24
-rw-r--r--branches/sca-java-1.5/samples/store-android/src/services/CatalogProxy.java52
-rw-r--r--branches/sca-java-1.5/samples/store-android/src/services/Item.java51
-rw-r--r--branches/sca-java-1.5/samples/store-android/src/services/ShoppingCartProxy.java44
-rw-r--r--branches/sca-java-1.5/samples/store-android/src/services/json/rpc/JSONRpc.java44
5 files changed, 0 insertions, 215 deletions
diff --git a/branches/sca-java-1.5/samples/store-android/src/services/Catalog.java b/branches/sca-java-1.5/samples/store-android/src/services/Catalog.java
deleted file mode 100644
index 9105f1047c..0000000000
--- a/branches/sca-java-1.5/samples/store-android/src/services/Catalog.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-package services;
-
-public interface Catalog {
- Item[] get();
-}
diff --git a/branches/sca-java-1.5/samples/store-android/src/services/CatalogProxy.java b/branches/sca-java-1.5/samples/store-android/src/services/CatalogProxy.java
deleted file mode 100644
index 3ce9459844..0000000000
--- a/branches/sca-java-1.5/samples/store-android/src/services/CatalogProxy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package services;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import services.json.rpc.JSONRpc;
-
-public class CatalogProxy implements Catalog {
- private static final String jsonRPCServiceURI = "http://192.168.1.104:8080/Catalog";
- private static final String jsonRPCRequest = "{\"id\": 3, \"method\": \"Service.get\", \"params\": []}";
-
- private List<Item> catalog = new ArrayList<Item>();
-
- public CatalogProxy() {
- initialize();
- }
-
- public void initialize() {
- JSONObject json = null;
-
- try {
- json = JSONRpc.invoke(jsonRPCServiceURI, jsonRPCRequest);
-
- if(json == null) {
- return;
- }
-
- JSONArray result = json.getJSONArray("result");
- for(int i = 0; i < result.length(); i++) {
- Item item = new Item();
- item.setName(result.getJSONObject(i).getString("name"));
- item.setPrice(result.getJSONObject(i).getString("price"));
-
- catalog.add(item);
- }
-
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- public Item[] get() {
- Item[] catalogArray = new Item[catalog.size()];
- catalog.toArray(catalogArray);
- return catalogArray;
- }
-
-}
diff --git a/branches/sca-java-1.5/samples/store-android/src/services/Item.java b/branches/sca-java-1.5/samples/store-android/src/services/Item.java
deleted file mode 100644
index 27abd4f016..0000000000
--- a/branches/sca-java-1.5/samples/store-android/src/services/Item.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-package services;
-
-
-public class Item {
- private String name;
- private String price;
-
- public Item() {
- }
-
- public Item(String name, String price) {
- this.name = name;
- this.price = price;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getPrice() {
- return price;
- }
-
- public void setPrice(String price) {
- this.price = price;
- }
-
-}
diff --git a/branches/sca-java-1.5/samples/store-android/src/services/ShoppingCartProxy.java b/branches/sca-java-1.5/samples/store-android/src/services/ShoppingCartProxy.java
deleted file mode 100644
index 872db654a4..0000000000
--- a/branches/sca-java-1.5/samples/store-android/src/services/ShoppingCartProxy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package services;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import services.json.rpc.JSONRpc;
-
-public class ShoppingCartProxy {
- private static final String jsonRPCTotalServiceURI = "http://192.168.1.104:8080/ShoppingCart/Total";
- private static final String jsonRPCTotalRequest = "{\"id\": 4, \"method\": \"Service.getTotal\", \"params\": []}";
-
- public Item[] getItems() {
- return null;
- }
-
- public void addItem(Item item) {
-
- }
-
- public void removeItem(Item item) {
-
- }
-
- public void checkOut() {
-
- }
-
- public String getTotal() {
- String total = "";
- JSONObject json = null;
-
- try {
- json = JSONRpc.invoke(jsonRPCTotalServiceURI, jsonRPCTotalRequest);
-
- if(json != null) {
- total = json.getString("result");
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- return total;
- }
-}
diff --git a/branches/sca-java-1.5/samples/store-android/src/services/json/rpc/JSONRpc.java b/branches/sca-java-1.5/samples/store-android/src/services/json/rpc/JSONRpc.java
deleted file mode 100644
index 927a840b86..0000000000
--- a/branches/sca-java-1.5/samples/store-android/src/services/json/rpc/JSONRpc.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package services.json.rpc;
-
-import java.io.IOException;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.util.EntityUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-public class JSONRpc {
-
- protected JSONRpc() {
-
- }
-
- public static JSONObject invoke(String serviceURI, String rpcRequest) throws JSONException{
- HttpClient httpClient = new DefaultHttpClient();
- HttpPost httpPost = new HttpPost(serviceURI);
-
- JSONObject result = null;
- try {
- httpPost.setHeader("Content-Type", "text/xml");
- httpPost.setEntity(new StringEntity(rpcRequest));
-
- HttpResponse httpResponse = httpClient.execute(httpPost);
- if (httpResponse.getStatusLine().getStatusCode() == 200) {
- String jsonResult = EntityUtils.toString(httpResponse.getEntity());
- result = new JSONObject(jsonResult);
- } else {
- String errorMessage = httpResponse.getStatusLine()
- .getReasonPhrase();
- System.out.println(errorMessage);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return result;
- }
-}