ImportsHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { importedPackages = null; resolvedImports = bundle.getResolvedImports(); } else { importedPackages = bundle.getImportPackages(); resolvedImports = null; } }
ImportsHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { importedPackages = null; resolvedImports = bundle.getResolvedImports(); } else { importedPackages = bundle.getImportPackages(); resolvedImports = null; } }
ImportsHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { importedPackages = null; resolvedImports = bundle.getResolvedImports(); } else { importedPackages = bundle.getImportPackages(); resolvedImports = null; } }
ImportsHolder(BundleDescription bundle, int options) { isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0; if (isUsingResolved) { importedPackages = null; resolvedImports = bundle.getResolvedImports(); } else { importedPackages = bundle.getImportPackages(); resolvedImports = null; } }
private boolean isAffected(BundleDescription desc, BundleDescription dependent) { ImportPackageSpecification[] imports = dependent.getImportPackages(); Iterator<Object> iter = fElements.keySet().iterator(); while (iter.hasNext()) { String name = ((IJavaElement) iter.next()).getElementName(); for (ImportPackageSpecification spec : imports) { if (name.equals(spec.getName())) { BaseDescription supplier = spec.getSupplier(); if (supplier instanceof ExportPackageDescription) { if (desc.equals(((ExportPackageDescription) supplier).getExporter())) return true; } } } } return false; }
public BundleInfo[] getPrerequisteBundles(BundleInfo bInfo) { Set set = new HashSet(); URI realLocation = bInfo.getLocation(); BundleDescription bundle = getBundleByLocation(realLocation); ImportPackageSpecification[] imports = bundle.getImportPackages(); for (int i = 0; i < imports.length; i++) { BaseDescription supplier = imports[i].getSupplier(); if (supplier == null) { if (!imports[i].getDirective(Constants.RESOLUTION_DIRECTIVE).equals(ImportPackageSpecification.RESOLUTION_OPTIONAL)) throw new IllegalStateException("Internal error: import supplier should not be null"); //$NON-NLS-1$ } else set.add(supplier.getSupplier()); } BundleDescription[] requires = bundle.getResolvedRequires(); for (int i = 0; i < requires.length; i++) { set.add(requires[i]); } BundleDescription[] bundles = new BundleDescription[set.size()]; set.toArray(bundles); return convertState(bundles); }
protected final void findImportPackages(IBundle bundle, Set<String> ignorePkgs) { IManifestHeader header = bundle.getManifestHeader(Constants.IMPORT_PACKAGE); if (header == null || header.getValue() == null) return; if (header instanceof ImportPackageHeader) { ImportPackageObject[] pkgs = ((ImportPackageHeader) header).getPackages(); for (ImportPackageObject pkg : pkgs) ignorePkgs.add(pkg.getName()); } else { ImportPackageSpecification[] pkgs = fBase.getBundleDescription().getImportPackages(); for (ImportPackageSpecification pkg : pkgs) ignorePkgs.add(pkg.getName()); } }
@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 addHostPlugin(HostSpecification hostSpec, HashSet<BundleDescription> added, Map<BundleDescription, ArrayList<Rule>> map, ArrayList<IClasspathEntry> entries) throws CoreException { BaseDescription desc = hostSpec.getSupplier(); if (desc instanceof BundleDescription) { BundleDescription host = (BundleDescription) desc; // add host plug-in if (added.add(host) && addPlugin(host, false, map, entries)) { BundleSpecification[] required = host.getRequiredBundles(); for (int i = 0; i < required.length; i++) { addDependency((BundleDescription) required[i].getSupplier(), added, map, entries); } // add Import-Package ImportPackageSpecification[] imports = host.getImportPackages(); for (int i = 0; i < imports.length; i++) { BaseDescription supplier = imports[i].getSupplier(); if (supplier instanceof ExportPackageDescription) { addDependencyViaImportPackage(((ExportPackageDescription) supplier).getExporter(), added, map, entries); } } } } }
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()); }
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; }
protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary 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; }