Author: apanday
Date: Mon Nov 19 15:03:47 2012
New Revision: 1411227

URL: http://svn.apache.org/viewvc?rev=1411227&view=rev
Log:
[FELIX-3764] servicediagnostics plugin does not append the correct context path 
info to it's javascript files

Removed:
    
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/resources/html/js/jquery-1.7.1.min.js
    
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/webconsole/Servlet.scala
Modified:
    felix/trunk/webconsole-plugins/servicediagnostics/changelog.txt
    
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/DEPENDENCIES
    
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/LICENSE
    
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/resources/html/index.html
    
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/Activator.scala
    
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/webconsole/WebConsolePlugin.scala
    
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/DEPENDENCIES
    
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/LICENSE

Modified: felix/trunk/webconsole-plugins/servicediagnostics/changelog.txt
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/changelog.txt?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/servicediagnostics/changelog.txt (original)
+++ felix/trunk/webconsole-plugins/servicediagnostics/changelog.txt Mon Nov 19 
15:03:47 2012
@@ -2,17 +2,16 @@ Changes from 0.1.1 to 0.2.0
 ---------------------------
 
 ** Bug
+  * [FELIX-3764] servicediagnostics plugin does not append the correct context 
path info to it's javascript files
+  * [FELIX-3767] servicediagnostics plugin should properly handle service 
properties
 
 ** Improvement
-
-* complete rewrite
-* support for service properties
-* detection of circular dependencies
-* doesn't embedd scala and json anymore
+  * complete rewrite
+  * [FELIX-3768] servicediagnostics plugin should detect circular dependencies
+  * doesn't embedd scala, json or jquery anymore
 
 ** Backward compatibility
-
-* broken: plugin API changed
+  * broken: plugin API changed
 
 Release 0.1.1
 -------------

Modified: 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/DEPENDENCIES
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/DEPENDENCIES?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/DEPENDENCIES
 (original)
+++ 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/DEPENDENCIES
 Mon Nov 19 15:03:47 2012
@@ -11,10 +11,6 @@ This product includes software developed
 The Apache Software Foundation (http://www.apache.org/).
 Licensed under the Apache License 2.0.
 
-This product includes software from http://www.jquery.com
-Copyright (c) 2009 John Resig, http://jquery.com/
-Licensed under the MIT License
-
 This product includes software from http://raphaeljs.com
 Copyright (c) 2008 Dmitry Baranovskiy
 Licensed under the MIT License
@@ -24,14 +20,6 @@ Copyright (c) 2006 Aslak Hellesoy <aslak
 Copyright (c) 2006 Dave Hoover <[email protected]> 
 Licensed under the MIT License
 
-This product includes software from http://www.scala-lang.org
-Copyright (c) 2002-2011 EPFL, Lausanne
-Licensed under a BSD-style license (see LICENSE)
-
-This product includes software from http://www.json.org
-Copyright (c) 2002 JSON.org
-Licensed under the JSON License
-
 
 II. Used Third-Party Software
 
@@ -44,6 +32,4 @@ Licensed under the Apache License 2.0.
 III. License Summary
 
 - Apache License 2.0
-- JSON License
 - MIT License
-- BSD License

Modified: 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/LICENSE
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/LICENSE?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/LICENSE
 (original)
+++ 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/appended-resources/META-INF/LICENSE
 Mon Nov 19 15:03:47 2012
@@ -8,80 +8,6 @@ code for the these subcomponents is subj
 conditions of the following licenses. 
 
 
-For the JSON component:
-
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
-
-
-For the Scala component:
-
-Copyright (c) 2002-2011 EPFL, Lausanne, unless otherwise specified.
-All rights reserved.
-
-This software was developed by the Programming Methods Laboratory of the
-Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland.
-
-Permission to use, copy, modify, and distribute this software in source
-or binary form for any purpose with or without fee is hereby granted,
-provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the EPFL nor the names of its contributors
-may be used to endorse or promote products derived from this
-software without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-
-For the JQuery component:
-
-Copyright (c) 2009 John Resig, http://jquery.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
 For the RaphaelJS and Graffle component:
 
 Copyright © 2008 Dmitry Baranovskiy

Modified: 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/resources/html/index.html
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/resources/html/index.html?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/resources/html/index.html
 (original)
+++ 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/resources/html/index.html
 Mon Nov 19 15:03:47 2012
@@ -18,12 +18,6 @@
  * under the License.
  */
 -->
-<html>
-<header>
-    <script type="text/javascript" 
src="/servicegraph/js/jquery-1.7.1.min.js"></script>
-    <script type="text/javascript" 
src="/servicegraph/js/raphael-1.3.1.min.js"></script>
-    <script type="text/javascript" 
src="/servicegraph/js/graffle-1.3.1.js"></script>
-    <script type="text/javascript" src="/servicegraph/js/graph.js"></script>
     <script type="text/javascript">
 <!--
 
@@ -133,7 +127,7 @@ function redraw() {
 function loadUnavail() {
   $("#canvas").html("Loading data. Please wait...");
   $.ajax({
-    url: "/servicegraph/json/notavail",
+    url: "servicegraph/notavail",
     dataType: "json",
     success: function(json){
       services = json;
@@ -147,7 +141,7 @@ function loadUnavail() {
 function loadAllServices() {
   $("#canvas").html("Loading data. Please wait...");
   $.ajax({
-    url: "/servicegraph/json/all",
+    url: "servicegraph/all",
     dataType: "json",
     success: function(json){
       services = json;
@@ -160,7 +154,10 @@ function loadAllServices() {
 
 /* only do all this when document has finished loading (needed for RaphaelJS) 
*/
 $(document).ready(function(){
-  $("#actions")
+    $.getScript("servicegraph/html/js/raphael-1.3.1.min.js")
+    $.getScript("servicegraph/html/js/graffle-1.3.1.js")
+    $.getScript("servicegraph/html/js/graph.js")
+    $("#actions")
        .append($("<a>").attr("href", 
"javascript:loadAllServices()").html("Show Service Registry"))
        .append($("<span>").html("&nbsp;|&nbsp;"))
        .append($("<a>").attr("href", "javascript:loadUnavail()").html("Show 
Not Avail"))
@@ -172,11 +169,9 @@ $(document).ready(function(){
       #actions a { color:black; font-weight:bold; text-decoration:none; }
       #warning { color:red; font-weight:bold; }
     </style>
-</header>
-<body>
+<div id="servicegraph">
 Filter:&nbsp;<input type="text" id="filter"/><button id="redraw" 
onclick="redraw();">redraw</button>
 &nbsp;&nbsp;<span id="actions"></span>
 &nbsp;&nbsp;<span id="warning"></span>
 <div id="canvas"></div>
-</body>
-</html>
+</div>

Modified: 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/Activator.scala
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/Activator.scala?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/Activator.scala
 (original)
+++ 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/Activator.scala
 Mon Nov 19 15:03:47 2012
@@ -29,7 +29,6 @@ import org.apache.felix.dm.DependencyAct
 import org.apache.felix.dm.DependencyManager
 
 import org.apache.felix.servicediagnostics._
-import org.apache.felix.servicediagnostics.webconsole.Servlet
 import org.apache.felix.servicediagnostics.webconsole.WebConsolePlugin
 
 /**
@@ -62,25 +61,16 @@ class Activator extends DependencyActiva
                 .setCallbacks("addPlugin", null, null)
                 .setRequired(false)))
 
-        // register the servlet used by webconsole plugin
-        dm.add(createComponent
-            .setInterface(classOf[HttpServlet].getName, null)
-            .setImplementation(classOf[Servlet])
-            .add(createServiceDependency
-                .setService(classOf[ServiceDiagnostics])
-                .setRequired(true)
-                .setAutoConfig("engine"))
-            .add(createServiceDependency
-                .setService(classOf[HttpService])
-                .setRequired(true)
-                .setCallbacks("setHttpService", null, null)))
-
-        // and the webconsole plugin itself
+        // register the webconsole plugin 
         dm.add(createComponent
             .setInterface(classOf[javax.servlet.Servlet].getName, new 
jHT[String,String]() {{
                   put("felix.webconsole.label", "servicegraph")
               }})
-            .setImplementation(classOf[WebConsolePlugin]))
+            .setImplementation(classOf[WebConsolePlugin])
+            .add(createServiceDependency
+                .setService(classOf[ServiceDiagnostics])
+                .setRequired(true)
+                .setAutoConfig("engine")))
     }
 
     override def destroy(bc:BundleContext, dm:DependencyManager) = {}

Modified: 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/webconsole/WebConsolePlugin.scala
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/webconsole/WebConsolePlugin.scala?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/webconsole/WebConsolePlugin.scala
 (original)
+++ 
felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/webconsole/WebConsolePlugin.scala
 Mon Nov 19 15:03:47 2012
@@ -18,10 +18,20 @@
  */
 package org.apache.felix.servicediagnostics.webconsole
 
+import scala.collection.JavaConversions._
+import scala.collection.mutable.{Map => mMap}
+
+import java.io.PrintStream
+
 import javax.servlet.http._
 
+import org.json.JSONObject
+import org.json.JSONArray
+
 import org.apache.felix.webconsole.SimpleWebConsolePlugin
 
+import org.apache.felix.servicediagnostics.ServiceDiagnostics
+
 /**
  * This is the Apache Felix WebConsolePlugin implementation.
  * It simply returns a static html page; actual processing is done by an ajax 
request to the servlet.
@@ -30,7 +40,32 @@ import org.apache.felix.webconsole.Simpl
  */
 class WebConsolePlugin extends SimpleWebConsolePlugin("servicegraph", "Service 
Graph", Array[String]()) 
 {
+    var engine:ServiceDiagnostics = _ //dependency injection. see Activator.
+
     val TEMPLATE = readTemplateFile("/html/index.html")
 
-    override def renderContent(req:HttpServletRequest, 
resp:HttpServletResponse) = resp.getWriter().print( TEMPLATE )
+    /**
+     * used for initial request, returns the contents of index.html.
+     * the rest is done via ajax calls
+     */
+    override def renderContent(req:HttpServletRequest, 
resp:HttpServletResponse) = 
+        resp.getWriter.print(TEMPLATE)
+
+    /**
+     * override doGet to handle ajax requests
+     */
+    override def doGet(req:HttpServletRequest, resp:HttpServletResponse) = 
+        req.getPathInfo match {
+            case "/servicegraph/all" => 
resp.getWriter.println(json(engine.allServices))
+            case "/servicegraph/notavail" => resp.getWriter.println(new 
JSONObject()
+                                  .put("notavail", json(engine.notavail))
+                                  .put("unresolved", json(engine.unresolved)))
+            case x => super.doGet(req, resp)
+          }
+
+    /** 
+     * turn the ServiceDiagnostics output into a JSON representation.
+     */
+    private def json(map:Map[String,List[AnyRef]]) = 
+      new JSONObject(asJavaMap(mMap() ++ map.map(kv => (kv._1, 
asJavaList(kv._2)))))
 }

Modified: 
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/DEPENDENCIES
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/DEPENDENCIES?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/DEPENDENCIES
 (original)
+++ 
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/DEPENDENCIES
 Mon Nov 19 15:03:47 2012
@@ -11,10 +11,6 @@ This product includes software developed
 The Apache Software Foundation (http://www.apache.org/).
 Licensed under the Apache License 2.0.
 
-This product includes software from http://www.scala-lang.org
-Copyright (c) 2002-2011 EPFL, Lausanne
-Licensed under a BSD-style license (see LICENSE)
-
 II. Used Third-Party Software
 
 This product uses software developed at
@@ -26,4 +22,3 @@ III. License Summary
 
 - Apache License 2.0
 - MIT License
-- BSD License

Modified: 
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/LICENSE
URL: 
http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/LICENSE?rev=1411227&r1=1411226&r2=1411227&view=diff
==============================================================================
--- 
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/LICENSE
 (original)
+++ 
felix/trunk/webconsole-plugins/servicediagnostics/sample/src/main/appended-resources/META-INF/LICENSE
 Mon Nov 19 15:03:47 2012
@@ -8,43 +8,6 @@ code for the these subcomponents is subj
 conditions of the following licenses. 
 
 
-For the Scala component:
-
-Copyright (c) 2002-2011 EPFL, Lausanne, unless otherwise specified.
-All rights reserved.
-
-This software was developed by the Programming Methods Laboratory of the
-Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland.
-
-Permission to use, copy, modify, and distribute this software in source
-or binary form for any purpose with or without fee is hereby granted,
-provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the EPFL nor the names of its contributors
-may be used to endorse or promote products derived from this
-software without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-
 For the Service Diagnostics component:
 
                                  Apache License


Reply via email to