You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2012/08/30 17:33:27 UTC

svn commit: r1378990 - /sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java

Author: cziegeler
Date: Thu Aug 30 15:33:26 2012
New Revision: 1378990

URL: http://svn.apache.org/viewvc?rev=1378990&view=rev
Log:
SLING-2591 : Provide a way to exclude sling properties from partial bundle lists

Modified:
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java?rev=1378990&r1=1378989&r2=1378990&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java (original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java Thu Aug 30 15:33:26 2012
@@ -108,7 +108,7 @@ public abstract class AbstractUsingBundl
     private File[] rewriteRuleFiles;
 
     /**
-     * The comma separated list of tokens to include when copying configs
+     * The list of tokens to include when copying configs
      * from partial bundle lists.
      *
      * @parameter default-value="**"
@@ -116,7 +116,7 @@ public abstract class AbstractUsingBundl
     private String[] configIncludes;
 
     /**
-     * The comma separated list of tokens to exclude when copying the configs
+     * The list of tokens to exclude when copying the configs
      * from partial bundle lists.
      *
      * @parameter
@@ -124,6 +124,14 @@ public abstract class AbstractUsingBundl
     private String[] configExcludes;
 
     /**
+     * The list of names to exclude when copying properties
+     * from partial bundle lists.
+     *
+     * @parameter
+     */
+    private String[] propertiesExcludes;
+
+    /**
      * @component
      */
     protected MavenFileFilter mavenFileFilter;
@@ -406,18 +414,21 @@ public abstract class AbstractUsingBundl
                     } else {
                         this.copyProperties(loadedProps, this.slingProperties);
                     }
+                    filterProperties(this.slingProperties);
                 } else if ( mode == 1 ) {
                     if ( this.slingWebappProperties == null ) {
                         this.slingWebappProperties = loadedProps;
                     } else {
                         this.copyProperties(loadedProps, this.slingWebappProperties);
                     }
+                    filterProperties(this.slingWebappProperties);
                 } else {
                     if ( this.slingStandaloneProperties == null ) {
                         this.slingStandaloneProperties = loadedProps;
                     } else {
                         this.copyProperties(loadedProps, this.slingStandaloneProperties);
                     }
+                    filterProperties(this.slingStandaloneProperties);
                 }
             } catch (IOException e) {
                 throw new MojoExecutionException("Unable to create filtered properties file", e);
@@ -431,6 +442,17 @@ public abstract class AbstractUsingBundl
         }
     }
 
+    /**
+     * Filter properties by removing excluded properties
+     */
+    private void filterProperties(final Properties props) {
+        if ( this.propertiesExcludes != null ) {
+            for(final String name : this.propertiesExcludes) {
+                props.remove(name.trim());
+            }
+        }
+    }
+
     protected Properties getSlingProperties(final boolean standalone) throws MojoExecutionException {
         readSlingProperties(this.commonSlingProps, 0);
         final Properties additionalProps = (standalone ? this.slingStandaloneProperties : this.slingWebappProperties);