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:35:05 UTC

[sling-org-apache-sling-featureflags] annotated tag org.apache.sling.featureflags-1.2.0 created (now 95913a9)

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

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


      at 95913a9  (tag)
 tagging e500e9d0f505aad1b594e4662c878a953139ea65 (commit)
      by Carsten Ziegeler
      on Fri Aug 19 16:30:49 2016 +0000

- Log -----------------------------------------------------------------
org.apache.sling.featureflags-1.2.0
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new b660cb4  New Feature Flags prototype
     new 68ee646  Implemet hiding of resource and decorating
     new 93f4097  Take II for the feature flags, separate into different contexts to avoid duplicate evaluation
     new fae60b1  Take II for the feature flags, separate into different contexts to avoid duplicate evaluation
     new d262cb3  Update javadocs
     new 085cc03  Remove "extensions" from package name
     new 8bf3903  Take III, add Feature interface and support adapting to functionality interfaces
     new 3e0d594  Moving feature flags into trunk
     new 35ebee9  Take III, add Feature interface and support adapting to functionality interfaces
     new 7a1c95e  Remove FeatureProvider interface, Features are OSGi services now - rename ProviderContext to ExecutionContext
     new 9f8c00a  Remove FeatureProvider interface, Features are OSGi services now - rename ProviderContext to ExecutionContext
     new 62d89be  SLING-2698 - resource access security service for resource providers. Distinguish between context application and provider
     new 0416605  Use released Sling API
     new 5e66975  SLING-3148 Merge back from whiteboard/fmeschbe/featureflags/feature-flags
     new b5e22fe  SLING-3148 Set appropriate label for the configuration metatype
     new d7c9903  Fix some typos
     new a43e709  SLING-3346 Feature flag not respected
     new e2fe9d0  SLING-3148 : Get resource resolver from authentication support via request attribute
     new 7d315ba  SLING-3350 Simplify API and implementation:
     new 646abb7  SLING-3353 Move feature flags from contrib to bundles
     new 6bc6971  FELIX-3444 : Provide a switch to enable feature flags for the resource resolver
     new ff85fb8  SLING-3484 - Remove FeatureAuthenticationInfoPostProcessor and FeatureConstants, unneeded
     new 22dc66a  Add svn info, remove unused dep
     new 8ef0dda  [maven-release-plugin] prepare release org.apache.sling.featureflags-1.0.0
     new f5b6eac  [maven-release-plugin] prepare for next development iteration
     new 3129e0f  Update to parent pom v19
     new 0aaeefb  Updated to parent version 20
     new 806c579  Update to Sling Parent POM 22 with baselining enabled
     new ccebc03  Add missing licence header
     new f32cee4  Update to Sling Parent 23
     new e7232bb  Remove superflous sling.java.version=6 as it's the default now
     new 30019fc  SLING-4836 - Escape output in Apache Sling Feature Flags webconsole plugin * applied patch from  Alexandre Collignon (Thanks!)
     new 51324b5  [maven-release-plugin] prepare release org.apache.sling.featureflags-1.0.2
     new 78e9e11  [maven-release-plugin] prepare for next development iteration
     new d55bb79  set parent version to 24 and add empty relativePath where missing
     new eb18618  Update the main reactor to parent 25
     new 7c0bba4  Switch to parent pom 26
     new 1dfd47c  SLING-5939 : Register filter using http whiteboard
     new 93549a2  SLING-5939 : Register filter using Http Whiteboard
     new 23b8385  [maven-release-plugin] prepare release org.apache.sling.featureflags-1.1.0
     new 738f12d  [maven-release-plugin] prepare for next development iteration
     new d5ca8fe  SLING-5981 : Provide access to Features service in execution context
     new e7b4012  [maven-release-plugin] prepare release org.apache.sling.featureflags-1.2.0
     new e500e9d  [maven-release-plugin] copy for tag org.apache.sling.featureflags-1.2.0

The 44 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-featureflags] 02/04: SLING-5981 : Provide access to Features service in execution context

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.featureflags-1.2.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-featureflags.git

commit d5ca8fedfa681210afa8e8da357e130df1ee15da
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Aug 19 16:26:24 2016 +0000

    SLING-5981 : Provide access to Features service in execution context
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/feature-flags@1756930 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/featureflags/ExecutionContext.java       |  7 ++++++
 .../sling/featureflags/impl/ConfiguredFeature.java |  5 +++-
 .../featureflags/impl/ExecutionContextImpl.java    | 28 +++++++++++++++++-----
 .../sling/featureflags/impl/FeatureManager.java    | 23 ++++++++++--------
 .../apache/sling/featureflags/package-info.java    |  4 ++--
 5 files changed, 48 insertions(+), 19 deletions(-)

diff --git a/src/main/java/org/apache/sling/featureflags/ExecutionContext.java b/src/main/java/org/apache/sling/featureflags/ExecutionContext.java
index 5eda911..4d64685 100644
--- a/src/main/java/org/apache/sling/featureflags/ExecutionContext.java
+++ b/src/main/java/org/apache/sling/featureflags/ExecutionContext.java
@@ -60,4 +60,11 @@ public interface ExecutionContext {
      * @return the resource resolver or {@code null}
      */
     ResourceResolver getResourceResolver();
+
+    /**
+     * Return the {@link Features} manager. This allows a feature to find out
+     * about other features.
+     * @since 1.1.0
+     */
+    Features getFeatures();
 }
diff --git a/src/main/java/org/apache/sling/featureflags/impl/ConfiguredFeature.java b/src/main/java/org/apache/sling/featureflags/impl/ConfiguredFeature.java
index 266069e..7280f64 100644
--- a/src/main/java/org/apache/sling/featureflags/impl/ConfiguredFeature.java
+++ b/src/main/java/org/apache/sling/featureflags/impl/ConfiguredFeature.java
@@ -34,7 +34,10 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 
 @Designate(ocd = ConfiguredFeature.Config.class, factory = true)
 @Component(service = Feature.class,
-           configurationPolicy = ConfigurationPolicy.REQUIRE)
+           configurationPolicy = ConfigurationPolicy.REQUIRE,
+           property = {
+                   Constants.SERVICE_VENDOR + "=The Apache Software Foundation"
+           })
 public class ConfiguredFeature implements Feature {
 
     @ObjectClassDefinition(name = "Apache Sling Configured Feature",
diff --git a/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java b/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java
index 76d40c7..8a95302 100644
--- a/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java
+++ b/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java
@@ -23,9 +23,11 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.featureflags.ExecutionContext;
 import org.apache.sling.featureflags.Feature;
+import org.apache.sling.featureflags.Features;
 
 /**
  * Implementation of the provider context.
@@ -40,18 +42,25 @@ public class ExecutionContextImpl implements ExecutionContext {
 
     private final Map<String, Boolean> featureCache;
 
-    public ExecutionContextImpl(final HttpServletRequest request) {
+    private final Features features;
+
+    public ExecutionContextImpl(final Features features, final HttpServletRequest request) {
         ResourceResolver resourceResolver = null;
         if (request != null) {
-            Object resolverObject = request.getAttribute(REQUEST_ATTRIBUTE_RESOLVER);
-            if (resolverObject instanceof ResourceResolver) {
-                resourceResolver = (ResourceResolver) resolverObject;
+            if ( request instanceof SlingHttpServletRequest ) {
+                resourceResolver = ((SlingHttpServletRequest)request).getResourceResolver();
+            } else {
+                Object resolverObject = request.getAttribute(REQUEST_ATTRIBUTE_RESOLVER);
+                if (resolverObject instanceof ResourceResolver) {
+                    resourceResolver = (ResourceResolver) resolverObject;
+                }
             }
         }
 
         this.request = request;
         this.resourceResolver = resourceResolver;
         this.featureCache = new HashMap<String, Boolean>();
+        this.features = features;
     }
 
     @Override
@@ -64,11 +73,18 @@ public class ExecutionContextImpl implements ExecutionContext {
         return this.resourceResolver;
     }
 
-    boolean isEnabled(Feature feature) {
+    @Override
+    public Features getFeatures() {
+        return this.features;
+    }
+
+    boolean isEnabled(final Feature feature) {
         final String name = feature.getName();
         Boolean entry = this.featureCache.get(name);
         if (entry == null) {
-            entry = Boolean.valueOf(feature.isEnabled(this));
+            // put false in the cache to stop on circular calls
+            this.featureCache.put(name, Boolean.FALSE);
+            entry = feature.isEnabled(this);
             this.featureCache.put(name, entry);
         }
         return entry;
diff --git a/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java b/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java
index c8fd473..17464fd 100644
--- a/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java
+++ b/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java
@@ -62,7 +62,8 @@ import org.slf4j.LoggerFactory;
                    "felix.webconsole.label=features",
                    "felix.webconsole.title=Features",
                    "felix.webconsole.category=Sling",
-                   Constants.SERVICE_RANKING + ":Integer=16384"
+                   Constants.SERVICE_RANKING + ":Integer=16384",
+                   Constants.SERVICE_VENDOR + "=The Apache Software Foundation"
            })
 public class FeatureManager implements Features, Filter, Servlet {
 
@@ -90,7 +91,7 @@ public class FeatureManager implements Features, Filter, Servlet {
     }
 
     @Override
-    public boolean isEnabled(String featureName) {
+    public boolean isEnabled(final String featureName) {
         final Feature feature = this.getFeature(featureName);
         if (feature != null) {
             return getCurrentExecutionContext().isEnabled(feature);
@@ -101,15 +102,17 @@ public class FeatureManager implements Features, Filter, Servlet {
     //--- Filter
 
     @Override
-    public void init(FilterConfig filterConfig) {
-        // nothing todo do
+    public void init(final FilterConfig filterConfig) {
+        // nothing to do
     }
 
     @Override
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
-            ServletException {
+    public void doFilter(final ServletRequest request,
+            final ServletResponse response,
+            final FilterChain chain)
+    throws IOException, ServletException {
+        this.pushContext((HttpServletRequest) request);
         try {
-            this.pushContext((HttpServletRequest) request);
             chain.doFilter(request, response);
         } finally {
             this.popContext();
@@ -125,7 +128,7 @@ public class FeatureManager implements Features, Filter, Servlet {
     //--- Servlet
 
     @Override
-    public void init(ServletConfig config) {
+    public void init(final ServletConfig config) {
         this.servletConfig = config;
     }
 
@@ -221,7 +224,7 @@ public class FeatureManager implements Features, Filter, Servlet {
     //--- Client Context management and access
 
     void pushContext(final HttpServletRequest request) {
-        this.perThreadClientContext.set(new ExecutionContextImpl(request));
+        this.perThreadClientContext.set(new ExecutionContextImpl(this, request));
     }
 
     void popContext() {
@@ -230,7 +233,7 @@ public class FeatureManager implements Features, Filter, Servlet {
 
     ExecutionContextImpl getCurrentExecutionContext() {
         ExecutionContextImpl ctx = this.perThreadClientContext.get();
-        return (ctx != null) ? ctx : new ExecutionContextImpl(null);
+        return (ctx != null) ? ctx : new ExecutionContextImpl(this, null);
     }
 
     /**
diff --git a/src/main/java/org/apache/sling/featureflags/package-info.java b/src/main/java/org/apache/sling/featureflags/package-info.java
index ff01425..4df4dc6 100644
--- a/src/main/java/org/apache/sling/featureflags/package-info.java
+++ b/src/main/java/org/apache/sling/featureflags/package-info.java
@@ -60,8 +60,8 @@
  *  </tr>
  * </table>
  *
- * @version 1.0
+ * @version 1.1
  * @see <a href="http://sling.apache.org/documentation/the-sling-engine/featureflags.html">Feature Flags</a>
  */
-@org.osgi.annotation.versioning.Version("1.0.1")
+@org.osgi.annotation.versioning.Version("1.1.0")
 package org.apache.sling.featureflags;

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

[sling-org-apache-sling-featureflags] 03/04: [maven-release-plugin] prepare release org.apache.sling.featureflags-1.2.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.featureflags-1.2.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-featureflags.git

commit e7b4012ee1869af56f581202ae5563eb65b357f0
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Aug 19 16:30:35 2016 +0000

    [maven-release-plugin] prepare release org.apache.sling.featureflags-1.2.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/feature-flags@1756931 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 72366d6..2109b83 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,14 +28,14 @@
     
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.featureflags</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.2.0</version>
     <packaging>bundle</packaging>
     <name>Apache Sling Feature Flags</name>
     
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/feature-flags</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/feature-flags</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/feature-flags</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.featureflags-1.2.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.featureflags-1.2.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.featureflags-1.2.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-featureflags] 04/04: [maven-release-plugin] copy for tag org.apache.sling.featureflags-1.2.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.featureflags-1.2.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-featureflags.git

commit e500e9d0f505aad1b594e4662c878a953139ea65
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Aug 19 16:30:49 2016 +0000

    [maven-release-plugin] copy for tag org.apache.sling.featureflags-1.2.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.featureflags-1.2.0@1756932 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-featureflags] 01/04: [maven-release-plugin] prepare for next development iteration

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.featureflags-1.2.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-featureflags.git

commit 738f12da80ecc122301ce8d7a04530ce27910258
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Aug 2 07:35:15 2016 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/feature-flags@1754840 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 258e917..72366d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,14 +28,14 @@
     
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.featureflags</artifactId>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
     <name>Apache Sling Feature Flags</name>
     
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.featureflags-1.1.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.featureflags-1.1.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.featureflags-1.1.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/feature-flags</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/feature-flags</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/feature-flags</url>
     </scm>
 
     <build>

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