diff options
author | Igor Fedorenko | 2012-11-18 03:41:06 +0000 |
---|---|---|
committer | Igor Fedorenko | 2012-11-18 03:41:17 +0000 |
commit | 3167745338b7da3fd5fc1951f7fd1aa6f04323f4 (patch) | |
tree | 406e10150ccd9d4673a2083422304a4fc7195379 | |
parent | e1ca99f5630bb51b6a2ca1a6d6f07b79dfb77b09 (diff) | |
download | m2e-core-3167745338b7da3fd5fc1951f7fd1aa6f04323f4.tar.gz m2e-core-3167745338b7da3fd5fc1951f7fd1aa6f04323f4.tar.xz m2e-core-3167745338b7da3fd5fc1951f7fd1aa6f04323f4.zip |
introduced CompositeIndex#identifyAll method
this is useful when local repository index contains partial artifact
information. for example, local repository index may only have details
of the main artifact, while remote index(es) also provide information
about attached sources and javadoc artifacts.
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r-- | org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/CompositeIndex.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/CompositeIndex.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/CompositeIndex.java index 4a14363c..93b5fb42 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/CompositeIndex.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/CompositeIndex.java @@ -12,6 +12,7 @@ package org.eclipse.m2e.core.internal.index.nexus; import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -55,16 +56,23 @@ public class CompositeIndex implements IIndex { } public IndexedArtifactFile identify(File file) throws CoreException { + List<IndexedArtifactFile> aifs = identifyAll(file); + return !aifs.isEmpty() ? aifs.get(0) : null; + } + + public List<IndexedArtifactFile> identifyAll(File file) throws CoreException { + List<IndexedArtifactFile> result = new ArrayList<IndexedArtifactFile>(); + for(IIndex index : indexes) { IndexedArtifactFile aif = index.identify(file); if(aif != null) { // first one wins - return aif; + result.add(aif); } } // did not find anything - return null; + return result; } public Collection<IndexedArtifact> find(SearchExpression groupId, SearchExpression artifactId, |