}
private Dictionary generateManifest(Dictionary builtIn) throws BundleException {
String cacheLocation = FrameworkProperties.getProperty(LocationManager.PROP_MANIFEST_CACHE);
if (bundledata.getSymbolicName() != null) {
Headers existingHeaders = checkManifestAndParent(cacheLocation, bundledata.getSymbolicName(), bundledata.getVersion().toString(), manifestType);
if (existingHeaders != null)
return existingHeaders;
}
PluginConverterImpl converter = PluginConverterImpl.getDefault();
if (converter == null)
converter = new PluginConverterImpl(bundledata.getAdaptor(), bundledata.getAdaptor().getContext());
Dictionary generatedManifest;
try {
generatedManifest = converter.convertManifest(bundledata.getBundleFile().getBaseFile(), true, null, true, null);
} catch (PluginConversionException pce) {
String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONVERTER_ERROR_CONVERTING, bundledata.getBundleFile().getBaseFile());
throw new BundleException(message, BundleException.MANIFEST_ERROR, pce);
}
//Now we know the symbolicId and the version of the bundle, we check to see if don't have a manifest for it already
Version version = Version.parseVersion((String) generatedManifest.get(Constants.BUNDLE_VERSION));
String symbolicName = ManifestElement.parseHeader(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, (String) generatedManifest.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME))[0].getValue();
ManifestElement generatedFrom = ManifestElement.parseHeader(PluginConverterImpl.GENERATED_FROM, (String) generatedManifest.get(PluginConverterImpl.GENERATED_FROM))[0];
Headers existingHeaders = checkManifestAndParent(cacheLocation, symbolicName, version.toString(), Byte.parseByte(generatedFrom.getAttribute(PluginConverterImpl.MANIFEST_TYPE_ATTRIBUTE)));
//We don't have a manifest.
manifestTimeStamp = Long.parseLong(generatedFrom.getValue());
manifestType = Byte.parseByte(generatedFrom.getAttribute(PluginConverterImpl.MANIFEST_TYPE_ATTRIBUTE));
if (bundledata.getAdaptor().isReadOnly() || existingHeaders != null)
return existingHeaders;