Logo Search packages:      
Sourcecode: maven-repo-helper version File versions

POMInfo org::debian::maven::repo::Repository::searchMatchingPOM ( Dependency  dependency  )  [inline]

Search the best match for a dependency

Parameters:
dependency 
Returns:

Definition at line 72 of file Repository.java.

References org::debian::maven::repo::DependencyRule::apply(), org::debian::maven::repo::Dependency::equals(), and org::debian::maven::repo::DependencyRule::matches().

                                                            {
        POMInfo pom = getPOM(dependency);
        if (pom != null) {
            return pom;
        }

        // Map<DependencyRule,POMInfo>
        Map potentialMatches = new TreeMap();
        for (Iterator i = resolvedPoms.values().iterator(); i.hasNext();) {
            POMInfo testPom = (POMInfo) i.next();
            Set rules = testPom.getPublishedRules(true);
            for (Iterator j = rules.iterator(); j.hasNext();) {
                DependencyRule rule = (DependencyRule) j.next();
                if (rule.matches(dependency) && rule.apply(dependency).equals(testPom.getThisPom())) {
                    potentialMatches.put(rule, testPom);
                }
            }
        }
        if (!potentialMatches.isEmpty()) {
            // Return the best match
            return (POMInfo) potentialMatches.values().iterator().next();
        }
        return null;
    }


Generated by  Doxygen 1.6.0   Back to index