String identity = entry.getKey();
String versionStr = entry.getValue().get("version");
// Construct a filter & requirement to find matches
Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, identity);
if (versionStr != null)
filter = new AndFilter().addChild(filter).addChild(new LiteralFilter(Filters.fromVersionRange(versionStr)));
Requirement frameworkReq = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(
Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
// Iterate over repos looking for matches
for (Repository repo : repos) {
Map<Requirement,Collection<Capability>> providers = repo.findProviders(Collections
.singletonList(frameworkReq));