Class SparseDirectoryTrustedChecksumsSource
- java.lang.Object
-
- org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource
-
- All Implemented Interfaces:
org.eclipse.aether.spi.checksums.TrustedChecksumsSource
@Singleton @Named("sparseDirectory") public final class SparseDirectoryTrustedChecksumsSource extends java.lang.ObjectSparse fileFileTrustedChecksumsSourceSupportimplementation 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:
LocalPathComposer
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAME
-
Constructor Summary
Constructors Constructor Description SparseDirectoryTrustedChecksumsSource(org.eclipse.aether.spi.io.FileProcessor fileProcessor, LocalPathComposer localPathComposer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringconfigPropKey(java.lang.String name)To be used by underlying implementations to form configuration property keys properly scoped.protected java.util.Map<java.lang.String,java.lang.String>doGetTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, java.util.List<org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory> checksumAlgorithmFactories)Implementors MUST NOT returnnullat this point, as this source is enabled.protected org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource.SparseDirectoryWriterdoGetTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)Implementors may override this method and returnTrustedChecksumsSource.Writerinstance.protected java.nio.file.PathgetBasedir(org.eclipse.aether.RepositorySystemSession session, boolean mayCreate)Uses utilityDirectoryUtils.resolveDirectory(RepositorySystemSession, String, String, boolean)to calculate (and maybe create) basedir for this implementation, never returnsnull.java.util.Map<java.lang.String,java.lang.String>getTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, java.util.List<org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory> checksumAlgorithmFactories)This implementation will call into underlying code only if enabled, and will enforce non-nullreturn value.org.eclipse.aether.spi.checksums.TrustedChecksumsSource.WritergetTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)This implementation will call into underlying code only if enabled.protected booleanisEnabled(org.eclipse.aether.RepositorySystemSession session)Returnstrueif session configuration marks this instance as enabled.protected booleanisOriginAware(org.eclipse.aether.RepositorySystemSession session)Returnstrueif session configuration marks this instance as origin aware.
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SparseDirectoryTrustedChecksumsSource
@Inject public SparseDirectoryTrustedChecksumsSource(org.eclipse.aether.spi.io.FileProcessor fileProcessor, LocalPathComposer localPathComposer)
-
-
Method Detail
-
doGetTrustedArtifactChecksums
protected java.util.Map<java.lang.String,java.lang.String> doGetTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, java.util.List<org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory> checksumAlgorithmFactories)
Implementors MUST NOT returnnullat this point, as this source is enabled.
-
doGetTrustedArtifactChecksumsWriter
protected org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource.SparseDirectoryWriter doGetTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)
Implementors may override this method and returnTrustedChecksumsSource.Writerinstance.
-
getTrustedArtifactChecksums
public java.util.Map<java.lang.String,java.lang.String> getTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, java.util.List<org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory> checksumAlgorithmFactories)This implementation will call into underlying code only if enabled, and will enforce non-nullreturn value. In worst case, empty map should be returned, meaning "no trusted checksums available".- Specified by:
getTrustedArtifactChecksumsin interfaceorg.eclipse.aether.spi.checksums.TrustedChecksumsSource
-
getTrustedArtifactChecksumsWriter
public org.eclipse.aether.spi.checksums.TrustedChecksumsSource.Writer getTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)
This implementation will call into underlying code only if enabled. Underlying implementation may still choose to returnnull.- Specified by:
getTrustedArtifactChecksumsWriterin interfaceorg.eclipse.aether.spi.checksums.TrustedChecksumsSource
-
configPropKey
protected java.lang.String configPropKey(java.lang.String name)
To be used by underlying implementations to form configuration property keys properly scoped.
-
isEnabled
protected boolean isEnabled(org.eclipse.aether.RepositorySystemSession session)
Returnstrueif session configuration marks this instance as enabled.Default value is
false.
-
isOriginAware
protected boolean isOriginAware(org.eclipse.aether.RepositorySystemSession session)
Returnstrueif session configuration marks this instance as origin aware.Default value is
true.
-
getBasedir
protected java.nio.file.Path getBasedir(org.eclipse.aether.RepositorySystemSession session, boolean mayCreate)Uses utilityDirectoryUtils.resolveDirectory(RepositorySystemSession, String, String, boolean)to calculate (and maybe create) basedir for this implementation, never returnsnull. The returnedPathmay not exist, if invoked withmayCreatebeingfalse.Default value is
${LOCAL_REPOSITORY}/.checksums.- Returns:
- The
Pathof basedir, nevernull.
-
-