You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by vv...@apache.org on 2014/07/15 09:10:02 UTC

svn commit: r1610597 - in /felix/trunk/webconsole-plugins/ds: pom.xml src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java

Author: vvalchev
Date: Tue Jul 15 07:10:01 2014
New Revision: 1610597

URL: http://svn.apache.org/r1610597
Log:
Fixed FELIX-4559 : DS plugin should use Inventory instead of deprecated ConfigurationPrinter
https://issues.apache.org/jira/browse/FELIX-4559

Modified:
    felix/trunk/webconsole-plugins/ds/pom.xml
    felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java
    felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java

Modified: felix/trunk/webconsole-plugins/ds/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/pom.xml?rev=1610597&r1=1610596&r2=1610597&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/pom.xml (original)
+++ felix/trunk/webconsole-plugins/ds/pom.xml Tue Jul 15 07:10:01 2014
@@ -100,6 +100,13 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.inventory</artifactId>
+		    <version>1.0.4</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
             <groupId>org.json</groupId>
             <artifactId>json</artifactId>
             <version>20070829</version>

Modified: felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java?rev=1610597&r1=1610596&r2=1610597&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java (original)
+++ felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java Tue Jul 15 07:10:01 2014
@@ -16,7 +16,9 @@
  */
 package org.apache.felix.webconsole.plugins.ds.internal;
 
-import org.apache.felix.webconsole.ConfigurationPrinter;
+import java.util.Hashtable;
+
+import org.apache.felix.inventory.InventoryPrinter;
 import org.apache.felix.webconsole.SimpleWebConsolePlugin;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -79,8 +81,14 @@ public class Activator implements Bundle
         {
             this.plugin = plugin = new WebConsolePlugin().register(context);
             final Object service = context.getService(reference);
-            printerRegistration = context.registerService(ConfigurationPrinter.SERVICE,
-                new ComponentConfigurationPrinter(service), null);
+
+            final Hashtable props = new Hashtable();
+            final String name = "Declarative Services Components";
+            props.put(InventoryPrinter.NAME, name.replace(' ', '_'));
+            props.put(InventoryPrinter.TITLE, name);
+            printerRegistration = context.registerService(InventoryPrinter.SERVICE,
+                new ComponentConfigurationPrinter(service), props);
+
             infoRegistration = new InfoProvider(context.getBundle(), service).register(context);
         }
 

Modified: felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java?rev=1610597&r1=1610596&r2=1610597&view=diff
==============================================================================
--- felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java (original)
+++ felix/trunk/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java Tue Jul 15 07:10:01 2014
@@ -25,10 +25,11 @@ import java.util.Iterator;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
+import org.apache.felix.inventory.Format;
+import org.apache.felix.inventory.InventoryPrinter;
 import org.apache.felix.scr.Component;
 import org.apache.felix.scr.Reference;
 import org.apache.felix.scr.ScrService;
-import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.apache.felix.webconsole.WebConsoleUtil;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
@@ -37,7 +38,7 @@ import org.osgi.service.component.Compon
 /**
  * ComponentConfigurationPrinter prints the available SCR services. 
  */
-class ComponentConfigurationPrinter implements ConfigurationPrinter
+class ComponentConfigurationPrinter implements InventoryPrinter
 {
 
     private final ScrService scrService;
@@ -48,21 +49,14 @@ class ComponentConfigurationPrinter impl
     }
 
     /**
-     * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
+     * @see org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter, org.apache.felix.inventory.Format, boolean)
      */
-    public String getTitle()
-    {
-        return "Declarative Services Components";
-    }
-
-    /**
-     * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
-     */
-    public void printConfiguration(PrintWriter pw)
+    public void print(PrintWriter pw, Format format, boolean isZip)
     {
         printComponents(pw, scrService.getComponents());
     }
-
+    
+    
     private static final void printComponents(final PrintWriter pw,
         final Component[] components)
     {
@@ -222,6 +216,8 @@ class ComponentConfigurationPrinter impl
         {
             case Component.STATE_DISABLED:
                 return "disabled";
+            case Component.STATE_ENABLING:
+                return "enabling";
             case Component.STATE_ENABLED:
                 return "enabled";
             case Component.STATE_UNSATISFIED:
@@ -236,10 +232,16 @@ class ComponentConfigurationPrinter impl
                 return "factory";
             case Component.STATE_DEACTIVATING:
                 return "deactivating";
+            case Component.STATE_DISABLING:
+                return "disabling";
+            case Component.STATE_DISPOSING:
+                return "disposing";
             case Component.STATE_DESTROYED:
-                return "destroyed";
+                return "destroyed/disposed";
             default:
                 return String.valueOf(state);
         }
     }
+
+
 }