incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1021391 - in /sling/trunk/bundles/extensions/settings: ./ src/main/java/org/apache/sling/settings/impl/
Date Mon, 11 Oct 2010 15:43:22 GMT
Author: cziegeler
Date: Mon Oct 11 15:43:21 2010
New Revision: 1021391

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

Modified:
    sling/trunk/bundles/extensions/settings/pom.xml
    sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/Activator.java
    sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java
    sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
    sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java

Modified: sling/trunk/bundles/extensions/settings/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings/pom.xml?rev=1021391&r1=1021390&r2=1021391&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/settings/pom.xml (original)
+++ sling/trunk/bundles/extensions/settings/pom.xml Mon Oct 11 15:43:21 2010
@@ -74,9 +74,7 @@
                             org.apache.sling.settings.impl.Activator
                         </Bundle-Activator>
                         <Import-Package>
-                            javax.servlet.*;
                             org.apache.felix.shell;
-                            org.apache.felix.webconsole;
                             resolution:=optional, *
                         </Import-Package>
                     </instructions>
@@ -100,16 +98,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.webconsole</artifactId>
-            <version>3.0.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>

Modified: sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/Activator.java?rev=1021391&r1=1021390&r2=1021391&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/Activator.java
(original)
+++ sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/Activator.java
Mon Oct 11 15:43:21 2010
@@ -84,16 +84,8 @@ public class Activator implements Bundle
         serviceRegistration = this.bundleContext.registerService(new String[] {
                                                SlingSettingsService.class.getName()},
                                                this.settingsService, props);
-        try {
-            SlingPropertiesPrinter.initPlugin(this.bundleContext);
-        } catch (Throwable ignore) {
-            // we just ignore this
-        }
-        try {
-            SlingSettingsPrinter.initPlugin(this.bundleContext, this.settingsService);
-        } catch (Throwable ignore) {
-            // we just ignore this
-        }
+        SlingPropertiesPrinter.initPlugin(this.bundleContext);
+        SlingSettingsPrinter.initPlugin(this.bundleContext, this.settingsService);
         try {
             RunModeCommand.initPlugin(this.bundleContext, this.settingsService.getRunModes());
         } catch (Throwable ignore) {
@@ -112,16 +104,9 @@ public class Activator implements Bundle
         } catch (Throwable ignore) {
             // we just ignore this
         }
-        try {
-            SlingSettingsPrinter.destroyPlugin();
-        } catch (Throwable ignore) {
-            // we just ignore this
-        }
-        try {
-            SlingPropertiesPrinter.destroyPlugin();
-        } catch (Throwable ignore) {
-            // we just ignore this
-        }
+        SlingSettingsPrinter.destroyPlugin();
+        SlingPropertiesPrinter.destroyPlugin();
+
         if ( serviceRegistration != null ) {
             serviceRegistration.unregister();
             serviceRegistration = null;

Modified: sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java?rev=1021391&r1=1021390&r2=1021391&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java
(original)
+++ sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java
Mon Oct 11 15:43:21 2010
@@ -24,7 +24,6 @@ import java.util.Hashtable;
 import java.util.Set;
 
 import org.apache.felix.shell.Command;
-import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
@@ -45,7 +44,7 @@ public class RunModeCommand implements C
             "Apache Sling Sling Run Mode Shell Command");
         props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
 
-        pluginReg = bundleContext.registerService(ConfigurationPrinter.class.getName(),
+        pluginReg = bundleContext.registerService(Command.class.getName(),
                 command,
                 props);
     }

Modified: sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java?rev=1021391&r1=1021390&r2=1021391&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
(original)
+++ sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
Mon Oct 11 15:43:21 2010
@@ -30,8 +30,6 @@ import java.util.Properties;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import org.apache.felix.webconsole.ConfigurationPrinter;
-import org.apache.felix.webconsole.ModeAwareConfigurationPrinter;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
@@ -43,7 +41,7 @@ import org.slf4j.LoggerFactory;
  * prints out the Sling properties from Launchpad if available.
  *
  */
-public class SlingPropertiesPrinter implements ModeAwareConfigurationPrinter {
+public class SlingPropertiesPrinter {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SlingPropertiesPrinter.class);
 
@@ -66,14 +64,17 @@ public class SlingPropertiesPrinter impl
             }
             if ( props != null ) {
                 final SlingPropertiesPrinter propertiesPrinter = new SlingPropertiesPrinter(props);
-                final Dictionary<String, String> serviceProps2 = new Hashtable<String,
String>();
-                serviceProps2.put(Constants.SERVICE_DESCRIPTION,
+                final Dictionary<String, String> serviceProps = new Hashtable<String,
String>();
+                serviceProps.put(Constants.SERVICE_DESCRIPTION,
                     "Apache Sling Sling Properties Configuration Printer");
-                serviceProps2.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+                serviceProps.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+                serviceProps.put("felix.webconsole.label", "slingprops");
+                serviceProps.put("felix.webconsole.title", "Sling Properties");
+                serviceProps.put("felix.webconsole.configprinter.modes", "always");
 
-                propertiesPlugin = bundleContext.registerService(ConfigurationPrinter.class.getName(),
+                propertiesPlugin = bundleContext.registerService(SlingPropertiesPrinter.class.getName(),
                         propertiesPrinter,
-                        serviceProps2);
+                        serviceProps);
             }
         }
     }
@@ -94,13 +95,6 @@ public class SlingPropertiesPrinter impl
     }
 
     /**
-     * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
-     */
-    public String getTitle() {
-        return "Sling Properties";
-    }
-
-    /**
      * Print out the servlet filter chains.
      * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
      */
@@ -124,7 +118,7 @@ public class SlingPropertiesPrinter impl
      * @see org.apache.felix.webconsole.ModeAwareConfigurationPrinter#printConfiguration(java.io.PrintWriter,
java.lang.String)
      */
     public void printConfiguration(PrintWriter printWriter, String mode) {
-        if ( mode != ConfigurationPrinter.MODE_ZIP ) {
+        if ( ! "zip".equals(mode) ) {
             this.printConfiguration(printWriter);
         } else {
             // write into byte array first

Modified: sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java?rev=1021391&r1=1021390&r2=1021391&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
(original)
+++ sling/trunk/bundles/extensions/settings/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
Mon Oct 11 15:43:21 2010
@@ -22,7 +22,6 @@ import java.io.PrintWriter;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.apache.sling.settings.SlingSettingsService;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -33,7 +32,7 @@ import org.osgi.framework.ServiceRegistr
  * prints out the sling settings.
  *
  */
-public class SlingSettingsPrinter implements ConfigurationPrinter {
+public class SlingSettingsPrinter {
 
     private static ServiceRegistration pluginReg;
 
@@ -45,8 +44,11 @@ public class SlingSettingsPrinter implem
         props.put(Constants.SERVICE_DESCRIPTION,
             "Apache Sling Sling Settings Configuration Printer");
         props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+        props.put("felix.webconsole.label", "slingsettings");
+        props.put("felix.webconsole.title", "Sling Settings");
+        props.put("felix.webconsole.configprinter.modes", "always");
 
-        pluginReg = bundleContext.registerService(ConfigurationPrinter.class.getName(),
+        pluginReg = bundleContext.registerService(SlingSettingsPrinter.class.getName(),
                 printer,
                 props);
     }
@@ -67,13 +69,6 @@ public class SlingSettingsPrinter implem
     }
 
     /**
-     * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
-     */
-    public String getTitle() {
-        return "Sling Settings";
-    }
-
-    /**
      * Print out the servlet filter chains.
      * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
      */



Mime
View raw message