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 16:09:18 UTC

svn commit: r1059350 - in /karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features: AddFeaturesToRepoMojo.java CopyFileBasedDescriptor.java

Author: pieber
Date: Sat Jan 15 15:09:17 2011
New Revision: 1059350

URL: http://svn.apache.org/viewvc?rev=1059350&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/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java
Modified:
    karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java

Modified: karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java?rev=1059350&r1=1059349&r2=1059350&view=diff
==============================================================================
--- karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java (original)
+++ karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddFeaturesToRepoMojo.java Sat Jan 15 15:09:17 2011
@@ -88,6 +88,11 @@ public class AddFeaturesToRepoMojo exten
     /**
      * @parameter
      */
+    private List<CopyFileBasedDescriptor> copyFileBasedDescriptors;
+
+    /**
+     * @parameter
+     */
     private boolean includeMvnBasedDescriptors = false;
 
     /**
@@ -199,6 +204,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/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java?rev=1059350&view=auto
==============================================================================
--- karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java (added)
+++ karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/CopyFileBasedDescriptor.java Sat Jan 15 15:09:17 2011
@@ -0,0 +1,53 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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;
+    }
+
+}
+