class OBRRepositoryConnectorImpl implements OBRRepositoryService {

	protected List<String> getHighestBundleVersions(String... filenames) {
		if(filenames==null)
			return Collections.emptyList();
		SortedSetMultimap<String, String> map = TreeMultimap.create(Collator.getInstance(), new VersionComparator());
		for (String string : filenames) {
			Matcher matcher = BUNDLE_PATTERN.matcher(string);
			if(matcher.matches()) {
				String name = matcher.group(1);
				String version = matcher.group(2);
				map.put(name, version);
			}
			else {
				logger.warn("{} does not match the pattern {}. Skipping",string,BUNDLE_PATTERN);
			}
		}
		Set<Entry<String, Collection<String>>> entrySet = map.asMap().entrySet();
		List<String> result = new ArrayList<String>(entrySet.size());
		for (Entry<String, Collection<String>> entry : entrySet) {
			result.add(entry.getKey()+"_"+entry.getValue().iterator().next()+".jar");
		}
		return result;
	}

}