private static synchronized String getSymbolicName(String path) { if (fgCachedLocations == null) fgCachedLocations = new HashMap<>(); if (fgCachedLocations.containsKey(path)) { return fgCachedLocations.get(path); } // TODO Loading the entire manifest to get a name is an unecessary performance hit File file = new File(path); if (file.exists()) { try { Map<String, String> manifest = ManifestUtils.loadManifest(file); String name = manifest.get(Constants.BUNDLE_SYMBOLICNAME); if (name != null) { fgCachedLocations.put(path, name); return name; } } catch (CoreException e) { // Should have already been reported when creating the target platform } } return null; }
Map<String, String> map = loadPluginXML(bundleLocation); if (map != null && map.containsKey(Constants.BUNDLE_SYMBOLICNAME)) { return map; closeZipFileAndStream(stream, jarFile); File fxml = new File(bundleLocation, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR); if (pxml.exists() || fxml.exists()) { Map<String, String> map = loadPluginXML(bundleLocation); if (map != null && map.containsKey(Constants.BUNDLE_SYMBOLICNAME)) { return map;
private static void writeEntry(Writer out, String key, String value) throws IOException { if (value != null && value.length() > 0) { out.write(splitOnComma(key + ": " + value)); //$NON-NLS-1$ out.write('\n'); } }
IManifestHeader bundleClasspathheader = bundle.getManifestHeader(Constants.BUNDLE_CLASSPATH); IPackageFragmentRoot[] roots = ManifestUtils.findPackageFragmentRoots(bundleClasspathheader, fProject); for (int i = 0; i < roots.length; i++) { try { if (ManifestUtils.isImmediateRoot(roots[i])) { IJavaElement[] javaElements = roots[i].getChildren(); for (int j = 0; j < javaElements.length; j++)
libs = header.getValue().split(","); //$NON-NLS-1$ IBuild build = getBuild(project); if (build == null) { try {
writeEntry(out, MANIFEST_VERSION, manifestToWrite.remove(MANIFEST_VERSION)); writeEntry(out, Constants.BUNDLE_MANIFESTVERSION, manifestToWrite.remove(Constants.BUNDLE_MANIFESTVERSION)); writeEntry(out, Constants.BUNDLE_NAME, manifestToWrite.remove(Constants.BUNDLE_NAME)); writeEntry(out, Constants.BUNDLE_SYMBOLICNAME, manifestToWrite.remove(Constants.BUNDLE_SYMBOLICNAME)); writeEntry(out, Constants.BUNDLE_VERSION, manifestToWrite.remove(Constants.BUNDLE_VERSION)); writeEntry(out, Constants.BUNDLE_CLASSPATH, manifestToWrite.remove(Constants.BUNDLE_CLASSPATH)); writeEntry(out, Constants.BUNDLE_ACTIVATOR, manifestToWrite.remove(Constants.BUNDLE_ACTIVATOR)); writeEntry(out, Constants.BUNDLE_VENDOR, manifestToWrite.remove(Constants.BUNDLE_VENDOR)); writeEntry(out, Constants.FRAGMENT_HOST, manifestToWrite.remove(Constants.FRAGMENT_HOST)); writeEntry(out, Constants.BUNDLE_LOCALIZATION, manifestToWrite.remove(Constants.BUNDLE_LOCALIZATION)); writeEntry(out, Constants.EXPORT_PACKAGE, manifestToWrite.remove(Constants.EXPORT_PACKAGE)); writeEntry(out, ICoreConstants.PROVIDE_PACKAGE, manifestToWrite.remove(ICoreConstants.PROVIDE_PACKAGE)); writeEntry(out, Constants.REQUIRE_BUNDLE, manifestToWrite.remove(Constants.REQUIRE_BUNDLE)); Iterator<?> keys = manifestToWrite.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); writeEntry(out, key, manifestToWrite.get(key));
@Override public void save(PrintWriter writer) { IBundle bundle = getBundle(); Map<String, String> headers = ((Bundle) bundle).getHeaders(); // If the bundle doesn't have a user specified manifest version header, use the default 1.0 but don't save it in the model boolean addManifestVersion = headers.get(ManifestUtils.MANIFEST_VERSION) == null; if (addManifestVersion) { headers.put(ManifestUtils.MANIFEST_VERSION, "1.0"); //$NON-NLS-1$ } try { ManifestUtils.writeManifest(headers, writer); } catch (IOException e) { PDECore.logException(e); } finally { if (addManifestVersion) { headers.remove(ManifestUtils.MANIFEST_VERSION); } } fDirty = false; }
(IManifestHeader) bundle.getManifestHeader(Constants.BUNDLE_CLASSPATH); IPackageFragmentRoot[] roots = ManifestUtils.findPackageFragmentRoots(bundleClasspathheader, fProject); for (int i = 0; i < roots.length; i++) { try { if (ManifestUtils.isImmediateRoot(roots[i])) { IJavaElement[] javaElements = roots[i].getChildren(); for (int j = 0; j < javaElements.length; j++)
libs = header.getValue().split(","); //$NON-NLS-1$ IBuild build = getBuild(project); if (build == null) { try {
IPackageFragmentRoot[] roots = ManifestUtils.findPackageFragmentRoots(bundleClasspathheader, project); if (ManifestUtils.isImmediateRoot(root)) { IJavaElement[] elements = root.getChildren(); for (IJavaElement element : elements)
public BundleDescription addBundle(File bundleLocation, long bundleId) throws CoreException { Map<String, String> manifest = ManifestUtils.loadManifest(bundleLocation); // update for development mode TargetWeaver.weaveManifest(manifest); BundleDescription desc = addBundle(manifest, bundleLocation, bundleId); if (desc != null && manifest != null && "true".equals(manifest.get(ICoreConstants.ECLIPSE_SYSTEM_BUNDLE))) { //$NON-NLS-1$ // if this is the system bundle then // indicate that the javaProfile has changed since the new system // bundle may not contain profiles for all EE's in the list fEEListChanged = true; fSystemBundle = desc.getSymbolicName(); } if (desc != null) { addAuxiliaryData(desc, manifest, true); } return desc; }
throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(Messages.TargetFeature_FileDoesNotExist, file))); Map<String, String> manifest = ManifestUtils.loadManifest(file); try { fInfo = new BundleInfo(file.toURI());
/** * Returns this bundle's manifest as a dictionary or <code>null</code> if no * manifest was found. * * @return manifest dictionary or <code>null</code> * @exception CoreException if something goes terribly wrong */ protected synchronized Map<String, String> getManifest() throws CoreException { if (fManifest == null) { try { fManifest = ManifestUtils.loadManifest(new File(fLocation)); } catch (CoreException e) { if (e.getStatus().getCode() == ManifestUtils.STATUS_CODE_NOT_A_BUNDLE_MANIFEST) { // If we load a component with a manifest file that isn't a // bundle, ignore it return null; } else { throw e; } } if (isWorkspaceBinary()) { // must account for bundles in development mode - look for class // files in output // folders rather than jars TargetWeaver.weaveManifest(fManifest); } } return fManifest; }
Map<String, String> manifest = ManifestUtils.loadManifest(new File(fModel.getInstallLocation())); TargetWeaver.weaveManifest(manifest); Hashtable<String, String> dictionaryManifest = new Hashtable<>(manifest);