private byte[] generateManifest(JsonManifest descriptor)
{
Manifest mf = new Manifest();
mf.getMainAttributes().putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
mf.getMainAttributes().putValue(Constants.BUNDLE_MANIFESTVERSION, "2");
mf.getMainAttributes().putValue(OsgiPlugin.ATLASSIAN_PLUGIN_KEY, descriptor.getKey());
mf.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, descriptor.getKey());
mf.getMainAttributes().putValue(Constants.BUNDLE_VERSION, cleanManifestValue(descriptor.getVersion()));
mf.getMainAttributes().putValue(Constants.BUNDLE_NAME, cleanManifestValue(descriptor.getName()));
mf.getMainAttributes().putValue(Constants.BUNDLE_DESCRIPTION, cleanManifestValue(descriptor.getDescription()));
mf.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, ConventionDescriptorGenerator.class.getPackage().getName());
mf.getMainAttributes().putValue("Spring-Context", "*;timeout:=" + PluginUtils.getDefaultEnablingWaitPeriod());
if (descriptor.getVendor() != null)
{
mf.getMainAttributes().putValue(Constants.BUNDLE_VENDOR, descriptor.getVendor().getName());
}
ByteArrayOutputStream bout = new ByteArrayOutputStream();
try
{
mf.write(bout);
}
catch (IOException e)
{
throw new RuntimeException("Should never happen", e);
}
return bout.toByteArray();
}