RequiresHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { requiredBundles = null; resolvedBundlesExported = new HashMap<BundleDescription, Boolean>(); resolvedRequires = bundle.getResolvedRequires(); determineRequiresVisibility(bundle); } else { requiredBundles = bundle.getRequiredBundles(); resolvedBundlesExported = null; resolvedRequires = null; } }
RequiresHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { requiredBundles = null; resolvedBundlesExported = new HashMap<>(); resolvedRequires = bundle.getResolvedRequires(); determineRequiresVisibility(bundle); } else { requiredBundles = bundle.getRequiredBundles(); resolvedBundlesExported = null; resolvedRequires = null; } }
RequiresHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { requiredBundles = null; resolvedBundlesExported = new HashMap<BundleDescription, Boolean>(); resolvedRequires = bundle.getResolvedRequires(); determineRequiresVisibility(bundle); } else { requiredBundles = bundle.getRequiredBundles(); resolvedBundlesExported = null; resolvedRequires = null; } }
RequiresHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { requiredBundles = null; resolvedBundlesExported = new HashMap<BundleDescription, Boolean>(); resolvedRequires = bundle.getResolvedRequires(); determineRequiresVisibility(bundle); } else { requiredBundles = bundle.getRequiredBundles(); resolvedBundlesExported = null; resolvedRequires = null; } }
/** * Returns the set of String bundle names that are in the project's list of required * bundles. * * @return set of required bundle names, possibly empty */ private Set<String> getCurrentBundleNames() { IPluginModelBase base = PluginRegistry.findModel(fProject); if (base != null) { Set<String> bundleNames = new HashSet<>(); BundleSpecification[] reqBundles = base.getBundleDescription().getRequiredBundles(); for (BundleSpecification reqBundle : reqBundles) { bundleNames.add(reqBundle.getName()); } return bundleNames; } return Collections.emptySet(); }
private Set<String> findManifestPlugins(Set<String> ignorePkgs) { BundleSpecification[] bundles = fBase.getBundleDescription().getRequiredBundles(); Set<String> result = new HashSet<>((4 / 3) * (bundles.length) + 2); ArrayList<IPluginBase> plugins = new ArrayList<>(); for (BundleSpecification bundle : bundles) { String id = bundle.getName(); result.add(id); IPluginModelBase base = PluginRegistry.findModel(id); if (base != null) { ExportPackageDescription[] exportedPkgs = findExportedPackages(base.getBundleDescription()); for (ExportPackageDescription exportedPkg : exportedPkgs) ignorePkgs.add(exportedPkg.getName()); plugins.add(base.getPluginBase()); } } return result; }
@Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof BundleDescription) { BundleDescription desc = (BundleDescription) parentElement; if (desc.isResolved()) { Object[] required = getResolvedDependencies(desc.getRequiredBundles()); Object[] imported = getResolvedDependencies(desc.getImportPackages()); ArrayList<DependencyGroup> list = new ArrayList<>(2); if (required.length > 0) list.add(new DependencyGroup(required)); if (imported.length > 0) list.add(new DependencyGroup(imported)); return list.toArray(); } return desc.getContainingState().getResolverErrors(desc); } else if (parentElement instanceof DependencyGroup) { return ((DependencyGroup) parentElement).getChildren(); } return new Object[0]; }
private void checkFragmentConstraints(ResolverBundle bundle) { // get all currently attached fragments and ensure that any constraints // they have do not conflict with the constraints resolved to by the host ResolverBundle[] fragments = bundle.getFragments(); for (int i = 0; i < fragments.length; i++) { BundleDescription fragment = fragments[i].getBundleDescription(); if (bundle.constraintsConflict(fragment, fragment.getImportPackages(), fragment.getRequiredBundles(), fragment.getGenericRequires()) && !developmentMode) // found some conflicts; detach the fragment bundle.detachFragment(fragments[i], null); } }
private void checkFragmentConstraints(ResolverBundle bundle) { // get all currently attached fragments and ensure that any constraints // they have do not conflict with the constraints resolved to by the host ResolverBundle[] fragments = bundle.getFragments(); for (int i = 0; i < fragments.length; i++) { BundleDescription fragment = fragments[i].getBundleDescription(); if (bundle.constraintsConflict(fragment, fragment.getImportPackages(), fragment.getRequiredBundles(), fragment.getGenericRequires()) && !developmentMode) // found some conflicts; detach the fragment bundle.detachFragment(fragments[i], null); } }
private void checkFragmentConstraints(ResolverBundle bundle) { // get all currently attached fragments and ensure that any constraints // they have do not conflict with the constraints resolved to by the host ResolverBundle[] fragments = bundle.getFragments(); for (int i = 0; i < fragments.length; i++) { BundleDescription fragment = fragments[i].getBundleDescription(); if (bundle.constraintsConflict(fragment, fragment.getImportPackages(), fragment.getRequiredBundles(), fragment.getGenericRequires()) && !developmentMode) // found some conflicts; detach the fragment bundle.detachFragment(fragments[i], null); } }
private void checkFragmentConstraints(ResolverBundle bundle) { // get all currently attached fragments and ensure that any constraints // they have do not conflict with the constraints resolved to by the host ResolverBundle[] fragments = bundle.getFragments(); for (int i = 0; i < fragments.length; i++) { BundleDescription fragment = fragments[i].getBundleDescription(); if (bundle.constraintsConflict(fragment, fragment.getImportPackages(), fragment.getRequiredBundles(), fragment.getGenericRequires()) && !developmentMode) // found some conflicts; detach the fragment bundle.detachFragment(fragments[i], null); } }
private void addDependency(State state, String bundleID, Set<String> set) { if (bundleID == null || !set.add(bundleID)) return; BundleDescription desc = state.getBundle(bundleID, null); if (desc == null) return; BundleDescription[] fragments = desc.getFragments(); for (BundleDescription fragment : fragments) { addDependency(state, fragment.getSymbolicName(), set); } BundleSpecification[] specs = desc.getRequiredBundles(); for (BundleSpecification spec : specs) { if (spec.isResolved() && spec.isExported()) { addDependency(state, spec.getName(), set); } } }
private void addHostsFromFragmentConstraints(ResolverBundle unresolved, Set<BundleDescription> additionalRefresh) { if (!unresolved.isFragment()) return; ImportPackageSpecification[] newImports = unresolved.getBundleDescription().getImportPackages(); BundleSpecification[] newRequires = unresolved.getBundleDescription().getRequiredBundles(); if (newImports.length == 0 && newRequires.length == 0) return; // the fragment does not have its own constraints BundleConstraint hostConstraint = unresolved.getHost(); List<ResolverBundle> hosts = resolverBundles.get(hostConstraint.getVersionConstraint().getName()); for (ResolverBundle host : hosts) if (hostConstraint.isSatisfiedBy(host) && host.isResolved()) // we found a host that is resolved; // add it to the set of bundle to refresh so we can ensure this fragment is allowed to resolve additionalRefresh.add(host.getBundleDescription()); }
private void addHostsFromFragmentConstraints(ResolverBundle unresolved, Set<BundleDescription> additionalRefresh) { if (!unresolved.isFragment()) return; ImportPackageSpecification[] newImports = unresolved.getBundleDescription().getImportPackages(); BundleSpecification[] newRequires = unresolved.getBundleDescription().getRequiredBundles(); if (newImports.length == 0 && newRequires.length == 0) return; // the fragment does not have its own constraints BundleConstraint hostConstraint = unresolved.getHost(); List<ResolverBundle> hosts = resolverBundles.get(hostConstraint.getVersionConstraint().getName()); for (ResolverBundle host : hosts) if (hostConstraint.isSatisfiedBy(host) && host.isResolved()) // we found a host that is resolved; // add it to the set of bundle to refresh so we can ensure this fragment is allowed to resolve additionalRefresh.add(host.getBundleDescription()); }
private void addHostsFromFragmentConstraints(ResolverBundle unresolved, Set<BundleDescription> additionalRefresh) { if (!unresolved.isFragment()) return; ImportPackageSpecification[] newImports = unresolved.getBundleDescription().getImportPackages(); BundleSpecification[] newRequires = unresolved.getBundleDescription().getRequiredBundles(); if (newImports.length == 0 && newRequires.length == 0) return; // the fragment does not have its own constraints BundleConstraint hostConstraint = unresolved.getHost(); List<ResolverBundle> hosts = resolverBundles.get(hostConstraint.getVersionConstraint().getName()); for (ResolverBundle host : hosts) if (hostConstraint.isSatisfiedBy(host) && host.isResolved()) // we found a host that is resolved; // add it to the set of bundle to refresh so we can ensure this fragment is allowed to resolve additionalRefresh.add(host.getBundleDescription()); }
private void addHostsFromFragmentConstraints(ResolverBundle unresolved, Set<BundleDescription> additionalRefresh) { if (!unresolved.isFragment()) return; ImportPackageSpecification[] newImports = unresolved.getBundleDescription().getImportPackages(); BundleSpecification[] newRequires = unresolved.getBundleDescription().getRequiredBundles(); if (newImports.length == 0 && newRequires.length == 0) return; // the fragment does not have its own constraints BundleConstraint hostConstraint = unresolved.getHost(); List<ResolverBundle> hosts = resolverBundles.get(hostConstraint.getVersionConstraint().getName()); for (ResolverBundle host : hosts) if (hostConstraint.isSatisfiedBy(host) && host.isResolved()) // we found a host that is resolved; // add it to the set of bundle to refresh so we can ensure this fragment is allowed to resolve additionalRefresh.add(host.getBundleDescription()); }
void loadImports(BundleDescription description) { BundleSpecification[] required = description.getRequiredBundles(); for (int i = 0; i < required.length; i++) { PluginImport importElement = new PluginImport(); importElement.setModel(getModel()); importElement.setInTheModel(true); importElement.setParent(this); fImports.add(importElement); importElement.load(required[i]); } BundleDescription[] imported = PDEStateHelper.getImportedBundles(description); for (int i = 0; i < imported.length; i++) { PluginImport importElement = new PluginImport(); importElement.setModel(getModel()); importElement.setInTheModel(true); importElement.setParent(this); fImports.add(importElement); importElement.load(imported[i]); } }
@Override public synchronized IRequiredComponentDescription[] getRequiredComponents() throws CoreException { if (fBundleDescription == null) { baselineDisposed(getBaseline()); } BundleSpecification[] requiredBundles = fBundleDescription.getRequiredBundles(); IRequiredComponentDescription[] req = new IRequiredComponentDescription[requiredBundles.length]; for (int i = 0; i < requiredBundles.length; i++) { BundleSpecification bundle = requiredBundles[i]; req[i] = new RequiredComponentDescription(bundle.getName(), new BundleVersionRange(bundle.getVersionRange()), bundle.isOptional(), bundle.isExported()); } return req; }
private void stateResolveFragConstraints(ResolverBundle rb) { ResolverBundle host = (ResolverBundle) rb.getHost().getSelectedSupplier(); ImportPackageSpecification[] imports = rb.getBundleDescription().getImportPackages(); for (int i = 0; i < imports.length; i++) { ResolverImport hostImport = host == null ? null : host.getImport(imports[i].getName()); ResolverExport export = (ResolverExport) (hostImport == null ? null : hostImport.getSelectedSupplier()); BaseDescription supplier = export == null ? null : export.getExportPackageDescription(); state.resolveConstraint(imports[i], supplier); } BundleSpecification[] requires = rb.getBundleDescription().getRequiredBundles(); for (int i = 0; i < requires.length; i++) { BundleConstraint hostRequire = host == null ? null : host.getRequire(requires[i].getName()); ResolverBundle bundle = (ResolverBundle) (hostRequire == null ? null : hostRequire.getSelectedSupplier()); BaseDescription supplier = bundle == null ? null : bundle.getBundleDescription(); state.resolveConstraint(requires[i], supplier); } }
@Override protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary<String, String> environment) { // if there is an environment conflict boolean conflict = !super.shouldAddPlugin(bundle, environment); if (conflict) { // make a copy of the state if we haven't already if (fStateCopy == null) copyState(TargetPlatformHelper.getState()); // replace the current BundleDescription with a copy who does not have the platform filter. This will allow the plug-in to be resolved BundleDescription desc = fStateCopy.removeBundle(bundle.getBundleId()); BundleDescription newDesc = fStateCopy.getFactory().createBundleDescription(desc.getBundleId(), desc.getSymbolicName(), desc.getVersion(), desc.getLocation(), desc.getRequiredBundles(), desc.getHost(), desc.getImportPackages(), desc.getExportPackages(), desc.isSingleton(), desc.attachFragments(), desc.dynamicFragments(), null, desc.getExecutionEnvironments(), desc.getGenericRequires(), desc.getGenericCapabilities()); fStateCopy.addBundle(newDesc); } // always include plug-ins, even ones with environment conflicts return true; }