Package org.apache.maven.repository
Class DefaultMirrorSelector
- java.lang.Object
-
- org.apache.maven.repository.DefaultMirrorSelector
-
- All Implemented Interfaces:
MirrorSelector
@Component(role=MirrorSelector.class) public class DefaultMirrorSelector extends java.lang.Object implements MirrorSelector
DefaultMirrorSelector
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
EXTERNAL_WILDCARD
private static java.lang.String
WILDCARD
-
Constructor Summary
Constructors Constructor Description DefaultMirrorSelector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Mirror
getMirror(ArtifactRepository repository, java.util.List<Mirror> mirrors)
Determines the mirror for the specified repository.(package private) static boolean
isExternalRepo(ArtifactRepository originalRepository)
Checks the URL to see if this repository refers to an external repository(package private) static boolean
matchesLayout(java.lang.String repoLayout, java.lang.String mirrorLayout)
Checks whether the layouts configured for a mirror match with the layout of the repository.(package private) static boolean
matchesLayout(ArtifactRepository repository, Mirror mirror)
(package private) static boolean
matchPattern(ArtifactRepository originalRepository, java.lang.String pattern)
This method checks if the pattern matches the originalRepository.
-
-
-
Field Detail
-
WILDCARD
private static final java.lang.String WILDCARD
- See Also:
- Constant Field Values
-
EXTERNAL_WILDCARD
private static final java.lang.String EXTERNAL_WILDCARD
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMirror
public Mirror getMirror(ArtifactRepository repository, java.util.List<Mirror> mirrors)
Description copied from interface:MirrorSelector
Determines the mirror for the specified repository.- Specified by:
getMirror
in interfaceMirrorSelector
- Parameters:
repository
- The repository to determine the mirror for, must not benull
.mirrors
- The available mirrors, may benull
.- Returns:
- The mirror specification for the repository or
null
if no mirror matched.
-
matchPattern
static boolean matchPattern(ArtifactRepository originalRepository, java.lang.String pattern)
This method checks if the pattern matches the originalRepository. Valid patterns: * = everything external:* = everything not on the localhost and not file based. repo,repo1 = repo or repo1 *,!repo1 = everything except repo1- Parameters:
originalRepository
- to compare for a match.pattern
- used for match. Currently only '*' is supported.- Returns:
- true if the repository is a match to this pattern.
-
isExternalRepo
static boolean isExternalRepo(ArtifactRepository originalRepository)
Checks the URL to see if this repository refers to an external repository- Parameters:
originalRepository
-- Returns:
- true if external.
-
matchesLayout
static boolean matchesLayout(ArtifactRepository repository, Mirror mirror)
-
matchesLayout
static boolean matchesLayout(java.lang.String repoLayout, java.lang.String mirrorLayout)
Checks whether the layouts configured for a mirror match with the layout of the repository.- Parameters:
repoLayout
- The layout of the repository, may benull
.mirrorLayout
- The layouts supported by the mirror, may benull
.- Returns:
true
if the layouts associated with the mirror match the layout of the original repository,false
otherwise.
-
-