summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.0.1/samples/store/src/main/java
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:07:19 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:07:19 +0000
commit6fadbc9cd1fcf03d0b3630f772d91df149b70428 (patch)
tree32752e491abb97fc8ef4f246455e3b5fd2814862 /branches/sca-java-1.0.1/samples/store/src/main/java
parent5559ef5edbf8d3616f7a4b497b2a459b0ee4082b (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835123 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.0.1/samples/store/src/main/java')
-rw-r--r--branches/sca-java-1.0.1/samples/store/src/main/java/launch/Launch.java34
-rw-r--r--branches/sca-java-1.0.1/samples/store/src/main/java/services/Catalog.java27
-rw-r--r--branches/sca-java-1.0.1/samples/store/src/main/java/services/CatalogImpl.java49
-rw-r--r--branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverter.java29
-rw-r--r--branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverterImpl.java38
-rw-r--r--branches/sca-java-1.0.1/samples/store/src/main/java/services/ShoppingCartImpl.java99
6 files changed, 0 insertions, 276 deletions
diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/launch/Launch.java b/branches/sca-java-1.0.1/samples/store/src/main/java/launch/Launch.java
deleted file mode 100644
index 801697abea..0000000000
--- a/branches/sca-java-1.0.1/samples/store/src/main/java/launch/Launch.java
+++ /dev/null
@@ -1,34 +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 launch;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class Launch {
- public static void main(String[] args) throws Exception {
- System.out.println("Starting ...");
- SCADomain scaDomain = SCADomain.newInstance("store.composite");
- System.out.println("store.composite ready for big business !!!");
- System.in.read();
- System.out.println("Stopping ...");
- scaDomain.close();
- System.out.println();
- }
-}
diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/Catalog.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/Catalog.java
deleted file mode 100644
index 9f784b0848..0000000000
--- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/Catalog.java
+++ /dev/null
@@ -1,27 +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;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface Catalog {
- String[] get();
-}
diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CatalogImpl.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/CatalogImpl.java
deleted file mode 100644
index fd44c66bf6..0000000000
--- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CatalogImpl.java
+++ /dev/null
@@ -1,49 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-
-public class CatalogImpl implements Catalog {
- @Property
- public String currencyCode = "USD";
- @Reference
- public CurrencyConverter currencyConverter;
- private List<String> catalog = new ArrayList<String>();
-
- @Init
- public void init() {
- String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
- catalog.add("Apple - " + currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99f));
- catalog.add("Orange - " + currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55f));
- catalog.add("Pear - " + currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55f));
- }
-
- public String[] get() {
- String[] catalogArray = new String[catalog.size()];
- catalog.toArray(catalogArray);
- return catalogArray;
- }
-}
diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverter.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverter.java
deleted file mode 100644
index 8b0f70907d..0000000000
--- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverter.java
+++ /dev/null
@@ -1,29 +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;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface CurrencyConverter {
- public float getConversion(String fromCurrenycCode, String toCurrencyCode, float amount);
-
- public String getCurrencySymbol(String currencyCode);
-}
diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverterImpl.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverterImpl.java
deleted file mode 100644
index 0ae8f345ce..0000000000
--- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverterImpl.java
+++ /dev/null
@@ -1,38 +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 CurrencyConverterImpl implements CurrencyConverter {
- public float getConversion(String fromCurrencyCode, String toCurrencyCode, float amount) {
- if (toCurrencyCode.equals("USD"))
- return amount;
- else if (toCurrencyCode.equals("EUR"))
- return amount * 0.7256f;
- return 0;
- }
-
- public String getCurrencySymbol(String currencyCode) {
- if (currencyCode.equals("USD"))
- return "$";
- else if (currencyCode.equals("EUR"))
- return "€";
- return "?";
- }
-}
diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/ShoppingCartImpl.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/ShoppingCartImpl.java
deleted file mode 100644
index f3934717f8..0000000000
--- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/ShoppingCartImpl.java
+++ /dev/null
@@ -1,99 +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;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.tuscany.sca.binding.feed.collection.Collection;
-import org.apache.tuscany.sca.binding.feed.collection.NotFoundException;
-
-import com.sun.syndication.feed.atom.Content;
-import com.sun.syndication.feed.atom.Entry;
-import com.sun.syndication.feed.atom.Feed;
-import com.sun.syndication.feed.atom.Link;
-
-public class ShoppingCartImpl implements Collection {
-
- private static Map<String, Entry> cart = new HashMap<String, Entry>();
-
- public Feed getFeed() {
- Feed feed = new Feed();
- feed.setTitle("shopping cart");
- Content subtitle = new Content();
- subtitle.setValue("Total : " + getTotal());
- feed.setSubtitle(subtitle);
- feed.getEntries().addAll(cart.values());
- return feed;
- }
-
- public Entry get(String id) throws NotFoundException {
- return cart.get(id);
- }
-
- public Entry post(Entry entry) {
- System.out.println("post" + entry);
- String id = "cart-" + UUID.randomUUID().toString();
- entry.setId(id);
-
- Link link = new Link();
- link.setRel("edit");
- link.setHref(id);
- entry.getOtherLinks().add(link);
- link = new Link();
- link.setRel("alternate");
- link.setHref(id);
- entry.getAlternateLinks().add(link);
-
- entry.setCreated(new Date());
-
- cart.put(id, entry);
- return entry;
- }
-
- public Entry put(String id, Entry entry) throws NotFoundException {
- entry.setUpdated(new Date());
- cart.put(id, entry);
- return entry;
- }
-
- public void delete(String id) throws NotFoundException {
- if (id.equals(""))
- cart.clear();
- else
- cart.remove(id);
- }
-
- private String getTotal() {
- float total = 0;
- String currencySymbol = "";
- if (!cart.isEmpty()) {
- String item = ((Content)cart.values().iterator().next().getContents().get(0)).getValue();
- currencySymbol = item.substring(item.indexOf("-") + 2, item.indexOf("-") + 3);
- }
- for (Entry entry : cart.values()) {
- String item = ((Content)entry.getContents().get(0)).getValue();
- total += Float.valueOf(item.substring(item.indexOf("-") + 3));
- }
- return currencySymbol + String.valueOf(total);
- }
-}