[jboss-cvs] JBossAS SVN: r88787 - in projects/jboss-osgi/trunk/testsuite/trailblazer/src/test: java/org/jboss/test/osgi/trailblazer/audit and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 13 04:34:06 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-13 04:34:06 -0400 (Wed, 13 May 2009)
New Revision: 88787

Added:
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Product.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditServiceMBean.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java
Removed:
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/
Modified:
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd
Log:
Move cotract to the top level

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,16 @@
+package org.jboss.test.osgi.trailblazer;
+
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface AuditService
+{
+   int getTotalPurchases();
+
+   void purchaseProduct(Product product);
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,14 @@
+package org.jboss.test.osgi.trailblazer;
+
+import java.util.Collection;
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface PaymentService
+{
+   Collection<String> listPaymentTypes();
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Product.java (from rev 88755, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Product.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Product.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.trailblazer;
+
+import java.io.Serializable;
+
+
+//$Id$
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class Product implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+   
+   private String name;
+   private Integer price;
+   private Shop shop;
+   
+   public Product(Shop shop, String name, Integer price)
+   {
+      this.shop = shop;
+      this.name = name;
+      this.price = price;
+   }
+
+   public Product(String name, Integer price)
+   {
+      this.name = name;
+      this.price = price;
+   }
+
+   public Shop getShop()
+   {
+      return shop;
+   }
+
+   
+   public void setShop(Shop shop)
+   {
+      this.shop = shop;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public Integer getPrice()
+   {
+      return price;
+   }
+}

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,40 @@
+package org.jboss.test.osgi.trailblazer;
+
+import java.util.Collection;
+
+
+/**
+ * A {@link Shop} represents and individual shop implementation.
+ * <p/> 
+ * The trailblazer supports multiple shops. Each shop maintains a collection of
+ * {@link Products}s and a {@link PaymentService}
+ * <p/>
+ * Shops can get registered and unregistered at any time. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface Shop
+{
+   /**
+    * Get the name of the shop
+    */
+   String getName();
+   
+   /**
+    * Get the product list
+    * @return an empty collection if there are no products
+    */
+   Collection<Product> getProductList();
+   
+   /**
+    * Get a product by name
+    * @return null if the product does not exist
+    */
+   Product getProductByName(String name);
+   
+   /**
+    * Get the associated payment service. 
+    */
+   PaymentService getPaymentService();
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,28 @@
+package org.jboss.test.osgi.trailblazer;
+
+import java.util.Collection;
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface ShoppingMall
+{
+   /**
+    * Get the collection of currently registered shops. 
+    */
+   Collection<Shop> getShops();
+
+   /**
+    * Get a shop by name. 
+    */
+   Shop getShopByName(String shopName);
+   
+   /**
+    * Purchase a product
+    */
+   void purchaseProduct(Product product);
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -1,17 +0,0 @@
-package org.jboss.test.osgi.trailblazer.audit;
-
-import org.jboss.test.osgi.trailblazer.types.Product;
-
-
-/**
- * [TODO]
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface AuditService
-{
-   int getTotalPurchases();
-
-   void purchaseProduct(Product product);
-}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditServiceMBean.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditServiceMBean.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,14 @@
+package org.jboss.test.osgi.trailblazer.audit;
+
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface AuditServiceMBean
+{
+   int getTotalPurchases();
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditServiceMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -35,7 +35,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.mall.ShoppingMall;
+import org.jboss.test.osgi.trailblazer.ShoppingMall;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpService;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -31,10 +31,10 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.jboss.test.osgi.trailblazer.mall.ShoppingMall;
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
-import org.jboss.test.osgi.trailblazer.shop.Shop;
-import org.jboss.test.osgi.trailblazer.types.Product;
+import org.jboss.test.osgi.trailblazer.PaymentService;
+import org.jboss.test.osgi.trailblazer.Product;
+import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.ShoppingMall;
 
 /**
  * [TODO]

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -32,8 +32,8 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import org.jboss.test.osgi.trailblazer.shop.Shop;
-import org.jboss.test.osgi.trailblazer.types.Product;
+import org.jboss.test.osgi.trailblazer.Product;
+import org.jboss.test.osgi.trailblazer.Shop;
 
 /**
  * A basic implementation of a shopping cart that is maintained in the user session

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.trailblazer.mall;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.test.osgi.trailblazer.ShoppingMall;
+import org.jboss.test.osgi.trailblazer.frontend.HttpRenderServlet;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.log.LogService;
+
+/**
+ * A bundle activator that registers the {@link HttpRenderServlet} with the {@link HttpService}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+   private LogService log;
+   private ServiceRegistration registration;
+   
+   public void start(BundleContext context)
+   {
+      this.log = new LogServiceTracker(context);
+      
+      log.log(LogService.LOG_INFO, "Register ShoppingMallService");
+      ShoppingMallImpl mallService = new ShoppingMallImpl(context);
+      registration = context.registerService(ShoppingMall.class.getName(), mallService, null);
+   }
+
+   public void stop(BundleContext context)
+   {
+      if (registration  != null)
+      {
+         log.log(LogService.LOG_INFO, "Unregister ShoppingMallService");
+         registration.unregister();
+         registration = null;
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -1,30 +0,0 @@
-package org.jboss.test.osgi.trailblazer.mall;
-
-import java.util.Collection;
-
-import org.jboss.test.osgi.trailblazer.shop.Shop;
-import org.jboss.test.osgi.trailblazer.types.Product;
-
-/**
- * [TODO]
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface ShoppingMall
-{
-   /**
-    * Get the collection of currently registered shops. 
-    */
-   Collection<Shop> getShops();
-
-   /**
-    * Get a shop by name. 
-    */
-   Shop getShopByName(String shopName);
-   
-   /**
-    * Purchase a product
-    */
-   void purchaseProduct(Product product);
-}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.trailblazer.mall;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.test.osgi.trailblazer.AuditService;
+import org.jboss.test.osgi.trailblazer.PaymentService;
+import org.jboss.test.osgi.trailblazer.Product;
+import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.ShoppingMall;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * An implementation of {@link ShoppingMall}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class ShoppingMallImpl implements ShoppingMall
+{
+   private BundleContext context;
+   
+   public ShoppingMallImpl(BundleContext context)
+   {
+      this.context = context;
+   }
+
+   public Shop getShopByName(String shopName)
+   {
+      Shop shop = null;
+      for (Shop aux : getShops())
+      {
+         if (aux.getName().equals(shopName))
+         {
+            shop = aux;
+            break;
+         }
+      }
+      return shop;
+   }
+
+   public Collection<Shop> getShops()
+   {
+      Collection<Shop> shops = new ArrayList<Shop>();
+      try
+      {
+         ServiceReference[] shoprefs = context.getServiceReferences(Shop.class.getName(), null);
+         if (shoprefs != null)
+         {
+            for(ServiceReference sref : shoprefs)
+            {
+               shops.add((Shop)context.getService(sref));
+            }
+         }
+      }
+      catch (InvalidSyntaxException ex)
+      {
+         // ignore, because we don't have a filter
+      }
+      return shops;
+   }
+
+   public void purchaseProduct(Product product)
+   {
+      Shop shop = product.getShop();
+      PaymentService paymentService = shop.getPaymentService();
+      if (paymentService == null)
+         throw new IllegalStateException("Payment service not available");
+      
+      ServiceReference sref = context.getServiceReference(AuditService.class.getName());
+      if (sref != null)
+      {
+         AuditService auditService = (AuditService)context.getService(sref);
+         auditService.purchaseProduct(product);
+      }
+   }
+   
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -1,14 +0,0 @@
-package org.jboss.test.osgi.trailblazer.pay;
-
-import java.util.Collection;
-
-/**
- * [TODO]
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface PaymentService
-{
-   Collection<String> listPaymentTypes();
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -3,7 +3,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.PaymentService;
 
 
 /**

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -26,7 +26,7 @@
 import java.util.Hashtable;
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.PaymentService;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -3,7 +3,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.PaymentService;
 
 
 /**

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -26,7 +26,7 @@
 import java.util.Hashtable;
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.PaymentService;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -1,42 +0,0 @@
-package org.jboss.test.osgi.trailblazer.shop;
-
-import java.util.Collection;
-
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
-import org.jboss.test.osgi.trailblazer.types.Product;
-
-/**
- * A {@link Shop} represents and individual shop implementation.
- * <p/> 
- * The trailblazer supports multiple shops. Each shop maintains a collection of
- * {@link Products}s and a {@link PaymentService}
- * <p/>
- * Shops can get registered and unregistered at any time. 
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface Shop
-{
-   /**
-    * Get the name of the shop
-    */
-   String getName();
-   
-   /**
-    * Get the product list
-    * @return an empty collection if there are no products
-    */
-   Collection<Product> getProductList();
-   
-   /**
-    * Get a product by name
-    * @return null if the product does not exist
-    */
-   Product getProductByName(String name);
-   
-   /**
-    * Get the associated payment service. 
-    */
-   PaymentService getPaymentService();
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -28,9 +28,9 @@
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
-import org.jboss.test.osgi.trailblazer.shop.Shop;
-import org.jboss.test.osgi.trailblazer.types.Product;
+import org.jboss.test.osgi.trailblazer.PaymentService;
+import org.jboss.test.osgi.trailblazer.Product;
+import org.jboss.test.osgi.trailblazer.Shop;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -24,7 +24,7 @@
 //$Id$
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.shop.Shop;
+import org.jboss.test.osgi.trailblazer.Shop;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -33,9 +33,9 @@
 import javax.naming.NamingException;
 
 import org.jboss.osgi.jndi.NamingService;
-import org.jboss.test.osgi.trailblazer.pay.PaymentService;
-import org.jboss.test.osgi.trailblazer.shop.Shop;
-import org.jboss.test.osgi.trailblazer.types.Product;
+import org.jboss.test.osgi.trailblazer.PaymentService;
+import org.jboss.test.osgi.trailblazer.Product;
+import org.jboss.test.osgi.trailblazer.Shop;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java	2009-05-13 08:34:06 UTC (rev 88787)
@@ -24,7 +24,7 @@
 //$Id$
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.shop.Shop;
+import org.jboss.test.osgi.trailblazer.Shop;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd	2009-05-13 08:34:06 UTC (rev 88787)
@@ -6,12 +6,7 @@
 
 Private-Package: org.jboss.test.osgi.trailblazer.frontend
 
-Export-Package:	\
-	org.jboss.test.osgi.trailblazer.audit, \
-	org.jboss.test.osgi.trailblazer.mall, \
-	org.jboss.test.osgi.trailblazer.pay, \
-	org.jboss.test.osgi.trailblazer.shop, \
-	org.jboss.test.osgi.trailblazer.types
+Export-Package:	org.jboss.test.osgi.trailblazer
 
 Import-Package: \
 	javax.servlet*, \

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd	2009-05-13 08:34:06 UTC (rev 88787)
@@ -2,17 +2,13 @@
 
 Bundle-SymbolicName: trailblazer-mall
 
-Bundle-Activator: org.jboss.test.osgi.trailblazer.mall.internal.ServiceActivator
+Bundle-Activator: org.jboss.test.osgi.trailblazer.mall.ServiceActivator
 
-Private-Package: org.jboss.test.osgi.trailblazer.mall.internal
+Private-Package: org.jboss.test.osgi.trailblazer.mall
 
 Import-Package: \
 	org.osgi.framework, \
 	org.osgi.service.log, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer.audit, \
-	org.jboss.test.osgi.trailblazer.mall, \
-	org.jboss.test.osgi.trailblazer.pay, \
-	org.jboss.test.osgi.trailblazer.shop, \
-	org.jboss.test.osgi.trailblazer.types
+	org.jboss.test.osgi.trailblazer
 	
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd	2009-05-13 08:34:06 UTC (rev 88787)
@@ -9,4 +9,4 @@
 	org.osgi.framework, \
 	org.osgi.service.log, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer.pay
+	org.jboss.test.osgi.trailblazer

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd	2009-05-13 08:34:06 UTC (rev 88787)
@@ -9,4 +9,4 @@
 	org.osgi.framework, \
 	org.osgi.service.log, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer.pay
+	org.jboss.test.osgi.trailblazer

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd	2009-05-13 08:34:06 UTC (rev 88787)
@@ -9,6 +9,4 @@
 	org.osgi.framework, \
 	org.osgi.service.log, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer.pay, \
-	org.jboss.test.osgi.trailblazer.shop, \
-	org.jboss.test.osgi.trailblazer.types
+	org.jboss.test.osgi.trailblazer

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd	2009-05-13 08:14:55 UTC (rev 88786)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd	2009-05-13 08:34:06 UTC (rev 88787)
@@ -11,6 +11,4 @@
 	org.osgi.service.log, \
 	org.jboss.osgi.jndi, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer.pay, \
-	org.jboss.test.osgi.trailblazer.shop, \
-	org.jboss.test.osgi.trailblazer.types
+	org.jboss.test.osgi.trailblazer




More information about the jboss-cvs-commits mailing list