String featureResolutionRange) throws Exception {
for (Subsystem child : children) {
child.downloadBundles(manager, overrides, featureResolutionRange);
}
final Map<String, ResourceImpl> bundles = new ConcurrentHashMap<>();
final Downloader downloader = manager.createDownloader();
final Map<BundleInfo, Conditional> infos = new HashMap<>();
if (feature != null) {
for (Conditional cond : feature.getConditional()) {
for (final BundleInfo bi : cond.getBundles()) {
infos.put(bi, cond);
}
}
for (BundleInfo bi : feature.getBundles()) {
infos.put(bi, null);
}
}
for (Map.Entry<BundleInfo, Conditional> entry : infos.entrySet()) {
final BundleInfo bi = entry.getKey();
final String loc = bi.getLocation();
downloader.download(loc, new DownloadCallback() {
@Override
public void downloaded(StreamProvider provider) throws Exception {
ResourceImpl res = createResource(loc, provider.getMetadata());
bundles.put(loc, res);
}
});
}
for (Clause bundle : Parser.parseClauses(this.bundles.toArray(new String[this.bundles.size()]))) {
final String loc = bundle.getName();
downloader.download(loc, new DownloadCallback() {
@Override
public void downloaded(StreamProvider provider) throws Exception {
ResourceImpl res = createResource(loc, provider.getMetadata());
bundles.put(loc, res);
}
});
}
for (String override : overrides) {
final String loc = Overrides.extractUrl(override);
downloader.download(loc, new DownloadCallback() {
@Override
public void downloaded(StreamProvider provider) throws Exception {
ResourceImpl res = createResource(loc, provider.getMetadata());
bundles.put(loc, res);
}
});
}
downloader.await();
Overrides.override(bundles, overrides);
if (feature != null) {
// Add conditionals
Map<Conditional, Resource> resConds = new HashMap<>();
for (Conditional cond : feature.getConditional()) {