public Bundle[] getHosts(Bundle bundle) { ModuleWiring wiring = getWiring(bundle); if (wiring == null) { return null; } List<ModuleWire> hostWires = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); if (hostWires == null) { // we don't hold locks while checking the graph, just return if no longer valid return null; } Collection<Bundle> hosts = new ArrayList<Bundle>(hostWires.size()); for (ModuleWire wire : hostWires) { Bundle host = wire.getProvider().getBundle(); if (host != null) { hosts.add(host); } } return hosts.isEmpty() ? null : hosts.toArray(new Bundle[hosts.size()]); }
private URL findResource(String resource) { ModuleWiring searchWiring = generation.getRevision().getWiring(); if (searchWiring != null) { if ((generation.getRevision().getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) { List<ModuleWire> hostWires = searchWiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); searchWiring = null; Long lowestHost = Long.MAX_VALUE; if (hostWires != null) { // search for the host with the highest ID for (ModuleWire hostWire : hostWires) { Long hostID = hostWire.getProvider().getRevisions().getModule().getId(); if (hostID.compareTo(lowestHost) <= 0) { lowestHost = hostID; searchWiring = hostWire.getProviderWiring(); } } } } } if (searchWiring != null) { int lastSlash = resource.lastIndexOf('/'); String path = lastSlash > 0 ? resource.substring(0, lastSlash) : "/"; //$NON-NLS-1$ String fileName = lastSlash != -1 ? resource.substring(lastSlash + 1) : resource; List<URL> result = searchWiring.findEntries(path, fileName, 0); return (result == null || result.isEmpty()) ? null : result.get(0); } // search the raw bundle file for the generation return generation.getEntry(resource); }
public Bundle[] getHosts(Bundle bundle) { ModuleWiring wiring = getWiring(bundle); if (wiring == null) { return null; } List<ModuleWire> hostWires = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); if (hostWires == null) { // we don't hold locks while checking the graph, just return if no longer valid return null; } Collection<Bundle> hosts = new ArrayList<Bundle>(hostWires.size()); for (ModuleWire wire : hostWires) { Bundle host = wire.getProvider().getBundle(); if (host != null) { hosts.add(host); } } return hosts.isEmpty() ? null : hosts.toArray(new Bundle[hosts.size()]); }
private URL findResource(String resource) { ModuleWiring searchWiring = generation.getRevision().getWiring(); if (searchWiring != null) { if ((generation.getRevision().getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) { List<ModuleWire> hostWires = searchWiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); searchWiring = null; Long lowestHost = Long.MAX_VALUE; if (hostWires != null) { // search for the host with the highest ID for (ModuleWire hostWire : hostWires) { Long hostID = hostWire.getProvider().getRevisions().getModule().getId(); if (hostID.compareTo(lowestHost) <= 0) { lowestHost = hostID; searchWiring = hostWire.getProviderWiring(); } } } } } if (searchWiring != null) { int lastSlash = resource.lastIndexOf('/'); String path = lastSlash > 0 ? resource.substring(0, lastSlash) : "/"; //$NON-NLS-1$ String fileName = lastSlash != -1 ? resource.substring(lastSlash + 1) : resource; List<URL> result = searchWiring.findEntries(path, fileName, 0); return (result == null || result.isEmpty()) ? null : result.get(0); } // search the raw bundle file for the generation return generation.getEntry(resource); }
public Bundle[] getHosts(Bundle bundle) { ModuleWiring wiring = getWiring(bundle); if (wiring == null) { return null; } List<ModuleWire> hostWires = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); if (hostWires == null) { // we don't hold locks while checking the graph, just return if no longer valid return null; } Collection<Bundle> hosts = new ArrayList<Bundle>(hostWires.size()); for (ModuleWire wire : hostWires) { Bundle host = wire.getProvider().getBundle(); if (host != null) { hosts.add(host); } } return hosts.isEmpty() ? null : hosts.toArray(new Bundle[hosts.size()]); }
public Bundle[] getHosts(Bundle bundle) { ModuleWiring wiring = getWiring(bundle); if (wiring == null) { return null; } List<ModuleWire> hostWires = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); if (hostWires == null) { // we don't hold locks while checking the graph, just return if no longer valid return null; } Collection<Bundle> hosts = new ArrayList<Bundle>(hostWires.size()); for (ModuleWire wire : hostWires) { Bundle host = wire.getProvider().getBundle(); if (host != null) { hosts.add(host); } } return hosts.isEmpty() ? null : hosts.toArray(new Bundle[hosts.size()]); }
public Bundle[] getHosts(Bundle bundle) { ModuleWiring wiring = getWiring(bundle); if (wiring == null) { return null; } List<ModuleWire> hostWires = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); if (hostWires == null) { // we don't hold locks while checking the graph, just return if no longer valid return null; } Collection<Bundle> hosts = new ArrayList<>(hostWires.size()); for (ModuleWire wire : hostWires) { Bundle host = wire.getProvider().getBundle(); if (host != null) { hosts.add(host); } } return hosts.isEmpty() ? null : hosts.toArray(new Bundle[hosts.size()]); }
public Bundle[] getHosts(Bundle bundle) { ModuleWiring wiring = getWiring(bundle); if (wiring == null) { return null; } List<ModuleWire> hostWires = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); if (hostWires == null) { // we don't hold locks while checking the graph, just return if no longer valid return null; } Collection<Bundle> hosts = new ArrayList<>(hostWires.size()); for (ModuleWire wire : hostWires) { Bundle host = wire.getProvider().getBundle(); if (host != null) { hosts.add(host); } } return hosts.isEmpty() ? null : hosts.toArray(new Bundle[hosts.size()]); }
private static void addDependents(ModuleRevision revision, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<ModuleRevision> dependencyClosure) { if (dependencyClosure.contains(revision)) return; dependencyClosure.add(revision); ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) return; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer(), wiringCopy, dependencyClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider(), wiringCopy, dependencyClosure); } } }
private static void addDependents(ModuleRevision revision, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<ModuleRevision> dependencyClosure) { if (dependencyClosure.contains(revision)) return; dependencyClosure.add(revision); ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) return; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer(), wiringCopy, dependencyClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider(), wiringCopy, dependencyClosure); } } }
private static void addDependents(ModuleRevision revision, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<ModuleRevision> dependencyClosure) { if (dependencyClosure.contains(revision)) return; dependencyClosure.add(revision); ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) return; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer(), wiringCopy, dependencyClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider(), wiringCopy, dependencyClosure); } } }
private static void addDependents(ModuleRevision revision, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<ModuleRevision> dependencyClosure) { if (dependencyClosure.contains(revision)) return; dependencyClosure.add(revision); ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) return; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer(), wiringCopy, dependencyClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider(), wiringCopy, dependencyClosure); } } }
private static void addDependents(ModuleRevision revision, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<ModuleRevision> dependencyClosure) { if (dependencyClosure.contains(revision)) return; dependencyClosure.add(revision); ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) return; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer(), wiringCopy, dependencyClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider(), wiringCopy, dependencyClosure); } } }
private static void addDependents(ModuleRevision revision, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<ModuleRevision> dependencyClosure) { if (dependencyClosure.contains(revision)) return; dependencyClosure.add(revision); ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) return; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer(), wiringCopy, dependencyClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider(), wiringCopy, dependencyClosure); } } }
private static void addDependents(Module module, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<Module> refreshClosure) { if (refreshClosure.contains(module)) return; refreshClosure.add(module); List<ModuleRevision> revisions = module.getRevisions().getModuleRevisions(); for (ModuleRevision revision : revisions) { ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) continue; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer().getRevisions().getModule(), wiringCopy, refreshClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider().getRevisions().getModule(), wiringCopy, refreshClosure); } } } }
private static void addDependents(Module module, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<Module> refreshClosure) { if (refreshClosure.contains(module)) return; refreshClosure.add(module); List<ModuleRevision> revisions = module.getRevisions().getModuleRevisions(); for (ModuleRevision revision : revisions) { ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) continue; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer().getRevisions().getModule(), wiringCopy, refreshClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider().getRevisions().getModule(), wiringCopy, refreshClosure); } } } }
private static void addDependents(Module module, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<Module> refreshClosure) { if (refreshClosure.contains(module)) return; refreshClosure.add(module); List<ModuleRevision> revisions = module.getRevisions().getModuleRevisions(); for (ModuleRevision revision : revisions) { ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) continue; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer().getRevisions().getModule(), wiringCopy, refreshClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider().getRevisions().getModule(), wiringCopy, refreshClosure); } } } }
private static void addDependents(Module module, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<Module> refreshClosure) { if (refreshClosure.contains(module)) return; refreshClosure.add(module); List<ModuleRevision> revisions = module.getRevisions().getModuleRevisions(); for (ModuleRevision revision : revisions) { ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) continue; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer().getRevisions().getModule(), wiringCopy, refreshClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider().getRevisions().getModule(), wiringCopy, refreshClosure); } } } }
private static void addDependents(Module module, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<Module> refreshClosure) { if (refreshClosure.contains(module)) return; refreshClosure.add(module); List<ModuleRevision> revisions = module.getRevisions().getModuleRevisions(); for (ModuleRevision revision : revisions) { ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) continue; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer().getRevisions().getModule(), wiringCopy, refreshClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider().getRevisions().getModule(), wiringCopy, refreshClosure); } } } }
private static void addDependents(Module module, Map<ModuleRevision, ModuleWiring> wiringCopy, Set<Module> refreshClosure) { if (refreshClosure.contains(module)) return; refreshClosure.add(module); List<ModuleRevision> revisions = module.getRevisions().getModuleRevisions(); for (ModuleRevision revision : revisions) { ModuleWiring wiring = wiringCopy.get(revision); if (wiring == null) continue; List<ModuleWire> provided = wiring.getProvidedModuleWires(null); // No null checks; we are holding the read lock here. // Add all requirers of the provided wires for (ModuleWire providedWire : provided) { addDependents(providedWire.getRequirer().getRevisions().getModule(), wiringCopy, refreshClosure); } // add all hosts of a fragment if (revision.getTypes() == BundleRevision.TYPE_FRAGMENT) { List<ModuleWire> hosts = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE); for (ModuleWire hostWire : hosts) { addDependents(hostWire.getProvider().getRevisions().getModule(), wiringCopy, refreshClosure); } } } }