You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by jo...@apache.org on 2025/11/03 12:03:48 UTC
(sling-org-apache-sling-settings) branch SLING-12989 created (now e477dc1)
This is an automated email from the ASF dual-hosted git repository.
joerghoh pushed a change to branch SLING-12989
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git
at e477dc1 SLING-12989 apply spotless formatting
This branch includes the following new commits:
new e477dc1 SLING-12989 apply spotless formatting
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(sling-org-apache-sling-settings) 01/01: SLING-12989 apply spotless formatting
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joerghoh pushed a commit to branch SLING-12989
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git
commit e477dc190b95f2dd0eb8ea5d1ef6ff79a4ddf4d8
Author: Joerg Hoh <jo...@apache.org>
AuthorDate: Mon Nov 3 13:03:20 2025 +0100
SLING-12989 apply spotless formatting
---
.../sling/settings/SlingSettingsService.java | 2 +-
.../org/apache/sling/settings/impl/Activator.java | 1 -
.../apache/sling/settings/impl/SlingIdUtil.java | 1 -
.../settings/impl/SlingPropertiesPrinter.java | 34 ++++++++++------------
.../sling/settings/impl/SlingSettingsPrinter.java | 8 ++++-
.../settings/impl/SlingSettingsServiceImpl.java | 20 ++++++++-----
.../org/apache/sling/settings/package-info.java | 2 --
7 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/src/main/java/org/apache/sling/settings/SlingSettingsService.java b/src/main/java/org/apache/sling/settings/SlingSettingsService.java
index 108678d..94f6129 100644
--- a/src/main/java/org/apache/sling/settings/SlingSettingsService.java
+++ b/src/main/java/org/apache/sling/settings/SlingSettingsService.java
@@ -138,7 +138,7 @@ public interface SlingSettingsService {
* conjunction ::= notrunmode | runmode
* notrunmode ::= '-' runmode
* </code></pre>
- *
+ *
* The operator order is first "-" (not), second "." (AND), last "," (OR).
* @param spec the run mode spec string to check against
* @return the number of matching run modes or 0 if no match. If multiple disjunctions match the one with the highest number of matching run modes is returned.
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 ef219a5..c21b45d 100644
--- a/src/main/java/org/apache/sling/settings/impl/Activator.java
+++ b/src/main/java/org/apache/sling/settings/impl/Activator.java
@@ -35,5 +35,4 @@ public class Activator implements BundleActivator {
public void stop(BundleContext context) throws Exception {
// no need to unregister services registered at start(...) as this happens implicitly
}
-
}
diff --git a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
index 4b1995a..e0648b4 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
@@ -84,5 +84,4 @@ public class SlingIdUtil {
}
}
}
-
}
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 cafe764..5e4d89e 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingPropertiesPrinter.java
@@ -41,21 +41,21 @@ import org.slf4j.LoggerFactory;
public class SlingPropertiesPrinter {
private static final Logger LOGGER = LoggerFactory.getLogger(SlingPropertiesPrinter.class);
-
+
// Called from bundle activator
public static void init(BundleContext bundleContext) throws IOException {
// if the properties are available, we register the sling properties plugin
Properties props;
final String propUrl = bundleContext.getProperty("sling.properties.url");
- if ( propUrl != null ) {
+ if (propUrl != null) {
// try to read properties
try (final InputStream is = new URL(propUrl).openStream()) {
final Properties tmp = new Properties();
tmp.load(is);
// update props
- for(final Object key : tmp.keySet()) {
+ for (final Object key : tmp.keySet()) {
final Object value = bundleContext.getProperty(key.toString());
- if ( value != null ) {
+ if (value != null) {
tmp.put(key, value);
}
}
@@ -66,8 +66,9 @@ public class SlingPropertiesPrinter {
return;
}
} else {
- LOGGER.debug("No bundle context property 'sling.properties.url' provided, not starting 'slingprops' webconsole plugin!");
- return;
+ LOGGER.debug(
+ "No bundle context property 'sling.properties.url' provided, not starting 'slingprops' webconsole plugin!");
+ return;
}
final SlingPropertiesPrinter propertiesPrinter = new SlingPropertiesPrinter(props);
final Dictionary<String, String> serviceProps = new Hashtable<>();
@@ -75,13 +76,11 @@ public class SlingPropertiesPrinter {
serviceProps.put("felix.webconsole.title", "Sling Properties");
serviceProps.put("felix.webconsole.configprinter.modes", "always");
- // no need to keep serviceregistration return value as deregistration only happens automatically once bundle stops
- bundleContext.registerService(SlingPropertiesPrinter.class.getName(),
- propertiesPrinter,
- serviceProps);
+ // no need to keep serviceregistration return value as deregistration only happens automatically once bundle
+ // stops
+ bundleContext.registerService(SlingPropertiesPrinter.class.getName(), propertiesPrinter, serviceProps);
}
-
private static String HEADLINE = "Apache Sling Launchpad Properties";
private final Properties props;
@@ -90,7 +89,6 @@ public class SlingPropertiesPrinter {
this.props = props;
}
-
/**
* Print out the servlet filter chains.
* @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
@@ -98,13 +96,13 @@ public class SlingPropertiesPrinter {
public void printConfiguration(PrintWriter pw) {
pw.println(HEADLINE);
pw.println();
- SortedSet<Object> keys = new TreeSet<Object>( props.keySet() );
- for ( Iterator<Object> ki = keys.iterator(); ki.hasNext(); ) {
+ SortedSet<Object> keys = new TreeSet<Object>(props.keySet());
+ for (Iterator<Object> ki = keys.iterator(); ki.hasNext(); ) {
final Object key = ki.next();
- pw.print( key );
+ pw.print(key);
pw.print(" = ");
final Object value = props.get(key);
- if ( value != null ) {
+ if (value != null) {
pw.print(value.toString());
}
pw.println();
@@ -115,14 +113,14 @@ public class SlingPropertiesPrinter {
* @see org.apache.felix.webconsole.ModeAwareConfigurationPrinter#printConfiguration(java.io.PrintWriter, java.lang.String)
*/
public void printConfiguration(PrintWriter printWriter, String mode) {
- if ( ! "zip".equals(mode) ) {
+ if (!"zip".equals(mode)) {
this.printConfiguration(printWriter);
} else {
// write into byte array first
String contents = null;
try {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- this.props.store(baos , HEADLINE);
+ this.props.store(baos, HEADLINE);
contents = baos.toString("8859_1");
} catch (IOException ioe) {
// if something goes wrong here we default to text output
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 4999ff0..ace294d 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsPrinter.java
@@ -30,7 +30,13 @@ import org.osgi.service.component.annotations.Reference;
* prints out the sling settings.
*
*/
-@Component(service = SlingSettingsPrinter.class, property= {"felix.webconsole.label=slingsettings","felix.webconsole.title=Sling Settings","felix.webconsole.configprinter.modes=always"})
+@Component(
+ service = SlingSettingsPrinter.class,
+ property = {
+ "felix.webconsole.label=slingsettings",
+ "felix.webconsole.title=Sling Settings",
+ "felix.webconsole.configprinter.modes=always"
+ })
public class SlingSettingsPrinter {
private static String HEADLINE = "Apache Sling Settings";
diff --git a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
index 8b5cc89..a53a412 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -51,8 +51,7 @@ import org.slf4j.LoggerFactory;
@Component
@Designate(ocd = SlingSettingsServiceImpl.Configuration.class)
@ServiceDescription("Apache Sling Settings Service")
-public class SlingSettingsServiceImpl
- implements SlingSettingsService {
+public class SlingSettingsServiceImpl implements SlingSettingsService {
/** The logger */
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -77,18 +76,23 @@ public class SlingSettingsServiceImpl
/** The name of the data file holding install run mode options */
private static final String OPTIONS_FILE = "sling.options.file";
- @ObjectClassDefinition(id = "org.apache.sling.settings.impl.SlingSettingsServiceImpl", name = "Apache Sling Settings Service",
- description = "The settings service manages some basic settings of Sling like run modes or information about the current instance.")
+ @ObjectClassDefinition(
+ id = "org.apache.sling.settings.impl.SlingSettingsServiceImpl",
+ name = "Apache Sling Settings Service",
+ description =
+ "The settings service manages some basic settings of Sling like run modes or information about the current instance.")
static @interface Configuration {
@AttributeDefinition(name = "Instance Name", description = "A human readable name for the current instance.")
String sling_name();
- @AttributeDefinition(name = "Instance Description", description = "A human readable description for the current instance.")
+ @AttributeDefinition(
+ name = "Instance Description",
+ description = "A human readable description for the current instance.")
String sling_description();
}
/** Create the service and search the Sling home urls and get/create a sling id. Setup run modes
- *
+ *
* @param context The bundle context */
@Activate
public SlingSettingsServiceImpl(final Configuration configuration, final BundleContext context) {
@@ -97,7 +101,7 @@ public class SlingSettingsServiceImpl
this.setupSlingId(context);
this.setupRunModes(context);
}
-
+
/**
* Constructor only to be used from tests
* @param runModes
@@ -367,7 +371,7 @@ public class SlingSettingsServiceImpl
@Override
public String getSlingName() {
String name = configuration.sling_name();
- if ( name == null ) {
+ if (name == null) {
name = "Instance " + this.slingId; // default
}
return name;
diff --git a/src/main/java/org/apache/sling/settings/package-info.java b/src/main/java/org/apache/sling/settings/package-info.java
index d30eb0d..70c48c4 100644
--- a/src/main/java/org/apache/sling/settings/package-info.java
+++ b/src/main/java/org/apache/sling/settings/package-info.java
@@ -18,5 +18,3 @@
*/
@org.osgi.annotation.versioning.Version("1.4.0")
package org.apache.sling.settings;
-
-