String existingFeatureRepos = retrieveProperty(properties, FEATURES_REPOSITORIES);
if (!existingFeatureRepos.contains(uri.toString())) {
existingFeatureRepos = existingFeatureRepos + uri.toString();
properties.put(FEATURES_REPOSITORIES, existingFeatureRepos);
}
Features repo = readFeatures(uri);
for (Feature feature : repo.getFeature()) {
featureSet.add(feature);
if (startupFeatures != null && startupFeatures.contains(feature.getName())) {
installFeature(feature, null);
} else if (bootFeatures != null && bootFeatures.contains(feature.getName())) {
localRepoFeatures.add(feature);
missingDependencies.addAll(feature.getDependencies());
String existingBootFeatures = retrieveProperty(properties, FEATURES_BOOT);
if (!existingBootFeatures.contains(feature.getName())) {
existingBootFeatures = existingBootFeatures + feature.getName();
properties.put(FEATURES_BOOT, existingBootFeatures);
}
} else if (installedFeatures != null && installedFeatures.contains(feature.getName())) {
localRepoFeatures.add(feature);
missingDependencies.addAll(feature.getDependencies());
}
}
if (addTransitiveFeatures) {
addMissingDependenciesToRepo();
}
FileOutputStream out = new FileOutputStream(featuresCfgFile);
try {
properties.save(out);
} finally {
out.close();
}
}
} else {
getLog().info("Installing feature " + uri + " to system and startup.properties");
Features features = readFeatures(uri);
for (Feature feature : features.getFeature()) {
installFeature(feature, null);
}
}
}