incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1021688 - in /sling/trunk/bundles/extensions/threaddump: pom.xml src/main/java/org/apache/sling/extensions/threaddump/internal/Activator.java src/main/java/org/apache/sling/extensions/threaddump/internal/ThreadDumperPanel.java
Date Tue, 12 Oct 2010 09:05:12 GMT
Author: cziegeler
Date: Tue Oct 12 09:05:11 2010
New Revision: 1021688

URL: http://svn.apache.org/viewvc?rev=1021688&view=rev
Log:
SLING-1836 : Remove direct dependency to web console by using new configuration printer support
(REVERT!)

Modified:
    sling/trunk/bundles/extensions/threaddump/pom.xml
    sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/Activator.java
    sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/ThreadDumperPanel.java

Modified: sling/trunk/bundles/extensions/threaddump/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/threaddump/pom.xml?rev=1021688&r1=1021687&r2=1021688&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/threaddump/pom.xml (original)
+++ sling/trunk/bundles/extensions/threaddump/pom.xml Tue Oct 12 09:05:11 2010
@@ -61,7 +61,8 @@
                             org.osgi.framework,
                             org.slf4j.*,
                             javax.servlet.*;
-                            org.apache.felix.shell;resolution:=optional
+                            org.apache.felix.shell;
+                            org.apache.felix.webconsole;resolution:=optional
                         </Import-Package>
                         <Private-Package>
                             org.apache.sling.extensions.threaddump.*
@@ -89,6 +90,11 @@
             <version>1.0.0</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.webconsole</artifactId>
+            <version>1.2.0</version>
+        </dependency>
+        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
         </dependency>

Modified: sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/Activator.java?rev=1021688&r1=1021687&r2=1021688&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/Activator.java
(original)
+++ sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/Activator.java
Tue Oct 12 09:05:11 2010
@@ -45,20 +45,20 @@ public class Activator implements Bundle
         try {
             register(bundleContext,
                 new String[] { "org.apache.felix.shell.Command" },
-                new ThreadDumpCommand(), null);
+                new ThreadDumpCommand());
         } catch (Throwable t) {
             // shell service might not be available, don't care
         }
 
         // install Web Console configuration printer
-        Dictionary<String, Object> props = new Hashtable<String, Object>();
-        props.put("felix.webconsole.label", "slingthreads");
-        props.put("felix.webconsole.title", "Threads");
-        props.put("felix.webconsole.configprinter.modes", "always");
-
-        register(bundleContext, new String[] {
-                ThreadDumperPanel.class.getName() },
-                new ThreadDumperPanel(), props);
+        try {
+            ThreadDumperPanel tdp = new ThreadDumperPanel();
+
+            register(bundleContext, new String[] {
+                "org.apache.felix.webconsole.ConfigurationPrinter" }, tdp);
+        } catch (Throwable t) {
+            // web console might not be available, don't care
+        }
     }
 
     public void stop(BundleContext bundleContext) {
@@ -66,12 +66,9 @@ public class Activator implements Bundle
     }
 
     private void register(BundleContext context, String[] serviceNames,
-            Object service,
-            Dictionary<String, Object> properties) {
+            Object service) {
 
-        if ( properties == null ) {
-            properties = new Hashtable<String, Object>();
-        }
+        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
 
         // default settings
         properties.put(Constants.SERVICE_DESCRIPTION, "Thread Dumper ("

Modified: sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/ThreadDumperPanel.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/ThreadDumperPanel.java?rev=1021688&r1=1021687&r2=1021688&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/ThreadDumperPanel.java
(original)
+++ sling/trunk/bundles/extensions/threaddump/src/main/java/org/apache/sling/extensions/threaddump/internal/ThreadDumperPanel.java
Tue Oct 12 09:05:11 2010
@@ -20,10 +20,21 @@ package org.apache.sling.extensions.thre
 
 import java.io.PrintWriter;
 
-public class ThreadDumperPanel {
+import org.apache.felix.webconsole.ConfigurationPrinter;
+
+public class ThreadDumperPanel implements ConfigurationPrinter {
+
+    private static final String TITLE = "Threads";
 
     private BaseThreadDumper baseThreadDumper = new BaseThreadDumper();
 
+    /**
+     * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
+     */
+    public String getTitle() {
+        return TITLE;
+    }
+
     // ---------- ConfigurationPrinter
 
     /**



Mime
View raw message