diff options
Diffstat (limited to 'sandbox/travelsample')
9 files changed, 105 insertions, 66 deletions
diff --git a/sandbox/travelsample/contributions/fullapp-frontend/src/main/resources/scatours.composite b/sandbox/travelsample/contributions/fullapp-frontend/src/main/resources/scatours.composite index a64f9f160a..6d18947bd1 100644 --- a/sandbox/travelsample/contributions/fullapp-frontend/src/main/resources/scatours.composite +++ b/sandbox/travelsample/contributions/fullapp-frontend/src/main/resources/scatours.composite @@ -66,7 +66,7 @@ <reference name="flightBook" target="Trip/Book"/> <reference name="carBook" target="Car/Book"/> <reference name="tripBook" target="Trip/Book"/> - <reference name="shoppingCart" target="ShoppingCart"/> + <reference name="cartUpdates" target="ShoppingCart/CartUpdates"/> </component> </composite> diff --git a/sandbox/travelsample/contributions/fullapp-shoppingcart/src/main/resources/scatours.composite b/sandbox/travelsample/contributions/fullapp-shoppingcart/src/main/resources/scatours.composite index 327145df71..97c6e649e2 100644 --- a/sandbox/travelsample/contributions/fullapp-shoppingcart/src/main/resources/scatours.composite +++ b/sandbox/travelsample/contributions/fullapp-shoppingcart/src/main/resources/scatours.composite @@ -23,7 +23,6 @@ <component name="ShoppingCart"> <implementation.java class="com.tuscanyscatours.shoppingcart.impl.ShoppingCartImpl"/> - <service name="ShoppingCart"/> <reference name="cartStore" target="CartStore"/> <reference name="payment"> <binding.ws uri="http://localhost:8081/Payment" /> @@ -32,7 +31,6 @@ <component name="CartStore"> <implementation.java class="com.tuscanyscatours.shoppingcart.impl.CartStoreImpl"/> - <service name="CartStore"/> </component> </composite> diff --git a/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.composite b/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.composite index acc92c10b2..5dd0d01102 100644 --- a/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.composite +++ b/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.composite @@ -51,7 +51,8 @@ </service> <reference name="travelCatalogSearch" target="TravelCatalog/TravelCatalogSearch"/> <reference name="tripBooking" target="TripBooking"/> - <reference name="shoppingCart" target="ShoppingCart"/> + <reference name="cartInitialize" target="ShoppingCart/CartInitialize"/> + <reference name="cartCheckout" target="ShoppingCart/CartCheckout"/> </component> </composite> diff --git a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java index a39e6a5623..e84d0b3191 100644 --- a/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java +++ b/sandbox/travelsample/contributions/scatours/src/main/java/com/tuscanyscatours/impl/SCAToursImpl.java @@ -18,13 +18,6 @@ */
package com.tuscanyscatours.impl;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.annotations.Context;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -34,7 +27,8 @@ import com.tuscanyscatours.SCAToursCart; import com.tuscanyscatours.SCAToursSearch;
import com.tuscanyscatours.common.TripItem;
import com.tuscanyscatours.common.TripLeg;
-import com.tuscanyscatours.shoppingcart.ShoppingCart;
+import com.tuscanyscatours.shoppingcart.CartCheckout;
+import com.tuscanyscatours.shoppingcart.CartInitialize;
import com.tuscanyscatours.travelcatalog.TravelCatalogSearch;
import com.tuscanyscatours.tripbooking.TripBooking;
@@ -53,7 +47,10 @@ public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCa protected TripBooking tripBooking;
@Reference
- protected ShoppingCart shoppingCart;
+ protected CartInitialize cartInitialize;
+
+ @Reference
+ protected CartCheckout cartCheckout;
// SCAToursSearch methods
@@ -71,17 +68,17 @@ public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCa // SCAToursCart methods
public String newCart(){
- String cartId = shoppingCart.newCart();
+ String cartId = cartInitialize.newCart();
return cartId;
}
public TripItem[] getTrips(String cartId){
- return shoppingCart.getTrips(cartId);
+ return cartInitialize.getTrips(cartId);
}
public void checkout(String cartId){
// need to get the user id from the context here but
// just make one up for the time being
- shoppingCart.checkout(cartId, "c-0");
+ cartCheckout.checkout(cartId, "c-0");
}
}
diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java new file mode 100644 index 0000000000..d14da414ef --- /dev/null +++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartCheckout.java @@ -0,0 +1,26 @@ +/* + * 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 com.tuscanyscatours.shoppingcart; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CartCheckout { + void checkout(String cartId,String name); +} diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java new file mode 100644 index 0000000000..916f7f7ed0 --- /dev/null +++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartInitialize.java @@ -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 com.tuscanyscatours.shoppingcart; + +import org.osoa.sca.annotations.Remotable; + +import com.tuscanyscatours.common.TripItem; + +@Remotable +public interface CartInitialize { + String newCart(); + TripItem[] getTrips(String cartId); +} diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/ShoppingCart.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java index 9242686b69..b3528e2ae1 100644 --- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/ShoppingCart.java +++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/CartUpdates.java @@ -1,37 +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 com.tuscanyscatours.shoppingcart;
-
-import org.osoa.sca.annotations.Conversational;
-import org.osoa.sca.annotations.EndsConversation;
-import org.osoa.sca.annotations.Remotable;
-
-import com.tuscanyscatours.common.TripItem;
-
-/**
- * The ShoppingCart service interface
- */
-@Remotable
-public interface ShoppingCart{
- String newCart();
- void addTrip(String cartId,TripItem trip);
- void removeTrip(String cartId,TripItem trip);
- TripItem[] getTrips(String cartId);
- void checkout(String cartId,String name);
-}
+/* + * 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 com.tuscanyscatours.shoppingcart; + +import org.osoa.sca.annotations.Remotable; + +import com.tuscanyscatours.common.TripItem; + +@Remotable +public interface CartUpdates { + void addTrip(String cartId,TripItem trip); + void removeTrip(String cartId,TripItem trip); +} diff --git a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java index 676d6bac86..5549d5cf7b 100644 --- a/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java +++ b/sandbox/travelsample/contributions/shoppingcart/src/main/java/com/tuscanyscatours/shoppingcart/impl/ShoppingCartImpl.java @@ -18,32 +18,28 @@ */
package com.tuscanyscatours.shoppingcart.impl;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.osoa.sca.ComponentContext;
import org.osoa.sca.ServiceReference;
import org.osoa.sca.annotations.Context;
-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 com.tuscanyscatours.common.TripItem;
import com.tuscanyscatours.payment.Payment;
+import com.tuscanyscatours.shoppingcart.CartInitialize;
import com.tuscanyscatours.shoppingcart.CartStore;
-import com.tuscanyscatours.shoppingcart.ShoppingCart;
+import com.tuscanyscatours.shoppingcart.CartCheckout;
+import com.tuscanyscatours.shoppingcart.CartUpdates;
/**
* An implementation of the ShoppingCart service
*/
-@Service(interfaces={ShoppingCart.class})
-public class ShoppingCartImpl implements ShoppingCart{
+@Service(interfaces={CartInitialize.class, CartUpdates.class, CartCheckout.class})
+public class ShoppingCartImpl implements CartInitialize, CartUpdates, CartCheckout{
@Reference
protected Payment payment;
diff --git a/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java b/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java index 6d66a1ec45..d5dfca951c 100644 --- a/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java +++ b/sandbox/travelsample/contributions/tripbooking/src/main/java/com/tuscanyscatours/tripbooking/impl/TripBookingImpl.java @@ -26,7 +26,7 @@ import org.osoa.sca.annotations.Service; import com.tuscanyscatours.common.Book;
import com.tuscanyscatours.common.TripItem;
-import com.tuscanyscatours.shoppingcart.ShoppingCart;
+import com.tuscanyscatours.shoppingcart.CartUpdates;
import com.tuscanyscatours.tripbooking.TripBooking;
/**
@@ -48,7 +48,7 @@ public class TripBookingImpl implements TripBooking{ protected Book tripBook;
@Reference
- protected ShoppingCart shoppingCart;
+ protected CartUpdates cartUpdates;
@Context
protected ComponentContext componentContext;
@@ -81,8 +81,8 @@ public class TripBookingImpl implements TripBooking{ }
// add trip to the shopping cart
- ServiceReference<ShoppingCart> cart = componentContext.getServiceReference(ShoppingCart.class,
- "shoppingCart");
+ ServiceReference<CartUpdates> cart = componentContext.getServiceReference(CartUpdates.class,
+ "cartUpdates");
cart.setConversationID(cartId);
cart.getService().addTrip(cartId, trip);
|