Class SparseDirectoryTrustedChecksumsSource
java.lang.Object
org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource
- All Implemented Interfaces:
TrustedChecksumsSource
@Singleton
@Named("sparseDirectory")
public final class SparseDirectoryTrustedChecksumsSource
extends Object
Sparse file
FileTrustedChecksumsSourceSupport
implementation that use specified directory as base
directory, where it expects artifacts checksums on standard Maven2 "local" layout. This implementation uses Artifact
coordinates solely to form path from basedir, pretty much as Maven local repository does.
The source by default is "origin aware", it will factor in origin repository ID as well into base directory name (for example ".checksums/central/...").
The checksums files are directly loaded from disk, so in-flight file changes during lifecycle of session are picked up. This implementation can be simultaneously used to lookup and also write checksums. The written checksums will become visible across all sessions right after the moment they were written.
The name of this implementation is "sparseDirectory".
- Since:
- 1.9.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.aether.spi.checksums.TrustedChecksumsSource
TrustedChecksumsSource.Writer
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSparseDirectoryTrustedChecksumsSource
(FileProcessor fileProcessor, LocalPathComposer localPathComposer) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
configPropKey
(String name) To be used by underlying implementations to form configuration property keys properly scoped.doGetTrustedArtifactChecksums
(RepositorySystemSession session, Artifact artifact, ArtifactRepository artifactRepository, List<ChecksumAlgorithmFactory> checksumAlgorithmFactories) Implementors MUST NOT returnnull
at this point, as this source is enabled.protected org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource.SparseDirectoryWriter
Implementors may override this method and returnTrustedChecksumsSource.Writer
instance.protected Path
getBasedir
(RepositorySystemSession session, boolean mayCreate) Uses utilityDirectoryUtils.resolveDirectory(RepositorySystemSession, String, String, boolean)
to calculate (and maybe create) basedir for this implementation, never returnsnull
.getTrustedArtifactChecksums
(RepositorySystemSession session, Artifact artifact, ArtifactRepository artifactRepository, List<ChecksumAlgorithmFactory> checksumAlgorithmFactories) This implementation will call into underlying code only if enabled, and will enforce non-null
return value.This implementation will call into underlying code only if enabled.protected boolean
isEnabled
(RepositorySystemSession session) Returnstrue
if session configuration marks this instance as enabled.protected boolean
isOriginAware
(RepositorySystemSession session) Returnstrue
if session configuration marks this instance as origin aware.
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
SparseDirectoryTrustedChecksumsSource
@Inject public SparseDirectoryTrustedChecksumsSource(FileProcessor fileProcessor, LocalPathComposer localPathComposer)
-
-
Method Details
-
doGetTrustedArtifactChecksums
protected Map<String,String> doGetTrustedArtifactChecksums(RepositorySystemSession session, Artifact artifact, ArtifactRepository artifactRepository, List<ChecksumAlgorithmFactory> checksumAlgorithmFactories) Implementors MUST NOT returnnull
at this point, as this source is enabled. -
doGetTrustedArtifactChecksumsWriter
protected org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource.SparseDirectoryWriter doGetTrustedArtifactChecksumsWriter(RepositorySystemSession session) Implementors may override this method and returnTrustedChecksumsSource.Writer
instance. -
getTrustedArtifactChecksums
public Map<String,String> getTrustedArtifactChecksums(RepositorySystemSession session, Artifact artifact, ArtifactRepository artifactRepository, List<ChecksumAlgorithmFactory> checksumAlgorithmFactories) This implementation will call into underlying code only if enabled, and will enforce non-null
return value. In worst case, empty map should be returned, meaning "no trusted checksums available".- Specified by:
getTrustedArtifactChecksums
in interfaceTrustedChecksumsSource
- Parameters:
session
- The repository system session, nevernull
.artifact
- The artifact we want checksums for, nevernull
.artifactRepository
- The origin repository: local, workspace, remote repository, nevernull
.checksumAlgorithmFactories
- The checksum algorithms that are expected, nevernull
.- Returns:
- Map of expected checksums, or
null
if not enabled.
-
getTrustedArtifactChecksumsWriter
public TrustedChecksumsSource.Writer getTrustedArtifactChecksumsWriter(RepositorySystemSession session) This implementation will call into underlying code only if enabled. Underlying implementation may still choose to returnnull
.- Specified by:
getTrustedArtifactChecksumsWriter
in interfaceTrustedChecksumsSource
-
configPropKey
To be used by underlying implementations to form configuration property keys properly scoped. -
isEnabled
Returnstrue
if session configuration marks this instance as enabled.Default value is
false
. -
isOriginAware
Returnstrue
if session configuration marks this instance as origin aware.Default value is
true
. -
getBasedir
Uses utilityDirectoryUtils.resolveDirectory(RepositorySystemSession, String, String, boolean)
to calculate (and maybe create) basedir for this implementation, never returnsnull
. The returnedPath
may not exist, if invoked withmayCreate
beingfalse
.Default value is
${LOCAL_REPOSITORY}/.checksums
.- Returns:
- The
Path
of basedir, nevernull
.
-