public RegisteredPolicy(BundleLoader requester) { super(requester); //Filter the dependents; if (allDependents == null) return; for (Iterator<BundleDescription> iter = allDependents.iterator(); iter.hasNext();) { BundleLoaderProxy proxy = buddyRequester.getLoaderProxy(iter.next()); if (proxy == null) iter.remove(); try { String[] allContributions = ManifestElement.getArrayFromList(((AbstractBundle) proxy.getBundle()).getBundleData().getManifest().get(Constants.REGISTERED_POLICY)); if (allContributions == null) { iter.remove(); continue; } boolean contributes = false; for (int j = 0; j < allContributions.length && contributes == false; j++) { if (allContributions[j].equals(buddyRequester.getBundle().getSymbolicName())) contributes = true; } if (!contributes) iter.remove(); } catch (BundleException e) { iter.remove(); } } //After the filtering, if nothing is left then null out the variable for optimization if (allDependents.size() == 0) allDependents = null; }
public RegisteredPolicy(BundleLoader requester) { super(requester); //Filter the dependents; if (allDependents == null) return; for (Iterator<BundleDescription> iter = allDependents.iterator(); iter.hasNext();) { BundleLoaderProxy proxy = buddyRequester.getLoaderProxy(iter.next()); if (proxy == null) iter.remove(); try { String[] allContributions = ManifestElement.getArrayFromList(((AbstractBundle) proxy.getBundle()).getBundleData().getManifest().get(Constants.REGISTERED_POLICY)); if (allContributions == null) { iter.remove(); continue; } boolean contributes = false; for (int j = 0; j < allContributions.length && contributes == false; j++) { if (allContributions[j].equals(buddyRequester.getBundle().getSymbolicName())) contributes = true; } if (!contributes) iter.remove(); } catch (BundleException e) { iter.remove(); } } //After the filtering, if nothing is left then null out the variable for optimization if (allDependents.size() == 0) allDependents = null; }
public Bundle[] getImportingBundles() { if (supplier.isStale()) return null; AbstractBundle bundle = (AbstractBundle) getExportingBundle(); if (bundle == null) return null; AbstractBundle[] bundles = bundle.framework.getAllBundles(); List<Bundle> importers = new ArrayList<Bundle>(10); PackageSource supplierSource = supplier.createPackageSource(exportedPackage, false); for (int i = 0; i < bundles.length; i++) { if (!(bundles[i] instanceof BundleHost)) continue; BundleLoader loader = ((BundleHost) bundles[i]).getBundleLoader(); if (loader == null || loader.getBundle() == supplier.getBundle()) continue; // do not include include the exporter of the package PackageSource importerSource = loader.getPackageSource(getName()); if (supplierSource != null && supplierSource.hasCommonSource(importerSource)) importers.add(bundles[i]); } return importers.toArray(new Bundle[importers.size()]); }
public Bundle[] getImportingBundles() { if (supplier.isStale()) return null; AbstractBundle bundle = (AbstractBundle) getExportingBundle(); if (bundle == null) return null; AbstractBundle[] bundles = bundle.framework.getAllBundles(); List<Bundle> importers = new ArrayList<Bundle>(10); PackageSource supplierSource = supplier.createPackageSource(exportedPackage, false); for (int i = 0; i < bundles.length; i++) { if (!(bundles[i] instanceof BundleHost)) continue; BundleLoader loader = ((BundleHost) bundles[i]).getBundleLoader(); if (loader == null || loader.getBundle() == supplier.getBundle()) continue; // do not include include the exporter of the package PackageSource importerSource = loader.getPackageSource(getName()); if (supplierSource != null && supplierSource.hasCommonSource(importerSource)) importers.add(bundles[i]); } return importers.toArray(new Bundle[importers.size()]); }