private File createBundle(String symbolicName, String version) throws IOException {
File tmpFile = File.createTempFile("tmpbundle-", "jar");
tmpFile.deleteOnExit();
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
if (symbolicName != null) {
manifest.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, symbolicName);
}
if (version != null) {
manifest.getMainAttributes().putValue(Constants.BUNDLE_VERSION, version);
}
JarOutputStream target = new JarOutputStream(new FileOutputStream(tmpFile), manifest);
target.close();
return tmpFile;
}
|