sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject [sling-whiteboard] branch master updated: Update javadoc
Date Wed, 18 Apr 2018 07:10:18 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new b4852ce  Update javadoc
b4852ce is described below

commit b4852ceb3265a598b740e445df7560a9a37074c5
Author: Carsten Ziegeler <cziegeler@apache.org>
AuthorDate: Wed Apr 18 09:09:58 2018 +0200

    Update javadoc
---
 .../feature/support/process/BuilderContext.java    | 40 +++++++++++++++-------
 .../sling/feature/support/process/BuilderUtil.java |  6 ++++
 .../support/process/FeatureExtensionHandler.java   |  4 ++-
 3 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderContext.java
b/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderContext.java
index f44ad3b..baf04ae 100644
--- a/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderContext.java
+++ b/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderContext.java
@@ -16,8 +16,8 @@
  */
 package org.apache.sling.feature.support.process;
 
-import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * Builder context holds services used by {@link ApplicationBuilder}
@@ -27,17 +27,13 @@ public class BuilderContext {
 
     private final FeatureProvider provider;
 
-    private final List<FeatureExtensionHandler> featureExtensionHandlers = new ArrayList<>();
+    private final List<FeatureExtensionHandler> featureExtensionHandlers = new CopyOnWriteArrayList<>();
 
     /**
-     * Assemble the full feature by processing all includes.
+     * Create a new context
      *
-     * @param feature The feature to start
      * @param provider A provider providing the included features
-     * @param extensionMergers Optional feature mergers
-     * @return The assembled feature.
-     * @throws IllegalArgumentException If feature or provider is {@code null}
-     * @throws IllegalStateException If an included feature can't be provided or merged.
+     * @throws IllegalArgumentException If feature provider is {@code null}
      */
     public BuilderContext(final FeatureProvider provider) {
         if ( provider == null ) {
@@ -46,19 +42,37 @@ public class BuilderContext {
         this.provider = provider;
     }
 
+    /**
+     * Add a feature extension handler
+     * @param handler A handler
+     * @return This instance
+     */
+    public BuilderContext add(final FeatureExtensionHandler handler) {
+        featureExtensionHandlers.add(handler);
+        return this;
+    }
+
+    /**
+     * Get the feature provider.
+     * @return The feature provider
+     */
     FeatureProvider getFeatureProvider() {
         return this.provider;
     }
 
+    /**
+     * Get the list of extension handlers
+     * @return The list of handlers
+     */
     List<FeatureExtensionHandler> getFeatureExtensionHandlers() {
         return this.featureExtensionHandlers;
     }
 
-    public BuilderContext add(final FeatureExtensionHandler handler) {
-        featureExtensionHandlers.add(handler);
-        return this;
-    }
-
+    /**
+     * Clone the context and replace the feature provider
+     * @param featureProvider The new feature provider
+     * @return Cloned context
+     */
     BuilderContext clone(final FeatureProvider featureProvider) {
         final BuilderContext ctx = new BuilderContext(featureProvider);
         ctx.featureExtensionHandlers.addAll(featureExtensionHandlers);
diff --git a/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderUtil.java
b/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderUtil.java
index d3943e9..87f5f86 100644
--- a/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderUtil.java
+++ b/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/BuilderUtil.java
@@ -210,6 +210,12 @@ class BuilderUtil {
                 target.getExtensions().add(ext);
             }
         }
+        // post processing
+        for(final Extension ext : target.getExtensions()) {
+            for(final FeatureExtensionHandler fem : context.getFeatureExtensionHandlers())
{
+                fem.postProcess(target, ext.getName());
+            }
+        }
     }
 
     static void mergeExtensions(final Application target,
diff --git a/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/FeatureExtensionHandler.java
b/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/FeatureExtensionHandler.java
index 297f5c3..df3497d 100644
--- a/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/FeatureExtensionHandler.java
+++ b/featuremodel/feature-support/src/main/java/org/apache/sling/feature/support/process/FeatureExtensionHandler.java
@@ -46,7 +46,9 @@ public interface FeatureExtensionHandler {
     void merge(Feature target, Feature source, String extensionName);
 
     /**
-     * Post process the feature with respect to the extension
+     * Post process the feature with respect to the extension.
+     * Post processing is invoked after all extensions have been merged.
+     * This method is called regardless whether {@link #canMerge(String)} returned {@code
true} or not.
      * @param feature The feature
      * @param extensionName The extension name
      * @throws IllegalStateException If post processing failed

-- 
To stop receiving notification emails like this one, please contact
cziegeler@apache.org.

Mime
View raw message