use of org.osgi.service.indexer.impl.types.VersionRange in project bnd by bndtools.
the class SCRAnalyzer method analyzeResource.
public void analyzeResource(Resource resource, List<Capability> caps, List<Requirement> reqs) throws Exception {
String header = null;
Manifest manifest = resource.getManifest();
if (manifest != null)
header = manifest.getMainAttributes().getValue(ComponentConstants.SERVICE_COMPONENT);
if (header == null)
return;
StringTokenizer tokenizer = new StringTokenizer(header, ",");
Version highest = null;
while (tokenizer.hasMoreTokens()) {
String pattern = tokenizer.nextToken().trim();
List<String> paths = Util.findMatchingPaths(resource, pattern);
if (paths != null)
for (String path : paths) {
Version version = processScrXml(resource, path, caps, reqs);
if (version == null)
continue;
if (highest == null || (version.compareTo(highest) > 0))
highest = version;
}
}
if (highest != null) {
Version lower = new Version(highest.getMajor(), highest.getMinor(), 0);
Version upper = new Version(highest.getMajor() + 1, 0, 0);
Requirement requirement = createRequirement(new VersionRange(true, lower, upper, false));
reqs.add(requirement);
}
}
Aggregations