felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gokt...@apache.org
Subject svn commit: r1346631 - in /felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator: Pojoization.java store/DirectoryResourceStore.java
Date Tue, 05 Jun 2012 22:22:37 GMT
Author: gokturk
Date: Tue Jun  5 22:22:36 2012
New Revision: 1346631

URL: http://svn.apache.org/viewvc?rev=1346631&view=rev
Log:
Fix for FELIX-3466.
directoryManipulation() fixed to take supplied MANIFEST file's location into account while
updating it.

Modified:
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java

Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java?rev=1346631&r1=1346630&r2=1346631&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
Tue Jun  5 22:22:36 2012
@@ -216,10 +216,12 @@ public class Pojoization {
         }
 
         ManifestProvider manifestProvider;
+        File selectedManifestFile;
         if (manifestFile != null) {
             if (manifestFile.isFile()) {
                 try {
                     manifestProvider = new FileManifestProvider(manifestFile);
+                    selectedManifestFile = manifestFile;
                 } catch (IOException e) {
                     m_reporter.error("Cannot read Manifest from '" + manifestFile.getAbsolutePath()
+ "'");
                     return;
@@ -235,6 +237,7 @@ public class Pojoization {
             if (original.isFile()) {
                 try {
                     manifestProvider = new FileManifestProvider(original);
+                    selectedManifestFile = original;
                 } catch (IOException e) {
                     m_reporter.error("Cannot read Manifest from '" + original.getAbsolutePath()
+ "'");
                     return;
@@ -254,6 +257,7 @@ public class Pojoization {
                 store.setResourceMapper(new WABResourceMapper());
             }
             store.setManifest(manifestProvider.getManifest());
+            store.setManifestFile(selectedManifestFile);
             DefaultManifestBuilder dmb = new DefaultManifestBuilder();
             dmb.setMetadataRenderer(new MetadataRenderer());
             store.setManifestBuilder(dmb);

Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java?rev=1346631&r1=1346630&r2=1346631&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java
Tue Jun  5 22:22:36 2012
@@ -61,6 +61,11 @@ public class DirectoryResourceStore impl
      * Original manifest to be updated.
      */
     private Manifest m_manifest;
+    
+    /**
+     * Location of the manifest file to update.
+     */
+    private File m_manifest_file;
 
     /**
      * Resource Mapper.
@@ -87,6 +92,10 @@ public class DirectoryResourceStore impl
     public void setManifest(Manifest manifest) {
         m_manifest = manifest;
     }
+    
+    public void setManifestFile(File manifestFile){
+    	m_manifest_file = manifestFile;
+    }
 
     public byte[] read(String path) throws IOException {
         File resource = new File(m_source, m_mapper.internalize(path));
@@ -119,11 +128,9 @@ public class DirectoryResourceStore impl
 
         // Update the manifest
         Manifest updated = m_manifestBuilder.build(m_manifest);
-
-        // Write it on disk
-        File metaInf = new File(m_target, "META-INF");
-        File resource = new File(metaInf, "MANIFEST.MF");
-        OutputStream os = new FileOutputStream(resource);
+        
+        // Write it to disk
+        OutputStream os = new FileOutputStream(m_manifest_file);
         try {
             updated.write(os);
         } finally {



Mime
View raw message