if (rootDependency != null) {
// as a hack lets just add this bundle in
LOG.info("Got root: " + rootDependency);
List<String> parentIds = profile.getParentIds();
Profile overlay = profileService.getOverlayProfile(profile);
String bundleUrl = rootDependency.toBundleUrlWithType();
LOG.info("Using resolver to add extra features and bundles on " + bundleUrl);
List<String> features = new ArrayList<String>();
List<String> bundles = new ArrayList<String>();
List<String> optionals = new ArrayList<String>();
if (requirements.getFeatures() != null) {
features.addAll(requirements.getFeatures());
}
if (requirements.getBundles() != null) {
bundles.addAll(requirements.getBundles());
}
bundles.add(bundleUrl);
LOG.info("Adding bundle: " + bundleUrl);
// TODO we maybe should detect a karaf based container in a nicer way than this?
boolean isKarafContainer = parentIds.contains("karaf") || parentIds.contains("containers-karaf");
boolean addBundleDependencies = Objects.equal("bundle", rootDependency.getType()) || isKarafContainer;
if (addBundleDependencies && requirements.isUseResolver()) {
// lets build up a list of all current active features and bundles along with all discovered features
List<Feature> availableFeatures = new ArrayList<Feature>();
addAvailableFeaturesFromProfile(availableFeatures, fabric, overlay);
Set<String> currentBundleLocations = new HashSet<>();
currentBundleLocations.addAll(bundles);
// lets add the current features
DownloadManager downloadManager = DownloadManagers.createDownloadManager(fabric, executorService);
Set<Feature> currentFeatures = AgentUtils.getFeatures(fabric, downloadManager, overlay);
addBundlesFromProfile(currentBundleLocations, overlay);
List<String> parentProfileIds = requirements.getParentProfiles();
if (parentProfileIds != null) {
for (String parentProfileId : parentProfileIds) {
Profile parentProfile = profileService.getProfile(profile.getVersion(), parentProfileId);
Profile parentOverlay = profileService.getOverlayProfile(parentProfile);
Set<Feature> parentFeatures = AgentUtils.getFeatures(fabric, downloadManager, parentOverlay);
currentFeatures.addAll(parentFeatures);
addAvailableFeaturesFromProfile(availableFeatures, fabric, parentOverlay);
addBundlesFromProfile(currentBundleLocations, parentOverlay);
}