Author: cziegeler
Date: Fri Nov  4 15:17:44 2016
New Revision: 1768050

URL: http://svn.apache.org/viewvc?rev=1768050&view=rev
Log:
SLING-6244 : Provide an SPI for influencing the collection inheritance

Added:
    
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/CollectionInheritanceDecider.java
   (with props)
    
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/InheritanceDecision.java
   (with props)
Modified:
    
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/ConfigurationResourceResolvingStrategy.java
    
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/package-info.java

Added: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/CollectionInheritanceDecider.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/CollectionInheritanceDecider.java?rev=1768050&view=auto
==============================================================================
--- 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/CollectionInheritanceDecider.java
 (added)
+++ 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/CollectionInheritanceDecider.java
 Fri Nov  4 15:17:44 2016
@@ -0,0 +1,43 @@
+/*
+ * 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.caconfig.resource.spi;
+
+import org.apache.sling.api.resource.Resource;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * The {@code CollectionInheritanceDecider} is an SPI which should be used by
+ * all {@link ConfigurationResourceResolvingStrategy} implementations if they
+ * support inheritance for collections.
+ *
+ * @since 1.1
+ */
+@ConsumerType
+public interface CollectionInheritanceDecider {
+
+    /**
+     * Decide whether the provided resource should be included in the 
collection.
+     * The provided resource can either be included, excluded or blocked.
+     *
+     * @param bucketName The bucket name
+     * @param resource The resource
+     * @return The decision.
+     */
+    InheritanceDecision decide(String bucketName, Resource resource);
+}

Propchange: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/CollectionInheritanceDecider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/CollectionInheritanceDecider.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Modified: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/ConfigurationResourceResolvingStrategy.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/ConfigurationResourceResolvingStrategy.java?rev=1768050&r1=1768049&r2=1768050&view=diff
==============================================================================
--- 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/ConfigurationResourceResolvingStrategy.java
 (original)
+++ 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/ConfigurationResourceResolvingStrategy.java
 Fri Nov  4 15:17:44 2016
@@ -29,6 +29,10 @@ import org.osgi.annotation.versioning.Co
 /**
  * Defines how and where the configuration resources are looked up.
  * This SPI allows application to define their own configuration storage and 
inheritance strategies.
+ *
+ * If this strategy supports inheritance for collections, it should use the 
optional
+ * {@link CollectionInheritanceDecider} SPI interface. If such a service is 
available, it should
+ * be called.
  */
 @ConsumerType
 public interface ConfigurationResourceResolvingStrategy {
@@ -36,7 +40,7 @@ public interface ConfigurationResourceRe
     /**
      * 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 
+     * @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.
@@ -47,20 +51,20 @@ public interface ConfigurationResourceRe
     /**
      * 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 
+     * @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). 
+     * 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 
+     * @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.
@@ -71,14 +75,14 @@ public interface ConfigurationResourceRe
     /**
      * 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). 
+     * 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 
+     * @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);
-    
+
 }

Added: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/InheritanceDecision.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/InheritanceDecision.java?rev=1768050&view=auto
==============================================================================
--- 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/InheritanceDecision.java
 (added)
+++ 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/InheritanceDecision.java
 Fri Nov  4 15:17:44 2016
@@ -0,0 +1,31 @@
+/*
+ * 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.caconfig.resource.spi;
+
+/**
+ * Return values for {@link CollectionInheritanceDecider}.
+ *
+ * @since 1.1
+ */
+public enum InheritanceDecision {
+
+    INCLUDE, // include the resource.
+    EXCLUDE, // exclude the resource, but allow others to provide it.
+    BLOCK    // exclude the resource, no one else can provide it.
+}

Propchange: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/InheritanceDecision.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/InheritanceDecision.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Modified: 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/package-info.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/package-info.java?rev=1768050&r1=1768049&r2=1768050&view=diff
==============================================================================
--- 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/package-info.java
 (original)
+++ 
sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/resource/spi/package-info.java
 Fri Nov  4 15:17:44 2016
@@ -19,5 +19,5 @@
 /**
  * SPI for applications hooking into the configuration resource infrastructure 
for parameterizing and customizing.
  */
[email protected]("1.0.0")
[email protected]("1.1.0")
 package org.apache.sling.caconfig.resource.spi;


Reply via email to