LatestStrategy strategy,
VersionMatcher versionMatcher,
ResourceMDParser rmdparser,
ModuleRevisionId mrid,
Date date) {
ResolvedResource found = null;
List sorted = strategy.sort(rress);
List rejected = new ArrayList();
for (ListIterator iter = sorted.listIterator(sorted.size()); iter.hasPrevious();) {
ResolvedResource rres = (ResolvedResource) iter.previous();
if ((date != null && rres.getLastModified() > date.getTime())) {
Message.verbose("\t"+name+": too young: "+rres);
rejected.add(rres.getRevision()+" ("+rres.getLastModified()+")");
continue;
}
ModuleRevisionId foundMrid = ModuleRevisionId.newInstance(mrid, rres.getRevision());
if (!versionMatcher.accept(mrid, foundMrid)) {
Message.debug("\t"+name+": rejected by version matcher: "+rres);
rejected.add(rres.getRevision());
continue;
}
if (versionMatcher.needModuleDescriptor(mrid, foundMrid)) {
ResolvedResource r = rmdparser.parse(rres.getResource(), rres.getRevision());
ModuleDescriptor md = ((MDResolvedResource)r).getResolvedModuleRevision().getDescriptor();
if (md.isDefault()) {
Message.debug("\t"+name+": default md rejected by version matcher requiring module descriptor: "+rres);
rejected.add(rres.getRevision()+" (MD)");
continue;