karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf] branch karaf-4.1.x updated: [KARAF-5203] Includes conditional bundles and configuration files when creating a KAR
Date Wed, 13 Dec 2017 17:32:48 GMT
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.1.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.1.x by this push:
     new 07ef05b  [KARAF-5203] Includes conditional bundles and configuration files when creating
a KAR
07ef05b is described below

commit 07ef05be2b8016872b06b9af890921aa7469750a
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
AuthorDate: Wed Dec 13 14:58:04 2017 +0100

    [KARAF-5203] Includes conditional bundles and configuration files when creating a KAR
---
 .../apache/karaf/kar/internal/KarServiceImpl.java    | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
index 7ecbb5e..667ac6a 100644
--- a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
+++ b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
@@ -46,12 +46,7 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 
-import org.apache.karaf.features.BundleInfo;
-import org.apache.karaf.features.ConfigFileInfo;
-import org.apache.karaf.features.Dependency;
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
+import org.apache.karaf.features.*;
 import org.apache.karaf.kar.KarService;
 import org.apache.karaf.util.StreamUtils;
 import org.apache.karaf.util.maven.Parser;
@@ -405,14 +400,27 @@ public class KarServiceImpl implements KarService {
 
     private void copyFeatureToJar(JarOutputStream jos, Feature feature, Map<URI, Integer>
locationMap)
         throws URISyntaxException {
+        // add bundles
         for (BundleInfo bundleInfo : feature.getBundles()) {
             URI location = new URI(bundleInfo.getLocation());
             copyResourceToJar(jos, location, locationMap);
         }
+        // add config files
         for (ConfigFileInfo configFileInfo : feature.getConfigurationFiles()) {
             URI location = new URI(configFileInfo.getLocation());
             copyResourceToJar(jos, location, locationMap);
         }
+        // add bundles and config files in conditionals
+        for (Conditional conditional : feature.getConditional()) {
+            for (BundleInfo bundleInfo : conditional.getBundles()) {
+                URI location = new URI(bundleInfo.getLocation());
+                copyResourceToJar(jos, location, locationMap);
+            }
+            for (ConfigFileInfo configFileInfo : conditional.getConfigurationFiles()) {
+                URI location = new URI(configFileInfo.getLocation());
+                copyResourceToJar(jos, location, locationMap);
+            }
+        }
     }
 
     private void copyResourceToJar(JarOutputStream jos, URI location, Map<URI, Integer>
locationMap) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@karaf.apache.org" <commits@karaf.apache.org>'].

Mime
View raw message