incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1221134 - 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, 20 Dec 2011 08:11:29 GMT
Author: cziegeler
Date: Tue Dec 20 08:11:28 2011
New Revision: 1221134

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

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=1221134&r1=1221133&r2=1221134&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/threaddump/pom.xml (original)
+++ sling/trunk/bundles/extensions/threaddump/pom.xml Tue Dec 20 08:11:28 2011
@@ -58,11 +58,7 @@
                 <configuration>
                     <instructions>
                         <Import-Package>
-                            org.osgi.framework,
-                            org.slf4j.*,
-                            javax.servlet.*;
-                            org.apache.felix.shell;
-                            org.apache.felix.webconsole;resolution:=optional,
+                            org.apache.felix.shell;resolution:=optional,
                             *
                         </Import-Package>
                         <Private-Package>
@@ -91,11 +87,6 @@
             <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=1221134&r1=1221133&r2=1221134&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 Dec 20 08:11:28 2011
@@ -45,37 +45,41 @@ public class Activator implements Bundle
         try {
             register(bundleContext,
                 new String[] { "org.apache.felix.shell.Command" },
-                new ThreadDumpCommand());
+                new ThreadDumpCommand(), null);
         } catch (Throwable t) {
             // shell service might not be available, don't care
         }
 
         // install Web Console configuration printer
-        try {
-            ThreadDumperPanel tdp = new ThreadDumperPanel();
+        final 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[] {
-                "org.apache.felix.webconsole.ConfigurationPrinter" }, tdp);
-        } catch (Throwable t) {
-            // web console might not be available, don't care
-        }
+        final ThreadDumperPanel tdp = new ThreadDumperPanel();
+
+        register(bundleContext, new String[] {
+            "org.apache.felix.webconsole.ConfigurationPrinter" }, tdp, props);
     }
 
     public void stop(BundleContext bundleContext) {
         Thread.setDefaultUncaughtExceptionHandler(oldHandler);
     }
 
-    private void register(BundleContext context, String[] serviceNames,
-            Object service) {
+    private void register(final BundleContext context,
+            final String[] serviceNames,
+            final Object service,
+            final Dictionary<String, Object> properties) {
 
-        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
+        final Dictionary<String, Object> props =
+                (properties == null ? new Hashtable<String, Object>() : properties);
 
         // default settings
-        properties.put(Constants.SERVICE_DESCRIPTION, "Thread Dumper ("
+        props.put(Constants.SERVICE_DESCRIPTION, "Thread Dumper ("
             + serviceNames[0] + ")");
-        properties.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
+        props.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
 
-        context.registerService(serviceNames, service, properties);
+        context.registerService(serviceNames, service, props);
     }
 
     // ---------- UncaughtExceptionHandler

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=1221134&r1=1221133&r2=1221134&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 Dec 20 08:11:28 2011
@@ -20,27 +20,13 @@ package org.apache.sling.extensions.thre
 
 import java.io.PrintWriter;
 
-import org.apache.felix.webconsole.ConfigurationPrinter;
+public class ThreadDumperPanel {
 
-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;
-    }
+    private final BaseThreadDumper baseThreadDumper = new BaseThreadDumper();
 
     // ---------- ConfigurationPrinter
 
-    /**
-     * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
-     */
-    public void printConfiguration(PrintWriter pw) {
+    public void printConfiguration(final PrintWriter pw) {
         pw.println("*** Threads Dumps:");
         baseThreadDumper.printThreads(pw, true);
     }



Mime
View raw message