[jboss-cvs] JBossAS SVN: r88719 - in projects/jboss-osgi/trunk/testsuite/trailblazer: scripts and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 12 09:54:31 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-12 09:54:30 -0400 (Tue, 12 May 2009)
New Revision: 88719

Added:
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd
Removed:
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd
Modified:
   projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
   projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml
   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/ServiceActivator.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
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
Log:
Add trailblazer documentation

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml	2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml	2009-05-12 13:54:30 UTC (rev 88719)
@@ -16,6 +16,11 @@
 
   <!-- Properties -->
   <properties>
+    <trailblazer.java.path>https://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer</trailblazer.java.path>
+    <climbingstore.java>${trailblazer.java.path}/shop/sports/ClimbingStore.java</climbingstore.java>
+    <shoppingmall.java>${trailblazer.java.path}/ShoppingMall.java</shoppingmall.java>
+    <shop.java>${trailblazer.java.path}/Shop.java</shop.java>
+    <userguide.html>http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/build/distribution/target/auto-install-dest/docs/userguide/html</userguide.html>
   </properties>
 
   <!-- Build -->

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml	2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml	2009-05-12 13:54:30 UTC (rev 88719)
@@ -43,8 +43,8 @@
     <!-- frontend -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-frontend.jar" files="${tests.resources.dir}/trailblazer/frontend.bnd" />
     
-    <!-- main -->
-    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-main.jar" files="${tests.resources.dir}/trailblazer/main.bnd" />
+    <!-- mall -->
+    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-mall.jar" files="${tests.resources.dir}/trailblazer/mall.bnd" />
   	
     <!-- pay-creditcard -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-pay-creditcard.jar" files="${tests.resources.dir}/trailblazer/pay-creditcard.bnd" />

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-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java	2009-05-12 13:54:30 UTC (rev 88719)
@@ -23,8 +23,11 @@
 
 //$Id$
 
+import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.PrintWriter;
+import java.net.URL;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -52,10 +55,12 @@
 {
    private LogService log;
    
+   private BundleContext context;
    private ShoppingMall mallService;
 
    public HttpRenderServlet(BundleContext context)
    {
+      this.context = context;
       this.log = new LogServiceTracker(context);
       
       ServiceTracker tracker = new ServiceTracker(context, ShoppingMall.class.getName(), null)
@@ -100,7 +105,7 @@
          else if (path.startsWith("/buy"))
          {
             reqHandler.actionAddToCart(req, res);
-            reqHandler.renderCartPage(req, res);
+            res.sendRedirect(req.getServletPath() + "/cart");
          }
          else if (path.startsWith("/clear"))
          {
@@ -111,12 +116,16 @@
          {
             reqHandler.actionCheckout(req, res);
             reqHandler.actionClearProducts(req, res);
-            reqHandler.renderConfirmPage(req, res);
+            res.sendRedirect(req.getServletPath() + "/confirm?" + req.getQueryString());
          }
          else if (path.startsWith("/cart"))
          {
             reqHandler.renderCartPage(req, res);
          }
+         else if (path.startsWith("/confirm"))
+         {
+            reqHandler.renderConfirmPage(req, res);
+         }
          else
          {
             reqHandler.renderHomePage(req, res);
@@ -144,13 +153,59 @@
       out.println("<a href='" + req.getServletPath() + "'>home</a>");
       out.println("<a href='" + req.getServletPath() + "/cart'>cart</a>");
       out.println("<p/>");
+      out.println("<table><tr valign='top'><td width='400'>");
    }
 
    private void renderFooter(HttpServletRequest req, HttpServletResponse res) throws IOException
    {
       PrintWriter out = res.getWriter();
+
+      out.println("</td><td>");
+      
+      renderNotes(req, res);
+      
+      out.println("</td></tr>");
+      out.println("</table>");
       out.println("</body>");
       out.println("</html>");
    }
 
+   private void renderNotes(HttpServletRequest req, HttpServletResponse res) throws IOException
+   {
+      PrintWriter out = res.getWriter();
+      
+      String path = req.getPathInfo();
+      if (path == null)
+         path = "/";
+      
+      if (path.equals("/"))
+         path = "/home";
+      
+      out.println("<div class='notes'>");
+      
+      String notesPath = "notes" + path;
+      
+      String paramShop = req.getParameter("shop");
+      if (paramShop != null)
+         notesPath += "-" + paramShop;
+      
+      notesPath = notesPath.toLowerCase() + ".html";
+      
+      URL htmlRes = context.getBundle().getResource(notesPath);
+      if (htmlRes != null)
+      {
+         BufferedReader br = new BufferedReader(new InputStreamReader(htmlRes.openStream()));
+         String line = br.readLine();
+         while (line != null)
+         {
+            out.println(line);
+            line = br.readLine();
+         }
+      }
+      else
+      {
+         out.println("Cannot find: " + notesPath);
+      }
+      out.println("</div>");
+   }
 }

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-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java	2009-05-12 13:54:30 UTC (rev 88719)
@@ -154,7 +154,7 @@
    {
       PrintWriter out = res.getWriter();
       Shop shop = getShopFromRequestParam(req);
-      out.println("<p>Thanks for shopping with <b>" + shop.getName() + "</b></p>");
+      out.println("<p>Thanks for shopping with " + shop.getName() + "</p>");
    }
 
    public void actionAddToCart(HttpServletRequest req, HttpServletResponse res)

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java	2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java	2009-05-12 13:54:30 UTC (rev 88719)
@@ -62,6 +62,7 @@
                HttpRenderServlet servlet = new HttpRenderServlet(context);
                httpService.registerServlet(CONTEXT_PATH, servlet, null, null);
                httpService.registerResources(CONTEXT_PATH + "/style", "/style", null);
+               httpService.registerResources(CONTEXT_PATH + "/notes", "/notes", null);
             }
             catch (Exception ex)
             {

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main)

Modified: 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/main/ServiceActivator.java	2009-05-11 21:38:26 UTC (rev 88675)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java	2009-05-12 13:54:30 UTC (rev 88719)
@@ -19,7 +19,7 @@
  * 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.main;
+package org.jboss.test.osgi.trailblazer.mall;
 
 //$Id$
 

Modified: 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/main/ShoppingMallImpl.java	2009-05-11 21:38:26 UTC (rev 88675)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java	2009-05-12 13:54:30 UTC (rev 88719)
@@ -19,7 +19,7 @@
  * 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.main;
+package org.jboss.test.osgi.trailblazer.mall;
 
 //$Id$
 

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html	2009-05-12 13:54:30 UTC (rev 88719)
@@ -0,0 +1,37 @@
+<b>This is the home page of the OSGi Trailblazer application.</b>
+
+<p/>
+It uses an imaginary shopping mall to demonstrate usage and best practices 
+in <a href='http://www.osgi.org'>OSGi</a> general and of some of it's more advanced features
+defined by the <a href='http://www.osgi.org/EEG/HomePage'>OSGi Enterprise Expert Group</a>.
+<p/>
+In this version it covers the usage of 
+<ul>
+	<li>Service registration</li> 
+	<li>Access to the naming and directory service (JNDI)</li> 
+	<li>Access to the managment service (JMX)</li> 
+</ul>
+ 
+Future versions will be expanded to cover 
+<ul>
+	<li>Component wiring and injection (Blueprint Service)</li> 
+	<li>Access to the persistence service (JPA)</li> 
+	<li>Distributed OSGi</li> 
+</ul> 
+
+The application works such that the <a href='${shoppingmall.java}'>ShoppingMall</a> dynamically discovers
+<a href='${shop.java}'>Shop</a> instance from the OSGi Registry.<br/> 
+Shops can come and go at any time.
+<p/>
+The individual Shops maintain their respective product lists using various technics available 
+in <a href='http://www.osgi.org/EEG/HomePage'>OSGi EE</a>.
+<p/>
+For comments, bugs or suggestion please go to the <a href='http://www.jboss.org/community/wiki/JBossOSGi'>JBossOSGi</a> 
+<a href='http://www.jboss.org/index.html?module=bb&op=viewforum&f=257'>User Forum</a>
+or file an issue in <a href='https://jira.jboss.org/jira/browse/JBOSGI'>Jira</a>.  
+<p/>
+Please click on the individual shops to read more.
+<p/>
+
+
+-enjoy
\ No newline at end of file

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html	2009-05-12 13:54:30 UTC (rev 88719)
@@ -0,0 +1,15 @@
+<b>The ClimbingStore is a specific implementation of the Shop service.</b>
+
+<p/>
+The <a href='${climbingstore.java}'>ClimbingStore</a> uses <a href='http://java.sun.com/products/jndi'>JNDI</a> to maintain it's product list.
+<p/>
+The current implementation uses the <a href='http://www.jboss.org/community/wiki/JBossOSGi'>JBossOSGi</a> 
+<a href='${userguide.html}/ChapProvidedBundles.html'>NamingService</a>. Future versions will use propper OSGi JNDI integration (RFP-84).
+<p/>
+<b>TODOs</b>
+<p/>
+<small>
+<a href='https://jira.jboss.org/jira/browse/JBOSGI-81'>[JBOSGI-81]</a> - Provide propper JNDI integration (RFP-84)<br/>
+<a href='https://jira.jboss.org/jira/browse/JBOSGI-82'>[JBOSGI-82]</a> - Remove the requirement to set the context classloader for JNDI access<br/>
+</small>
+  
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css	2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css	2009-05-12 13:54:30 UTC (rev 88719)
@@ -1,38 +1,34 @@
-p {
+body {
   font-family: Helvetica,Arial,sans-serif;
   font-size: 14;
 }
 
+div.notes {
+  color : gray;
+  font-size: 12;
+}
+
 th {
-  font-family: Helvetica,Arial,sans-serif;
   font-weight: bold;
-  font-size: 14;
 }
 
 td {
-  font-family: Helvetica,Arial,sans-serif;
-  font-size: 14;
 }
 
 a {
-  font-family: Helvetica,Arial,sans-serif;
-  font-size: 14;
 }
 
 h1 {
-  font-family: Helvetica,Arial,sans-serif;
   font-weight: bold;
   font-size: 20;
 }
 
 h2 {
-  font-family: Helvetica,Arial,sans-serif;
   font-weight: bold;
   font-size: 18;
 }
 
 h3 {
-  font-family: Helvetica,Arial,sans-serif;
   font-weight: bold;
   font-size: 16;
 }

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-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd	2009-05-12 13:54:30 UTC (rev 88719)
@@ -13,4 +13,6 @@
 	org.jboss.test.osgi.trailblazer, \
 	org.jboss.test.osgi.trailblazer.types 
 
-Include-Resource: style/osgishop.css=../META-INF/style/osgishop.css
\ No newline at end of file
+Include-Resource: \
+	style/osgishop.css=../META-INF/style/osgishop.css, \
+	notes=../META-INF/notes
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd	2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd	2009-05-12 13:54:30 UTC (rev 88719)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-main.jar src/test/resources/trailblazer/main.bnd
-
-Bundle-SymbolicName: trailblazer-main
-Bundle-Activator: org.jboss.test.osgi.trailblazer.main.ServiceActivator
-Private-Package: org.jboss.test.osgi.trailblazer.main 
-Export-Package: org.jboss.test.osgi.trailblazer, org.jboss.test.osgi.trailblazer.types 

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd	2009-05-12 13:54:30 UTC (rev 88719)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-mall.jar src/test/resources/trailblazer/mall.bnd
+
+Bundle-SymbolicName: trailblazer-mall
+Bundle-Activator: org.jboss.test.osgi.trailblazer.mall.ServiceActivator
+Private-Package: org.jboss.test.osgi.trailblazer.mall 
+Export-Package: org.jboss.test.osgi.trailblazer, org.jboss.test.osgi.trailblazer.types 




More information about the jboss-cvs-commits mailing list