Author: antelder
Date: Tue Mar  3 07:42:24 2009
New Revision: 749551

URL: http://svn.apache.org/viewvc?rev=749551&view=rev
Log:
TUSCANY-2873: Apply patch from Hasan Ceylan for Wrapping of non-OSGi components 
creates versions that may makes no-sense

Modified:
    
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java
    
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java

Modified: 
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java
URL: 
http://svn.apache.org/viewvc/tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java?rev=749551&r1=749550&r2=749551&view=diff
==============================================================================
--- 
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java
 (original)
+++ 
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/BundleUtil.java
 Tue Mar  3 07:42:24 2009
@@ -101,6 +101,22 @@
      * @throws IllegalStateException
      */
     static Manifest libraryManifest(Set<File> jarFiles, String name, String 
symbolicName, String version, String dir)
+    throws IllegalStateException {
+       return libraryManifest(jarFiles, name, symbolicName, version, dir, 
null);
+    }
+    /**
+     * Generate a Bundle manifest for a set of JAR files.
+     * 
+     * @param jarFiles
+     * @param name
+     * @param symbolicName
+     * @param version
+     * @param dir 
+     * @param buddyPolicy 
+     * @return
+     * @throws IllegalStateException
+     */
+    static Manifest libraryManifest(Set<File> jarFiles, String name, String 
symbolicName, String version, String dir, String buddyPolicy)
         throws IllegalStateException {
         try {
 
@@ -143,6 +159,9 @@
             attributes.putValue(BUNDLE_NAME, name);
             attributes.putValue(BUNDLE_VERSION, version);
             attributes.putValue(DYNAMICIMPORT_PACKAGE, "*");
+            if (buddyPolicy != null && buddyPolicy.length() > 0){
+               attributes.putValue("Eclipse-BuddyPolicy", buddyPolicy);
+            }
             if (exports.length() > 1) {
                 attributes.putValue(EXPORT_PACKAGE, exports.substring(0, 
exports.length() - 1));
             }
@@ -178,6 +197,7 @@
         write(attributes, BUNDLE_CLASSPATH, dos);
         write(attributes, IMPORT_PACKAGE, dos);
         write(attributes, EXPORT_PACKAGE, dos);
+        write(attributes, "Eclipse-BuddyPolicy", dos);
         dos.flush();
     }
 

Modified: 
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java
URL: 
http://svn.apache.org/viewvc/tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java?rev=749551&r1=749550&r2=749551&view=diff
==============================================================================
--- 
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java
 (original)
+++ 
tuscany/maven-plugins/trunk/maven-bundle-plugin/src/main/java/org/apache/tuscany/maven/bundle/plugin/ModuleBundlesBuildMojo.java
 Tue Mar  3 07:42:24 2009
@@ -232,6 +232,12 @@
      */
     private ArtifactAggregation[] artifactAggregations;
     
+    /**
+     * Inserts a generic Eclipse-BuddyPolicy header into generated artifacts 
manifests
+     * @parameter default-value="dependent"
+     */
+    private String genericBuddyPolicy = "dependent";
+    
     private static final String XML_PI = "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>";
     private static final String ASL_HEADER =
             "<!--"
@@ -462,7 +468,7 @@
                     Set<File> jarFiles = new HashSet<File>();
                     jarFiles.add(artifactFile);
                     String symbolicName = (artifact.getGroupId() + "." + 
artifact.getArtifactId());
-                    Manifest mf = BundleUtil.libraryManifest(jarFiles, 
symbolicName, symbolicName, version, null);
+                    Manifest mf = BundleUtil.libraryManifest(jarFiles, 
symbolicName, symbolicName, version, null, this.genericBuddyPolicy);
                     File file = new File(dir, "META-INF");
                     file.mkdirs();
                     file = new File(file, "MANIFEST.MF");
@@ -495,7 +501,7 @@
                         copyFile(a.getFile(), dir);
                         jarNames.add(a, symbolicName + "-" + version + "/" + 
a.getFile().getName());
                     }
-                    Manifest mf = BundleUtil.libraryManifest(jarFiles, 
symbolicName, symbolicName, version, null);
+                    Manifest mf = BundleUtil.libraryManifest(jarFiles, 
symbolicName, symbolicName, version, null, this.genericBuddyPolicy);
                     File file = new File(dir, "META-INF");
                     file.mkdirs();
                     file = new File(file, "MANIFEST.MF");


Reply via email to