The bnd-ipojo-plugin must write manipulation metadata.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1161460 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java b/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
index 1755467..aab2239 100644
--- a/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
+++ b/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
@@ -44,6 +44,8 @@
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 void writeMetadata(Element metadata) {
+ m_metadata = metadata;
// Find referred packages and add them into Bnd
for (String referred : Metadatas.findReferredPackages(metadata)) {
@@ -93,19 +96,7 @@
}
}
- // Write the iPOJO header
- String components = m_analyzer.getProperty("IPOJO-Components");
- StringBuilder builder = new StringBuilder();
-
- if (components != null) {
- builder.append(components);
- }
- builder.append(m_renderer.render(metadata));
-
- if (builder.length() != 0) {
- m_analyzer.setProperty("IPOJO-Components", builder.toString());
- }
-
+ // IPOJO-Components will be written during the close method.
}
@@ -115,6 +106,18 @@
}
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(m_metadata));
+
+ if (builder.length() != 0) {
+ m_analyzer.setProperty("IPOJO-Components", builder.toString());
+ }
// Add some mandatory imported packages
Map<String, String> version = new TreeMap<String, String>();
@@ -137,5 +140,6 @@
m_analyzer.getReferred().put("org.osgi.service.log", log);
}
+
}
}