if (exportPackages != null) { String value = (String) manifest.get(Constants.EXPORT_PACKAGE); if (value == null) { value = exportPackages; } else { value += "," + exportPackages; } manifest.set(Constants.EXPORT_PACKAGE, null); manifest.set(Constants.EXPORT_PACKAGE, value); } if (exportServices != null) { String value = (String) manifest.get(Constants.EXPORT_SERVICE); if (value == null) { value = exportServices; } else { value += "," + exportServices; } manifest.set(Constants.EXPORT_SERVICE, null); manifest.set(Constants.EXPORT_SERVICE, value); } if (providePackages != null) { String value = (String) manifest.get(Constants.PROVIDE_PACKAGE); if (value == null) { value = providePackages; } else { value += "," + providePackages; } manifest.set(Constants.PROVIDE_PACKAGE, null); manifest.set(Constants.PROVIDE_PACKAGE, value); } return manifest;
if (exportPackages != null) appendManifestValue(systemManifest, Constants.EXPORT_PACKAGE, exportPackages); if (exportServices != null) appendManifestValue(systemManifest, Constants.EXPORT_SERVICE, exportServices); if (providePackages != null) appendManifestValue(systemManifest, Constants.PROVIDE_PACKAGE, providePackages); return systemManifest;
	protected Headers createManifest(FrameworkAdaptor adaptor) throws BundleException {		InputStream in = null;		if (osgiBase != null && osgiBase.exists()) {			try {				in = new FileInputStream(new File(osgiBase, Constants.OSGI_BUNDLE_MANIFEST));			} catch (FileNotFoundException e) {				// do nothing here.  in == null			}		}		//TODO Do we still support this case? I thought we would only every ship with manifest.mf		// If we cannot find the Manifest file then use the old SYSTEMBUNDLE.MF file.		if (in == null) {			in = getClass().getResourceAsStream(Constants.OSGI_SYSTEMBUNDLE_MANIFEST);		}		if (Debug.DEBUG && Debug.DEBUG_GENERAL) {			if (in == null) {				Debug.println("Unable to find system bundle manifest " + Constants.OSGI_SYSTEMBUNDLE_MANIFEST);			}		}		Headers manifest = Headers.parseManifest(in);		String systemExportProp = System.getProperty(Constants.OSGI_SYSTEMPACKAGES);		if (systemExportProp != null) {			String value = (String) manifest.get(Constants.EXPORT_PACKAGE);			if (value == null) {				value = systemExportProp;			} else {				value += "," + systemExportProp;			}			manifest.set(Constants.EXPORT_PACKAGE, null);			manifest.set(Constants.EXPORT_PACKAGE, value);		}		// now get any extra packages and services that the adaptor wants		// to export and merge this into the system bundle's manifest		String exportPackages = adaptor.getExportPackages();		String exportServices = adaptor.getExportServices();		String providePackages = adaptor.getProvidePackages();		if (exportPackages != null) {			String value = (String) manifest.get(Constants.EXPORT_PACKAGE);			if (value == null) {				value = exportPackages;			} else {				value += "," + exportPackages;			}			manifest.set(Constants.EXPORT_PACKAGE, null);			manifest.set(Constants.EXPORT_PACKAGE, value);		}		if (exportServices != null) {			String value = (String) manifest.get(Constants.EXPORT_SERVICE);			if (value == null) {				value = exportServices;			} else {				value += "," + exportServices;			}			manifest.set(Constants.EXPORT_SERVICE, null);			manifest.set(Constants.EXPORT_SERVICE, value);		}		if (providePackages != null) {			String value = (String) manifest.get(Constants.PROVIDE_PACKAGE);			if (value == null) {				value = providePackages;			} else {				value += "," + providePackages;			}			manifest.set(Constants.PROVIDE_PACKAGE, null);			manifest.set(Constants.PROVIDE_PACKAGE, value);		}		return manifest;	}