Author: ieb
Date: Wed Feb 24 16:42:32 2010
New Revision: 915859

URL: http://svn.apache.org/viewvc?rev=915859&view=rev
Log:
SLING-1351 When the xpp parser loads a Bundle it only sets the attributes 
specified on the bundle, and takes no account of
any containers, hence on merge the container start level must be inspected to 
determine where a bundle should be merged.
If not specified (ie 0) it should be merged in the containing bundle. This 
means that its not going to be possible
to specify a bundle as loading in start level 0 by setting the level on the 
bundle. To load in start level 0 you must
put the bundle element inside a startLevel element of 0.

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

Modified: 
sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java?rev=915859&r1=915858&r2=915859&view=diff
==============================================================================
--- 
sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
 (original)
+++ 
sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
 Wed Feb 24 16:42:32 2010
@@ -55,7 +55,7 @@
     public void merge(BundleList bundleList) {
         for (StartLevel sl : bundleList.getStartLevels()) {
             for (Bundle bnd : sl.getBundles()) {
-                add(bnd);
+                add(sl, bnd);
             }
         }
     }
@@ -67,11 +67,25 @@
      * @param newBnd the bundle to add
      */
     public void add(Bundle newBnd) {
+       add(null, newBnd);
+    }
+
+    /**
+     * Merge bundle into a start level using the supplied level if present.
+     * @param mergeStartLevel
+     * @param newBnd
+     */
+    private void add(StartLevel mergeStartLevel, Bundle newBnd) {
         Bundle current = get(newBnd, false);
         if (current != null) {
 
         } else {
-            StartLevel startLevel = 
getOrCreateStartLevel(newBnd.getStartLevel());
+            StartLevel startLevel = null;
+            if ( mergeStartLevel == null || newBnd.getStartLevel() > 0) {
+                startLevel = getOrCreateStartLevel(newBnd.getStartLevel());
+            } else {
+                startLevel = getOrCreateStartLevel(mergeStartLevel.getLevel());
+            }
             startLevel.getBundles().add(newBnd);
         }
 


Reply via email to