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()) {
FeatureResource resCond = FeatureResource.build(feature, cond, featureResolutionRange, bundles);
addIdentityRequirement(this, resCond, false);
addIdentityRequirement(resCond, this, true);
installable.add(resCond);
resConds.put(cond, resCond);
}
// Add features
FeatureResource resFeature = FeatureResource.build(feature, featureResolutionRange, bundles);
addIdentityRequirement(resFeature, this);
installable.add(resFeature);
// Add dependencies
for (Map.Entry<BundleInfo, Conditional> entry : infos.entrySet()) {
final BundleInfo bi = entry.getKey();
final String loc = bi.getLocation();
final Conditional cond = entry.getValue();
ResourceImpl res = bundles.get(loc);
if (bi.isDependency()) {
addDependency(res, false, bi.isStart(), bi.getStartLevel());
} else {
doAddDependency(res, cond == null, bi.isStart(), bi.getStartLevel());
}
if (cond != null) {
addIdentityRequirement(res, resConds.get(cond), true);
}
}