You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2021/12/16 17:16:22 UTC

[sling-org-apache-sling-caconfig-spi] branch master updated: cosmetic: cleanup whitespaces

This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-spi.git


The following commit(s) were added to refs/heads/master by this push:
     new 82532a2  cosmetic: cleanup whitespaces
82532a2 is described below

commit 82532a2abe735aa13ed60e7c3fd9bc5bf3a8f575
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Dec 16 18:15:27 2021 +0100

    cosmetic: cleanup whitespaces
---
 .../caconfig/resource/spi/ContextResource.java     |  6 ++--
 .../spi/ConfigurationCollectionPersistData.java    | 10 +++---
 .../caconfig/spi/ConfigurationPersistData.java     |  2 +-
 .../spi/ConfigurationPersistenceStrategy.java      | 20 ++++++------
 .../spi/ConfigurationPersistenceStrategy2.java     | 38 +++++++++++-----------
 .../caconfig/spi/metadata/AbstractMetadata.java    |  8 ++---
 .../spi/metadata/ConfigurationMetadata.java        |  6 ++--
 .../caconfig/spi/metadata/PropertyMetadata.java    | 14 ++++----
 .../caconfig/resource/spi/ContextResourceTest.java |  6 ++--
 .../spi/metadata/ConfigurationMetadataTest.java    |  4 +--
 .../spi/metadata/PropertyMetadataTest.java         |  8 ++---
 11 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/main/java/org/apache/sling/caconfig/resource/spi/ContextResource.java b/src/main/java/org/apache/sling/caconfig/resource/spi/ContextResource.java
index 72f1ab9..cbbd18a 100644
--- a/src/main/java/org/apache/sling/caconfig/resource/spi/ContextResource.java
+++ b/src/main/java/org/apache/sling/caconfig/resource/spi/ContextResource.java
@@ -30,12 +30,12 @@ import org.osgi.annotation.versioning.ProviderType;
  */
 @ProviderType
 public final class ContextResource {
-    
+
     private final Resource resource;
     private final String configRef;
     private final int serviceRanking;
     private final String key;
-    
+
     /**
      * @param resource Context root resource
      * @param configRef Config reference (normally a resource path).
@@ -74,7 +74,7 @@ public final class ContextResource {
     public @Nullable String getConfigRef() {
         return configRef;
     }
-    
+
     /**
      * @return Service ranking of the context path strategy implementation
      */
diff --git a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationCollectionPersistData.java b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationCollectionPersistData.java
index e682512..80a4ad0 100644
--- a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationCollectionPersistData.java
+++ b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationCollectionPersistData.java
@@ -34,12 +34,12 @@ import org.osgi.annotation.versioning.ProviderType;
  */
 @ProviderType
 public final class ConfigurationCollectionPersistData {
-    
+
     private static final Pattern ITEM_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9_-]+$");
 
     private final Collection<ConfigurationPersistData> items;
     private Map<String,Object> properties;
-    
+
     /**
      * @param items Collection of configuration collection items
      */
@@ -47,9 +47,9 @@ public final class ConfigurationCollectionPersistData {
         validateItems(items);
         this.items = items;
     }
-    
+
     private void validateItems(Collection<ConfigurationPersistData> items) {
-        // ensure unique and valid key names        
+        // ensure unique and valid key names
         Set<String> keyNames = new HashSet<>();
         for (ConfigurationPersistData item : items) {
             if (StringUtils.isBlank(item.getCollectionItemName())) {
@@ -71,7 +71,7 @@ public final class ConfigurationCollectionPersistData {
     public @NotNull Collection<ConfigurationPersistData> getItems() {
         return items;
     }
-    
+
     /**
      * @return Properties for the configuration collection itself. Does not contain configuration data, but control data e.g. for enabling collection inheritance.
      */
diff --git a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistData.java b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistData.java
index d632128..1310aa3 100644
--- a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistData.java
+++ b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistData.java
@@ -32,7 +32,7 @@ public final class ConfigurationPersistData {
 
     private final Map<String,Object> properties;
     private String collectionItemName;
-    
+
     /**
      * @param properties Property values
      */
diff --git a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy.java b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy.java
index e29bb16..62560d4 100644
--- a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy.java
+++ b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy.java
@@ -35,52 +35,52 @@ public interface ConfigurationPersistenceStrategy {
 
     /**
      * Allows the strategy to transform the given configuration resource according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resource Configuration resource
      * @return Transformed configuration resource. If null is returned this strategy does not support the given configuration resource.
      */
     @Nullable Resource getResource(@NotNull Resource resource);
-    
+
     /**
      * Allows the strategy to transform the given configuration resource path according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resourcePath Configuration resource path or part of it (e.g. config name)
      * @return Transformed configuration resource path. If null is returned this strategy does not support the given configuration resource path.
      */
     @Nullable String getResourcePath(@NotNull String resourcePath);
-    
+
     /**
      * Stores configuration data for a singleton configuration resource.
      * The changes are written using the given resource resolver. They are not committed, this is left to the caller.
      * @param resourceResolver Resource resolver
-     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created. 
+     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created.
      * @param data Configuration data to be stored. All existing properties are erased and replaced with the new ones.
      * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy
      *      (in case of error throw an exception).
      */
     boolean persistConfiguration(@NotNull ResourceResolver resourceResolver,
             @NotNull String configResourcePath, @NotNull ConfigurationPersistData data);
-    
+
     /**
      * Stores configuration data for a configuration resource collection.
      * The changes are written using the given resource resolver. They are not committed, this is left to the caller.
      * @param resourceResolver Resource resolver
      * @param configResourceCollectionParentPath Parent path to store configuration collection data to.
-     *      The resource (and it's parents) may not exist and may have to be created. 
+     *      The resource (and it's parents) may not exist and may have to be created.
      * @param data Configuration collection data. All existing collection entries on this context path level are erased and replaced with the new ones.
      * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy
      *      (in case of error throw an exception).
      */
     boolean persistConfigurationCollection(@NotNull ResourceResolver resourceResolver,
             @NotNull String configResourceCollectionParentPath, @NotNull ConfigurationCollectionPersistData data);
- 
+
     /**
      * Delete configuration or configuration collection data from repository using the inner-most context path as reference.
      * @param resourceResolver Resource resolver
-     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created. 
+     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created.
      * @return true if the data was delete. false if deleting the data was not accepted by this persistence strategy
      *      (in case of error throw an exception).
      */
     boolean deleteConfiguration(@NotNull ResourceResolver resourceResolver, @NotNull String configResourcePath);
-    
+
 }
diff --git a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy2.java b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy2.java
index 2d4ca7a..6ae2a8c 100644
--- a/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy2.java
+++ b/src/main/java/org/apache/sling/caconfig/spi/ConfigurationPersistenceStrategy2.java
@@ -33,7 +33,7 @@ public interface ConfigurationPersistenceStrategy2 {
 
     /**
      * Allows the strategy to transform the given configuration resource according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resource Singleton configuration resource
      * @return Transformed configuration resource. If null is returned this strategy does not support the given configuration resource.
      */
@@ -41,7 +41,7 @@ public interface ConfigurationPersistenceStrategy2 {
 
     /**
      * Allows the strategy to transform the given configuration resource according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resource Configuration collection parent resource
      * @return Transformed configuration resource. If null is returned this strategy does not support the given configuration resource.
      */
@@ -49,7 +49,7 @@ public interface ConfigurationPersistenceStrategy2 {
 
     /**
      * Allows the strategy to transform the given configuration resource according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resource Configuration collection item resource
      * @return Transformed configuration resource. If null is returned this strategy does not support the given configuration resource.
      */
@@ -57,15 +57,15 @@ public interface ConfigurationPersistenceStrategy2 {
 
     /**
      * Allows the strategy to transform the given configuration resource path according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resourcePath Configuration resource path (full path)
      * @return Transformed configuration resource path. If null is returned this strategy does not support the given configuration resource path.
      */
     @Nullable String getResourcePath(@NotNull String resourcePath);
-    
+
     /**
      * Allows the strategy to transform the given configuration resource path according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resourcePath Configuration collection parent resource path (full path)
      * @return Transformed configuration resource path. If null is returned this strategy does not support the given configuration resource path.
      */
@@ -73,25 +73,25 @@ public interface ConfigurationPersistenceStrategy2 {
 
     /**
      * Allows the strategy to transform the given configuration resource path according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param resourcePath Configuration collection item resource path (full path)
      * @return Transformed configuration resource path. If null is returned this strategy does not support the given configuration resource path.
      */
     @Nullable String getCollectionItemResourcePath(@NotNull String resourcePath);
-    
+
     /**
      * Allows the strategy to transform the given configuration name for nested configurations according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param configName Configuration name
      * @param relatedConfigPath Path of a configuration resource that was resolved in context of this configuration name.
      *     This can be used to detect if the persistence strategy supports the configuration location. If null it should be assumed that it matches.
      * @return Transformed configuration name. If null is returned this strategy does not support the given configuration resource path.
      */
     @Nullable String getConfigName(@NotNull String configName, @Nullable String relatedConfigPath);
-    
+
     /**
      * Allows the strategy to transform the given configuration name for nested configurations according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param configName Configuration name
      * @param relatedConfigPath Path of a configuration resource that was resolved in context of this configuration name.
      *     This can be used to detect if the persistence strategy supports the configuration location. If null it should be assumed that it matches.
@@ -101,46 +101,46 @@ public interface ConfigurationPersistenceStrategy2 {
 
     /**
      * Allows the strategy to transform the given configuration name for nested configurations according to it's persistent strategies,
-     * e.g. fetching the data from a child resource instead of the given resource. 
+     * e.g. fetching the data from a child resource instead of the given resource.
      * @param configName Configuration name
      * @param relatedConfigPath Path of a configuration resource that was resolved in context of this configuration name.
      *     This can be used to detect if the persistence strategy supports the configuration location. If null it should be assumed that it matches.
      * @return Transformed configuration name. If null is returned this strategy does not support the given configuration resource path.
      */
     @Nullable String getCollectionItemConfigName(@NotNull String configName, @Nullable String relatedConfigPath);
-    
+
     /**
      * Stores configuration data for a singleton configuration resource.
      * The changes are written using the given resource resolver. They are not committed, this is left to the caller.
      * @param resourceResolver Resource resolver
-     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created. 
+     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created.
      * @param data Configuration data to be stored. All existing properties are erased and replaced with the new ones.
      * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy
      *      (in case of error throw an exception).
      */
     boolean persistConfiguration(@NotNull ResourceResolver resourceResolver,
             @NotNull String configResourcePath, @NotNull ConfigurationPersistData data);
-    
+
     /**
      * Stores configuration data for a configuration resource collection.
      * The changes are written using the given resource resolver. They are not committed, this is left to the caller.
      * @param resourceResolver Resource resolver
      * @param configResourceCollectionParentPath Parent path to store configuration collection data to.
-     *      The resource (and it's parents) may not exist and may have to be created. 
+     *      The resource (and it's parents) may not exist and may have to be created.
      * @param data Configuration collection data. All existing collection entries on this context path level are erased and replaced with the new ones.
      * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy
      *      (in case of error throw an exception).
      */
     boolean persistConfigurationCollection(@NotNull ResourceResolver resourceResolver,
             @NotNull String configResourceCollectionParentPath, @NotNull ConfigurationCollectionPersistData data);
- 
+
     /**
      * Delete configuration or configuration collection data from repository using the inner-most context path as reference.
      * @param resourceResolver Resource resolver
-     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created. 
+     * @param configResourcePath Path to store configuration data to. The resource (and it's parents) may not exist and may have to be created.
      * @return true if the data was delete. false if deleting the data was not accepted by this persistence strategy
      *      (in case of error throw an exception).
      */
     boolean deleteConfiguration(@NotNull ResourceResolver resourceResolver, @NotNull String configResourcePath);
-    
+
 }
diff --git a/src/main/java/org/apache/sling/caconfig/spi/metadata/AbstractMetadata.java b/src/main/java/org/apache/sling/caconfig/spi/metadata/AbstractMetadata.java
index 7592d35..feb3c25 100644
--- a/src/main/java/org/apache/sling/caconfig/spi/metadata/AbstractMetadata.java
+++ b/src/main/java/org/apache/sling/caconfig/spi/metadata/AbstractMetadata.java
@@ -39,14 +39,14 @@ abstract class AbstractMetadata<T> {
         }
         this.name = name;
     }
-    
+
     /**
      * @return Parameter name
      */
     public @NotNull String getName() {
         return this.name;
     }
-    
+
     /**
      * @return Label
      */
@@ -87,7 +87,7 @@ abstract class AbstractMetadata<T> {
     public Map<String,String> getProperties() {
         return this.properties;
     }
-    
+
     /**
      * @param properties Further properties for documentation and configuration of behavior in configuration editor.
      * @return this;
@@ -97,7 +97,7 @@ abstract class AbstractMetadata<T> {
         this.properties = properties;
         return (T)this;
     }
-    
+
     @Override
     public String toString() {
         return this.name;
diff --git a/src/main/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadata.java
index b3e0f2b..0b4c075 100644
--- a/src/main/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadata.java
+++ b/src/main/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadata.java
@@ -46,7 +46,7 @@ public final class ConfigurationMetadata extends AbstractMetadata<ConfigurationM
         this.propertyMetadata = toMap(propertyMetadata);
         this.collection = collection;
     }
-    
+
     private static Map<String,PropertyMetadata<?>> toMap(Collection<PropertyMetadata<?>> propertyMetadata) {
         Map<String,PropertyMetadata<?>> map = new LinkedHashMap<>();
         for (PropertyMetadata<?> item : propertyMetadata) {
@@ -57,14 +57,14 @@ public final class ConfigurationMetadata extends AbstractMetadata<ConfigurationM
         }
         return map;
     }
-    
+
     /**
      * @return true if configuration is singleton
      */
     public boolean isSingleton() {
         return !collection;
     }
-    
+
     /**
      * @return true if configuration is collection
      */
diff --git a/src/main/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadata.java
index a35ebe9..7543e9c 100644
--- a/src/main/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadata.java
+++ b/src/main/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadata.java
@@ -42,13 +42,13 @@ public final class PropertyMetadata<T> extends AbstractMetadata<PropertyMetadata
         double.class,
         boolean.class
     };
-    
+
     /**
      * Set with all types support for property metadata (not including nested configurations).
      */
     public static final Set<Class<?>> SUPPORTED_TYPES = Collections.unmodifiableSet(
             new HashSet<>(Arrays.asList(SUPPORTED_TYPES_ARRAY)));
-    
+
     private final Class<T> type;
     private T defaultValue;
     private ConfigurationMetadata configurationMetadata;
@@ -77,7 +77,7 @@ public final class PropertyMetadata<T> extends AbstractMetadata<PropertyMetadata
         this(name, (Class<T>)defaultValue.getClass());
         this.defaultValue = defaultValue;
     }
-    
+
     private static Class<?> typeToPrimitive(Class<?> clazz) {
         if (clazz.isArray()) {
             if (ClassUtils.isPrimitiveWrapper(clazz.getComponentType())) {
@@ -140,7 +140,7 @@ public final class PropertyMetadata<T> extends AbstractMetadata<PropertyMetadata
     public T getDefaultValue() {
         return this.defaultValue;
     }
-    
+
     /**
      * @param value Default value if parameter is not set for configuration
      * @return this;
@@ -149,7 +149,7 @@ public final class PropertyMetadata<T> extends AbstractMetadata<PropertyMetadata
         this.defaultValue = value;
         return this;
     }
-    
+
     /**
      * @return Number to control property order in configuration editor.
      */
@@ -181,7 +181,7 @@ public final class PropertyMetadata<T> extends AbstractMetadata<PropertyMetadata
         this.configurationMetadata = configurationMetadata;
         return this;
     }
-    
+
     /**
      * @return true if this property describes a nested configuration.
      *   In this case it is ensured configuration metadata is present, and the type is ConfigurationMetadata or ConfigurationMetadata[].
@@ -190,7 +190,7 @@ public final class PropertyMetadata<T> extends AbstractMetadata<PropertyMetadata
         return configurationMetadata != null
                 && (this.type.equals(ConfigurationMetadata.class) || this.type.equals(ConfigurationMetadata[].class));
     }
-    
+
     @Override
     public String toString() {
         return getName() + "[" + this.type.getSimpleName() + "]";
diff --git a/src/test/java/org/apache/sling/caconfig/resource/spi/ContextResourceTest.java b/src/test/java/org/apache/sling/caconfig/resource/spi/ContextResourceTest.java
index 5b95824..dbf8c44 100644
--- a/src/test/java/org/apache/sling/caconfig/resource/spi/ContextResourceTest.java
+++ b/src/test/java/org/apache/sling/caconfig/resource/spi/ContextResourceTest.java
@@ -29,13 +29,13 @@ import org.junit.Rule;
 import org.junit.Test;
 
 public class ContextResourceTest {
-    
+
     @Rule
     public SlingContext context = new SlingContext();
-    
+
     private Resource resource1;
     private Resource resource2;
-    
+
     @Before
     public void setUp() {
         resource1 = context.create().resource("/content/test1");
diff --git a/src/test/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadataTest.java b/src/test/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadataTest.java
index 83bd8f5..30bb4ed 100644
--- a/src/test/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadataTest.java
+++ b/src/test/java/org/apache/sling/caconfig/spi/metadata/ConfigurationMetadataTest.java
@@ -37,12 +37,12 @@ public class ConfigurationMetadataTest {
         assertEquals("name1", underTest.getName());
         assertTrue(underTest.isSingleton());
         assertFalse(underTest.isCollection());
-        
+
         Map<String,String> props = ImmutableMap.of("p1", "v1");
         underTest.label("label1")
             .description("desc1")
             .properties(props);
-        
+
         assertEquals("label1", underTest.getLabel());
         assertEquals("desc1", underTest.getDescription());
         assertEquals(props, underTest.getProperties());
diff --git a/src/test/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadataTest.java
index 87e8417..ae70e1d 100644
--- a/src/test/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadataTest.java
+++ b/src/test/java/org/apache/sling/caconfig/spi/metadata/PropertyMetadataTest.java
@@ -35,7 +35,7 @@ public class PropertyMetadataTest {
         PropertyMetadata<String> underTest = new PropertyMetadata<>("name1", String.class);
         assertEquals("name1", underTest.getName());
         assertEquals(String.class, underTest.getType());
-        
+
         ConfigurationMetadata configMetadata = new ConfigurationMetadata("test", ImmutableList.<PropertyMetadata<?>>of(), false);
         Map<String,String> props = ImmutableMap.of("p1", "v1");
         underTest.label("label1")
@@ -43,7 +43,7 @@ public class PropertyMetadataTest {
             .defaultValue("value1")
             .properties(props)
             .configurationMetadata(configMetadata);
-        
+
         assertEquals("label1", underTest.getLabel());
         assertEquals("desc1", underTest.getDescription());
         assertEquals("value1", underTest.getDefaultValue());
@@ -99,10 +99,10 @@ public class PropertyMetadataTest {
         PropertyMetadata<String> stringProp = new PropertyMetadata<>("name1", "defValue");
         assertEquals("defValue", stringProp.getDefaultValue());
         assertEquals(String.class, stringProp.getType());
-        
+
         PropertyMetadata<Integer> intProp = new PropertyMetadata<>("name1", 5);
         assertEquals((Integer)5, intProp.getDefaultValue());
         assertEquals(int.class, intProp.getType());
     }
-    
+
 }