Class AbstractDependencyResolver
- java.lang.Object
-
- org.apache.jackrabbit.vault.validation.context.AbstractDependencyResolver
-
- All Implemented Interfaces:
DependencyResolver
public abstract class AbstractDependencyResolver extends Object implements DependencyResolver
Abstract package dependency resolver supporting Maven repository dependency location URIs (starting withmaven:
). All package dependencies are mapped to Maven coordinates by this class and then resolved viaresolvePackageInfo(MavenCoordinates)
. The resolver comes with a cache so that the same package dependency is not resolved more than once. This class is not thread-safe.- See Also:
PackageInfo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractDependencyResolver.MavenCoordinates
Encapsulates Maven coordinates groupId, artifactId, version, packaging (defaultzip
), classifier (optional)
-
Field Summary
Fields Modifier and Type Field Description static String
MAVEN_REPOSITORY_SCHEME
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDependencyResolver()
protected
AbstractDependencyResolver(@NotNull Collection<PackageInfo> packageInfoCache)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected @Nullable PackageInfo
resolvePackageInfo(@NotNull Dependency dependency)
Uses some heuristics to map the package dependency to Maven coordinates.@NotNull Collection<PackageInfo>
resolvePackageInfo(@NotNull Dependency[] dependencies, @NotNull Map<PackageId,URI> dependencyLocations)
Resolves multiple package dependencies taking into account a map from package id to URI (given via package propertiesdependencies-locations
).abstract @Nullable PackageInfo
resolvePackageInfo(@NotNull AbstractDependencyResolver.MavenCoordinates mavenCoordinates)
Resolves the main meta information of a package dependency given via Maven coordinates.
-
-
-
Field Detail
-
MAVEN_REPOSITORY_SCHEME
public static final String MAVEN_REPOSITORY_SCHEME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractDependencyResolver
protected AbstractDependencyResolver()
-
AbstractDependencyResolver
protected AbstractDependencyResolver(@NotNull @NotNull Collection<PackageInfo> packageInfoCache)
-
-
Method Detail
-
resolvePackageInfo
@NotNull public @NotNull Collection<PackageInfo> resolvePackageInfo(@NotNull @NotNull Dependency[] dependencies, @NotNull @NotNull Map<PackageId,URI> dependencyLocations) throws IOException
Description copied from interface:DependencyResolver
Resolves multiple package dependencies taking into account a map from package id to URI (given via package propertiesdependencies-locations
).- Specified by:
resolvePackageInfo
in interfaceDependencyResolver
- Parameters:
dependencies
- the dependencies to resolvedependencyLocations
- a map of package ids to URIs- Returns:
- the list of
PackageInfo
for all resolved dependencies (as this is only a best effort implementation the list being returned might be smaller than the array size ofdependencies
). - Throws:
IOException
- in case some error happened during resolving
-
resolvePackageInfo
@Nullable protected @Nullable PackageInfo resolvePackageInfo(@NotNull @NotNull Dependency dependency) throws IOException
Uses some heuristics to map the package dependency to Maven coordinates. It tries to resolve the package version ranges in the following order:- trying lower bound version
- trying higher bound version
- trying LATEST version
resolvePackageInfo(MavenCoordinates)
. It doesn't leverage any Maven API for version range resolution, therefore this method should be overwritten if there are better ways to resolve version ranges.- Parameters:
dependency
- the dependency from which to retrieve the package info- Returns:
- the resolved package info or
null
- Throws:
IOException
-
resolvePackageInfo
@Nullable public abstract @Nullable PackageInfo resolvePackageInfo(@NotNull @NotNull AbstractDependencyResolver.MavenCoordinates mavenCoordinates) throws IOException
Resolves the main meta information of a package dependency given via Maven coordinates.- Parameters:
mavenCoordinates
- the coordinates of the package dependency- Returns:
- the resolved package info or
null
- Throws:
IOException
-
-