You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2016/11/17 17:50:36 UTC
svn commit: r1770249 [2/2] - in
/sling/trunk/contrib/extensions/contextaware-config: impl/
impl/src/main/java/org/apache/sling/caconfig/impl/
impl/src/main/java/org/apache/sling/caconfig/impl/def/
impl/src/main/java/org/apache/sling/caconfig/resource/i...
Modified: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/resource/impl/def/DefaultConfigurationResourceResolvingStrategyTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/resource/impl/def/DefaultConfigurationResourceResolvingStrategyTest.java?rev=1770249&r1=1770248&r2=1770249&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/resource/impl/def/DefaultConfigurationResourceResolvingStrategyTest.java (original)
+++ sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/resource/impl/def/DefaultConfigurationResourceResolvingStrategyTest.java Thu Nov 17 17:50:36 2016
@@ -23,7 +23,6 @@ import static org.apache.sling.caconfig.
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.caconfig.resource.impl.ContextPathStrategyMultiplexer;
@@ -257,7 +256,7 @@ public class DefaultConfigurationResourc
"enabled", false);
assertNull(underTest.getResource(site1Page1, BUCKET, "test"));
- assertTrue(underTest.getResourceCollection(site1Page1, BUCKET, "feature").isEmpty());
+ assertNull(underTest.getResourceCollection(site1Page1, BUCKET, "feature"));
assertNull(underTest.getResourcePath(site1Page1, BUCKET, "test"));
assertNull(underTest.getResourceCollectionParentPath(site1Page1, BUCKET, "feature"));
}
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=1770249&r1=1770248&r2=1770249&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 Thu Nov 17 17:50:36 2016
@@ -19,6 +19,7 @@
package org.apache.sling.caconfig.resource.spi;
import java.util.Collection;
+import java.util.Iterator;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
@@ -46,7 +47,7 @@ public interface ConfigurationResourceRe
* 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}.
+ * @return Configuration resource or {@code null} if this strategy did not found matching resources.
*/
@CheckForNull Resource getResource(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
@@ -57,9 +58,33 @@ public interface ConfigurationResourceRe
* 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.
+ * @return Collection of configuration resources or {@code null} if this strategy did not found matching resources.
*/
- @Nonnull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
+ @CheckForNull Collection<Resource> getResourceCollection(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
+
+ /**
+ * Get a context-aware singleton configuration resource inheritance chain defined by the given configuration name.
+ * The first item of the inheritance chain it the same resource returned by {@link #getResource(Resource, String, String)}.
+ * @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 inheritance chain or {@code null} if this strategy did not found matching resources.
+ */
+ @CheckForNull Iterator<Resource> getResourceInheritanceChain(@Nonnull Resource resource, @Nonnull String bucketName, @Nonnull String configName);
+
+ /**
+ * Get a collection of context-aware configuration resource inheritance chains defined by the given configuration name.
+ * The first item of each inheritance chain is the same item returned by {@link #getResourceCollection(Resource, String, String)}.
+ * @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 resource inheritance chains or {@code null} if this strategy did not found matching resources.
+ */
+ @CheckForNull Collection<Iterator<Resource>> getResourceCollectionInheritanceChain(@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.
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=1770249&r1=1770248&r2=1770249&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 Thu Nov 17 17:50:36 2016
@@ -1,4 +1,4 @@
-/*
+ /*
* 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
@@ -19,5 +19,5 @@
/**
* SPI for applications hooking into the configuration resource infrastructure for parameterizing and customizing.
*/
-@org.osgi.annotation.versioning.Version("1.1.0")
+@org.osgi.annotation.versioning.Version("2.0.0")
package org.apache.sling.caconfig.resource.spi;
Added: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationInheritanceStrategy.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationInheritanceStrategy.java?rev=1770249&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationInheritanceStrategy.java (added)
+++ sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationInheritanceStrategy.java Thu Nov 17 17:50:36 2016
@@ -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.caconfig.spi;
+
+import java.util.Iterator;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Defines how (and if) resources in a resource hierarchy should inherit form each other.
+ * Primary use case is property inheritance over the inheritance chain.
+ */
+@ConsumerType
+public interface ConfigurationInheritanceStrategy {
+
+ /**
+ * Pick or merge resources for inheritance.
+ * @param configResources Iterator of configuration resources that form the inheritance hierarchy.
+ * First resource is the "closest" match, the other resources may be used to inherit from.
+ * @return Inherited resource or null if this strategy does not support the given resources
+ */
+ @CheckForNull Resource getResource(@Nonnull Iterator<Resource> configResources);
+
+}
Propchange: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationInheritanceStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationInheritanceStrategy.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Thu Nov 17 17:50:36 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author
Propchange: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationInheritanceStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/package-info.java?rev=1770249&r1=1770248&r2=1770249&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/package-info.java (original)
+++ sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/package-info.java Thu Nov 17 17:50:36 2016
@@ -19,5 +19,5 @@
/**
* SPI for applications hooking into the configuration infrastructure for parameterizing and customizing.
*/
-@org.osgi.annotation.versioning.Version("1.0.0")
+@org.osgi.annotation.versioning.Version("1.1.0")
package org.apache.sling.caconfig.spi;