clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1521621 - in /clerezza/trunk/provisioning: ./ tools/ tools/karaf-maven-plugin/ tools/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ tools/karaf-maven-plugin/src/main/resources/META-INF/plexus/
Date Tue, 10 Sep 2013 20:10:25 GMT
Author: reto
Date: Tue Sep 10 20:10:24 2013
New Revision: 1521621

URL: http://svn.apache.org/r1521621
Log:
CLEREZZA-815: tweaked version of the karaf-maven-plugin to provide support for creating sling
partial-bundlelists

Added:
    clerezza/trunk/provisioning/
    clerezza/trunk/provisioning/tools/
    clerezza/trunk/provisioning/tools/karaf-maven-plugin/
      - copied from r1521480, karaf/tags/karaf-3.0.0.RC1/tooling/karaf-maven-plugin/
Modified:
    clerezza/trunk/provisioning/tools/karaf-maven-plugin/NOTICE
    clerezza/trunk/provisioning/tools/karaf-maven-plugin/pom.xml
    clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
    clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/resources/META-INF/plexus/components.xml

Modified: clerezza/trunk/provisioning/tools/karaf-maven-plugin/NOTICE
URL: http://svn.apache.org/viewvc/clerezza/trunk/provisioning/tools/karaf-maven-plugin/NOTICE?rev=1521621&r1=1521480&r2=1521621&view=diff
==============================================================================
--- clerezza/trunk/provisioning/tools/karaf-maven-plugin/NOTICE (original)
+++ clerezza/trunk/provisioning/tools/karaf-maven-plugin/NOTICE Tue Sep 10 20:10:24 2013
@@ -1,71 +1,71 @@
-Apache Karaf
-Copyright 2010-2013 The Apache Software Foundation
-
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2010).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-OW2 (http://www.ow2.org/).
-Licensed under the BSD License.
-
-This product includes software developed at
-OPS4J (http://www.ops4j.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-Eclipse Foundation (http://www.eclipse.org/).
-Licensed under the EPL.
-
-This product includes software written by
-Antony Lesuisse.
-Licensed under Public Domain.
-
-
-II. Used Software
-
-This product uses software developed at
-FUSE Source (http://www.fusesource.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-AOP Alliance (http://aopalliance.sourceforge.net/).
-Licensed under the Public Domain.
-
-This product uses software developed at
-Tanuki Software (http://www.tanukisoftware.com/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-Jasypt (http://jasypt.sourceforge.net/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-JLine (http://jline.sourceforge.net).
-Licensed under the BSD License.
-
-This product uses software developed at
-SLF4J (http://www.slf4j.org/).
-Licensed under the MIT License.
-
-This product uses software developed at
-SpringSource (http://www.springsource.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software from http://www.json.org.
-Copyright (c) 2002 JSON.org
-
-
-III. License Summary
-- Apache License 2.0
-- BSD License
-- EPL License
-- MIT License
+Apache Karaf
+Copyright 2010-2013 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+OW2 (http://www.ow2.org/).
+Licensed under the BSD License.
+
+This product includes software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+Eclipse Foundation (http://www.eclipse.org/).
+Licensed under the EPL.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+AOP Alliance (http://aopalliance.sourceforge.net/).
+Licensed under the Public Domain.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Jasypt (http://jasypt.sourceforge.net/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product uses software developed at
+SpringSource (http://www.springsource.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0
+- BSD License
+- EPL License
+- MIT License

Modified: clerezza/trunk/provisioning/tools/karaf-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/clerezza/trunk/provisioning/tools/karaf-maven-plugin/pom.xml?rev=1521621&r1=1521480&r2=1521621&view=diff
==============================================================================
--- clerezza/trunk/provisioning/tools/karaf-maven-plugin/pom.xml (original)
+++ clerezza/trunk/provisioning/tools/karaf-maven-plugin/pom.xml Tue Sep 10 20:10:24 2013
@@ -27,7 +27,9 @@
         <version>3.0.0.RC1</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
-
+    <!-- This is a temporary for in the clerezza repository to give things a try,
+    if it turns out to be util it will hopefully make it back to karaf, see CLEREZZA-816
   -->
+    <groupId>org.apache.clerezza.provisionig.tooling</groupId>
     <artifactId>karaf-maven-plugin</artifactId>
     <packaging>maven-plugin</packaging>
     <name>Apache Karaf :: Tooling :: Maven Karaf Plugin</name>

Modified: clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java?rev=1521621&r1=1521480&r2=1521621&view=diff
==============================================================================
--- clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
(original)
+++ clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
Tue Sep 10 20:10:24 2013
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.jar.JarInputStream;
@@ -76,6 +77,7 @@ import static org.apache.karaf.deployer.
  */
 @SuppressWarnings("unchecked")
 public class GenerateDescriptorMojo extends AbstractLogEnabled implements Mojo {
+    private static final int BUNDLELIST_DEFAULT_STARTLEVEL = 25;
 
     /**
      * An (optional) input feature file to extend.  This is highly recommended as it is the
only way to add <code>&lt;feature/&gt;</code>
@@ -104,6 +106,11 @@ public class GenerateDescriptorMojo exte
      * @parameter default-value="${project.build.directory}/feature/feature.xml"
      */
     private File outputFile;
+    
+    /**
+     * @parameter default-value="${project.build.directory}/partialBundleList.xml"
+     */
+    private File partialBundleListOutputFile;
 
     /**
      * The resolver to use for the feature.  Normally null or "OBR" or "(OBR)"
@@ -170,6 +177,14 @@ public class GenerateDescriptorMojo exte
      * @parameter default-value="true"
      */
     private boolean includeTransitiveDependency;
+    
+    /**
+     * Flag indicating whether a Sling partial-bundlelist shall be created (<code>true</code>)
or not (<code>false</code>).
+     * <p/>
+     *
+     * @parameter default-value="false"
+     */
+    private boolean createSlingPartialBundleList;
 
     /**
      * The standard behavior is to add dependencies as <code>&lt;bundle&gt;</code>
elements to a <code>&lt;feature&gt;</code>
@@ -265,6 +280,7 @@ public class GenerateDescriptorMojo exte
 
     //maven log
     private Log log;
+    private Map<Artifact, Bundle> artifact2Bundle = new HashMap<Artifact, Bundle>();;
 
     public void execute() throws MojoExecutionException, MojoFailureException {
         try {
@@ -274,14 +290,29 @@ public class GenerateDescriptorMojo exte
             this.treeListing = dependencyHelper.getTreeListing();
             File dir = outputFile.getParentFile();
             if (dir.isDirectory() || dir.mkdirs()) {
-                PrintStream out = new PrintStream(new FileOutputStream(outputFile));
-                try {
-                    writeFeatures(out);
-                } finally {
-                    out.close();
+                {
+                    PrintStream out = new PrintStream(new FileOutputStream(outputFile));
+                    try {
+                        writeFeatures(out);
+                    } finally {
+                        out.close();
+                    }
+                    // now lets attach it
+                    projectHelper.attachArtifact(project, attachmentArtifactType, attachmentArtifactClassifier,
outputFile);
+                }
+                getLogger().info("createSlingPartialBundleList "+createSlingPartialBundleList);
+                if (createSlingPartialBundleList) {
+                    PrintStream out = new PrintStream(new FileOutputStream(partialBundleListOutputFile));
+                    try {
+                        writePartialBundleList(out);
+                    } finally {
+                        out.close();
+                    }
+                    project.getArtifact().setFile(partialBundleListOutputFile);
+                    /*projectHelper.attachArtifact(project, 
+                            "xml", 
+                            "bundlelist", partialBundleListOutputFile);*/
                 }
-                // now lets attach it
-                projectHelper.attachArtifact(project, attachmentArtifactType, attachmentArtifactClassifier,
outputFile);
 
             } else {
                 throw new MojoExecutionException("Could not create directory for features
file: " + dir);
@@ -291,6 +322,30 @@ public class GenerateDescriptorMojo exte
             throw new MojoExecutionException("Unable to create features.xml file: " + e,
e);
         }
     }
+    
+    private void writePartialBundleList(PrintStream out) throws ArtifactResolutionException,
ArtifactNotFoundException,
+            IOException, JAXBException, SAXException, ParserConfigurationException, XMLStreamException,
MojoExecutionException {
+        getLogger().info("Creating Sling partial Bundlelist");
+        out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+        out.println("<bundles>");
+        
+        for (Map.Entry<Artifact, String> entry : localDependencies.entrySet()) {
+            Artifact artifact = entry.getKey();
+            Bundle bundle = artifact2Bundle.get(artifact);
+            int bundleStartLevel = bundle.getStartLevel() == 0 ? BUNDLELIST_DEFAULT_STARTLEVEL
: bundle.getStartLevel();
+            out.println("  <startLevel level=\""+bundleStartLevel+"\">");
+            
+            out.println("  <bundle>");
+            out.println("      <groupId>"+artifact.getGroupId()+"</groupId>");
+            out.println("      <artifactId>"+artifact.getArtifactId()+"</artifactId>");
+            out.println("      <version>"+artifact.getVersion()+"</version>");
+            out.println("      <classifier></classifier>");
+            out.println("    </bundle>");
+            //out.println(artifact.getArtifactId());
+            out.println("  </startLevel>");
+        }
+        out.println("</bundles>");
+    }
 
     /*
      * Write all project dependencies as feature
@@ -375,6 +430,7 @@ public class GenerateDescriptorMojo exte
                 if (startLevel != null && bundle.getStartLevel() == 0) {
                     bundle.setStartLevel(startLevel);
                 }
+                artifact2Bundle.put(artifact, bundle);
             }
         }
 

Modified: clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/resources/META-INF/plexus/components.xml?rev=1521621&r1=1521480&r2=1521621&view=diff
==============================================================================
--- clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/resources/META-INF/plexus/components.xml
(original)
+++ clerezza/trunk/provisioning/tools/karaf-maven-plugin/src/main/resources/META-INF/plexus/components.xml
Tue Sep 10 20:10:24 2013
@@ -30,7 +30,7 @@
                         <id>default</id>
                         <phases>
                             <compile>
-                                org.apache.karaf.tooling:karaf-maven-plugin:features-generate-descriptor
+                                org.apache.clerezza.provisionig.tooling:karaf-maven-plugin:features-generate-descriptor
                             </compile>
                             <install>
                                 org.apache.maven.plugins:maven-install-plugin:install
@@ -69,10 +69,10 @@
                                 org.apache.maven.plugins:maven-resources-plugin:resources
                             </process-resources>
                             <compile>
-                                org.apache.karaf.tooling:karaf-maven-plugin:features-generate-descriptor
+                                org.apache.clerezza.provisionig.tooling:karaf-maven-plugin:features-generate-descriptor
                             </compile>
                             <package>
-                                org.apache.karaf.tooling:karaf-maven-plugin:features-create-kar
+                                org.apache.clerezza.provisionig.tooling:karaf-maven-plugin:features-create-kar
                             </package>
                             <install>
                                 org.apache.maven.plugins:maven-install-plugin:install
@@ -115,12 +115,12 @@
                         <phases>
                             <process-resources>
                                 org.apache.maven.plugins:maven-resources-plugin:resources,
-                                org.apache.karaf.tooling:karaf-maven-plugin:install-kars
+                                org.apache.clerezza.provisionig.tooling:karaf-maven-plugin:install-kars
                             </process-resources>
                             <compile>
                             </compile>
                             <package>
-                                org.apache.karaf.tooling:karaf-maven-plugin:instance-create-archive
+                                org.apache.clerezza.provisionig.tooling:karaf-maven-plugin:instance-create-archive
                             </package>
                             <install>
                                 org.apache.maven.plugins:maven-install-plugin:install



Mime
View raw message