Allow specifying a resource type when blacklisting
@@ -45,6 +45,9 @@ public class Blacklist {
protected static final String BLACKLIST_URL = "url";
protected static final String BLACKLIST_RANGE = "range";
+ protected static final String BLACKLIST_TYPE = "type";
+ protected static final String TYPE_FEATURE = "feature";
+ protected static final String TYPE_BUNDLE = "bundle";
private static final Logger LOGGER = LoggerFactory.getLogger(Blacklist.class);
@@ -83,9 +86,12 @@ public class Blacklist {
range = new VersionRange(vr, true);
}
if (range.contains(VersionTable.getVersion(feature.getVersion()))) {
+ String type = clause.getAttribute(BLACKLIST_TYPE);
+ if (type == null || TYPE_FEATURE.equals(type)) {
return true;
}
}
+ }
// Check bundles
blacklist(feature.getBundle(), clauses);
// Check conditional bundles
@@ -105,12 +111,15 @@ public class Blacklist {
url = clause.getAttribute(BLACKLIST_URL);
}
if (info.getLocation().equals(url)) {
+ String type = clause.getAttribute(BLACKLIST_TYPE);
+ if (type == null || TYPE_BUNDLE.equals(type)) {
iterator.remove();
break;
}
}
}
}
+ }
public static Set<String> loadBlacklist(String blacklistUrl) {
Set<String> blacklist = new HashSet<>();
@@ -148,10 +157,13 @@ public class Blacklist {
range = new VersionRange(vr, true);
}
if (range.contains(VersionTable.getVersion(version))) {
+ String type = clause.getAttribute(BLACKLIST_TYPE);
+ if (type == null || TYPE_FEATURE.equals(type)) {
return true;
}
}
}
+ }
return false;
}
@@ -163,9 +175,12 @@ public class Blacklist {
url = clause.getAttribute(BLACKLIST_URL);
}
if (uri.equals(url)) {
+ String type = clause.getAttribute(BLACKLIST_TYPE);
+ if (type == null || TYPE_BUNDLE.equals(type)) {
return true;
}
}
+ }
return false;
}
}
