From 875d6f06c269ded7231475bde1a6c2449fea07d4 Mon Sep 17 00:00:00 2001 From: nash Date: Sun, 8 Feb 2009 23:43:13 +0000 Subject: Reorganize shoppingcart-contribution source tree git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@742210 13f79535-47bb-0310-9956-ffa450edef68 --- .../META-INF/sca-contribution.xml | 24 ------ .../java/scatours/shoppingcart/ShoppingCart.java | 39 ++++++++++ .../scatours/shoppingcart/ShoppingCartImpl.java | 89 ++++++++++++++++++++++ .../main/resources/META-INF/sca-contribution.xml | 24 ++++++ .../src/scatours/shoppingcart/ShoppingCart.java | 39 ---------- .../scatours/shoppingcart/ShoppingCartImpl.java | 89 ---------------------- 6 files changed, 152 insertions(+), 152 deletions(-) delete mode 100644 sandbox/travelsample/shared-contributions/shoppingcart-contribution/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCart.java create mode 100644 sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java create mode 100644 sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCart.java delete mode 100644 sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCartImpl.java (limited to 'sandbox/travelsample/shared-contributions') 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 deleted file mode 100644 index f4010d04b1..0000000000 --- a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCart.java b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCart.java new file mode 100644 index 0000000000..f7595c71fe --- /dev/null +++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/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/main/java/scatours/shoppingcart/ShoppingCartImpl.java b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java new file mode 100644 index 0000000000..31b273bf47 --- /dev/null +++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/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 trips = new ArrayList(); + + // 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); + } + +} diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..f4010d04b1 --- /dev/null +++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file 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 deleted file mode 100644 index f7595c71fe..0000000000 --- a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCart.java +++ /dev/null @@ -1,39 +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 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 deleted file mode 100644 index 31b273bf47..0000000000 --- a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/scatours/shoppingcart/ShoppingCartImpl.java +++ /dev/null @@ -1,89 +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 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 trips = new ArrayList(); - - // 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); - } - -} -- cgit v1.2.3