felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1161460 - /felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
Date Thu, 25 Aug 2011 09:26:51 GMT
Author: clement
Date: Thu Aug 25 09:26:51 2011
New Revision: 1161460

URL: http://svn.apache.org/viewvc?rev=1161460&view=rev
Log:
The bnd-ipojo-plugin must write manipulation metadata.

Modified:
    felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java

Modified: felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java?rev=1161460&r1=1161459&r2=1161460&view=diff
==============================================================================
--- felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
(original)
+++ felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
Thu Aug 25 09:26:51 2011
@@ -44,6 +44,8 @@ public class BndJarResourceStore impleme
 
     private MetadataRenderer m_renderer = new MetadataRenderer();
 
+    private Element m_metadata;
+
     public BndJarResourceStore(Analyzer analyzer, Reporter reporter) {
         m_analyzer = analyzer;
         m_reporter = reporter;
@@ -84,6 +86,7 @@ public class BndJarResourceStore impleme
     }
 
     public void writeMetadata(Element metadata) {
+        m_metadata = metadata;
 
         // Find referred packages and add them into Bnd
         for (String referred : Metadatas.findReferredPackages(metadata)) {
@@ -93,29 +96,29 @@ public class BndJarResourceStore impleme
             }
         }
 
-        // Write the iPOJO header
+        // IPOJO-Components will be written during the close method.
+
+    }
+
+    public void write(String resourcePath, byte[] resource) throws IOException {
+        Jar jar = m_analyzer.getJar();
+        jar.putResource(resourcePath, new ByteArrayResource(resource));
+    }
+
+    public void close() throws IOException {
+        // Write the iPOJO header (including manipulation metadata)
         String components = m_analyzer.getProperty("IPOJO-Components");
         StringBuilder builder = new StringBuilder();
 
         if (components != null) {
             builder.append(components);
         }
-        builder.append(m_renderer.render(metadata));
+        builder.append(m_renderer.render(m_metadata));
 
         if (builder.length() != 0) {
             m_analyzer.setProperty("IPOJO-Components", builder.toString());
         }
 
-
-    }
-
-    public void write(String resourcePath, byte[] resource) throws IOException {
-        Jar jar = m_analyzer.getJar();
-        jar.putResource(resourcePath, new ByteArrayResource(resource));
-    }
-
-    public void close() throws IOException {
-
         // Add some mandatory imported packages
         Map<String, String> version = new TreeMap<String, String>();
         version.put("version", Pojoization.IPOJO_PACKAGE_VERSION);
@@ -137,5 +140,6 @@ public class BndJarResourceStore impleme
             m_analyzer.getReferred().put("org.osgi.service.log", log);
         }
 
+
     }
 }



Mime
View raw message