incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1143901 - in /sling/trunk/maven/maven-launchpad-plugin/src: main/java/org/apache/sling/maven/projectsupport/ main/java/org/apache/sling/maven/projectsupport/bundlelist/ test/java/org/apache/sling/maven/projectsupport/
Date Thu, 07 Jul 2011 16:09:27 GMT
Author: cziegeler
Date: Thu Jul  7 16:09:27 2011
New Revision: 1143901

URL: http://svn.apache.org/viewvc?rev=1143901&view=rev
Log:
SLING-2124 : Improve support for OSGi installer by distinguishing between bootstrap and app
bundles

Modified:
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundle.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
    sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java?rev=1143901&r1=1143900&r2=1143901&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
Thu Jul  7 16:09:27 2011
@@ -27,10 +27,12 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import org.apache.felix.framework.Logger;
 import org.apache.maven.artifact.Artifact;
@@ -119,9 +121,14 @@ public abstract class AbstractLaunchpadS
 
         public Iterator<String> getChildren(String path) {
             if (path.equals(BUNDLE_PATH_PREFIX)) {
-                List<String> levels = new ArrayList<String>();
-                for (StartLevel level : getBundleList().getStartLevels()) {
-                    levels.add(String.valueOf(BUNDLE_PATH_PREFIX + "/" + level.getLevel())
+ "/");
+                final Set<String> levels = new HashSet<String>();
+                for (final StartLevel level : getBundleList().getStartLevels()) {
+                    // we treat the boot level as level 1
+                    if ( level.getStartLevel() == -1 ) {
+                        levels.add(BUNDLE_PATH_PREFIX + "/1/");
+                    } else {
+                        levels.add(BUNDLE_PATH_PREFIX + "/" + level.getLevel() + "/");
+                    }
                 }
                 return levels.iterator();
             } else if (path.equals("resources/corebundles")) {
@@ -150,28 +157,28 @@ public abstract class AbstractLaunchpadS
                     return empty.iterator();
                 }
             } else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
-                String startLevel = path.substring(BUNDLE_PATH_PREFIX.length() + 1);
+                final String startLevelInfo = path.substring(BUNDLE_PATH_PREFIX.length()
+ 1);
                 try {
-                    int i = Integer.parseInt(startLevel);
-                    List<String> bundles = new ArrayList<String>();
-                    for (StartLevel level : getBundleList().getStartLevels()) {
-                        if (level.getStartLevel() == i) {
-                            for (Bundle bundle : level.getBundles()) {
-                                ArtifactDefinition d = new ArtifactDefinition(bundle, i);
+                    final int startLevel = Integer.parseInt(startLevelInfo);
+
+                    final List<String> bundles = new ArrayList<String>();
+                    for (final StartLevel level : getBundleList().getStartLevels()) {
+                        if (level.getStartLevel() == startLevel || (startLevel == 1 &&
level.getStartLevel() == -1)) {
+                            for (final Bundle bundle : level.getBundles()) {
+                                final ArtifactDefinition d = new ArtifactDefinition(bundle,
startLevel);
                                 try {
-                                    Artifact artifact = getArtifact(d);
+                                    final Artifact artifact = getArtifact(d);
                                     bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
                                 } catch (Exception e) {
                                     getLog().error("Unable to resolve artifact ", e);
                                 }
                             }
-
-                            break;
                         }
                     }
                     return bundles.iterator();
 
                 } catch (NumberFormatException e) {
+                    // we ignore this
                 }
             }
 

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java?rev=1143901&r1=1143900&r2=1143901&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
Thu Jul  7 16:09:27 2011
@@ -193,7 +193,7 @@ public class PreparePackageMojo extends 
         } catch (IOException e) {
             throw new MojoExecutionException("Unable to copy configuration files", e);
         }
-        
+
     }
 
     private void unpack(File source, File destination, String includes, String excludes)

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundle.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundle.java?rev=1143901&r1=1143900&r2=1143901&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundle.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundle.java
Thu Jul  7 16:09:27 2011
@@ -30,4 +30,10 @@ public abstract class BaseBundle {
 
     public abstract String getVersion();
 
+    @Override
+    public String toString() {
+        return "Bundle [artifactId=" + getArtifactId() + ", classifier="
+                + getClassifier() + ", groupId=" + getGroupId() + ", startLevel="
+                + getStartLevel() + ", type=" + getType() + ", version=" + getVersion() +
"]";
+    }
 }

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=1143901&r1=1143900&r2=1143901&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
Thu Jul  7 16:09:27 2011
@@ -81,7 +81,7 @@ public abstract class BaseBundleList {
             current.setVersion(newBnd.getVersion());
         } else {
             StartLevel startLevel = null;
-            if ( mergeStartLevel == null || newBnd.getStartLevel() > 0) {
+            if ( mergeStartLevel == null || newBnd.getStartLevel() != 0) {
                 startLevel = getOrCreateStartLevel(newBnd.getStartLevel());
             } else {
                 startLevel = getOrCreateStartLevel(mergeStartLevel.getStartLevel());

Modified: sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java?rev=1143901&r1=1143900&r2=1143901&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
Thu Jul  7 16:09:27 2011
@@ -16,11 +16,13 @@
  */
 package org.apache.sling.maven.projectsupport;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
 import org.junit.Test;
-import static org.junit.Assert.*;
 
 /**
  * Tests of PreparePageMojo



Mime
View raw message