incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1021410 - in /sling/trunk/bundles/commons/log: pom.xml src/main/java/org/apache/sling/commons/log/internal/LogManager.java src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingConfigurationPrinter.java
Date Mon, 11 Oct 2010 16:28:21 GMT
Author: cziegeler
Date: Mon Oct 11 16:28:21 2010
New Revision: 1021410

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

Modified:
    sling/trunk/bundles/commons/log/pom.xml
    sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java
    sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingConfigurationPrinter.java

Modified: sling/trunk/bundles/commons/log/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/pom.xml?rev=1021410&r1=1021409&r2=1021410&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/pom.xml (original)
+++ sling/trunk/bundles/commons/log/pom.xml Mon Oct 11 16:28:21 2010
@@ -77,7 +77,6 @@
                         </Private-Package>
                         <Import-Package>
                             javax.servlet.*;resolution:=optional,
-                            org.apache.felix.webconsole;resolution:=optional,
                             org.osgi.framework;version=1.3,
                             *
                         </Import-Package>

Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java?rev=1021410&r1=1021409&r2=1021410&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java
(original)
+++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java
Mon Oct 11 16:28:21 2010
@@ -124,12 +124,8 @@ public class LogManager {
             SlingLogPanel.registerPanel(context);
         } catch (Throwable ignore) {
         }
-        // setup the web console configuration printer. This may fail loading
-        // the class if the web console API is not wired
-        try {
-            SlingConfigurationPrinter.registerPrinter(context);
-        } catch (Throwable ignore) {
-        }
+        // setup the web console configuration printer.
+        SlingConfigurationPrinter.registerPrinter(context);
     }
 
     void shutdown() {
@@ -141,10 +137,7 @@ public class LogManager {
         } catch (Throwable ignore) {
         }
         // tear down the web console configuration printer (if created at all).
-        try {
-            SlingConfigurationPrinter.unregisterPrinter();
-        } catch (Throwable ignore) {
-        }
+        SlingConfigurationPrinter.unregisterPrinter();
 
         if (loggingConfigurable != null) {
             loggingConfigurable.unregister();

Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingConfigurationPrinter.java?rev=1021410&r1=1021409&r2=1021410&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingConfigurationPrinter.java
(original)
+++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/SlingConfigurationPrinter.java
Mon Oct 11 16:28:21 2010
@@ -30,8 +30,6 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.felix.webconsole.AttachmentProvider;
-import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
@@ -40,8 +38,7 @@ import org.osgi.framework.ServiceRegistr
  * Web Console plugin to display the currently configured log
  * files.
  */
-public class SlingConfigurationPrinter
-    implements ConfigurationPrinter, AttachmentProvider {
+public class SlingConfigurationPrinter {
 
     /** The registration. */
     private static ServiceRegistration registration;
@@ -49,9 +46,12 @@ public class SlingConfigurationPrinter
     public static void registerPrinter(BundleContext ctx) {
         if (registration == null) {
             Dictionary<String, Object> props = new Hashtable<String, Object>();
+            props.put("felix.webconsole.label", "slinglogs");
+            props.put("felix.webconsole.title", "Log Files");
+            props.put("felix.webconsole.configprinter.modes", "always");
 
             SlingConfigurationPrinter printer = new SlingConfigurationPrinter();
-            registration = ctx.registerService(ConfigurationPrinter.class.getName(),
+            registration = ctx.registerService(SlingConfigurationPrinter.class.getName(),
                     printer, props);
         }
     }
@@ -64,13 +64,6 @@ public class SlingConfigurationPrinter
     }
 
     /**
-     * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
-     */
-    public String getTitle() {
-        return "Log Files";
-    }
-
-    /**
      * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
      */
     public void printConfiguration(PrintWriter printWriter) {
@@ -110,7 +103,7 @@ public class SlingConfigurationPrinter
      */
     public URL[] getAttachments(String mode) {
         // we only provide urls for mode zip
-        if ( ConfigurationPrinter.MODE_ZIP.equals(mode) ) {
+        if ( "zip".equals(mode) ) {
             final List<URL> urls = new ArrayList<URL>();
             final LogConfigManager logConfigManager = LogConfigManager.getInstance();
             Iterator<SlingLoggerWriter> writers = logConfigManager.getSlingLoggerWriters();



Mime
View raw message