private void processDiscoveryCoreBundle(IExtensionRegistry registry) { // we must add a contribution from the core bundle so that we get the // extension point itself try { Bundle bundle = Platform.getBundle("org.eclipse.equinox.p2.discovery.compatibility"); //$NON-NLS-1$ IContributor contributor = new RegistryContributor(bundle.getSymbolicName(), bundle.getSymbolicName(), null, null); try (InputStream inputStream = bundle.getEntry("plugin.xml").openStream()) { //$NON-NLS-1$ registry.addContribution(inputStream, contributor, false, bundle.getSymbolicName(), null, token); } } catch (IOException e) { throw new IllegalStateException(); } }
private void processBundle(IExtensionRegistry registry, Directory.Entry entry, File bundleFile) throws IOException { JarFile jarFile = new JarFile(bundleFile); jars.add(jarFile); ZipEntry pluginXmlEntry = jarFile.getEntry("plugin.xml"); //$NON-NLS-1$ if (pluginXmlEntry == null) { throw new IOException(Messages.DiscoveryRegistryStrategy_missing_pluginxml); } IContributor contributor = new RegistryContributor(bundleFile.getName(), bundleFile.getName(), null, null); if (((IDynamicExtensionRegistry) registry).hasContributor(contributor)) { jarFile.close(); return; } contributorToJarFile.put(contributor, bundleFile); contributorToDirectoryEntry.put(contributor, entry); ResourceBundle translationBundle = loadTranslationBundle(jarFile); try (InputStream inputStream = jarFile.getInputStream(pluginXmlEntry)) { registry.addContribution(inputStream, contributor, false, bundleFile.getPath(), translationBundle, token); } }
registry.addContribution(new BufferedInputStream(is), contributor, true, input.getPath(), null, fKey);
private void register() throws BundleException { IExtensionRegistry reg = RegistryFactory.getRegistry(); Object registryUser = ((ExtensionRegistry) reg).getTemporaryUserToken(); if (!reg.addContribution(getStreamForEntry(PLUGIN_XML), createContributor(), false, null, getPluginProperties(), registryUser)) { throw new BundleException("Could not add plugin: " + bundle.getSymbolicName(), BundleException.REJECTED_BY_HOOK); } }
registry.addContribution(new ByteArrayInputStream(bogusDef.getBytes()), pointContributor, false, null, null, this); registry.addContribution(new BufferedInputStream(new FileInputStream(pxml)), contributor, false, null, null, this); IExtension[] extensions = registry.getExtensions(contributor); for (int i = 0; i < extensions.length; i++) {
IContributor contributor = ContributorFactoryOSGi.createContributor(bundle); if (!((IDynamicExtensionRegistry)registry).hasContributor(contributor)) { registry.addContribution(new ByteArrayInputStream(EMPTY_PLUGIN_XML.getBytes()), contributor, false, null, null, ((ExtensionRegistry)registry) .getTemporaryUserToken());
registry.addContribution(pluginXMLInputStream, contributor, false, bundleSymbolicName, resourceBundle, null);
registry.addContribution(pluginXMLInputStream, contributor, false, bundleSymbolicName, resourceBundle, null);