You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:16:06 UTC
[sling-org-apache-sling-settings] 03/05: SLING-1835 : Remove direct
dependency to web console by using new configuration printer support
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.settings-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git
commit 1c24d3b92556f5264b4af592effa85b5e9a0d505
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Oct 11 15:43:21 2010 +0000
SLING-1835 : Remove direct dependency to web console by using new configuration printer support
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1021391 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 12 ----------
.../org/apache/sling/settings/impl/Activator.java | 25 +++++----------------
.../apache/sling/settings/impl/RunModeCommand.java | 3 +--
.../settings/impl/SlingPropertiesPrinter.java | 26 +++++++++-------------
.../sling/settings/impl/SlingSettingsPrinter.java | 15 +++++--------
5 files changed, 21 insertions(+), 60 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7b5f781..f6ee688 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>
diff --git a/src/main/java/org/apache/sling/settings/impl/Activator.java b/src/main/java/org/apache/sling/settings/impl/Activator.java
index 61a0bae..5a7b299 100644
--- a/src/main/java/org/apache/sling/settings/impl/Activator.java
+++ b/src/main/java/org/apache/sling/settings/impl/Activator.java
@@ -84,16 +84,8 @@ public class Activator implements BundleActivator, BundleListener {
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 BundleActivator, BundleListener {
} 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;
diff --git a/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java b/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java
index 1aa93cf..e757e38 100644
--- a/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java
+++ b/src/main/java/org/apache/sling/settings/impl/RunModeCommand.java
@@ -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 Command {
"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);
}
diff --git a/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java b/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
index fd3fbdc..de2606b 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
@@ -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 implements ModeAwareConfigurationPrinter {
}
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 implements ModeAwareConfigurationPrinter {
}
/**
- * @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 implements ModeAwareConfigurationPrinter {
* @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
diff --git a/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java b/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
index d45b9a4..bec99e8 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
@@ -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.ServiceRegistration;
* prints out the sling settings.
*
*/
-public class SlingSettingsPrinter implements ConfigurationPrinter {
+public class SlingSettingsPrinter {
private static ServiceRegistration pluginReg;
@@ -45,8 +44,11 @@ public class SlingSettingsPrinter implements ConfigurationPrinter {
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 implements ConfigurationPrinter {
}
/**
- * @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)
*/
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.