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 09:18:46 UTC

[sling-org-apache-sling-caconfig-api] annotated tag org.apache.sling.caconfig.api-1.0.0 created (now 7d3b9bb)

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

rombert pushed a change to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git.


      at 7d3b9bb  (tag)
 tagging c9ef1d454de0353ba017bfd74b26f2e4e8bb1d60 (commit)
      by Stefan Seifert
      on Fri Oct 14 22:18:36 2016 +0000

- Log -----------------------------------------------------------------
org.apache.sling.caconfig.api-1.0.0
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new fd452cb  SLING-5886 : Add draft api
     new 77b18cf  SLING-5886 : Refactor packages and update javadocs
     new 677765a  SLING-5886 : Add dummy implementation
     new c669426  SLING-5886 : Remove SPI for now
     new fc3ecc6  SLING-5886 : Merge in confmgr implementation
     new 42b0031  SLING-5886 : Use converter service
     new a8cae31  SLING-5886 : Clarify API and implement accordingly
     new d0566e8  update to parent 28
     new 4826c70  SLING-5886 unify package names - always use "contextaware.config" in package name e.g. do not use org.apache.sling.contextaware.resource as package name for "ConfigurationResourceResolver" because it also has "configration" in it's name unify sling API dependency version
     new 239aa27  SLING-5886 rename folder to contextaware-config to keep it in line with package name contextaware.config update poms
     new e24c5b8  SLING-5886 use consistent wording for "Context-Aware Configuration"
     new a736f2d  SLING-5886 make sure config converstion to class never returns null. allow throwing of ConversionException as it cannot be suppressed currently completely anyway
     new 27b75fa  SLING-5982 implement support for nested configuration classes, and use native valuemap support for type conversion
     new e6edc8a  SLING-6016 split up annotation class/valuemap/adaptable usecases into separate methods and make return value handling consistent
     new c26f9d4  SLING-6024 Context-Aware Config: Introduce "bucket name" parameter in ConfigurationResourceResolver
     new 96d253b  SLING-6029 default folder name to /conf rename the sling:config property name to sling:config-ref
     new a45b1ea  SLING-6025 Context-Aware Config: Provide configuration parameter metadata
     new 69f4d50  SLING-5886 rename to "context-aware" config
     new 743a808  SLING-6023 Summary: Context-Aware Config: Add pluggable context paths strategies SLING-6026 Summary: Context-Aware Config: Pluggable configuration persistence
     new bc14a47  update to released versions
     new bf5306b  SLING-6057 Context-Aware Config: Separate Maven Project for SPI
     new f5dd0f0  SLING-6157 Context-Aware Config: Change java package name to o.a.s.caconfig
     new d36e6d0  [maven-release-plugin] prepare release org.apache.sling.caconfig.api-1.0.0
     new c9ef1d4  [maven-release-plugin] copy for tag org.apache.sling.caconfig.api-1.0.0

The 24 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.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-caconfig-api] 06/24: SLING-5886 : Use converter service

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 42b0031b550066a5a95f3a008d98493a461d9d56
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Aug 3 12:03:03 2016 +0000

    SLING-5886 : Use converter service
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1755082 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/contextaware/resource/ConfigurationResourceResolver.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
index 936313f..8c88897 100644
--- a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
@@ -28,7 +28,7 @@ import org.osgi.annotation.versioning.ProviderType;
 
 /**
  * Getting context-specific configuration resources for a given resource context.
- * This is a low-level interface for supporting advanced usecases. If you just want to fetch
+ * This is a low-level interface for supporting advanced use cases. If you just want to fetch
  * some configuration parameters {@link ConfigurationResolver} is the right place.
  */
 @ProviderType
@@ -36,6 +36,8 @@ public interface ConfigurationResourceResolver {
 
     /**
      * Get a context-specific singleton configuration resource defined by the given configuration name.
+     *
+     * TODO - can we always ensure to return a resource?
      * @param resource Context resource to fetch configuration for
      * @param configName Configuration name or relative path.
      * @return Configuration resource

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 17/24: SLING-6025 Context-Aware Config: Provide configuration parameter metadata

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit a45b1eac2b59afd7641f2110ab44d6544093ad10
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Sep 9 13:31:23 2016 +0000

    SLING-6025 Context-Aware Config: Provide configuration parameter metadata
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1760017 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  23 +++++
 .../config/annotation/Configuration.java           |  53 +++++++++++
 .../Property.java}                                 |  31 ++++++-
 .../config/{ => annotation}/package-info.java      |   4 +-
 .../sling/contextaware/config/package-info.java    |   2 +-
 .../ConfigurationMetadataProvider.java}            |  30 +++++-
 .../config/spi/metadata/AbstractMetadata.java      |  99 ++++++++++++++++++++
 .../config/spi/metadata/ConfigurationMetadata.java |  79 ++++++++++++++++
 .../config/spi/metadata/PropertyMetadata.java      | 103 +++++++++++++++++++++
 .../config/{ => spi/metadata}/package-info.java    |   4 +-
 .../config/{ => spi}/package-info.java             |   4 +-
 .../spi/metadata/ConfigurationMetadataTest.java    |  53 +++++++++++
 .../config/spi/metadata/PropertyMetadataTest.java  |  79 ++++++++++++++++
 13 files changed, 551 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index a9254d9..5bed74c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,14 +56,37 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
             <version>2.9.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.sling-mock</artifactId>
+            <version>1.7.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>2.0.87-beta</version>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/contextaware/config/annotation/Configuration.java b/src/main/java/org/apache/sling/contextaware/config/annotation/Configuration.java
new file mode 100644
index 0000000..06a1477
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/annotation/Configuration.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks an annotation class to be useable with Sling context-aware configuration. 
+ */
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Configuration {
+
+    /**
+     * @return Allows to overwrite the configuration name. If not set the class name of the annotation is used.
+     */
+    String name() default "";
+    
+    /**
+     * @return Label for the resource (e.g. for configuration editor GUIs).
+     */
+    String label() default "";
+    
+    /**
+     * @return Description for the resource (e.g. for configuration editor GUIs).
+     */
+    String description() default "";
+    
+    /**
+     * @return Further properties e.g. for configuration editor GUIs.
+     */
+    String[] property() default {};
+    
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/package-info.java b/src/main/java/org/apache/sling/contextaware/config/annotation/Property.java
similarity index 50%
copy from src/main/java/org/apache/sling/contextaware/config/package-info.java
copy to src/main/java/org/apache/sling/contextaware/config/annotation/Property.java
index ccfe13b..911c2bd 100644
--- a/src/main/java/org/apache/sling/contextaware/config/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/annotation/Property.java
@@ -16,8 +16,33 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.sling.contextaware.config.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
 /**
- * API for accessing context-specific configuration.
+ * Adds further metadata for properties of context-aware configuration annotation classes.
  */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config;
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Property {
+
+    /**
+     * @return Label for the property (e.g. for configuration editor GUIs).
+     */
+    String label() default "";
+    
+    /**
+     * @return Description for the property (e.g. for configuration editor GUIs).
+     */
+    String description() default "";
+    
+    /**
+     * @return Further properties e.g. for configuration editor GUIs.
+     */
+    String[] property() default {};
+    
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/package-info.java b/src/main/java/org/apache/sling/contextaware/config/annotation/package-info.java
similarity index 89%
copy from src/main/java/org/apache/sling/contextaware/config/package-info.java
copy to src/main/java/org/apache/sling/contextaware/config/annotation/package-info.java
index ccfe13b..9a71f4d 100644
--- a/src/main/java/org/apache/sling/contextaware/config/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/annotation/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * API for accessing context-specific configuration.
+ * Annotations for context-aware configurations.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config;
+package org.apache.sling.contextaware.config.annotation;
diff --git a/src/main/java/org/apache/sling/contextaware/config/package-info.java b/src/main/java/org/apache/sling/contextaware/config/package-info.java
index ccfe13b..9602c19 100644
--- a/src/main/java/org/apache/sling/contextaware/config/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * API for accessing context-specific configuration.
+ * API for accessing context-aware configuration.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
 package org.apache.sling.contextaware.config;
diff --git a/src/main/java/org/apache/sling/contextaware/config/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
similarity index 51%
copy from src/main/java/org/apache/sling/contextaware/config/package-info.java
copy to src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
index ccfe13b..92ac552 100644
--- a/src/main/java/org/apache/sling/contextaware/config/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
@@ -16,8 +16,32 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.sling.contextaware.config.spi;
+
+import java.util.SortedSet;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
+import org.osgi.annotation.versioning.ConsumerType;
+
 /**
- * API for accessing context-specific configuration.
+ * Allows application to provide the necessary metadata for configurations.
  */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config;
+@ConsumerType
+public interface ConfigurationMetadataProvider {
+
+    /**
+     * Get all configuration names.
+     * @return Configuration names
+     */
+    @Nonnull SortedSet<String> getConfigurationNames();
+
+    /**
+     * Get configuration metadata.
+     * @param configName Configuration name
+     * @return Configuration metadata or null if none exists for the given name.
+     */
+    ConfigurationMetadata getConfigurationMetadata(String configName);
+
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java
new file mode 100644
index 0000000..bd1f70b
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.spi.metadata;
+
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Common properties for configuration and properties.
+ */
+@ProviderType
+abstract class AbstractMetadata {
+
+    private final String name;
+    private String label;
+    private String description;
+    private Map<String,String> properties;
+
+    public AbstractMetadata(@Nonnull String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Invalid name: " + name);
+        }
+        this.name = name;
+    }
+    
+    /**
+     * @return Parameter name
+     */
+    public @Nonnull String getName() {
+        return this.name;
+    }
+    
+    /**
+     * @return Label
+     */
+    public String getLabel() {
+        return label;
+    }
+
+    /**
+     * @param label Label
+     */
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    /**
+     * @return Description
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * @param description Description
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * @return Further properties for documentation and configuration of behavior in configuration editor.
+     */
+    public Map<String,String> getProperties() {
+        return this.properties;
+    }
+    
+    /**
+     * @param properties Further properties for documentation and configuration of behavior in configuration editor.
+     */
+    public void setProperties(Map<String,String> properties) {
+        this.properties = properties;
+    }
+    
+    @Override
+    public String toString() {
+        return this.name;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
new file mode 100644
index 0000000..a838f56
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.spi.metadata;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Defines a configuration.
+ */
+@ProviderType
+public final class ConfigurationMetadata extends AbstractMetadata {
+
+    private boolean isList;
+    private List<PropertyMetadata<?>> propertyMetadata;
+
+    /**
+     * @param name Configuration name
+     */
+    public ConfigurationMetadata(@Nonnull String name) {
+        super(name);
+    }
+    
+    /**
+     * @return true if configuration is singleton
+     */
+    public boolean isSingleton() {
+        return !isList;
+    }
+    
+    /**
+     * @return true if configuration is list
+     */
+    public boolean isList() {
+        return isList;
+    }
+
+    /**
+     * @param isList true if configuration is list
+     */
+    public void setList(boolean isList) {
+        this.isList = isList;
+    }
+
+    /**
+     * @return Configuration properties
+     */
+    public Collection<PropertyMetadata<?>> getPropertyMetadata() {
+        return this.propertyMetadata;
+    }
+
+    /**
+     * @param propertyMetadata Configuration properties
+     */
+    public void setPropertyMetadata(List<PropertyMetadata<?>> propertyMetadata) {
+        this.propertyMetadata = propertyMetadata;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
new file mode 100644
index 0000000..fa6735a
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.spi.metadata;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Defines a configuration property.
+ * @param <T> Property value type
+ */
+@ProviderType
+public final class PropertyMetadata<T> extends AbstractMetadata {
+
+    private static final Class<?>[] SUPPORTED_TYPES_ARRAY = {
+        String.class,
+        int.class,
+        long.class,
+        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;
+
+    public PropertyMetadata(@Nonnull String name, @Nonnull Class<T> type) {
+        super(name);
+        if (type == null || !isSupportedType(type)) {
+            throw new IllegalArgumentException("Parameter '" + name + "': Invalid type " + type);
+        }
+        this.type = type;
+    }
+    
+    private static boolean isSupportedType(Class<?> paramType) {
+        if (paramType.isArray()) {
+            return isSupportedType(paramType.getComponentType());
+        }
+        for (Class<?> type : SUPPORTED_TYPES) {
+            if (type.equals(paramType)) {
+                return true;
+            }
+        }
+        if (paramType == ConfigurationMetadata.class) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @return Parameter type
+     */
+    public @Nonnull Class<T> getType() {
+        return this.type;
+    }
+
+    /**
+     * @return Default value if parameter is not set for configuration
+     */
+    public T getDefaultValue() {
+        return this.defaultValue;
+    }
+    
+    /**
+     * @param value Default value if parameter is not set for configuration
+     */
+    public void setDefaultValue(T value) {
+        this.defaultValue = value;
+    }
+
+    @Override
+    public String toString() {
+        return getName() + "[" + this.type.getSimpleName() + "]";
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
similarity index 87%
copy from src/main/java/org/apache/sling/contextaware/config/package-info.java
copy to src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
index ccfe13b..0372745 100644
--- a/src/main/java/org/apache/sling/contextaware/config/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * API for accessing context-specific configuration.
+ * Defining configuration and parameter metadata for the SPI.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config;
+package org.apache.sling.contextaware.config.spi.metadata;
diff --git a/src/main/java/org/apache/sling/contextaware/config/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
similarity index 84%
copy from src/main/java/org/apache/sling/contextaware/config/package-info.java
copy to src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
index ccfe13b..76033c3 100644
--- a/src/main/java/org/apache/sling/contextaware/config/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * API for accessing context-specific configuration.
+ * SPI for applications hooking into the configuration infrastructure for parameterizing and customizing.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config;
+package org.apache.sling.contextaware.config.spi;
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
new file mode 100644
index 0000000..b5cf061
--- /dev/null
+++ b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.spi.metadata;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Map;
+
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+public class ConfigurationMetadataTest {
+
+    @Test
+    public void testProps() {
+        ConfigurationMetadata underTest = new ConfigurationMetadata("name1");
+        assertEquals("name1", underTest.getName());
+        assertTrue(underTest.isSingleton());
+        assertFalse(underTest.isList());
+        
+        underTest.setLabel("label1");
+        underTest.setDescription("desc1");
+        underTest.setList(true);
+        Map<String,String> props = ImmutableMap.of("p1", "v1");
+        underTest.setProperties(props);
+        
+        assertEquals("label1", underTest.getLabel());
+        assertEquals("desc1", underTest.getDescription());
+        assertFalse(underTest.isSingleton());
+        assertTrue(underTest.isList());
+        assertEquals(props, underTest.getProperties());
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
new file mode 100644
index 0000000..fb9a7b0
--- /dev/null
+++ b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.spi.metadata;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Map;
+
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+public class PropertyMetadataTest {
+
+    @Test
+    public void testProps() {
+        PropertyMetadata<String> underTest = new PropertyMetadata<>("name1", String.class);
+        assertEquals("name1", underTest.getName());
+        assertEquals(String.class, underTest.getType());
+        
+        underTest.setLabel("label1");
+        underTest.setDescription("desc1");
+        underTest.setDefaultValue("value1");
+        Map<String,String> props = ImmutableMap.of("p1", "v1");
+        underTest.setProperties(props);
+        
+        assertEquals("label1", underTest.getLabel());
+        assertEquals("desc1", underTest.getDescription());
+        assertEquals("value1", underTest.getDefaultValue());
+        assertEquals(props, underTest.getProperties());
+    }
+
+    @Test
+    public void testAllowedTypes() {
+        new PropertyMetadata<>("name1", String.class);
+        new PropertyMetadata<>("name1", String[].class);
+        new PropertyMetadata<>("name1", int.class);
+        new PropertyMetadata<>("name1", int[].class);
+        new PropertyMetadata<>("name1", long.class);
+        new PropertyMetadata<>("name1", long[].class);
+        new PropertyMetadata<>("name1", double.class);
+        new PropertyMetadata<>("name1", double[].class);
+        new PropertyMetadata<>("name1", boolean.class);
+        new PropertyMetadata<>("name1", boolean[].class);
+    }
+
+    @Test
+    public void testNestedConfiguration() {
+        new PropertyMetadata<>("name1", ConfigurationMetadata.class);
+        new PropertyMetadata<>("name1", ConfigurationMetadata[].class);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testDisallowedType() {
+        new PropertyMetadata<>("name1", Object.class);
+    }
+
+    @Test(expected=IllegalArgumentException.class)
+    public void testNullNale() {
+        new PropertyMetadata<>(null, Object.class);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 10/24: SLING-5886 rename folder to contextaware-config to keep it in line with package name contextaware.config update poms

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 239aa278975ab16db4f57c82d4853c89b94fe602
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Aug 19 12:09:04 2016 +0000

    SLING-5886 rename folder to contextaware-config to keep it in line with package name contextaware.config
    update poms
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1756908 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9223622..2d5f69a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -17,7 +17,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -34,9 +34,9 @@
     <description>Apache Sling Context-Aware-Config API</description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api</connection>
-        <developerConnection> scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/context-aware-config/api</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/api</url>
     </scm>
     
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 15/24: SLING-6024 Context-Aware Config: Introduce "bucket name" parameter in ConfigurationResourceResolver

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit c26f9d4a1de3457f6f54f727c94311fe0b1fcdd5
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 1 12:29:30 2016 +0000

    SLING-6024 Context-Aware Config: Introduce "bucket name" parameter in ConfigurationResourceResolver
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1758767 13f79535-47bb-0310-9956-ffa450edef68
---
 .../config/resource/ConfigurationResourceResolver.java         | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
index c52aeda..6ebd698 100644
--- a/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
@@ -39,18 +39,24 @@ public interface ConfigurationResourceResolver {
      * Get a context-specific singleton configuration resource defined by the given configuration name.
      *
      * @param resource Context resource to fetch configuration for
+     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
+     *     it's configuration data grouped in a child resource of the configuration resource. This is what
+     *     we call a "bucket", and the resource name is specified with this parameter.
      * @param configName Configuration name or relative path.
      * @return Configuration resource or {@code null}.
      */
-    @CheckForNull Resource getResource(@Nonnull Resource resource, @Nonnull String configName);
+    @CheckForNull Resource getResource(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
 
     /**
      * Get a collection of context-specific configuration resources defined by the given configuration name.
      * @param resource Context resource to fetch configuration for
+     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
+     *     it's configuration data grouped in a child resource of the configuration resource. This is what
+     *     we call a "bucket", and the resource name is specified with this parameter.
      * @param configName Configuration name or relative path.
      * @return Collection of configuration resources, the collection might be empty.
      */
-    @Nonnull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String configName);
+    @Nonnull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
 
     /**
      * Get the inner-most context path (deepest path) returned by {@link #getAllContextPaths(Resource)}.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 18/24: SLING-5886 rename to "context-aware" config

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 69f4d501d1e7b32b96d891056b9721ae21175f40
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Sep 12 11:23:35 2016 +0000

    SLING-5886 rename to "context-aware" config
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1760334 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/contextaware/config/ConfigurationResolver.java       |  2 +-
 .../config/resource/ConfigurationResourceResolver.java         | 10 +++++-----
 .../sling/contextaware/config/resource/package-info.java       |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
index c59c372..c1aab2e 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
@@ -24,7 +24,7 @@ import org.apache.sling.api.resource.Resource;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
- * Getting context-specific configurations for a given resource context.
+ * Getting context-aware configurations for a given resource context.
  * Context-specific configuration may be different for different parts of the resource
  * hierarchy, and configuration parameter inheritance may take place.
  *
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
index 6ebd698..be8160e 100644
--- a/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
@@ -27,7 +27,7 @@ import org.apache.sling.api.resource.Resource;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
- * Getting context-specific configuration resources for a given resource context.
+ * Getting context-aware configuration resources for a given resource context.
  * This is a low-level interface for supporting advanced use cases. If you just want to fetch
  * some configuration parameters {@link org.apache.sling.contextaware.config.ConfigurationResolver}
  * is the right place.
@@ -36,7 +36,7 @@ import org.osgi.annotation.versioning.ProviderType;
 public interface ConfigurationResourceResolver {
 
     /**
-     * Get a context-specific singleton configuration resource defined by the given configuration name.
+     * Get a context-aware singleton configuration resource defined by the given configuration name.
      *
      * @param resource Context resource to fetch configuration for
      * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
@@ -48,7 +48,7 @@ public interface ConfigurationResourceResolver {
     @CheckForNull Resource getResource(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
 
     /**
-     * Get a collection of context-specific configuration resources defined by the given configuration name.
+     * Get a collection of context-aware configuration resources defined by the given configuration name.
      * @param resource Context resource to fetch configuration for
      * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
      *     it's configuration data grouped in a child resource of the configuration resource. This is what
@@ -66,9 +66,9 @@ public interface ConfigurationResourceResolver {
     String getContextPath(@Nonnull Resource resource);
 
     /**
-     * Get all context paths for which context-specific configurations could be defined.
+     * Get all context paths for which context-aware configurations could be defined.
      * The context paths are always ancestors of the resource path, or the resource path itself.
-     * Which ancestors are allowed for context-specific configuration depends on configuration.
+     * Which ancestors are allowed for context-aware configuration depends on configuration.
      * @param resource Context resource to fetch configuration for
      * @return List of context paths
      */
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java b/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
index c14e498..e91b4cd 100644
--- a/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * API for accessing context-specific configuration resources.
+ * API for accessing context-aware configuration resources.
  * This is a low-level API.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 12/24: SLING-5886 make sure config converstion to class never returns null. allow throwing of ConversionException as it cannot be suppressed currently completely anyway

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit a736f2d544531067443bbc5ee5adbd585e10f216
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Aug 19 16:11:42 2016 +0000

    SLING-5886 make sure config converstion to class never returns null.
    allow throwing of ConversionException as it cannot be suppressed currently completely anyway
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1756928 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/contextaware/config/ConfigurationBuilder.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
index 1842d90..dc1447e 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
@@ -42,16 +42,14 @@ public interface ConfigurationBuilder {
     /**
      * Get configuration as singleton and its properties mapped to the given annotation class.
      * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
-     * @return Configuration object or {@code null} if the conversion failed or the provided name
-     *         is invalid.
+     * @return Configuration object. Contains only the default values if the conversion fails or the provided name is invalid.
      */
     @Nonnull <T> T as(@Nonnull Class<T> clazz);
 
     /**
      * Get collection of configuration instances with its properties mapped to the given annotation class.
      * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
-     * @return Collection of configuration objects, might be empty if conversion failed or the
-     *         provided name is invalid.
+     * @return Collection of configuration objects. Might be empty if the provided name is invalid.
      */
     @Nonnull <T> Collection<T> asCollection(@Nonnull Class<T> clazz);
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 08/24: update to parent 28

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit d0566e8a129d83c288335711768166f690d3064e
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Aug 18 10:28:08 2016 +0000

    update to parent 28
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1756754 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 01f197c..8556d61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>27</version>
+        <version>28</version>
         <relativePath />
     </parent>
     

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 03/24: SLING-5886 : Add dummy implementation

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 677765a3405c8d65a4e33d2a410ea06c9b3362fd
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jul 29 13:12:04 2016 +0000

    SLING-5886 : Add dummy implementation
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1754513 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index e00d9e4..01f197c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
         <relativePath />
     </parent>
     
-    <artifactId>org.apache.sling.config.api</artifactId>
+    <artifactId>org.apache.sling.contextaware.config.api</artifactId>
     <packaging>bundle</packaging>
     <version>1.0.0-SNAPSHOT</version>
     <name>Apache Sling Context-Aware-Config API</name>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 11/24: SLING-5886 use consistent wording for "Context-Aware Configuration"

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit e24c5b8ef636fa90b15975f551bcbeadfa0f5050
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Aug 19 13:56:07 2016 +0000

    SLING-5886 use consistent wording for "Context-Aware Configuration"
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1756918 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2d5f69a..a9254d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,8 +30,8 @@
     <artifactId>org.apache.sling.contextaware.config.api</artifactId>
     <packaging>bundle</packaging>
     <version>1.0.0-SNAPSHOT</version>
-    <name>Apache Sling Context-Aware-Config API</name>
-    <description>Apache Sling Context-Aware-Config API</description>
+    <name>Apache Sling Context-Aware Configuration API</name>
+    <description>Apache Sling Context-Aware Configuration API</description>
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api</connection>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 20/24: update to released versions

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit bc14a47856a05388cac071d6a8b71a3b99e0474b
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Sep 19 15:42:38 2016 +0000

    update to released versions
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1761470 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2d10043..8f0f1a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,13 +75,13 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
-            <version>2.0.5-SNAPSHOT</version>
+            <version>2.1.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-            <version>1.7.1-SNAPSHOT</version>
+            <version>1.8.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 09/24: SLING-5886 unify package names - always use "contextaware.config" in package name e.g. do not use org.apache.sling.contextaware.resource as package name for "ConfigurationResourceResolver" because it also has "configration" in it's name unify sling API dependency version

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 4826c7034339461e231e597b87af633a23cb99f2
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Aug 19 09:57:41 2016 +0000

    SLING-5886 unify package names - always use "contextaware.config" in package name
    e.g. do not use org.apache.sling.contextaware.resource as package name for "ConfigurationResourceResolver" because it also has "configration" in it's name
    unify sling API dependency version
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1756894 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                             | 2 +-
 .../{ => config}/resource/ConfigurationResourceResolver.java        | 6 +++---
 .../sling/contextaware/{ => config}/resource/package-info.java      | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8556d61..9223622 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,7 +58,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.4.0</version>
+            <version>2.9.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
similarity index 93%
rename from src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
rename to src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
index a06400c..c52aeda 100644
--- a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.contextaware.resource;
+package org.apache.sling.contextaware.config.resource;
 
 import java.util.Collection;
 
@@ -24,13 +24,13 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.contextaware.config.ConfigurationResolver;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
  * Getting context-specific configuration resources for a given resource context.
  * This is a low-level interface for supporting advanced use cases. If you just want to fetch
- * some configuration parameters {@link ConfigurationResolver} is the right place.
+ * some configuration parameters {@link org.apache.sling.contextaware.config.ConfigurationResolver}
+ * is the right place.
  */
 @ProviderType
 public interface ConfigurationResourceResolver {
diff --git a/src/main/java/org/apache/sling/contextaware/resource/package-info.java b/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
similarity index 94%
rename from src/main/java/org/apache/sling/contextaware/resource/package-info.java
rename to src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
index 4344ba3..c14e498 100644
--- a/src/main/java/org/apache/sling/contextaware/resource/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
@@ -21,4 +21,4 @@
  * This is a low-level API.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.resource;
+package org.apache.sling.contextaware.config.resource;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 05/24: SLING-5886 : Merge in confmgr implementation

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit fc3ecc6a7d805b3e8c88674ca8eab04a1a6aa8b6
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jul 29 13:22:22 2016 +0000

    SLING-5886 : Merge in confmgr implementation
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1754520 13f79535-47bb-0310-9956-ffa450edef68
---
 .../resource/ConfigurationResourceResolver.java           | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
index e8f85d3..936313f 100644
--- a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
@@ -23,6 +23,7 @@ import java.util.Collection;
 import javax.annotation.Nonnull;
 
 import org.apache.sling.api.resource.Resource;
+import org.apache.sling.contextaware.config.ConfigurationResolver;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
@@ -34,21 +35,21 @@ import org.osgi.annotation.versioning.ProviderType;
 public interface ConfigurationResourceResolver {
 
     /**
-     * Get a context-specific singleton configuration resource defined by the given configuration name. 
+     * Get a context-specific singleton configuration resource defined by the given configuration name.
      * @param resource Context resource to fetch configuration for
      * @param configName Configuration name or relative path.
      * @return Configuration resource
      */
     @Nonnull Resource getResource(@Nonnull Resource resource, @Nonnull String configName);
-    
+
     /**
-     * Get a list of context-specific configuration resources defined by the given configuration name. 
+     * Get a collection of context-specific configuration resources defined by the given configuration name.
      * @param resource Context resource to fetch configuration for
      * @param configName Configuration name or relative path.
-     * @return List of configuration resources
+     * @return Collection of configuration resources
      */
-    @Nonnull Collection<Resource> getResourceList(@Nonnull Resource resource, @Nonnull String configName);
-    
+    @Nonnull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String configName);
+
     /**
      * Get the inner-most context path (deepest path) returned by {@link #getAllContextPaths(Resource)}.
      * @param resource Context resource to fetch configuration for
@@ -64,5 +65,5 @@ public interface ConfigurationResourceResolver {
      * @return List of context paths
      */
     @Nonnull Collection<String> getAllContextPaths(@Nonnull Resource resource);
-    
+
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 04/24: SLING-5886 : Remove SPI for now

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit c6694269fb7fb100ee3abd34e650dd2f468cf25e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jul 29 13:14:49 2016 +0000

    SLING-5886 : Remove SPI for now
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1754517 13f79535-47bb-0310-9956-ffa450edef68
---
 .../config/spi/ConfigurationMetadataProvider.java  | 39 ----------
 .../config/spi/ConfigurationOverrideProvider.java  | 68 -----------------
 .../spi/ConfigurationPersistenceProvider.java      | 60 ---------------
 .../config/spi/ContextPathStrategy.java            | 44 -----------
 .../spi/metadata/AbstractConfigurationPart.java    | 65 ----------------
 .../config/spi/metadata/ConfigurationMetadata.java | 73 ------------------
 .../config/spi/metadata/ConfigurationPart.java     | 44 -----------
 .../config/spi/metadata/PropertyMetadata.java      | 86 ----------------------
 .../config/spi/metadata/package-info.java          | 23 ------
 .../contextaware/config/spi/package-info.java      | 23 ------
 .../spi/metadata/ConfigurationMetadataTest.java    | 62 ----------------
 .../config/spi/metadata/PropertyMetadataTest.java  | 53 -------------
 12 files changed, 640 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
deleted file mode 100644
index a260aca..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi;
-
-import java.util.Collection;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Allows application to provide the necessary metadata for configurations.
- */
-@ConsumerType
-public interface ConfigurationMetadataProvider {
-
-    /**
-     * @return Configuration metadata that the application defines
-     */
-    @Nonnull Collection<ConfigurationMetadata> getConfigSets();
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java
deleted file mode 100644
index acd4d66..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Provides configuration override values (default or forced).
- */
-@ConsumerType
-public interface ConfigurationOverrideProvider {
-
-    /**
-     * Returns a map with key value pairs for configuration parameter override.
-     * <p>
-     * Key:
-     * </p>
-     * <ul>
-     * <li>Syntax: <code>[{scope}[:locked]]{configName}/{propertyName}</code></li>
-     * <li><code>{scope}</code>: if "default", the system default parameter is overridden. Otherwise <code>{scope}</code>
-     * may define a context path, in this case the configuration set's property value is overwritten by force for this
-     * context path. If the [{scope}] part is missing or [locked], the parameter is overridden for all context paths.</li>
-     * <li><code>locked</code>: If the scope value is suffixed with the string &quot;:locked&quot; this configuration
-     * parameter cannot be overridden in nested configuration scopes.</li>
-     * <li><code>{configName}</code>: Configuration name</li>
-     * <li><code>{propertyName}</code>: Configuration property name</li>
-     * </ul>
-     * <p>
-     * Examples:
-     * </p>
-     * <ul>
-     * <li><code>[default]set1/param1</code> - Override default value for property "param1" from set "set1"</li>
-     * <li><code>set1/param1</code> - Override value for property "param1" from set "set1" for all context paths</li>
-     * <li><code>[/content/region1/site1]set1/param1</code> - Override value for property "param1" from set "set1" for the context path
-     * <code>/content/region1/site1</code>. This has higher precedence than the other variants.</li>
-     * </ul>
-     * <p>
-     * Value:
-     * </p>
-     * <ul>
-     *  <li>Override value</li>
-     * <li>Has to be convertible to the property's type</li>
-     * </ul>
-     * @return Map
-     */
-    @Nonnull Map<String, String> getOverrideMap();
-    
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java
deleted file mode 100644
index e62b520..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.PersistenceException;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Provides configuration persistence implementations.
- */
-@ConsumerType
-public interface ConfigurationPersistenceProvider {
-
-    /**
-     * Get all configuration values stored for a context path.
-     * @param resolver Resource resolver
-     * @param contextPath Context path
-     * @param configNames If a set of config names is given only configuration for these names is returned.
-     *      Otherwise all are returned.
-     * @return Configuration names with value map containing the configuration set properties.
-     *      Returns null if no parameters stored for this context paths, allowing other 
-     *      persistence providers to step in.
-     */
-    Map<String, Map<String, Object>> get(@Nonnull ResourceResolver resolver, @Nonnull String contextPath, String... configNames);
-
-    /**
-     * Writes configuration values for a context paths. For each configuration name contained in the values map all existing 
-     * parameter values are erased before writing the new ones.
-     * @param resolver Resource resolver
-     * @param contextPath Context path
-     * @param values Configuration names with value map containing the configuration set properties.
-     * @return true if configurations are accepted. false if this provider does not accept storing 
-     *          the configurations and the next provider should be asked to store them.
-     * @throws PersistenceException Persistence exception is thrown when storing configurations failed.
-     */
-    boolean store(@Nonnull ResourceResolver resolver, @Nonnull String contextPath, @Nonnull String configName,
-            @Nonnull Map<String, Map<String, Object>> values) throws PersistenceException;
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java b/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java
deleted file mode 100644
index 6935013..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi;
-
-import java.util.Collection;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.Resource;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Allows application to define a strategy to find context paths for content paths.
- * Each context path may have it's own context-specific configuration.
- */
-@ConsumerType
-public interface ContextPathStrategy {
-
-    /**
-     * Finds context paths for the given context resource.
-     * @param resource Context resource
-     * @return Context paths that where detected in the given path
-     *      (in order of closest matching first).
-     *      If none are found an empty list is returned.
-     */
-    @Nonnull Collection<String> findContextPaths(@Nonnull Resource resource);
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java
deleted file mode 100644
index 2b7fa39..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import java.util.HashMap;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.api.wrappers.ValueMapDecorator;
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration set.
- */
-@ProviderType
-abstract class AbstractConfigurationPart implements ConfigurationPart {
-
-    private final String name;
-    private final ValueMap properties = new ValueMapDecorator(new HashMap<String, Object>());
-
-    public AbstractConfigurationPart(@Nonnull String name) {
-        if (name == null || !ConfigurationPart.NAME_PATTERN.matcher(name).matches()) {
-            throw new IllegalArgumentException("Invalid name: " + name);
-        }
-        this.name = name;
-    }
-    
-    /**
-     * @return Parameter name
-     */
-    public @Nonnull String getName() {
-        return this.name;
-    }
-
-    /**
-     * @return Further properties for documentation and configuration of
-     *         behavior in configuration editor.
-     */
-    public @Nonnull ValueMap getProperties() {
-        return this.properties;
-    }
-    
-    @Override
-    public String toString() {
-        return this.name;
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
deleted file mode 100644
index 91a7480..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration set.
- */
-@ProviderType
-public final class ConfigurationMetadata extends AbstractConfigurationPart {
-
-    private boolean isList;
-    private final List<ConfigurationPart> parts = new ArrayList<>();
-
-    /**
-     * @param name Configuration name
-     */
-    public ConfigurationMetadata(@Nonnull String name) {
-        super(name);
-    }
-    
-    /**
-     * @return true if configuration is singleton
-     */
-    public boolean isSingleton() {
-        return !isList;
-    }
-    
-    /**
-     * @return true if configuration is list
-     */
-    public boolean isList() {
-        return isList;
-    }
-
-    /**
-     * @param isList true if configuration is list
-     */
-    public void setList(boolean isList) {
-        this.isList = isList;
-    }
-
-    /**
-     * @return Configuration set parts
-     */
-    public @Nonnull Collection<ConfigurationPart> getParts() {
-        return this.parts;
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java
deleted file mode 100644
index 23be0c5..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import java.util.regex.Pattern;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Part of configuration set.
- */
-@ProviderType
-public interface ConfigurationPart {
-
-    /**
-     * Pattern for allowed configuration part names.
-     */
-    Pattern NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9\\-\\_\\.]+(/[a-zA-Z0-9\\-\\_\\.]+)*$");
-    
-    /**
-     * Configuration part name
-     * @return
-     */
-    @Nonnull String getName();
-    
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
deleted file mode 100644
index e6ed34d..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration property.
- * @param <T> Property value type
- */
-@ProviderType
-public final class PropertyMetadata<T> extends AbstractConfigurationPart {
-
-    private static final Class<?>[] SUPPORTED_TYPES = {
-        String.class, String[].class,
-        Integer.class, Integer[].class,
-        Long.class, Long[].class,
-        Double.class, Double[].class,
-        Boolean.class, Boolean[].class
-    };
-    
-    private final Class<T> type;
-    private T defaultValue;
-
-    public PropertyMetadata(@Nonnull String name, @Nonnull Class<T> type) {
-        super(name);
-        if (type == null || !isSupportedType(type)) {
-            throw new IllegalArgumentException("Invalid parameter type: " + type);
-        }
-        this.type = type;
-    }
-    
-    private boolean isSupportedType(Class<T> paramType) {
-        for (Class<?> type : SUPPORTED_TYPES) {
-            if (type.equals(paramType)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * @return Parameter type
-     */
-    public @Nonnull Class<T> getType() {
-        return this.type;
-    }
-
-    /**
-     * @return Default value if parameter is not set for configuration
-     */
-    public T getDefaultValue() {
-        return this.defaultValue;
-    }
-    
-    /**
-     * @param value Default value if parameter is not set for configuration
-     */
-    public void setDefaultValue(T value) {
-        this.defaultValue = value;
-    }
-
-    @Override
-    public String toString() {
-        return getName() + "[" + this.type.getSimpleName() + "]";
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
deleted file mode 100644
index 0372745..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * Defining configuration and parameter metadata for the SPI.
- */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.spi.metadata;
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
deleted file mode 100644
index 76033c3..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * SPI for applications hooking into the configuration infrastructure for parameterizing and customizing.
- */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.spi;
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
deleted file mode 100644
index 556337a..0000000
--- a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
-import org.apache.sling.contextaware.config.spi.metadata.PropertyMetadata;
-import org.junit.Test;
-
-public class ConfigurationMetadataTest {
-
-    @Test
-    public void testSimple() {
-        ConfigurationMetadata underTest = new ConfigurationMetadata("hier1/set1");
-        assertEquals("hier1/set1", underTest.getName());
-        assertTrue(underTest.isSingleton());
-        assertFalse(underTest.isList());
-        
-        underTest.getProperties().put("p1", "v1");
-        assertEquals("v1", underTest.getProperties().get("p1", String.class));
-        
-        underTest.getParts().add(new PropertyMetadata<String>("param1", String.class));
-        underTest.getParts().add(new PropertyMetadata<Integer>("param2", Integer.class));
-        underTest.getParts().add(new ConfigurationMetadata("set1"));
-        
-        assertEquals(3, underTest.getParts().size());
-    }
-
-    @Test
-    public void testList() {
-        ConfigurationMetadata underTest = new ConfigurationMetadata("hier1/set1");
-        underTest.setList(true);
-        assertEquals("hier1/set1", underTest.getName());
-        assertFalse(underTest.isSingleton());
-        assertTrue(underTest.isList());
-    }
-    
-    @Test(expected = IllegalArgumentException.class)
-    public void testInvalidName() {
-        new ConfigurationMetadata("$illegal name");
-    }
-
-}
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
deleted file mode 100644
index 66ae8b3..0000000
--- a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import org.apache.sling.contextaware.config.spi.metadata.PropertyMetadata;
-import org.junit.Test;
-
-public class PropertyMetadataTest {
-
-    @Test
-    public void testValid() {
-        PropertyMetadata<String> underTest = new PropertyMetadata<String>("testParam", String.class);
-        assertEquals("testParam", underTest.getName());
-        assertEquals(String.class, underTest.getType());
-        assertNull(underTest.getDefaultValue());
-        
-        underTest.getProperties().put("p1", "v1");
-        assertEquals("v1", underTest.getProperties().get("p1", String.class));
-
-        underTest.setDefaultValue("defValue");
-        assertEquals("defValue", underTest.getDefaultValue());
-    }
-    
-    @Test(expected = IllegalArgumentException.class)
-    public void testInvalidName() {
-        new PropertyMetadata<String>("$illegal name", String.class);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testInvalidType() {
-        new PropertyMetadata<Object>("testParam", Object.class);
-    }
-
-}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 01/24: SLING-5886 : Add draft api

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit fd452cbd4744dda2da0d7ea68ed6a2646278bcb5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jul 29 12:19:18 2016 +0000

    SLING-5886 : Add draft api
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1754502 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt                                         | 25 +++++++
 pom.xml                                            | 69 +++++++++++++++++
 .../apache/sling/config/ConfigurationBuilder.java  | 54 ++++++++++++++
 .../apache/sling/config/ConfigurationResolver.java | 41 +++++++++++
 .../java/org/apache/sling/config/package-info.java | 23 ++++++
 .../resource/ConfigurationResourceResolver.java    | 68 +++++++++++++++++
 .../apache/sling/config/resource/package-info.java | 24 ++++++
 .../config/spi/ConfigurationMetadataProvider.java  | 39 ++++++++++
 .../config/spi/ConfigurationOverrideProvider.java  | 68 +++++++++++++++++
 .../spi/ConfigurationPersistenceProvider.java      | 60 +++++++++++++++
 .../sling/config/spi/ContextPathStrategy.java      | 44 +++++++++++
 .../spi/metadata/AbstractConfigurationPart.java    | 65 ++++++++++++++++
 .../config/spi/metadata/ConfigurationMetadata.java | 73 ++++++++++++++++++
 .../config/spi/metadata/ConfigurationPart.java     | 44 +++++++++++
 .../config/spi/metadata/PropertyMetadata.java      | 86 ++++++++++++++++++++++
 .../sling/config/spi/metadata/package-info.java    | 23 ++++++
 .../org/apache/sling/config/spi/package-info.java  | 23 ++++++
 .../spi/metadata/ConfigurationMetadataTest.java    | 60 +++++++++++++++
 .../config/spi/metadata/PropertyMetadataTest.java  | 52 +++++++++++++
 19 files changed, 941 insertions(+)

diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..5d77ea0
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,25 @@
+Apache Sling Context Aware Configuration API
+
+
+Getting Started
+===============
+
+This component uses a Maven 3 (http://maven.apache.org/) build
+environment. It requires a Java 7 JDK (or higher) and Maven (http://maven.apache.org/)
+3.3.9 or later. We recommend to use the latest Maven version.
+
+If you have Maven 3 installed, you can compile and
+package the jar using the following command:
+
+    mvn package
+
+See the Maven 3 documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+    svn checkout https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api
+
+See the Subversion documentation for other source control features.
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..e00d9e4
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>27</version>
+        <relativePath />
+    </parent>
+    
+    <artifactId>org.apache.sling.config.api</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Apache Sling Context-Aware-Config API</name>
+    <description>Apache Sling Context-Aware-Config API</description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api</connection>
+        <developerConnection> scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/context-aware-config/api</url>
+    </scm>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.code.findbugs</groupId>
+            <artifactId>jsr305</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.4.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/src/main/java/org/apache/sling/config/ConfigurationBuilder.java b/src/main/java/org/apache/sling/config/ConfigurationBuilder.java
new file mode 100644
index 0000000..acf44c6
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/ConfigurationBuilder.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config;
+
+import java.util.Collection;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Defines how the configuration should be mapped and returned.
+ */
+@ProviderType
+public interface ConfigurationBuilder {
+    
+    /**
+     * Define configuration name. Optional when using annotation class, mandatory when getting configuration as value map.
+     * @param configName Relative path
+     * @return Configuration builder
+     */
+    @Nonnull ConfigurationBuilder name(@Nonnull String configName);
+    
+    /**
+     * Get configuration as singleton and its properties mapped to the given annotation class.
+     * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
+     * @return Configuration object
+     */
+    @Nonnull <T> T as(@Nonnull Class<T> clazz);
+
+    /**
+     * Get list of configuration instances with its properties mapped to the given annotation class.
+     * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
+     * @return List of configuration objects
+     */
+    @Nonnull <T> Collection<T> asCollection(@Nonnull Class<T> clazz);
+
+}
diff --git a/src/main/java/org/apache/sling/config/ConfigurationResolver.java b/src/main/java/org/apache/sling/config/ConfigurationResolver.java
new file mode 100644
index 0000000..b3a4285
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/ConfigurationResolver.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Getting context-specific configurations for a given resource context.
+ * Context-specific configuration may be different for different parts of the resource
+ * hierarchy, and configuration parameter inheritance may take place.
+ */
+@ProviderType
+public interface ConfigurationResolver {
+
+    /**
+     * Get configuration for given resource.
+     * @param resource Context resource
+     * @return Configuration builder
+     */
+    @Nonnull ConfigurationBuilder get(@Nonnull Resource resource);
+
+}
diff --git a/src/main/java/org/apache/sling/config/package-info.java b/src/main/java/org/apache/sling/config/package-info.java
new file mode 100644
index 0000000..e4bc375
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * API for accessing context-specific configuration.
+ */
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.config;
diff --git a/src/main/java/org/apache/sling/config/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/config/resource/ConfigurationResourceResolver.java
new file mode 100644
index 0000000..4fa6baf
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/resource/ConfigurationResourceResolver.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.resource;
+
+import java.util.Collection;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Getting context-specific configuration resources for a given resource context.
+ * This is a low-level interface for supporting advanced usecases. If you just want to fetch
+ * some configuration parameters {@link ConfigurationResolver} is the right place.
+ */
+@ProviderType
+public interface ConfigurationResourceResolver {
+
+    /**
+     * Get a context-specific singleton configuration resource defined by the given configuration name. 
+     * @param resource Context resource to fetch configuration for
+     * @param configName Configuration name or relative path.
+     * @return Configuration resource
+     */
+    @Nonnull Resource getResource(@Nonnull Resource resource, @Nonnull String configName);
+    
+    /**
+     * Get a list of context-specific configuration resources defined by the given configuration name. 
+     * @param resource Context resource to fetch configuration for
+     * @param configName Configuration name or relative path.
+     * @return List of configuration resources
+     */
+    @Nonnull Collection<Resource> getResourceList(@Nonnull Resource resource, @Nonnull String configName);
+    
+    /**
+     * Get the inner-most context path (deepest path) returned by {@link #getAllContextPaths(Resource)}.
+     * @param resource Context resource to fetch configuration for
+     * @return Context path or null
+     */
+    String getContextPath(@Nonnull Resource resource);
+
+    /**
+     * Get all context paths for which context-specific configurations could be defined.
+     * The context paths are always ancestors of the resource path, or the resource path itself.
+     * Which ancestors are allowed for context-specific configuration depends on configuration.
+     * @param resource Context resource to fetch configuration for
+     * @return List of context paths
+     */
+    @Nonnull Collection<String> getAllContextPaths(@Nonnull Resource resource);
+    
+}
diff --git a/src/main/java/org/apache/sling/config/resource/package-info.java b/src/main/java/org/apache/sling/config/resource/package-info.java
new file mode 100644
index 0000000..f602d02
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/resource/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * API for accessing context-specific configuration resources.
+ * This is a low-level API.
+ */
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.config.resource;
diff --git a/src/main/java/org/apache/sling/config/spi/ConfigurationMetadataProvider.java b/src/main/java/org/apache/sling/config/spi/ConfigurationMetadataProvider.java
new file mode 100644
index 0000000..c7e83f9
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/ConfigurationMetadataProvider.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi;
+
+import java.util.Collection;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.config.spi.metadata.ConfigurationMetadata;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Allows application to provide the necessary metadata for configurations.
+ */
+@ConsumerType
+public interface ConfigurationMetadataProvider {
+
+    /**
+     * @return Configuration metadata that the application defines
+     */
+    @Nonnull Collection<ConfigurationMetadata> getConfigSets();
+
+}
diff --git a/src/main/java/org/apache/sling/config/spi/ConfigurationOverrideProvider.java b/src/main/java/org/apache/sling/config/spi/ConfigurationOverrideProvider.java
new file mode 100644
index 0000000..56b2d50
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/ConfigurationOverrideProvider.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi;
+
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Provides configuration override values (default or forced).
+ */
+@ConsumerType
+public interface ConfigurationOverrideProvider {
+
+    /**
+     * Returns a map with key value pairs for configuration parameter override.
+     * <p>
+     * Key:
+     * </p>
+     * <ul>
+     * <li>Syntax: <code>[{scope}[:locked]]{configName}/{propertyName}</code></li>
+     * <li><code>{scope}</code>: if "default", the system default parameter is overridden. Otherwise <code>{scope}</code>
+     * may define a context path, in this case the configuration set's property value is overwritten by force for this
+     * context path. If the [{scope}] part is missing or [locked], the parameter is overridden for all context paths.</li>
+     * <li><code>locked</code>: If the scope value is suffixed with the string &quot;:locked&quot; this configuration
+     * parameter cannot be overridden in nested configuration scopes.</li>
+     * <li><code>{configName}</code>: Configuration name</li>
+     * <li><code>{propertyName}</code>: Configuration property name</li>
+     * </ul>
+     * <p>
+     * Examples:
+     * </p>
+     * <ul>
+     * <li><code>[default]set1/param1</code> - Override default value for property "param1" from set "set1"</li>
+     * <li><code>set1/param1</code> - Override value for property "param1" from set "set1" for all context paths</li>
+     * <li><code>[/content/region1/site1]set1/param1</code> - Override value for property "param1" from set "set1" for the context path
+     * <code>/content/region1/site1</code>. This has higher precedence than the other variants.</li>
+     * </ul>
+     * <p>
+     * Value:
+     * </p>
+     * <ul>
+     *  <li>Override value</li>
+     * <li>Has to be convertible to the property's type</li>
+     * </ul>
+     * @return Map
+     */
+    @Nonnull Map<String, String> getOverrideMap();
+    
+}
diff --git a/src/main/java/org/apache/sling/config/spi/ConfigurationPersistenceProvider.java b/src/main/java/org/apache/sling/config/spi/ConfigurationPersistenceProvider.java
new file mode 100644
index 0000000..eee2245
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/ConfigurationPersistenceProvider.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi;
+
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Provides configuration persistence implementations.
+ */
+@ConsumerType
+public interface ConfigurationPersistenceProvider {
+
+    /**
+     * Get all configuration values stored for a context path.
+     * @param resolver Resource resolver
+     * @param contextPath Context path
+     * @param configNames If a set of config names is given only configuration for these names is returned.
+     *      Otherwise all are returned.
+     * @return Configuration names with value map containing the configuration set properties.
+     *      Returns null if no parameters stored for this context paths, allowing other 
+     *      persistence providers to step in.
+     */
+    Map<String, Map<String, Object>> get(@Nonnull ResourceResolver resolver, @Nonnull String contextPath, String... configNames);
+
+    /**
+     * Writes configuration values for a context paths. For each configuration name contained in the values map all existing 
+     * parameter values are erased before writing the new ones.
+     * @param resolver Resource resolver
+     * @param contextPath Context path
+     * @param values Configuration names with value map containing the configuration set properties.
+     * @return true if configurations are accepted. false if this provider does not accept storing 
+     *          the configurations and the next provider should be asked to store them.
+     * @throws PersistenceException Persistence exception is thrown when storing configurations failed.
+     */
+    boolean store(@Nonnull ResourceResolver resolver, @Nonnull String contextPath, @Nonnull String configName,
+            @Nonnull Map<String, Map<String, Object>> values) throws PersistenceException;
+
+}
diff --git a/src/main/java/org/apache/sling/config/spi/ContextPathStrategy.java b/src/main/java/org/apache/sling/config/spi/ContextPathStrategy.java
new file mode 100644
index 0000000..7d6b629
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/ContextPathStrategy.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi;
+
+import java.util.Collection;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Allows application to define a strategy to find context paths for content paths.
+ * Each context path may have it's own context-specific configuration.
+ */
+@ConsumerType
+public interface ContextPathStrategy {
+
+    /**
+     * Finds context paths for the given context resource.
+     * @param resource Context resource
+     * @return Context paths that where detected in the given path
+     *      (in order of closest matching first).
+     *      If none are found an empty list is returned.
+     */
+    @Nonnull Collection<String> findContextPaths(@Nonnull Resource resource);
+
+}
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/AbstractConfigurationPart.java b/src/main/java/org/apache/sling/config/spi/metadata/AbstractConfigurationPart.java
new file mode 100644
index 0000000..b79d8b5
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/metadata/AbstractConfigurationPart.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi.metadata;
+
+import java.util.HashMap;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.api.wrappers.ValueMapDecorator;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Defines a configuration set.
+ */
+@ProviderType
+abstract class AbstractConfigurationPart implements ConfigurationPart {
+
+    private final String name;
+    private final ValueMap properties = new ValueMapDecorator(new HashMap<String, Object>());
+
+    public AbstractConfigurationPart(@Nonnull String name) {
+        if (name == null || !ConfigurationPart.NAME_PATTERN.matcher(name).matches()) {
+            throw new IllegalArgumentException("Invalid name: " + name);
+        }
+        this.name = name;
+    }
+    
+    /**
+     * @return Parameter name
+     */
+    public @Nonnull String getName() {
+        return this.name;
+    }
+
+    /**
+     * @return Further properties for documentation and configuration of
+     *         behavior in configuration editor.
+     */
+    public @Nonnull ValueMap getProperties() {
+        return this.properties;
+    }
+    
+    @Override
+    public String toString() {
+        return this.name;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationMetadata.java
new file mode 100644
index 0000000..e43cecc
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationMetadata.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi.metadata;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Defines a configuration set.
+ */
+@ProviderType
+public final class ConfigurationMetadata extends AbstractConfigurationPart {
+
+    private boolean isList;
+    private final List<ConfigurationPart> parts = new ArrayList<>();
+
+    /**
+     * @param name Configuration name
+     */
+    public ConfigurationMetadata(@Nonnull String name) {
+        super(name);
+    }
+    
+    /**
+     * @return true if configuration is singleton
+     */
+    public boolean isSingleton() {
+        return !isList;
+    }
+    
+    /**
+     * @return true if configuration is list
+     */
+    public boolean isList() {
+        return isList;
+    }
+
+    /**
+     * @param isList true if configuration is list
+     */
+    public void setList(boolean isList) {
+        this.isList = isList;
+    }
+
+    /**
+     * @return Configuration set parts
+     */
+    public @Nonnull Collection<ConfigurationPart> getParts() {
+        return this.parts;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationPart.java b/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationPart.java
new file mode 100644
index 0000000..1a1590c
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationPart.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi.metadata;
+
+import java.util.regex.Pattern;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Part of configuration set.
+ */
+@ProviderType
+public interface ConfigurationPart {
+
+    /**
+     * Pattern for allowed configuration part names.
+     */
+    Pattern NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9\\-\\_\\.]+(/[a-zA-Z0-9\\-\\_\\.]+)*$");
+    
+    /**
+     * Configuration part name
+     * @return
+     */
+    @Nonnull String getName();
+    
+}
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/config/spi/metadata/PropertyMetadata.java
new file mode 100644
index 0000000..2b4e1a6
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/metadata/PropertyMetadata.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi.metadata;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Defines a configuration property.
+ * @param <T> Property value type
+ */
+@ProviderType
+public final class PropertyMetadata<T> extends AbstractConfigurationPart {
+
+    private static final Class<?>[] SUPPORTED_TYPES = {
+        String.class, String[].class,
+        Integer.class, Integer[].class,
+        Long.class, Long[].class,
+        Double.class, Double[].class,
+        Boolean.class, Boolean[].class
+    };
+    
+    private final Class<T> type;
+    private T defaultValue;
+
+    public PropertyMetadata(@Nonnull String name, @Nonnull Class<T> type) {
+        super(name);
+        if (type == null || !isSupportedType(type)) {
+            throw new IllegalArgumentException("Invalid parameter type: " + type);
+        }
+        this.type = type;
+    }
+    
+    private boolean isSupportedType(Class<T> paramType) {
+        for (Class<?> type : SUPPORTED_TYPES) {
+            if (type.equals(paramType)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @return Parameter type
+     */
+    public @Nonnull Class<T> getType() {
+        return this.type;
+    }
+
+    /**
+     * @return Default value if parameter is not set for configuration
+     */
+    public T getDefaultValue() {
+        return this.defaultValue;
+    }
+    
+    /**
+     * @param value Default value if parameter is not set for configuration
+     */
+    public void setDefaultValue(T value) {
+        this.defaultValue = value;
+    }
+
+    @Override
+    public String toString() {
+        return getName() + "[" + this.type.getSimpleName() + "]";
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/package-info.java b/src/main/java/org/apache/sling/config/spi/metadata/package-info.java
new file mode 100644
index 0000000..f8b578b
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/metadata/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Defining configuration and parameter metadata for the SPI.
+ */
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.config.spi.metadata;
diff --git a/src/main/java/org/apache/sling/config/spi/package-info.java b/src/main/java/org/apache/sling/config/spi/package-info.java
new file mode 100644
index 0000000..3b35911
--- /dev/null
+++ b/src/main/java/org/apache/sling/config/spi/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * SPI for applications hooking into the configuration infrastructure for parameterizing and customizing.
+ */
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.config.spi;
diff --git a/src/test/java/org/apache/sling/config/spi/metadata/ConfigurationMetadataTest.java b/src/test/java/org/apache/sling/config/spi/metadata/ConfigurationMetadataTest.java
new file mode 100644
index 0000000..50c6dd5
--- /dev/null
+++ b/src/test/java/org/apache/sling/config/spi/metadata/ConfigurationMetadataTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi.metadata;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class ConfigurationMetadataTest {
+
+    @Test
+    public void testSimple() {
+        ConfigurationMetadata underTest = new ConfigurationMetadata("hier1/set1");
+        assertEquals("hier1/set1", underTest.getName());
+        assertTrue(underTest.isSingleton());
+        assertFalse(underTest.isList());
+        
+        underTest.getProperties().put("p1", "v1");
+        assertEquals("v1", underTest.getProperties().get("p1", String.class));
+        
+        underTest.getParts().add(new PropertyMetadata<String>("param1", String.class));
+        underTest.getParts().add(new PropertyMetadata<Integer>("param2", Integer.class));
+        underTest.getParts().add(new ConfigurationMetadata("set1"));
+        
+        assertEquals(3, underTest.getParts().size());
+    }
+
+    @Test
+    public void testList() {
+        ConfigurationMetadata underTest = new ConfigurationMetadata("hier1/set1");
+        underTest.setList(true);
+        assertEquals("hier1/set1", underTest.getName());
+        assertFalse(underTest.isSingleton());
+        assertTrue(underTest.isList());
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void testInvalidName() {
+        new ConfigurationMetadata("$illegal name");
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/config/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/config/spi/metadata/PropertyMetadataTest.java
new file mode 100644
index 0000000..60fab1b
--- /dev/null
+++ b/src/test/java/org/apache/sling/config/spi/metadata/PropertyMetadataTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.config.spi.metadata;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class PropertyMetadataTest {
+
+    @Test
+    public void testValid() {
+        PropertyMetadata<String> underTest = new PropertyMetadata<String>("testParam", String.class);
+        assertEquals("testParam", underTest.getName());
+        assertEquals(String.class, underTest.getType());
+        assertNull(underTest.getDefaultValue());
+        
+        underTest.getProperties().put("p1", "v1");
+        assertEquals("v1", underTest.getProperties().get("p1", String.class));
+
+        underTest.setDefaultValue("defValue");
+        assertEquals("defValue", underTest.getDefaultValue());
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void testInvalidName() {
+        new PropertyMetadata<String>("$illegal name", String.class);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInvalidType() {
+        new PropertyMetadata<Object>("testParam", Object.class);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 07/24: SLING-5886 : Clarify API and implement accordingly

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit a8cae312c937d9bc5b798329760995c6f1417c73
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Aug 4 15:18:21 2016 +0000

    SLING-5886 : Clarify API and implement accordingly
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1755198 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/contextaware/config/ConfigurationBuilder.java       | 11 +++++------
 .../contextaware/resource/ConfigurationResourceResolver.java  |  8 ++++----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
index 2a03f8d..1842d90 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
@@ -34,9 +34,6 @@ public interface ConfigurationBuilder {
      * Define configuration name. This parameter is optional, it defaults to the class
      * name of the argument provided either to {@link #as(Class)} or {@link #asCollection(Class)}.
      *
-     * TODO - what happens if an invalid name is provided? I assume the same as if no
-     * configuration resource exists.
-     *
      * @param configName Relative path
      * @return Configuration builder
      */
@@ -45,14 +42,16 @@ public interface ConfigurationBuilder {
     /**
      * Get configuration as singleton and its properties mapped to the given annotation class.
      * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
-     * @return Configuration object
+     * @return Configuration object or {@code null} if the conversion failed or the provided name
+     *         is invalid.
      */
     @Nonnull <T> T as(@Nonnull Class<T> clazz);
 
     /**
-     * Get list of configuration instances with its properties mapped to the given annotation class.
+     * Get collection of configuration instances with its properties mapped to the given annotation class.
      * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
-     * @return List of configuration objects
+     * @return Collection of configuration objects, might be empty if conversion failed or the
+     *         provided name is invalid.
      */
     @Nonnull <T> Collection<T> asCollection(@Nonnull Class<T> clazz);
 
diff --git a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
index 8c88897..a06400c 100644
--- a/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
@@ -20,6 +20,7 @@ package org.apache.sling.contextaware.resource;
 
 import java.util.Collection;
 
+import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
 import org.apache.sling.api.resource.Resource;
@@ -37,18 +38,17 @@ public interface ConfigurationResourceResolver {
     /**
      * Get a context-specific singleton configuration resource defined by the given configuration name.
      *
-     * TODO - can we always ensure to return a resource?
      * @param resource Context resource to fetch configuration for
      * @param configName Configuration name or relative path.
-     * @return Configuration resource
+     * @return Configuration resource or {@code null}.
      */
-    @Nonnull Resource getResource(@Nonnull Resource resource, @Nonnull String configName);
+    @CheckForNull Resource getResource(@Nonnull Resource resource, @Nonnull String configName);
 
     /**
      * Get a collection of context-specific configuration resources defined by the given configuration name.
      * @param resource Context resource to fetch configuration for
      * @param configName Configuration name or relative path.
-     * @return Collection of configuration resources
+     * @return Collection of configuration resources, the collection might be empty.
      */
     @Nonnull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String configName);
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 24/24: [maven-release-plugin] copy for tag org.apache.sling.caconfig.api-1.0.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit c9ef1d454de0353ba017bfd74b26f2e4e8bb1d60
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Oct 14 22:18:36 2016 +0000

    [maven-release-plugin] copy for tag org.apache.sling.caconfig.api-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.caconfig.api-1.0.0@1764980 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 19/24: SLING-6023 Summary: Context-Aware Config: Add pluggable context paths strategies SLING-6026 Summary: Context-Aware Config: Pluggable configuration persistence

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 743a808d63d81136c2707fd77cf73d0156dc16d4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Sep 19 15:39:17 2016 +0000

    SLING-6023 Summary: Context-Aware Config: Add pluggable context paths strategies
    SLING-6026 Summary: Context-Aware Config: Pluggable configuration persistence
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1761468 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 20 +++++-
 .../contextaware/config/ConfigurationBuilder.java  |  9 ++-
 .../ConfigurationResourceResolvingStrategy.java    | 84 ++++++++++++++++++++++
 .../config/resource/spi/ContextPathStrategy.java   | 46 ++++++++++++
 .../config/resource/spi/package-info.java          | 23 ++++++
 .../spi/ConfigurationPersistenceException.java     | 38 ++++++++++
 .../spi/ConfigurationPersistenceStrategy.java      | 67 +++++++++++++++++
 .../config/spi/metadata/AbstractMetadata.java      |  3 -
 .../config/spi/metadata/ConfigurationMetadata.java |  9 ++-
 .../config/spi/metadata/PropertyMetadata.java      | 34 ++++++++-
 .../config/spi/metadata/PropertyMetadataTest.java  | 11 +++
 11 files changed, 329 insertions(+), 15 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5bed74c..2d10043 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,9 +67,27 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.3.2</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
+            <version>2.0.5-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-            <version>1.7.0</version>
+            <version>1.7.1-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.4.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
index 1243e84..28d2a2a 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
@@ -44,6 +44,7 @@ public interface ConfigurationBuilder {
      * Configuration name is optional - if not given via {@link #name(String)} method it is derived
      * from the annotation interface class name.
      * @param clazz Annotation interface class
+     * @param <T> Annotation class type
      * @return Configuration object. Contains only the default values if content resource or configuration cannot be found.
      */
     @Nonnull <T> T as(@Nonnull Class<T> clazz);
@@ -53,6 +54,7 @@ public interface ConfigurationBuilder {
      * Configuration name is optional - if not given via {@link #name(String)} method it is derived
      * from the annotation interface class name.
      * @param clazz Annotation interface class
+     * @param <T> Annotation class type
      * @return Collection of configuration objects. Is empty if content resource or configuration cannot be found.
      */
     @Nonnull <T> Collection<T> asCollection(@Nonnull Class<T> clazz);
@@ -65,21 +67,22 @@ public interface ConfigurationBuilder {
 
     /**
      * Get collection of configuration resources with their properties mapped to the given annotation class.
-     * @param clazz Annotation interface class
      * @return Collection of value map. Is empty if content resource or configuration cannot be found.
      */
     @Nonnull Collection<ValueMap> asValueMapCollection();
 
     /**
      * Get configuration as singleton configuration resource and adapt it to the given class.
-     * @param clazz Class that can be adapted from a {@link Resource}
+     * @param clazz Class that can be adapted from a {@link org.apache.sling.api.resource.Resource}
+     * @param <T> Annotation class type
      * @return Object instance or null if content resource or configuration cannot be found or if the adaption was not possible.
      */
     <T> T asAdaptable(@Nonnull Class<T> clazz);
 
     /**
      * Get collection of configuration resources and adapt them to the given class.
-     * @param clazz Class that can be adapted from a {@link Resource}
+     * @param clazz Class that can be adapted from a {@link org.apache.sling.api.resource.Resource}
+     * @param <T> Annotation class type
      * @return Collection of object instances. Is empty if content resource or configuration cannot be found or if the adaption was not possible.
      */
     @Nonnull <T> Collection<T> asAdaptableCollection(@Nonnull Class<T> clazz);
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/spi/ConfigurationResourceResolvingStrategy.java b/src/main/java/org/apache/sling/contextaware/config/resource/spi/ConfigurationResourceResolvingStrategy.java
new file mode 100644
index 0000000..89ad4b8
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/spi/ConfigurationResourceResolvingStrategy.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.resource.spi;
+
+import java.util.Collection;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Defines how and where the configuration resources are looked up.
+ * This SPI allows application to define their own configuration storage and inheritance strategies.
+ */
+@ConsumerType
+public interface ConfigurationResourceResolvingStrategy {
+
+    /**
+     * Get a context-aware singleton configuration resource defined by the given configuration name.
+     * @param resource Context resource to fetch configuration for
+     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
+     *     it's configuration data grouped in a child resource of the configuration resource. This is what
+     *     we call a "bucket", and the resource name is specified with this parameter.
+     * @param configName Configuration name or relative path.
+     * @return Configuration resource or {@code null}.
+     */
+    @CheckForNull Resource getResource(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
+
+    /**
+     * Get a collection of context-aware configuration resources defined by the given configuration name.
+     * @param resource Context resource to fetch configuration for
+     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
+     *     it's configuration data grouped in a child resource of the configuration resource. This is what
+     *     we call a "bucket", and the resource name is specified with this parameter.
+     * @param configName Configuration name or relative path.
+     * @return Collection of configuration resources, the collection might be empty.
+     */
+    @Nonnull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
+    
+    /**
+     * Get the configuration resource path for storing configuration data for the given context resource and configuration name.
+     * This path is used when no configuration resource exists yet, but new configuration data should be stored.
+     * So usually the returned path does not yet exist (and perhaps not even it's parents). 
+     * @param resource Context resource to fetch configuration for
+     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
+     *     it's configuration data grouped in a child resource of the configuration resource. This is what
+     *     we call a "bucket", and the resource name is specified with this parameter.
+     * @param configName Configuration name or relative path.
+     * @return Resource path, or null if no matching configuration resource path can be determined
+     */
+    @CheckForNull String getResourcePath(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
+
+    /**
+     * Get the configuration resource collection parent path for storing configuration data for the given context resource and configuration name.
+     * This path is used when no configuration resource collection exists yet, but new configuration data should be stored.
+     * So usually the returned path does not yet exist (and perhaps not even it's parents). 
+     * @param resource Context resource to fetch configuration for
+     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
+     *     it's configuration data grouped in a child resource of the configuration resource. This is what
+     *     we call a "bucket", and the resource name is specified with this parameter.
+     * @param configName Configuration name or relative path.
+     * @return Resource path, or null if no matching configuration resource path can be determined
+     */
+    @CheckForNull String getResourceCollectionParentPath(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
+    
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/spi/ContextPathStrategy.java b/src/main/java/org/apache/sling/contextaware/config/resource/spi/ContextPathStrategy.java
new file mode 100644
index 0000000..4b93957
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/spi/ContextPathStrategy.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.resource.spi;
+
+import java.util.Iterator;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Allows application to define a strategy to find context paths for content paths.
+ * A context paths is the root path of a "configuration context", which is a subtree in the resource hierarchy.
+ * Each context may have it's own context-aware configuration attached to.0
+ * If multiple context path strategy implementations are defined the results of them are merged.
+ */
+@ConsumerType
+public interface ContextPathStrategy {
+
+    /**
+     * Finds context paths for the given resource.
+     * @param resource Context resource
+     * @return Root resource for each context found (in order of closest matching first).
+     *      Only one of the parent resources or the resource itself may be included in the result.
+     *      If none are found an empty list is returned.
+     */
+    @Nonnull Iterator<Resource> findContextResources(@Nonnull Resource resource);
+
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/spi/package-info.java b/src/main/java/org/apache/sling/contextaware/config/resource/spi/package-info.java
new file mode 100644
index 0000000..a7722f2
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/resource/spi/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * SPI for applications hooking into the configuration resource infrastructure for parameterizing and customizing.
+ */
+@org.osgi.annotation.versioning.Version("1.0.0")
+package org.apache.sling.contextaware.config.resource.spi;
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceException.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceException.java
new file mode 100644
index 0000000..618357d
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceException.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.spi;
+
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Is thrown when configuration cannot be persisted.
+ */
+@ProviderType
+public final class ConfigurationPersistenceException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public ConfigurationPersistenceException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ConfigurationPersistenceException(String message) {
+        super(message);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceStrategy.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceStrategy.java
new file mode 100644
index 0000000..9dfe945
--- /dev/null
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceStrategy.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.contextaware.config.spi;
+
+import java.util.Collection;
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Defines how configuration data is stored in the configuration resource.
+ * This SPI allows application to define their own content structure and node types to be used for configuration data storage.
+ */
+@ConsumerType
+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. 
+     * @param resource Configuration resource
+     * @return Transformed configuration resource. If null is returned this strategy does not support the given configuration resource.
+     */
+    Resource getResource(@Nonnull Resource resource);
+    
+    /**
+     * 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 properties Configuration properties
+     * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy (but in case of error throw an exception).
+     */
+    boolean persist(@Nonnull ResourceResolver resourceResolver,
+            @Nonnull String configResourcePath, @Nonnull Map<String,Object> properties);
+    
+    /**
+     * 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. 
+     * @param propertiesCollection Configuration properties
+     * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy (but in case of error throw an exception).
+     */
+    boolean persistCollection(@Nonnull ResourceResolver resourceResolver,
+            @Nonnull String configResourceCollectionParentPath, @Nonnull Collection<Map<String,Object>> propertiesCollection);
+    
+}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java
index bd1f70b..2cd0d17 100644
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java
@@ -22,12 +22,9 @@ import java.util.Map;
 
 import javax.annotation.Nonnull;
 
-import org.osgi.annotation.versioning.ProviderType;
-
 /**
  * Common properties for configuration and properties.
  */
-@ProviderType
 abstract class AbstractMetadata {
 
     private final String name;
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
index a838f56..7730157 100644
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
@@ -18,8 +18,7 @@
  */
 package org.apache.sling.contextaware.config.spi.metadata;
 
-import java.util.Collection;
-import java.util.List;
+import java.util.Map;
 
 import javax.annotation.Nonnull;
 
@@ -32,7 +31,7 @@ import org.osgi.annotation.versioning.ProviderType;
 public final class ConfigurationMetadata extends AbstractMetadata {
 
     private boolean isList;
-    private List<PropertyMetadata<?>> propertyMetadata;
+    private Map<String,PropertyMetadata<?>> propertyMetadata;
 
     /**
      * @param name Configuration name
@@ -65,14 +64,14 @@ public final class ConfigurationMetadata extends AbstractMetadata {
     /**
      * @return Configuration properties
      */
-    public Collection<PropertyMetadata<?>> getPropertyMetadata() {
+    public Map<String,PropertyMetadata<?>> getPropertyMetadata() {
         return this.propertyMetadata;
     }
 
     /**
      * @param propertyMetadata Configuration properties
      */
-    public void setPropertyMetadata(List<PropertyMetadata<?>> propertyMetadata) {
+    public void setPropertyMetadata(Map<String,PropertyMetadata<?>> propertyMetadata) {
         this.propertyMetadata = propertyMetadata;
     }
 
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
index fa6735a..5e0da26 100644
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
@@ -25,6 +25,7 @@ import java.util.Set;
 
 import javax.annotation.Nonnull;
 
+import org.apache.commons.lang3.ClassUtils;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
@@ -34,6 +35,7 @@ import org.osgi.annotation.versioning.ProviderType;
 @ProviderType
 public final class PropertyMetadata<T> extends AbstractMetadata {
 
+    // these are all types supported for fields of annotation classes (plus class which indicates nested configurations)
     private static final Class<?>[] SUPPORTED_TYPES_ARRAY = {
         String.class,
         int.class,
@@ -51,14 +53,40 @@ public final class PropertyMetadata<T> extends AbstractMetadata {
     private final Class<T> type;
     private T defaultValue;
 
+    /**
+     * @param name Property name
+     * @param type Property type
+     */
+    @SuppressWarnings("unchecked")
     public PropertyMetadata(@Nonnull String name, @Nonnull Class<T> type) {
         super(name);
-        if (type == null || !isSupportedType(type)) {
-            throw new IllegalArgumentException("Parameter '" + name + "': Invalid type " + type);
+        Class<T> convertedType = (Class<T>)typeToPrimitive(type);
+        if (!isSupportedType(convertedType)) {
+            throw new IllegalArgumentException("Invalid type for property '" + name + "': " + type);
         }
-        this.type = type;
+        this.type = convertedType;
+    }
+
+    /**
+     * @param name Property name
+     * @param defaultValue Default value (also defines property type)
+     */
+    @SuppressWarnings("unchecked")
+    public PropertyMetadata(@Nonnull String name, @Nonnull T defaultValue) {
+        this(name, (Class<T>)defaultValue.getClass());
+        this.defaultValue = defaultValue;
     }
     
+    private static Class<?> typeToPrimitive(Class<?> clazz) {
+        if (clazz != String.class && !clazz.isPrimitive()) {
+            Class<?> type = ClassUtils.wrapperToPrimitive(clazz);
+            if (type != null) {
+                return type;
+            }
+        }
+        return clazz;
+    }
+
     private static boolean isSupportedType(Class<?> paramType) {
         if (paramType.isArray()) {
             return isSupportedType(paramType.getComponentType());
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
index fb9a7b0..1427192 100644
--- a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
+++ b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
@@ -76,4 +76,15 @@ public class PropertyMetadataTest {
         new PropertyMetadata<>(null, Object.class);
     }
 
+    @Test
+    public void testDefaultValueConstructor() {
+        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());
+    }
+    
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 21/24: SLING-6057 Context-Aware Config: Separate Maven Project for SPI

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit bf5306b71f9f1bd55edabec05701f76fbf4e0ae8
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon Sep 19 16:18:18 2016 +0000

    SLING-6057 Context-Aware Config: Separate Maven Project for SPI
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1761475 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  40 -------
 .../ConfigurationResourceResolvingStrategy.java    |  84 -------------
 .../config/resource/spi/ContextPathStrategy.java   |  46 --------
 .../config/resource/spi/package-info.java          |  23 ----
 .../config/spi/ConfigurationMetadataProvider.java  |  47 --------
 .../spi/ConfigurationPersistenceException.java     |  38 ------
 .../spi/ConfigurationPersistenceStrategy.java      |  67 -----------
 .../config/spi/metadata/AbstractMetadata.java      |  96 ---------------
 .../config/spi/metadata/ConfigurationMetadata.java |  78 ------------
 .../config/spi/metadata/PropertyMetadata.java      | 131 ---------------------
 .../config/spi/metadata/package-info.java          |  23 ----
 .../contextaware/config/spi/package-info.java      |  23 ----
 .../spi/metadata/ConfigurationMetadataTest.java    |  53 ---------
 .../config/spi/metadata/PropertyMetadataTest.java  |  90 --------------
 14 files changed, 839 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8f0f1a7..1cba2c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,45 +66,5 @@
             <version>2.9.0</version>
             <scope>provided</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.3.2</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
-            <version>2.1.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.testing.sling-mock</artifactId>
-            <version>1.8.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.osgi</artifactId>
-            <version>2.4.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
-            <version>2.0.87-beta</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/spi/ConfigurationResourceResolvingStrategy.java b/src/main/java/org/apache/sling/contextaware/config/resource/spi/ConfigurationResourceResolvingStrategy.java
deleted file mode 100644
index 89ad4b8..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/resource/spi/ConfigurationResourceResolvingStrategy.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.resource.spi;
-
-import java.util.Collection;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.Resource;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Defines how and where the configuration resources are looked up.
- * This SPI allows application to define their own configuration storage and inheritance strategies.
- */
-@ConsumerType
-public interface ConfigurationResourceResolvingStrategy {
-
-    /**
-     * Get a context-aware singleton configuration resource defined by the given configuration name.
-     * @param resource Context resource to fetch configuration for
-     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
-     *     it's configuration data grouped in a child resource of the configuration resource. This is what
-     *     we call a "bucket", and the resource name is specified with this parameter.
-     * @param configName Configuration name or relative path.
-     * @return Configuration resource or {@code null}.
-     */
-    @CheckForNull Resource getResource(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
-
-    /**
-     * Get a collection of context-aware configuration resources defined by the given configuration name.
-     * @param resource Context resource to fetch configuration for
-     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
-     *     it's configuration data grouped in a child resource of the configuration resource. This is what
-     *     we call a "bucket", and the resource name is specified with this parameter.
-     * @param configName Configuration name or relative path.
-     * @return Collection of configuration resources, the collection might be empty.
-     */
-    @Nonnull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
-    
-    /**
-     * Get the configuration resource path for storing configuration data for the given context resource and configuration name.
-     * This path is used when no configuration resource exists yet, but new configuration data should be stored.
-     * So usually the returned path does not yet exist (and perhaps not even it's parents). 
-     * @param resource Context resource to fetch configuration for
-     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
-     *     it's configuration data grouped in a child resource of the configuration resource. This is what
-     *     we call a "bucket", and the resource name is specified with this parameter.
-     * @param configName Configuration name or relative path.
-     * @return Resource path, or null if no matching configuration resource path can be determined
-     */
-    @CheckForNull String getResourcePath(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
-
-    /**
-     * Get the configuration resource collection parent path for storing configuration data for the given context resource and configuration name.
-     * This path is used when no configuration resource collection exists yet, but new configuration data should be stored.
-     * So usually the returned path does not yet exist (and perhaps not even it's parents). 
-     * @param resource Context resource to fetch configuration for
-     * @param bucketName Configuration "bucket" name. Each high-level configuration resolver should store 
-     *     it's configuration data grouped in a child resource of the configuration resource. This is what
-     *     we call a "bucket", and the resource name is specified with this parameter.
-     * @param configName Configuration name or relative path.
-     * @return Resource path, or null if no matching configuration resource path can be determined
-     */
-    @CheckForNull String getResourceCollectionParentPath(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
-    
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/spi/ContextPathStrategy.java b/src/main/java/org/apache/sling/contextaware/config/resource/spi/ContextPathStrategy.java
deleted file mode 100644
index 4b93957..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/resource/spi/ContextPathStrategy.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.resource.spi;
-
-import java.util.Iterator;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.Resource;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Allows application to define a strategy to find context paths for content paths.
- * A context paths is the root path of a "configuration context", which is a subtree in the resource hierarchy.
- * Each context may have it's own context-aware configuration attached to.0
- * If multiple context path strategy implementations are defined the results of them are merged.
- */
-@ConsumerType
-public interface ContextPathStrategy {
-
-    /**
-     * Finds context paths for the given resource.
-     * @param resource Context resource
-     * @return Root resource for each context found (in order of closest matching first).
-     *      Only one of the parent resources or the resource itself may be included in the result.
-     *      If none are found an empty list is returned.
-     */
-    @Nonnull Iterator<Resource> findContextResources(@Nonnull Resource resource);
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/spi/package-info.java b/src/main/java/org/apache/sling/contextaware/config/resource/spi/package-info.java
deleted file mode 100644
index a7722f2..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/resource/spi/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * SPI for applications hooking into the configuration resource infrastructure for parameterizing and customizing.
- */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.resource.spi;
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
deleted file mode 100644
index 92ac552..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi;
-
-import java.util.SortedSet;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Allows application to provide the necessary metadata for configurations.
- */
-@ConsumerType
-public interface ConfigurationMetadataProvider {
-
-    /**
-     * Get all configuration names.
-     * @return Configuration names
-     */
-    @Nonnull SortedSet<String> getConfigurationNames();
-
-    /**
-     * Get configuration metadata.
-     * @param configName Configuration name
-     * @return Configuration metadata or null if none exists for the given name.
-     */
-    ConfigurationMetadata getConfigurationMetadata(String configName);
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceException.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceException.java
deleted file mode 100644
index 618357d..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Is thrown when configuration cannot be persisted.
- */
-@ProviderType
-public final class ConfigurationPersistenceException extends RuntimeException {
-    private static final long serialVersionUID = 1L;
-
-    public ConfigurationPersistenceException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public ConfigurationPersistenceException(String message) {
-        super(message);
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceStrategy.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceStrategy.java
deleted file mode 100644
index 9dfe945..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceStrategy.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi;
-
-import java.util.Collection;
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Defines how configuration data is stored in the configuration resource.
- * This SPI allows application to define their own content structure and node types to be used for configuration data storage.
- */
-@ConsumerType
-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. 
-     * @param resource Configuration resource
-     * @return Transformed configuration resource. If null is returned this strategy does not support the given configuration resource.
-     */
-    Resource getResource(@Nonnull Resource resource);
-    
-    /**
-     * 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 properties Configuration properties
-     * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy (but in case of error throw an exception).
-     */
-    boolean persist(@Nonnull ResourceResolver resourceResolver,
-            @Nonnull String configResourcePath, @Nonnull Map<String,Object> properties);
-    
-    /**
-     * 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. 
-     * @param propertiesCollection Configuration properties
-     * @return true if the data was persisted. false if persisting the data was not accepted by this persistence strategy (but in case of error throw an exception).
-     */
-    boolean persistCollection(@Nonnull ResourceResolver resourceResolver,
-            @Nonnull String configResourceCollectionParentPath, @Nonnull Collection<Map<String,Object>> propertiesCollection);
-    
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java
deleted file mode 100644
index 2cd0d17..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractMetadata.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-/**
- * Common properties for configuration and properties.
- */
-abstract class AbstractMetadata {
-
-    private final String name;
-    private String label;
-    private String description;
-    private Map<String,String> properties;
-
-    public AbstractMetadata(@Nonnull String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Invalid name: " + name);
-        }
-        this.name = name;
-    }
-    
-    /**
-     * @return Parameter name
-     */
-    public @Nonnull String getName() {
-        return this.name;
-    }
-    
-    /**
-     * @return Label
-     */
-    public String getLabel() {
-        return label;
-    }
-
-    /**
-     * @param label Label
-     */
-    public void setLabel(String label) {
-        this.label = label;
-    }
-
-    /**
-     * @return Description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * @param description Description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * @return Further properties for documentation and configuration of behavior in configuration editor.
-     */
-    public Map<String,String> getProperties() {
-        return this.properties;
-    }
-    
-    /**
-     * @param properties Further properties for documentation and configuration of behavior in configuration editor.
-     */
-    public void setProperties(Map<String,String> properties) {
-        this.properties = properties;
-    }
-    
-    @Override
-    public String toString() {
-        return this.name;
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
deleted file mode 100644
index 7730157..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration.
- */
-@ProviderType
-public final class ConfigurationMetadata extends AbstractMetadata {
-
-    private boolean isList;
-    private Map<String,PropertyMetadata<?>> propertyMetadata;
-
-    /**
-     * @param name Configuration name
-     */
-    public ConfigurationMetadata(@Nonnull String name) {
-        super(name);
-    }
-    
-    /**
-     * @return true if configuration is singleton
-     */
-    public boolean isSingleton() {
-        return !isList;
-    }
-    
-    /**
-     * @return true if configuration is list
-     */
-    public boolean isList() {
-        return isList;
-    }
-
-    /**
-     * @param isList true if configuration is list
-     */
-    public void setList(boolean isList) {
-        this.isList = isList;
-    }
-
-    /**
-     * @return Configuration properties
-     */
-    public Map<String,PropertyMetadata<?>> getPropertyMetadata() {
-        return this.propertyMetadata;
-    }
-
-    /**
-     * @param propertyMetadata Configuration properties
-     */
-    public void setPropertyMetadata(Map<String,PropertyMetadata<?>> propertyMetadata) {
-        this.propertyMetadata = propertyMetadata;
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
deleted file mode 100644
index 5e0da26..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.annotation.Nonnull;
-
-import org.apache.commons.lang3.ClassUtils;
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration property.
- * @param <T> Property value type
- */
-@ProviderType
-public final class PropertyMetadata<T> extends AbstractMetadata {
-
-    // these are all types supported for fields of annotation classes (plus class which indicates nested configurations)
-    private static final Class<?>[] SUPPORTED_TYPES_ARRAY = {
-        String.class,
-        int.class,
-        long.class,
-        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;
-
-    /**
-     * @param name Property name
-     * @param type Property type
-     */
-    @SuppressWarnings("unchecked")
-    public PropertyMetadata(@Nonnull String name, @Nonnull Class<T> type) {
-        super(name);
-        Class<T> convertedType = (Class<T>)typeToPrimitive(type);
-        if (!isSupportedType(convertedType)) {
-            throw new IllegalArgumentException("Invalid type for property '" + name + "': " + type);
-        }
-        this.type = convertedType;
-    }
-
-    /**
-     * @param name Property name
-     * @param defaultValue Default value (also defines property type)
-     */
-    @SuppressWarnings("unchecked")
-    public PropertyMetadata(@Nonnull String name, @Nonnull T defaultValue) {
-        this(name, (Class<T>)defaultValue.getClass());
-        this.defaultValue = defaultValue;
-    }
-    
-    private static Class<?> typeToPrimitive(Class<?> clazz) {
-        if (clazz != String.class && !clazz.isPrimitive()) {
-            Class<?> type = ClassUtils.wrapperToPrimitive(clazz);
-            if (type != null) {
-                return type;
-            }
-        }
-        return clazz;
-    }
-
-    private static boolean isSupportedType(Class<?> paramType) {
-        if (paramType.isArray()) {
-            return isSupportedType(paramType.getComponentType());
-        }
-        for (Class<?> type : SUPPORTED_TYPES) {
-            if (type.equals(paramType)) {
-                return true;
-            }
-        }
-        if (paramType == ConfigurationMetadata.class) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * @return Parameter type
-     */
-    public @Nonnull Class<T> getType() {
-        return this.type;
-    }
-
-    /**
-     * @return Default value if parameter is not set for configuration
-     */
-    public T getDefaultValue() {
-        return this.defaultValue;
-    }
-    
-    /**
-     * @param value Default value if parameter is not set for configuration
-     */
-    public void setDefaultValue(T value) {
-        this.defaultValue = value;
-    }
-
-    @Override
-    public String toString() {
-        return getName() + "[" + this.type.getSimpleName() + "]";
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
deleted file mode 100644
index 0372745..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * Defining configuration and parameter metadata for the SPI.
- */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.spi.metadata;
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
deleted file mode 100644
index 76033c3..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * SPI for applications hooking into the configuration infrastructure for parameterizing and customizing.
- */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.spi;
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
deleted file mode 100644
index b5cf061..0000000
--- a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map;
-
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-public class ConfigurationMetadataTest {
-
-    @Test
-    public void testProps() {
-        ConfigurationMetadata underTest = new ConfigurationMetadata("name1");
-        assertEquals("name1", underTest.getName());
-        assertTrue(underTest.isSingleton());
-        assertFalse(underTest.isList());
-        
-        underTest.setLabel("label1");
-        underTest.setDescription("desc1");
-        underTest.setList(true);
-        Map<String,String> props = ImmutableMap.of("p1", "v1");
-        underTest.setProperties(props);
-        
-        assertEquals("label1", underTest.getLabel());
-        assertEquals("desc1", underTest.getDescription());
-        assertFalse(underTest.isSingleton());
-        assertTrue(underTest.isList());
-        assertEquals(props, underTest.getProperties());
-    }
-
-}
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
deleted file mode 100644
index 1427192..0000000
--- a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.contextaware.config.spi.metadata;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Map;
-
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableMap;
-
-public class PropertyMetadataTest {
-
-    @Test
-    public void testProps() {
-        PropertyMetadata<String> underTest = new PropertyMetadata<>("name1", String.class);
-        assertEquals("name1", underTest.getName());
-        assertEquals(String.class, underTest.getType());
-        
-        underTest.setLabel("label1");
-        underTest.setDescription("desc1");
-        underTest.setDefaultValue("value1");
-        Map<String,String> props = ImmutableMap.of("p1", "v1");
-        underTest.setProperties(props);
-        
-        assertEquals("label1", underTest.getLabel());
-        assertEquals("desc1", underTest.getDescription());
-        assertEquals("value1", underTest.getDefaultValue());
-        assertEquals(props, underTest.getProperties());
-    }
-
-    @Test
-    public void testAllowedTypes() {
-        new PropertyMetadata<>("name1", String.class);
-        new PropertyMetadata<>("name1", String[].class);
-        new PropertyMetadata<>("name1", int.class);
-        new PropertyMetadata<>("name1", int[].class);
-        new PropertyMetadata<>("name1", long.class);
-        new PropertyMetadata<>("name1", long[].class);
-        new PropertyMetadata<>("name1", double.class);
-        new PropertyMetadata<>("name1", double[].class);
-        new PropertyMetadata<>("name1", boolean.class);
-        new PropertyMetadata<>("name1", boolean[].class);
-    }
-
-    @Test
-    public void testNestedConfiguration() {
-        new PropertyMetadata<>("name1", ConfigurationMetadata.class);
-        new PropertyMetadata<>("name1", ConfigurationMetadata[].class);
-    }
-
-    @Test(expected=IllegalArgumentException.class)
-    public void testDisallowedType() {
-        new PropertyMetadata<>("name1", Object.class);
-    }
-
-    @Test(expected=IllegalArgumentException.class)
-    public void testNullNale() {
-        new PropertyMetadata<>(null, Object.class);
-    }
-
-    @Test
-    public void testDefaultValueConstructor() {
-        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());
-    }
-    
-}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 23/24: [maven-release-plugin] prepare release org.apache.sling.caconfig.api-1.0.0

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit d36e6d071b96be97720b13f10d5517aba9198cba
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Oct 14 22:18:23 2016 +0000

    [maven-release-plugin] prepare release org.apache.sling.caconfig.api-1.0.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1764979 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0ae0c09..4b08c6d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,14 +29,14 @@
     
     <artifactId>org.apache.sling.caconfig.api</artifactId>
     <packaging>bundle</packaging>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>1.0.0</version>
     <name>Apache Sling Context-Aware Configuration API</name>
     <description>Apache Sling Context-Aware Configuration API</description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/api</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.caconfig.api-1.0.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.caconfig.api-1.0.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.caconfig.api-1.0.0</url>
     </scm>
     
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 13/24: SLING-5982 implement support for nested configuration classes, and use native valuemap support for type conversion

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 27b75fa98bdb32090305098a4e597f698cbd5677
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Aug 23 21:48:45 2016 +0000

    SLING-5982 implement support for nested configuration classes, and use native valuemap support for type conversion
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1757438 13f79535-47bb-0310-9956-ffa450edef68
---
 ...ver.java => ConfigurationResolveException.java} | 28 ++++++++--------------
 .../contextaware/config/ConfigurationResolver.java |  2 +-
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolveException.java
similarity index 51%
copy from src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
copy to src/main/java/org/apache/sling/contextaware/config/ConfigurationResolveException.java
index a0434f8..d41b274 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolveException.java
@@ -18,29 +18,21 @@
  */
 package org.apache.sling.contextaware.config;
 
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.Resource;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
- * Getting context-specific configurations for a given resource context.
- * Context-specific configuration may be different for different parts of the resource
- * hierarchy, and configuration parameter inheritance may take place.
- *
- * This service builds on top of the {@link org.apache.sling.contextaware.resource.ConfigurationResourceResolver}
- * and uses that service to resolve configuration resources. These resources
- * can then be converted into application specific configuration objects
- * using the {@link ConfigurationBuilder}.
+ * Is thrown when configuration cannot be resolved.
  */
 @ProviderType
-public interface ConfigurationResolver {
+public final class ConfigurationResolveException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public ConfigurationResolveException(String message, Throwable cause) {
+        super(message, cause);
+    }
 
-    /**
-     * Get configuration for given resource.
-     * @param resource Context resource
-     * @return Configuration builder
-     */
-    @Nonnull ConfigurationBuilder get(@Nonnull Resource resource);
+    public ConfigurationResolveException(String message) {
+        super(message);
+    }
 
 }
diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
index a0434f8..c59c372 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
@@ -28,7 +28,7 @@ import org.osgi.annotation.versioning.ProviderType;
  * Context-specific configuration may be different for different parts of the resource
  * hierarchy, and configuration parameter inheritance may take place.
  *
- * This service builds on top of the {@link org.apache.sling.contextaware.resource.ConfigurationResourceResolver}
+ * This service builds on top of the {@link org.apache.sling.contextaware.config.resource.ConfigurationResourceResolver}
  * and uses that service to resolve configuration resources. These resources
  * can then be converted into application specific configuration objects
  * using the {@link ConfigurationBuilder}.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 16/24: SLING-6029 default folder name to /conf rename the sling:config property name to sling:config-ref

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 96d253bd5e781e5f3940a57eaa8dc3b5b53eceec
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Thu Sep 1 20:37:42 2016 +0000

    SLING-6029 default folder name to /conf
    rename the sling:config property name to sling:config-ref
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1758853 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.txt b/README.txt
index 5d77ea0..5324717 100644
--- a/README.txt
+++ b/README.txt
@@ -20,6 +20,6 @@ Subversion (http://subversion.tigris.org/) source repository of
 the Apache Software Foundation. If you have Subversion installed,
 you can checkout the latest source using the following command:
 
-    svn checkout https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api
+    svn checkout https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api
 
 See the Subversion documentation for other source control features.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 02/24: SLING-5886 : Refactor packages and update javadocs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit 77b18cfedcedfc147fb52162fadb29a9dd15f56e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jul 29 12:31:34 2016 +0000

    SLING-5886 : Refactor packages and update javadocs
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1754505 13f79535-47bb-0310-9956-ffa450edef68
---
 .../{ => contextaware}/config/ConfigurationBuilder.java     | 13 +++++++++----
 .../{ => contextaware}/config/ConfigurationResolver.java    |  7 ++++++-
 .../sling/{ => contextaware}/config/package-info.java       |  2 +-
 .../config/spi/ConfigurationMetadataProvider.java           |  4 ++--
 .../config/spi/ConfigurationOverrideProvider.java           |  2 +-
 .../config/spi/ConfigurationPersistenceProvider.java        |  2 +-
 .../{ => contextaware}/config/spi/ContextPathStrategy.java  |  2 +-
 .../config/spi/metadata/AbstractConfigurationPart.java      |  2 +-
 .../config/spi/metadata/ConfigurationMetadata.java          |  2 +-
 .../config/spi/metadata/ConfigurationPart.java              |  2 +-
 .../config/spi/metadata/PropertyMetadata.java               |  2 +-
 .../config/spi/metadata/package-info.java                   |  2 +-
 .../sling/{ => contextaware}/config/spi/package-info.java   |  2 +-
 .../resource/ConfigurationResourceResolver.java             |  2 +-
 .../{config => contextaware}/resource/package-info.java     |  2 +-
 .../config/spi/metadata/ConfigurationMetadataTest.java      |  4 +++-
 .../config/spi/metadata/PropertyMetadataTest.java           |  3 ++-
 17 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/src/main/java/org/apache/sling/config/ConfigurationBuilder.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
similarity index 83%
rename from src/main/java/org/apache/sling/config/ConfigurationBuilder.java
rename to src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
index acf44c6..2a03f8d 100644
--- a/src/main/java/org/apache/sling/config/ConfigurationBuilder.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config;
+package org.apache.sling.contextaware.config;
 
 import java.util.Collection;
 
@@ -29,14 +29,19 @@ import org.osgi.annotation.versioning.ProviderType;
  */
 @ProviderType
 public interface ConfigurationBuilder {
-    
+
     /**
-     * Define configuration name. Optional when using annotation class, mandatory when getting configuration as value map.
+     * Define configuration name. This parameter is optional, it defaults to the class
+     * name of the argument provided either to {@link #as(Class)} or {@link #asCollection(Class)}.
+     *
+     * TODO - what happens if an invalid name is provided? I assume the same as if no
+     * configuration resource exists.
+     *
      * @param configName Relative path
      * @return Configuration builder
      */
     @Nonnull ConfigurationBuilder name(@Nonnull String configName);
-    
+
     /**
      * Get configuration as singleton and its properties mapped to the given annotation class.
      * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
diff --git a/src/main/java/org/apache/sling/config/ConfigurationResolver.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
similarity index 80%
rename from src/main/java/org/apache/sling/config/ConfigurationResolver.java
rename to src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
index b3a4285..a0434f8 100644
--- a/src/main/java/org/apache/sling/config/ConfigurationResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config;
+package org.apache.sling.contextaware.config;
 
 import javax.annotation.Nonnull;
 
@@ -27,6 +27,11 @@ import org.osgi.annotation.versioning.ProviderType;
  * Getting context-specific configurations for a given resource context.
  * Context-specific configuration may be different for different parts of the resource
  * hierarchy, and configuration parameter inheritance may take place.
+ *
+ * This service builds on top of the {@link org.apache.sling.contextaware.resource.ConfigurationResourceResolver}
+ * and uses that service to resolve configuration resources. These resources
+ * can then be converted into application specific configuration objects
+ * using the {@link ConfigurationBuilder}.
  */
 @ProviderType
 public interface ConfigurationResolver {
diff --git a/src/main/java/org/apache/sling/config/package-info.java b/src/main/java/org/apache/sling/contextaware/config/package-info.java
similarity index 95%
rename from src/main/java/org/apache/sling/config/package-info.java
rename to src/main/java/org/apache/sling/contextaware/config/package-info.java
index e4bc375..ccfe13b 100644
--- a/src/main/java/org/apache/sling/config/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/package-info.java
@@ -20,4 +20,4 @@
  * API for accessing context-specific configuration.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.config;
+package org.apache.sling.contextaware.config;
diff --git a/src/main/java/org/apache/sling/config/spi/ConfigurationMetadataProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
similarity index 90%
rename from src/main/java/org/apache/sling/config/spi/ConfigurationMetadataProvider.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
index c7e83f9..a260aca 100644
--- a/src/main/java/org/apache/sling/config/spi/ConfigurationMetadataProvider.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
@@ -16,13 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi;
+package org.apache.sling.contextaware.config.spi;
 
 import java.util.Collection;
 
 import javax.annotation.Nonnull;
 
-import org.apache.sling.config.spi.metadata.ConfigurationMetadata;
+import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
 import org.osgi.annotation.versioning.ConsumerType;
 
 /**
diff --git a/src/main/java/org/apache/sling/config/spi/ConfigurationOverrideProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java
similarity index 98%
rename from src/main/java/org/apache/sling/config/spi/ConfigurationOverrideProvider.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java
index 56b2d50..acd4d66 100644
--- a/src/main/java/org/apache/sling/config/spi/ConfigurationOverrideProvider.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi;
+package org.apache.sling.contextaware.config.spi;
 
 import java.util.Map;
 
diff --git a/src/main/java/org/apache/sling/config/spi/ConfigurationPersistenceProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java
similarity index 98%
rename from src/main/java/org/apache/sling/config/spi/ConfigurationPersistenceProvider.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java
index eee2245..e62b520 100644
--- a/src/main/java/org/apache/sling/config/spi/ConfigurationPersistenceProvider.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi;
+package org.apache.sling.contextaware.config.spi;
 
 import java.util.Map;
 
diff --git a/src/main/java/org/apache/sling/config/spi/ContextPathStrategy.java b/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java
similarity index 96%
rename from src/main/java/org/apache/sling/config/spi/ContextPathStrategy.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java
index 7d6b629..6935013 100644
--- a/src/main/java/org/apache/sling/config/spi/ContextPathStrategy.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi;
+package org.apache.sling.contextaware.config.spi;
 
 import java.util.Collection;
 
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/AbstractConfigurationPart.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java
similarity index 97%
rename from src/main/java/org/apache/sling/config/spi/metadata/AbstractConfigurationPart.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java
index b79d8b5..2b7fa39 100644
--- a/src/main/java/org/apache/sling/config/spi/metadata/AbstractConfigurationPart.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi.metadata;
+package org.apache.sling.contextaware.config.spi.metadata;
 
 import java.util.HashMap;
 
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
similarity index 96%
rename from src/main/java/org/apache/sling/config/spi/metadata/ConfigurationMetadata.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
index e43cecc..91a7480 100644
--- a/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationMetadata.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi.metadata;
+package org.apache.sling.contextaware.config.spi.metadata;
 
 import java.util.ArrayList;
 import java.util.Collection;
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationPart.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java
similarity index 95%
rename from src/main/java/org/apache/sling/config/spi/metadata/ConfigurationPart.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java
index 1a1590c..23be0c5 100644
--- a/src/main/java/org/apache/sling/config/spi/metadata/ConfigurationPart.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi.metadata;
+package org.apache.sling.contextaware.config.spi.metadata;
 
 import java.util.regex.Pattern;
 
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
similarity index 97%
rename from src/main/java/org/apache/sling/config/spi/metadata/PropertyMetadata.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
index 2b4e1a6..e6ed34d 100644
--- a/src/main/java/org/apache/sling/config/spi/metadata/PropertyMetadata.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi.metadata;
+package org.apache.sling.contextaware.config.spi.metadata;
 
 import javax.annotation.Nonnull;
 
diff --git a/src/main/java/org/apache/sling/config/spi/metadata/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
similarity index 94%
rename from src/main/java/org/apache/sling/config/spi/metadata/package-info.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
index f8b578b..0372745 100644
--- a/src/main/java/org/apache/sling/config/spi/metadata/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
@@ -20,4 +20,4 @@
  * Defining configuration and parameter metadata for the SPI.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.config.spi.metadata;
+package org.apache.sling.contextaware.config.spi.metadata;
diff --git a/src/main/java/org/apache/sling/config/spi/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
similarity index 95%
rename from src/main/java/org/apache/sling/config/spi/package-info.java
rename to src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
index 3b35911..76033c3 100644
--- a/src/main/java/org/apache/sling/config/spi/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
@@ -20,4 +20,4 @@
  * SPI for applications hooking into the configuration infrastructure for parameterizing and customizing.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.config.spi;
+package org.apache.sling.contextaware.config.spi;
diff --git a/src/main/java/org/apache/sling/config/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
similarity index 98%
rename from src/main/java/org/apache/sling/config/resource/ConfigurationResourceResolver.java
rename to src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
index 4fa6baf..e8f85d3 100644
--- a/src/main/java/org/apache/sling/config/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/contextaware/resource/ConfigurationResourceResolver.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.resource;
+package org.apache.sling.contextaware.resource;
 
 import java.util.Collection;
 
diff --git a/src/main/java/org/apache/sling/config/resource/package-info.java b/src/main/java/org/apache/sling/contextaware/resource/package-info.java
similarity index 95%
rename from src/main/java/org/apache/sling/config/resource/package-info.java
rename to src/main/java/org/apache/sling/contextaware/resource/package-info.java
index f602d02..4344ba3 100644
--- a/src/main/java/org/apache/sling/config/resource/package-info.java
+++ b/src/main/java/org/apache/sling/contextaware/resource/package-info.java
@@ -21,4 +21,4 @@
  * This is a low-level API.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.config.resource;
+package org.apache.sling.contextaware.resource;
diff --git a/src/test/java/org/apache/sling/config/spi/metadata/ConfigurationMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
similarity index 91%
rename from src/test/java/org/apache/sling/config/spi/metadata/ConfigurationMetadataTest.java
rename to src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
index 50c6dd5..556337a 100644
--- a/src/test/java/org/apache/sling/config/spi/metadata/ConfigurationMetadataTest.java
+++ b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi.metadata;
+package org.apache.sling.contextaware.config.spi.metadata;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
+import org.apache.sling.contextaware.config.spi.metadata.PropertyMetadata;
 import org.junit.Test;
 
 public class ConfigurationMetadataTest {
diff --git a/src/test/java/org/apache/sling/config/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
similarity index 93%
rename from src/test/java/org/apache/sling/config/spi/metadata/PropertyMetadataTest.java
rename to src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
index 60fab1b..66ae8b3 100644
--- a/src/test/java/org/apache/sling/config/spi/metadata/PropertyMetadataTest.java
+++ b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.config.spi.metadata;
+package org.apache.sling.contextaware.config.spi.metadata;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
+import org.apache.sling.contextaware.config.spi.metadata.PropertyMetadata;
 import org.junit.Test;
 
 public class PropertyMetadataTest {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 14/24: SLING-6016 split up annotation class/valuemap/adaptable usecases into separate methods and make return value handling consistent

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit e6edc8a949b470e4719f4af303a8e47e840b8690
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Tue Aug 30 14:43:28 2016 +0000

    SLING-6016 split up annotation class/valuemap/adaptable usecases into separate methods and make return value handling consistent
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1758402 13f79535-47bb-0310-9956-ffa450edef68
---
 .../contextaware/config/ConfigurationBuilder.java  | 49 ++++++++++++++++++----
 1 file changed, 40 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
index dc1447e..1243e84 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
+++ b/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
@@ -22,6 +22,7 @@ import java.util.Collection;
 
 import javax.annotation.Nonnull;
 
+import org.apache.sling.api.resource.ValueMap;
 import org.osgi.annotation.versioning.ProviderType;
 
 /**
@@ -31,26 +32,56 @@ import org.osgi.annotation.versioning.ProviderType;
 public interface ConfigurationBuilder {
 
     /**
-     * Define configuration name. This parameter is optional, it defaults to the class
-     * name of the argument provided either to {@link #as(Class)} or {@link #asCollection(Class)}.
-     *
+     * Define configuration name.
+     * Optional for the {@link #as(Class)} and {@link #asCollection(Class)} methods, mandatory for the others. 
      * @param configName Relative path
      * @return Configuration builder
      */
     @Nonnull ConfigurationBuilder name(@Nonnull String configName);
 
     /**
-     * Get configuration as singleton and its properties mapped to the given annotation class.
-     * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
-     * @return Configuration object. Contains only the default values if the conversion fails or the provided name is invalid.
+     * Get configuration as singleton resource and its properties mapped to the given annotation class.
+     * Configuration name is optional - if not given via {@link #name(String)} method it is derived
+     * from the annotation interface class name.
+     * @param clazz Annotation interface class
+     * @return Configuration object. Contains only the default values if content resource or configuration cannot be found.
      */
     @Nonnull <T> T as(@Nonnull Class<T> clazz);
 
     /**
-     * Get collection of configuration instances with its properties mapped to the given annotation class.
-     * @param clazz Annotation class or {@link org.apache.sling.api.resource.ValueMap}
-     * @return Collection of configuration objects. Might be empty if the provided name is invalid.
+     * Get collection of configuration resources with their properties mapped to the given annotation class.
+     * Configuration name is optional - if not given via {@link #name(String)} method it is derived
+     * from the annotation interface class name.
+     * @param clazz Annotation interface class
+     * @return Collection of configuration objects. Is empty if content resource or configuration cannot be found.
      */
     @Nonnull <T> Collection<T> asCollection(@Nonnull Class<T> clazz);
 
+    /**
+     * Get configuration as singleton resource and return its properties as value map.
+     * @return Value map. Map is empty if content resource or configuration cannot be found.
+     */
+    @Nonnull ValueMap asValueMap();
+
+    /**
+     * Get collection of configuration resources with their properties mapped to the given annotation class.
+     * @param clazz Annotation interface class
+     * @return Collection of value map. Is empty if content resource or configuration cannot be found.
+     */
+    @Nonnull Collection<ValueMap> asValueMapCollection();
+
+    /**
+     * Get configuration as singleton configuration resource and adapt it to the given class.
+     * @param clazz Class that can be adapted from a {@link Resource}
+     * @return Object instance or null if content resource or configuration cannot be found or if the adaption was not possible.
+     */
+    <T> T asAdaptable(@Nonnull Class<T> clazz);
+
+    /**
+     * Get collection of configuration resources and adapt them to the given class.
+     * @param clazz Class that can be adapted from a {@link Resource}
+     * @return Collection of object instances. Is empty if content resource or configuration cannot be found or if the adaption was not possible.
+     */
+    @Nonnull <T> Collection<T> asAdaptableCollection(@Nonnull Class<T> clazz);
+
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-caconfig-api] 22/24: SLING-6157 Context-Aware Config: Change java package name to o.a.s.caconfig

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git

commit f5dd0f09c5a1e3029f0096c9c2fe329a096f0f95
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Oct 14 21:38:06 2016 +0000

    SLING-6157 Context-Aware Config: Change java package name to o.a.s.caconfig
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/contextaware-config/api@1764966 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                               | 2 +-
 .../sling/{contextaware/config => caconfig}/ConfigurationBuilder.java | 2 +-
 .../config => caconfig}/ConfigurationResolveException.java            | 2 +-
 .../{contextaware/config => caconfig}/ConfigurationResolver.java      | 4 ++--
 .../{contextaware/config => caconfig}/annotation/Configuration.java   | 2 +-
 .../sling/{contextaware/config => caconfig}/annotation/Property.java  | 2 +-
 .../{contextaware/config => caconfig}/annotation/package-info.java    | 2 +-
 .../apache/sling/{contextaware/config => caconfig}/package-info.java  | 2 +-
 .../config => caconfig}/resource/ConfigurationResourceResolver.java   | 4 ++--
 .../{contextaware/config => caconfig}/resource/package-info.java      | 2 +-
 10 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1cba2c7..0ae0c09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
         <relativePath />
     </parent>
     
-    <artifactId>org.apache.sling.contextaware.config.api</artifactId>
+    <artifactId>org.apache.sling.caconfig.api</artifactId>
     <packaging>bundle</packaging>
     <version>1.0.0-SNAPSHOT</version>
     <name>Apache Sling Context-Aware Configuration API</name>
diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java b/src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java
similarity index 98%
rename from src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
rename to src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java
index 28d2a2a..be06432 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationBuilder.java
+++ b/src/main/java/org/apache/sling/caconfig/ConfigurationBuilder.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.contextaware.config;
+package org.apache.sling.caconfig;
 
 import java.util.Collection;
 
diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolveException.java b/src/main/java/org/apache/sling/caconfig/ConfigurationResolveException.java
similarity index 96%
rename from src/main/java/org/apache/sling/contextaware/config/ConfigurationResolveException.java
rename to src/main/java/org/apache/sling/caconfig/ConfigurationResolveException.java
index d41b274..ae4a650 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolveException.java
+++ b/src/main/java/org/apache/sling/caconfig/ConfigurationResolveException.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.contextaware.config;
+package org.apache.sling.caconfig;
 
 import org.osgi.annotation.versioning.ProviderType;
 
diff --git a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java b/src/main/java/org/apache/sling/caconfig/ConfigurationResolver.java
similarity index 90%
rename from src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
rename to src/main/java/org/apache/sling/caconfig/ConfigurationResolver.java
index c1aab2e..885daf4 100644
--- a/src/main/java/org/apache/sling/contextaware/config/ConfigurationResolver.java
+++ b/src/main/java/org/apache/sling/caconfig/ConfigurationResolver.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.contextaware.config;
+package org.apache.sling.caconfig;
 
 import javax.annotation.Nonnull;
 
@@ -28,7 +28,7 @@ import org.osgi.annotation.versioning.ProviderType;
  * Context-specific configuration may be different for different parts of the resource
  * hierarchy, and configuration parameter inheritance may take place.
  *
- * This service builds on top of the {@link org.apache.sling.contextaware.config.resource.ConfigurationResourceResolver}
+ * This service builds on top of the {@link org.apache.sling.caconfig.resource.ConfigurationResourceResolver}
  * and uses that service to resolve configuration resources. These resources
  * can then be converted into application specific configuration objects
  * using the {@link ConfigurationBuilder}.
diff --git a/src/main/java/org/apache/sling/contextaware/config/annotation/Configuration.java b/src/main/java/org/apache/sling/caconfig/annotation/Configuration.java
similarity index 96%
rename from src/main/java/org/apache/sling/contextaware/config/annotation/Configuration.java
rename to src/main/java/org/apache/sling/caconfig/annotation/Configuration.java
index 06a1477..973164d 100644
--- a/src/main/java/org/apache/sling/contextaware/config/annotation/Configuration.java
+++ b/src/main/java/org/apache/sling/caconfig/annotation/Configuration.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.contextaware.config.annotation;
+package org.apache.sling.caconfig.annotation;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
diff --git a/src/main/java/org/apache/sling/contextaware/config/annotation/Property.java b/src/main/java/org/apache/sling/caconfig/annotation/Property.java
similarity index 96%
rename from src/main/java/org/apache/sling/contextaware/config/annotation/Property.java
rename to src/main/java/org/apache/sling/caconfig/annotation/Property.java
index 911c2bd..752d171 100644
--- a/src/main/java/org/apache/sling/contextaware/config/annotation/Property.java
+++ b/src/main/java/org/apache/sling/caconfig/annotation/Property.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.contextaware.config.annotation;
+package org.apache.sling.caconfig.annotation;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
diff --git a/src/main/java/org/apache/sling/contextaware/config/annotation/package-info.java b/src/main/java/org/apache/sling/caconfig/annotation/package-info.java
similarity index 94%
rename from src/main/java/org/apache/sling/contextaware/config/annotation/package-info.java
rename to src/main/java/org/apache/sling/caconfig/annotation/package-info.java
index 9a71f4d..070a497 100644
--- a/src/main/java/org/apache/sling/contextaware/config/annotation/package-info.java
+++ b/src/main/java/org/apache/sling/caconfig/annotation/package-info.java
@@ -20,4 +20,4 @@
  * Annotations for context-aware configurations.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.annotation;
+package org.apache.sling.caconfig.annotation;
diff --git a/src/main/java/org/apache/sling/contextaware/config/package-info.java b/src/main/java/org/apache/sling/caconfig/package-info.java
similarity index 95%
rename from src/main/java/org/apache/sling/contextaware/config/package-info.java
rename to src/main/java/org/apache/sling/caconfig/package-info.java
index 9602c19..5a7580a 100644
--- a/src/main/java/org/apache/sling/contextaware/config/package-info.java
+++ b/src/main/java/org/apache/sling/caconfig/package-info.java
@@ -20,4 +20,4 @@
  * API for accessing context-aware configuration.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config;
+package org.apache.sling.caconfig;
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java b/src/main/java/org/apache/sling/caconfig/resource/ConfigurationResourceResolver.java
similarity index 95%
rename from src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
rename to src/main/java/org/apache/sling/caconfig/resource/ConfigurationResourceResolver.java
index be8160e..12f13c3 100644
--- a/src/main/java/org/apache/sling/contextaware/config/resource/ConfigurationResourceResolver.java
+++ b/src/main/java/org/apache/sling/caconfig/resource/ConfigurationResourceResolver.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.contextaware.config.resource;
+package org.apache.sling.caconfig.resource;
 
 import java.util.Collection;
 
@@ -29,7 +29,7 @@ import org.osgi.annotation.versioning.ProviderType;
 /**
  * Getting context-aware configuration resources for a given resource context.
  * This is a low-level interface for supporting advanced use cases. If you just want to fetch
- * some configuration parameters {@link org.apache.sling.contextaware.config.ConfigurationResolver}
+ * some configuration parameters {@link org.apache.sling.caconfig.ConfigurationResolver}
  * is the right place.
  */
 @ProviderType
diff --git a/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java b/src/main/java/org/apache/sling/caconfig/resource/package-info.java
similarity index 94%
rename from src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
rename to src/main/java/org/apache/sling/caconfig/resource/package-info.java
index e91b4cd..ef04a94 100644
--- a/src/main/java/org/apache/sling/contextaware/config/resource/package-info.java
+++ b/src/main/java/org/apache/sling/caconfig/resource/package-info.java
@@ -21,4 +21,4 @@
  * This is a low-level API.
  */
 @org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.resource;
+package org.apache.sling.caconfig.resource;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.