ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
Group group = groupManager.findGroupByName(groupName);
if (group == null || group.getMembers().isEmpty()) {
FeatureInfo info = new FeatureInfo(feature, version);
Map<FeatureInfo, Boolean> features = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName);
//1st check the existing configuration
if (version == null || (version.trim().length() < 1)) {
for (FeatureInfo f : features.keySet()) {
if (f.getName().equals(feature)) {
version = f.getVersion();
info.setVersion(version);
}
}
}
//2nd check the Features Service.
try {
for (Feature f : featuresService.listFeatures()) {
if (f.getName().equals(feature)) {
version = f.getVersion();
info.setVersion(version);
}
}
} catch (Exception e) {
logger.error("Error while browsing features", e);
}
if (info.getVersion() != null && (info.getVersion().trim().length() > 0)) {
features.put(info, status);
result = Boolean.TRUE;
}
}
} finally {