boolean isExported(int index) { if (isUsingResolved) return resolvedBundlesExported.get(resolvedRequires[index]).booleanValue(); return requiredBundles[index].isExported(); }
boolean isExported(int index) { if (isUsingResolved) return resolvedBundlesExported.get(resolvedRequires[index]).booleanValue(); return requiredBundles[index].isExported(); }
boolean isExported(int index) { if (isUsingResolved) return resolvedBundlesExported.get(resolvedRequires[index]).booleanValue(); return requiredBundles[index].isExported(); }
boolean isExported(int index) { if (isUsingResolved) return resolvedBundlesExported.get(resolvedRequires[index]).booleanValue(); return requiredBundles[index].isExported(); }
protected final void findExportedPackages(BundleDescription desc, BundleDescription projectDesc, Map<BundleDescription, ArrayList<Rule>> map) { if (desc != null) { Stack<BaseDescription> stack = new Stack<>(); stack.add(desc); while (!stack.isEmpty()) { BundleDescription bdesc = (BundleDescription) stack.pop(); ExportPackageDescription[] expkgs = bdesc.getExportPackages(); ArrayList<Rule> rules = new ArrayList<>(); for (int i = 0; i < expkgs.length; i++) { Rule rule = new Rule(); rule.discouraged = restrictPackage(projectDesc, expkgs[i]); rule.path = new Path(expkgs[i].getName().replaceAll("\\.", "/") + "/*"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ rules.add(rule); } map.put(bdesc, rules); // Look at re-exported Require-Bundles for any other exported packages BundleSpecification[] requiredBundles = bdesc.getRequiredBundles(); for (int i = 0; i < requiredBundles.length; i++) if (requiredBundles[i].isExported()) { BaseDescription bd = requiredBundles[i].getSupplier(); if (bd != null && bd instanceof BundleDescription) stack.add(bd); } } } }
protected final ExportPackageDescription[] findExportedPackages(BundleDescription desc) { if (desc != null) { IBundle bundle = fBase.getBundleModel().getBundle(); String value = bundle.getHeader(Constants.BUNDLE_SYMBOLICNAME); int index = (value != null) ? value.indexOf(';') : -1; String projectBundleId = (index > 0) ? value.substring(0, index) : value; List<ExportPackageDescription> result = new LinkedList<>(); Stack<BaseDescription> stack = new Stack<>(); stack.add(desc); while (!stack.isEmpty()) { BundleDescription bdesc = (BundleDescription) stack.pop(); ExportPackageDescription[] expkgs = bdesc.getExportPackages(); for (ExportPackageDescription expkg : expkgs) if (addPackage(projectBundleId, expkg)) result.add(expkg); // Look at re-exported Require-Bundles for any other exported packages BundleSpecification[] requiredBundles = bdesc.getRequiredBundles(); for (BundleSpecification requiredBundle : requiredBundles) if (requiredBundle.isExported()) { BaseDescription bd = requiredBundle.getSupplier(); if (bd != null && bd instanceof BundleDescription) stack.add(bd); } } return result.toArray(new ExportPackageDescription[result.size()]); } return new ExportPackageDescription[0]; }
public void load(BundleSpecification importModel) { this.fID = importModel.getName(); this.reexported = importModel.isExported(); this.optional = importModel.isOptional(); VersionRange versionRange = importModel.getVersionRange(); if (versionRange == null || VersionRange.emptyRange.equals(versionRange)) { this.version = null; match = IMatchRules.NONE; } else { this.version = versionRange.getMinimum() != null ? versionRange.getMinimum().toString() : null; match = PluginBase.getMatchRule(versionRange); } }
public void load(BundleSpecification importModel) { this.fID = importModel.getName(); this.reexported = importModel.isExported(); this.optional = importModel.isOptional(); VersionRange versionRange = importModel.getVersionRange(); if (versionRange == null || VersionRange.emptyRange.equals(versionRange)) { this.version = null; match = IMatchRules.NONE; } else { this.version = versionRange.getMinimum() != null ? versionRange.getMinimum().toString() : null; match = PluginBase.getMatchRule(versionRange); } }
private List<PackageRoots[]> isConsistentInternal(ResolverBundle requiringBundle, ResolverBundle matchingBundle, List<ResolverBundle> visited, boolean dynamicImport, List<PackageRoots[]> results) { // needed to prevent endless cycles if (visited.contains(matchingBundle)) return results; visited.add(matchingBundle); // check that the packages exported by the matching bundle are consistent ResolverExport[] matchingExports = matchingBundle.getExportPackages(); for (int i = 0; i < matchingExports.length; i++) { ResolverExport matchingExport = matchingExports[i]; if (matchingExports[i].getSubstitute() != null) matchingExport = (ResolverExport) matchingExports[i].getSubstitute(); results = isConsistentInternal(requiringBundle, matchingExport, dynamicImport, results); } // check that the packages from reexported bundles are consistent BundleConstraint[] supplierRequires = matchingBundle.getRequires(); for (int j = 0; j < supplierRequires.length; j++) { ResolverBundle reexported = (ResolverBundle) supplierRequires[j].getSelectedSupplier(); if (reexported == null || !((BundleSpecification) supplierRequires[j].getVersionConstraint()).isExported()) continue; results = isConsistentInternal(requiringBundle, reexported, visited, dynamicImport, results); } return results; }
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 List<PackageRoots[]> isConsistentInternal(ResolverBundle requiringBundle, ResolverBundle matchingBundle, List<ResolverBundle> visited, boolean dynamicImport, List<PackageRoots[]> results) { // needed to prevent endless cycles if (visited.contains(matchingBundle)) return results; visited.add(matchingBundle); // check that the packages exported by the matching bundle are consistent ResolverExport[] matchingExports = matchingBundle.getExportPackages(); for (int i = 0; i < matchingExports.length; i++) { ResolverExport matchingExport = matchingExports[i]; if (matchingExports[i].getSubstitute() != null) matchingExport = (ResolverExport) matchingExports[i].getSubstitute(); results = isConsistentInternal(requiringBundle, matchingExport, dynamicImport, results); } // check that the packages from reexported bundles are consistent BundleConstraint[] supplierRequires = matchingBundle.getRequires(); for (int j = 0; j < supplierRequires.length; j++) { ResolverBundle reexported = (ResolverBundle) supplierRequires[j].getSelectedSupplier(); if (reexported == null || !((BundleSpecification) supplierRequires[j].getVersionConstraint()).isExported()) continue; results = isConsistentInternal(requiringBundle, reexported, visited, dynamicImport, results); } return results; }
private List<PackageRoots[]> isConsistentInternal(ResolverBundle requiringBundle, ResolverBundle matchingBundle, List<ResolverBundle> visited, boolean dynamicImport, List<PackageRoots[]> results) { // needed to prevent endless cycles if (visited.contains(matchingBundle)) return results; visited.add(matchingBundle); // check that the packages exported by the matching bundle are consistent ResolverExport[] matchingExports = matchingBundle.getExportPackages(); for (int i = 0; i < matchingExports.length; i++) { ResolverExport matchingExport = matchingExports[i]; if (matchingExports[i].getSubstitute() != null) matchingExport = (ResolverExport) matchingExports[i].getSubstitute(); results = isConsistentInternal(requiringBundle, matchingExport, dynamicImport, results); } // check that the packages from reexported bundles are consistent BundleConstraint[] supplierRequires = matchingBundle.getRequires(); for (int j = 0; j < supplierRequires.length; j++) { ResolverBundle reexported = (ResolverBundle) supplierRequires[j].getSelectedSupplier(); if (reexported == null || !((BundleSpecification) supplierRequires[j].getVersionConstraint()).isExported()) continue; results = isConsistentInternal(requiringBundle, reexported, visited, dynamicImport, results); } return results; }
private List<PackageRoots[]> isConsistentInternal(ResolverBundle requiringBundle, ResolverBundle matchingBundle, List<ResolverBundle> visited, boolean dynamicImport, List<PackageRoots[]> results) { // needed to prevent endless cycles if (visited.contains(matchingBundle)) return results; visited.add(matchingBundle); // check that the packages exported by the matching bundle are consistent ResolverExport[] matchingExports = matchingBundle.getExportPackages(); for (int i = 0; i < matchingExports.length; i++) { ResolverExport matchingExport = matchingExports[i]; if (matchingExports[i].getSubstitute() != null) matchingExport = (ResolverExport) matchingExports[i].getSubstitute(); results = isConsistentInternal(requiringBundle, matchingExport, dynamicImport, results); } // check that the packages from reexported bundles are consistent BundleConstraint[] supplierRequires = matchingBundle.getRequires(); for (int j = 0; j < supplierRequires.length; j++) { ResolverBundle reexported = (ResolverBundle) supplierRequires[j].getSelectedSupplier(); if (reexported == null || !((BundleSpecification) supplierRequires[j].getVersionConstraint()).isExported()) continue; results = isConsistentInternal(requiringBundle, reexported, visited, dynamicImport, results); } return results; }
@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; }
public BundleSpecification createBundleSpecification(BundleSpecification original) { BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl(); bundleSpec.setName(original.getName()); bundleSpec.setVersionRange(original.getVersionRange()); bundleSpec.setExported(original.isExported()); bundleSpec.setOptional(original.isOptional()); if (original instanceof BundleSpecificationImpl) bundleSpec.setAttributes(((BundleSpecificationImpl) original).getAttributes()); return bundleSpec; }
private void addDependency(BundleDescription desc, HashSet added, Map map, ArrayList entries, boolean useInclusion) throws CoreException { if (desc == null || !added.add(desc)) return; BundleDescription[] fragments = hasExtensibleAPI(desc) ? desc.getFragments() : new BundleDescription[0]; // add fragment patches before host for (int i = 0; i < fragments.length; i++) { if (fragments[i].isResolved() && ClasspathUtilCore.isPatchFragment(fragments[i])) { addDependency(fragments[i], added, map, entries, useInclusion); } } addPlugin(desc, useInclusion, map, entries); // add fragments that are not patches after the host for (int i = 0; i < fragments.length; i++) { if (fragments[i].isResolved() && !ClasspathUtilCore.isPatchFragment(fragments[i])) { addDependency(fragments[i], added, map, entries, useInclusion); } } BundleSpecification[] required = desc.getRequiredBundles(); for (int i = 0; i < required.length; i++) { if (required[i].isExported()) { addDependency((BundleDescription)required[i].getSupplier(), added, map, entries, useInclusion); } } }
private void addDependency(BundleDescription desc, HashSet<BundleDescription> added, Map<BundleDescription, ArrayList<AccessRule>> map, ArrayList<DependencyEntry> entries, boolean useInclusion) { if (desc == null || !added.add(desc)) return; BundleDescription[] fragments = hasExtensibleAPI(desc) ? desc.getFragments() : new BundleDescription[0]; // add fragment patches before host for (int i = 0; i < fragments.length; i++) { if (fragments[i].isResolved() && isPatchFragment(fragments[i])) { addDependency(fragments[i], added, map, entries, useInclusion); } } addPlugin(desc, useInclusion, map, entries); // add fragments that are not patches after the host for (int i = 0; i < fragments.length; i++) { if (fragments[i].isResolved() && !isPatchFragment(fragments[i])) { addDependency(fragments[i], added, map, entries, useInclusion); } } BundleSpecification[] required = desc.getRequiredBundles(); for (int i = 0; i < required.length; i++) { if (required[i].isExported()) { addDependency((BundleDescription) required[i].getSupplier(), added, map, entries, useInclusion); } } }
public BundleSpecification createBundleSpecification(BundleSpecification original) { BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl(); bundleSpec.setName(original.getName()); bundleSpec.setVersionRange(original.getVersionRange()); bundleSpec.setExported(original.isExported()); bundleSpec.setOptional(original.isOptional()); if (original instanceof BundleSpecificationImpl) { bundleSpec.setAttributes(((BundleSpecificationImpl) original).getAttributes()); bundleSpec.setArbitraryDirectives(((BundleSpecificationImpl) original).getArbitraryDirectives()); } return bundleSpec; }
public BundleSpecification createBundleSpecification(BundleSpecification original) { BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl(); bundleSpec.setName(original.getName()); bundleSpec.setVersionRange(original.getVersionRange()); bundleSpec.setExported(original.isExported()); bundleSpec.setOptional(original.isOptional()); if (original instanceof BundleSpecificationImpl) { bundleSpec.setAttributes(((BundleSpecificationImpl) original).getAttributes()); bundleSpec.setArbitraryDirectives(((BundleSpecificationImpl) original).getArbitraryDirectives()); } return bundleSpec; }
public BundleSpecification createBundleSpecification(BundleSpecification original) { BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl(); bundleSpec.setName(original.getName()); bundleSpec.setVersionRange(original.getVersionRange()); bundleSpec.setExported(original.isExported()); bundleSpec.setOptional(original.isOptional()); if (original instanceof BundleSpecificationImpl) { bundleSpec.setAttributes(((BundleSpecificationImpl) original).getAttributes()); bundleSpec.setArbitraryDirectives(((BundleSpecificationImpl) original).getArbitraryDirectives()); } return bundleSpec; }