felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apan...@apache.org
Subject svn commit: r1411241 - in /felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl: Activator.scala ServiceDiagnosticsImpl.scala
Date Mon, 19 Nov 2012 15:22:35 GMT
Author: apanday
Date: Mon Nov 19 15:22:34 2012
New Revision: 1411241

URL: http://svn.apache.org/viewvc?rev=1411241&view=rev
Log:
cleanup and comments

Modified:
    felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/Activator.scala
    felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/ServiceDiagnosticsImpl.scala

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=1411241&r1=1411240&r2=1411241&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:22:34 2012
@@ -20,15 +20,13 @@ package org.apache.felix.servicediagnost
 
 import java.util. { Hashtable => jHT }
 
-import javax.servlet.http.HttpServlet
-
 import org.osgi.framework.BundleContext
-import org.osgi.service.http.HttpService
 
 import org.apache.felix.dm.DependencyActivatorBase
 import org.apache.felix.dm.DependencyManager
 
-import org.apache.felix.servicediagnostics._
+import org.apache.felix.servicediagnostics.ServiceDiagnostics
+import org.apache.felix.servicediagnostics.ServiceDiagnosticsPlugin
 import org.apache.felix.servicediagnostics.webconsole.WebConsolePlugin
 
 /**

Modified: felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/ServiceDiagnosticsImpl.scala
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/ServiceDiagnosticsImpl.scala?rev=1411241&r1=1411240&r2=1411241&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/ServiceDiagnosticsImpl.scala
(original)
+++ felix/trunk/webconsole-plugins/servicediagnostics/core/src/main/scala/servicediagnostics/impl/ServiceDiagnosticsImpl.scala
Mon Nov 19 15:22:34 2012
@@ -66,11 +66,19 @@ class ServiceDiagnosticsImpl(val bc:Bund
     }
 
     /**
-     * returns a map of (component.name -> list(component.name)) of unresolvable services,
if any
+     * Implements ServiceDiagnostics.unresolved.
+     * 
+     * Returns a map of (component.name -> list(component.name)) of unresolvable services,
if any.
+     * 
+     * This methods first attempts to resolve all possible paths by traversing the graph

+     * of components dependencies, entering the graph from its outer nodes. 
+     * Then it returns the list of unresolvable components by subtraction of the resolved
components
+     * from the original graph. This is done because "perfect loops" have no border node
and are 
+     * therefore "invisible" to the traversing algorithm.
      */
     override def unresolved :Map[String, List[String]] = 
     {
-        // first build a traversable graph from all found component and dependencies
+        // first build a traversable graph from all found components and dependencies
         def buildGraph(link:(Node,Node)=>Unit) = {
             // concatenate component nodes from all plugins
             val allnodes = for ( p <- plugins; comp <- p.components ) yield new Node(comp)
@@ -117,31 +125,27 @@ class ServiceDiagnosticsImpl(val bc:Bund
         } yield resolve(node)).flatten.toSet
 
         // finally filter the original graph by removing all resolved nodes
-        // and format the result
+        // and format the result (keeping only the names)
         (for (node <- graph.filterNot(n => resolved.contains(n)))
-          yield (node.name -> node.edges.map(_.name).toList)).toMap
+            yield (node.name -> node.edges.map(_.name).toList)).toMap
     }
 
     /**
-    * Implements ServiceDiagnostics.allServices.
-    */
+     * Implements ServiceDiagnostics.allServices.
+     */
     override def allServices:Map[String,List[String]] = 
     {
         val allrefs = bc.getAllServiceReferences(null, null)
         if (allrefs == null) return Map()
 
-        /*
-         * inner method used to return all the interface names a ServiceReference was registered
under
-         */
+        // inner method used to return all the interface names a ServiceReference was registered
under
         def names(ref:ServiceReference):Array[String] = 
         {
             val n = ref.getProperty(OBJECTCLASS)
             if (n != null) n.asInstanceOf[Array[String]] else Array()
         }
 
-        /*
-         * inner method used to return all the bundles using a given ServiceReference
-         */
+        // inner method used to return all the bundles using a given ServiceReference
         def using(ref:ServiceReference):List[String] = 
         {
             val u = ref.getUsingBundles



Mime
View raw message