You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/12/03 15:13:18 UTC

svn commit: r600543 - in /incubator/tuscany/java/sca/tutorial/catalog-jse: ./ calatolog-j2se.composite calatolog-jse.composite pom.xml services/ services/Catalog.java services/CurrencyConverter.java services/FruitsCatalogImpl.java services/Item.java

Author: slaws
Date: Mon Dec  3 06:13:17 2007
New Revision: 600543

URL: http://svn.apache.org/viewvc?rev=600543&view=rev
Log:
Update the web app so this it will run with the tomcat deep integration code

Added:
    incubator/tuscany/java/sca/tutorial/catalog-jse/calatolog-jse.composite
    incubator/tuscany/java/sca/tutorial/catalog-jse/services/
    incubator/tuscany/java/sca/tutorial/catalog-jse/services/Catalog.java
    incubator/tuscany/java/sca/tutorial/catalog-jse/services/CurrencyConverter.java
    incubator/tuscany/java/sca/tutorial/catalog-jse/services/FruitsCatalogImpl.java
    incubator/tuscany/java/sca/tutorial/catalog-jse/services/Item.java
Removed:
    incubator/tuscany/java/sca/tutorial/catalog-jse/calatolog-j2se.composite
Modified:
    incubator/tuscany/java/sca/tutorial/catalog-jse/   (props changed)
    incubator/tuscany/java/sca/tutorial/catalog-jse/pom.xml

Propchange: incubator/tuscany/java/sca/tutorial/catalog-jse/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Dec  3 06:13:17 2007
@@ -1,3 +1,4 @@
 .classpath
 .project
 .settings
+target

Added: incubator/tuscany/java/sca/tutorial/catalog-jse/calatolog-jse.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-jse/calatolog-jse.composite?rev=600543&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-jse/calatolog-jse.composite (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-jse/calatolog-jse.composite Mon Dec  3 06:13:17 2007
@@ -0,0 +1,34 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://store"
+           xmlns:sample="http://store"
+           name="catalog-jse">
+   
+    <component name="JSEFruitsCatalog">
+        <implementation.java class="services.FruitsCatalogImpl"/>
+        <service name="Catalog">
+            <binding.sca/>
+        </service> 
+        <property name="currencyCode">USD</property>
+        <reference name="currencyConverter" target="CloudCurrencyConverter"/>   
+    </component>     
+
+</composite>

Modified: incubator/tuscany/java/sca/tutorial/catalog-jse/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-jse/pom.xml?rev=600543&r1=600542&r2=600543&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-jse/pom.xml (original)
+++ incubator/tuscany/java/sca/tutorial/catalog-jse/pom.xml Mon Dec  3 06:13:17 2007
@@ -26,7 +26,7 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>tutorial-catalog-jse</artifactId>
-    <name>Apache Tuscany SCA Tutorial Catalog WAR COntribution</name>
+    <name>Apache Tuscany SCA Tutorial Catalog WAR Contribution</name>
     <packaging>war</packaging>
 
     <repositories>
@@ -41,20 +41,6 @@
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-sca-api</artifactId>
             <version>1.1-incubating-SNAPSHOT</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tutorial-assets</artifactId>
-            <version>1.1-incubating-SNAPSHOT</version>
-        </dependency>
-
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.2</version>
-            <scope>test</scope>
         </dependency>
 
     </dependencies>

Added: incubator/tuscany/java/sca/tutorial/catalog-jse/services/Catalog.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-jse/services/Catalog.java?rev=600543&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-jse/services/Catalog.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-jse/services/Catalog.java Mon Dec  3 06:13:17 2007
@@ -0,0 +1,27 @@
+/*
+ * 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 {
+    Item[] get();
+}

Added: incubator/tuscany/java/sca/tutorial/catalog-jse/services/CurrencyConverter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-jse/services/CurrencyConverter.java?rev=600543&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-jse/services/CurrencyConverter.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-jse/services/CurrencyConverter.java Mon Dec  3 06:13:17 2007
@@ -0,0 +1,29 @@
+/*
+ * 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 double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount);
+
+    public String getCurrencySymbol(String currencyCode);
+}

Added: incubator/tuscany/java/sca/tutorial/catalog-jse/services/FruitsCatalogImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-jse/services/FruitsCatalogImpl.java?rev=600543&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-jse/services/FruitsCatalogImpl.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-jse/services/FruitsCatalogImpl.java Mon Dec  3 06:13:17 2007
@@ -0,0 +1,56 @@
+/*
+ * 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;
+import org.osoa.sca.annotations.Service;
+
+@Service(Catalog.class)
+public class FruitsCatalogImpl implements Catalog {
+    
+    @Property
+    public String currencyCode = "USD";
+    
+    @Reference
+    public CurrencyConverter currencyConverter;
+    
+    private List<Item> catalog = new ArrayList<Item>();
+
+    @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)));
+        
+    }
+
+    public Item[] get() {
+        System.out.println("Getting catalog from webapp");
+        Item[] catalogArray = new Item[catalog.size()];
+        catalog.toArray(catalogArray);
+        return catalogArray;
+    }
+}

Added: incubator/tuscany/java/sca/tutorial/catalog-jse/services/Item.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-jse/services/Item.java?rev=600543&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-jse/services/Item.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-jse/services/Item.java Mon Dec  3 06:13:17 2007
@@ -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.    
+ */
+
+package services;
+
+import java.io.Serializable;
+
+public class Item implements Serializable {
+    private static final long serialVersionUID = -5847326138627338217L;
+    
+    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;
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org