summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/shared-contributions/shoppingcart-contribution
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-02-08 10:34:50 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-02-08 10:34:50 +0000
commiteb06796859bc8746cb3f25e065d3211fdadf2d6b (patch)
treef1825072a06bd8da1119a52669a6bd82f82737f2 /sandbox/travelsample/shared-contributions/shoppingcart-contribution
parenta1000cfafed375d9e87d9f97a0d9347be806b977 (diff)
re-org the modules
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@742040 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/shared-contributions/shoppingcart-contribution')
-rw-r--r--sandbox/travelsample/shared-contributions/shoppingcart-contribution/META-INF/sca-contribution.xml24
-rw-r--r--sandbox/travelsample/shared-contributions/shoppingcart-contribution/pom.xml88
-rw-r--r--sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCart.java39
-rw-r--r--sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCartImpl.java89
4 files changed, 240 insertions, 0 deletions
diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f4010d04b1
--- /dev/null
+++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <import.java package="scatours.common"/>
+ <import.java package="scatours.paymentprocess"/>
+ <export.java package="scatours.shoppingcart"/>
+</contribution> \ No newline at end of file
diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/pom.xml b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/pom.xml
new file mode 100644
index 0000000000..79621c1370
--- /dev/null
+++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/pom.xml
@@ -0,0 +1,88 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent>
+ <artifactId>scatours-shoppingcart-contribution</artifactId>
+ <name>Apache Tuscany SCA Tours Shopping Cart Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-api</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-common-contribution</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-currency-contribution</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-paymentprocess-contribution</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}/src</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ <exclude>target/**</exclude>
+ <exclude>src/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCart.java b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCart.java
new file mode 100644
index 0000000000..f7595c71fe
--- /dev/null
+++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCart.java
@@ -0,0 +1,39 @@
+/*
+ * 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 scatours.shoppingcart;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+import scatours.common.TripItem;
+
+/**
+ * The ShoppingCart service interface
+ */
+@Remotable
+@Conversational
+public interface ShoppingCart{
+ void addTrip(TripItem trip);
+ void removeTrip(TripItem trip);
+ TripItem[] getTrips();
+
+ @EndsConversation
+ void checkout(String name);
+}
diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCartImpl.java b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCartImpl.java
new file mode 100644
index 0000000000..5b6bc4007c
--- /dev/null
+++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCartImpl.java
@@ -0,0 +1,89 @@
+/*
+ * 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 scatours.shoppingcart;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+import scatours.common.TripItem;
+import scatours.paymentprocess.PaymentProcess;
+
+/**
+ * An implementation of the Trip service
+ */
+@Scope("CONVERSATION")
+@Service(interfaces={ShoppingCart.class})
+public class ShoppingCartImpl implements ShoppingCart{
+
+ // @Reference
+ // protected PaymentProcess paymentProcess;
+
+ @ConversationID
+ protected String cartId;
+
+ private List<TripItem> trips = new ArrayList<TripItem>();
+
+ // Trip methods
+
+ @Init
+ public void initCart() {
+ System.out.println("Cart init for id: " + cartId);
+ }
+
+ @Destroy
+ public void destroyCart() {
+ System.out.println("Cart destroy for id: " + cartId);
+ }
+
+ public void addTrip(TripItem trip) {
+ trips.add(trip);
+ }
+
+ public void removeTrip(TripItem trip) {
+ trips.remove(trip);
+ }
+
+ public TripItem[] getTrips(){
+ return trips.toArray(new TripItem[trips.size()]);
+ }
+
+ public void checkout(String customerName){
+ // get users credentials. Hard coded for now but should
+ // come from the security context
+ String customerId = customerName;
+
+ // get the total for all the trips
+ float amount = (float)0.0;
+
+ //paymentProcess.makePayment(customerId, amount);
+ }
+
+}