You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by pi...@apache.org on 2011/01/15 14:57:19 UTC

svn commit: r1059334 - in /karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features: AddFeaturesToRepoMojo.java CopyFileBasedDescriptor.java

Author: pieber
Date: Sat Jan 15 13:57:19 2011
New Revision: 1059334

URL: http://svn.apache.org/viewvc?rev=1059334&view=rev
Log:
[KARAF-373] add capabilities to directly install features.xml in target-repo

Signed-off-by: Andreas Pieber <an...@gmail.com>

Added:
    karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java
Modified:
    karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java

Modified: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java?rev=1059334&r1=1059333&r2=1059334&view=diff
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java (original)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java Sat Jan 15 13:57:19 2011
@@ -83,6 +83,11 @@ public class AddFeaturesToRepoMojo exten
     /**
      * @parameter
      */
+    private List<CopyFileBasedDescriptor> copyFileBasedDescriptors;
+
+    /**
+     * @parameter
+     */
     private boolean skipNonMavenProtocols = true;
 
     /**
@@ -117,7 +122,7 @@ public class AddFeaturesToRepoMojo exten
 
             // if transitive features are enabled we add the contents of those
             // features to the bundles list
-            if (this.addTransitiveFeatures) {
+            if (addTransitiveFeatures) {
                 for (String feature : transitiveFeatures) {
                     getLog().info("Adding contents of transitive feature: " + feature);
                     bundles.addAll(featuresMap.get(feature).getBundles());
@@ -125,7 +130,7 @@ public class AddFeaturesToRepoMojo exten
                     bundles.addAll(featuresMap.get(feature).getConfigFiles());
                 }
             }
-            
+
             getLog().info("Base repo: " + localRepo.getUrl());
             for (String bundle : bundles) {
                 // get rid of of possible line-breaks KARAF-313
@@ -201,6 +206,15 @@ public class AddFeaturesToRepoMojo exten
                     getLog().error("Can't resolve bundle " + bundle, e);
                 }
             }
+            if (copyFileBasedDescriptors != null) {
+                for (CopyFileBasedDescriptor fileBasedDescritpor : copyFileBasedDescriptors) {
+                    copy(new FileInputStream(fileBasedDescritpor.getSourceFile()),
+                        repository,
+                        fileBasedDescritpor.getTargetFileName(),
+                        fileBasedDescritpor.getTargetDirectory(),
+                        new byte[8192]);
+                }
+            }
         } catch (MojoExecutionException e) {
             throw e;
         } catch (MojoFailureException e) {

Added: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java?rev=1059334&view=auto
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java (added)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java Sat Jan 15 13:57:19 2011
@@ -0,0 +1,35 @@
+package org.apache.karaf.tooling.features;
+
+import java.io.File;
+
+public class CopyFileBasedDescriptor {
+
+    private File sourceFile;
+    private String targetDirectory;
+    private String targetFileName;
+
+    public File getSourceFile() {
+        return sourceFile;
+    }
+
+    public void setSourceFile(File sourceFile) {
+        this.sourceFile = sourceFile;
+    }
+
+    public String getTargetDirectory() {
+        return targetDirectory;
+    }
+
+    public void setTargetDirectory(String targetDirectory) {
+        this.targetDirectory = targetDirectory;
+    }
+
+    public String getTargetFileName() {
+        return targetFileName;
+    }
+
+    public void setTargetFileName(String targetFileName) {
+        this.targetFileName = targetFileName;
+    }
+
+}