Class FileTrustedChecksumsSourceSupport
- java.lang.Object
-
- org.eclipse.aether.internal.impl.checksum.FileTrustedChecksumsSourceSupport
-
- All Implemented Interfaces:
org.eclipse.aether.spi.checksums.TrustedChecksumsSource
- Direct Known Subclasses:
SparseDirectoryTrustedChecksumsSource,SummaryFileTrustedChecksumsSource
public abstract class FileTrustedChecksumsSourceSupport extends java.lang.Object implements org.eclipse.aether.spi.checksums.TrustedChecksumsSource
Support class for implementingTrustedChecksumsSourcebacked by local filesystem. It implements basic support like basedir calculation, "enabled" flag and "originAware" flag.The configuration keys supported:
aether.trustedChecksumsSource.${name}(boolean) must be explicitly set to "true" to become enabledaether.trustedChecksumsSource.${name}.basedir(string, path) directory from where implementation can use files. May be relative path (then is resolved against local repository basedir) or absolute. If unset, default value is ".checksums" and is resolved against local repository basedir.aether.trustedChecksumsSource.${name}.originAware(boolean) whether to make implementation "originAware", to factor in origin repository ID as well or not.
This implementation ensures that implementations have "name" property, used in configuration properties above.
- Since:
- 1.9.0
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringCONFIG_PROPS_PREFIXprotected org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileTrustedChecksumsSourceSupport(org.eclipse.aether.spi.remoterepo.RepositoryKeyFunctionFactory repositoryKeyFunctionFactory)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract 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.spi.checksums.TrustedChecksumsSource.WriterdoGetTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)Implementors may override this method and returnTrustedChecksumsSource.Writerinstance.protected abstract java.util.Map<java.lang.String,java.lang.String>doGetTrustedMetadataChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.metadata.Metadata metadata, 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 java.nio.file.PathgetBasedir(org.eclipse.aether.RepositorySystemSession session, java.lang.String defaultValue, java.lang.String configPropKey, 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.java.util.Map<java.lang.String,java.lang.String>getTrustedMetadataChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.metadata.Metadata metadata, 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.protected abstract booleanisEnabled(org.eclipse.aether.RepositorySystemSession session)Returnstrueif session configuration marks this instance as enabled.protected java.util.List<java.lang.String>repositoryKey(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.repository.ArtifactRepository artifactRepository)Returns repository keys to be used on file system layout.
-
-
-
Field Detail
-
CONFIG_PROPS_PREFIX
protected static final java.lang.String CONFIG_PROPS_PREFIX
- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Detail
-
FileTrustedChecksumsSourceSupport
protected FileTrustedChecksumsSourceSupport(org.eclipse.aether.spi.remoterepo.RepositoryKeyFunctionFactory repositoryKeyFunctionFactory)
-
-
Method Detail
-
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
-
getTrustedMetadataChecksums
public java.util.Map<java.lang.String,java.lang.String> getTrustedMetadataChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.metadata.Metadata metadata, 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:
getTrustedMetadataChecksumsin interfaceorg.eclipse.aether.spi.checksums.TrustedChecksumsSource- Since:
- 2.0.23
-
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
-
doGetTrustedArtifactChecksums
protected abstract 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.
-
doGetTrustedMetadataChecksums
protected abstract java.util.Map<java.lang.String,java.lang.String> doGetTrustedMetadataChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.metadata.Metadata metadata, 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. Metadata checksums are looked up using the same file conventions as artifact checksums, with the metadata path composed from the origin repository key (for exampleg/a/v/maven-metadata-central.xml).- Since:
- 2.0.23
-
doGetTrustedArtifactChecksumsWriter
protected org.eclipse.aether.spi.checksums.TrustedChecksumsSource.Writer doGetTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)
Implementors may override this method and returnTrustedChecksumsSource.Writerinstance.
-
isEnabled
protected abstract boolean isEnabled(org.eclipse.aether.RepositorySystemSession session)
Returnstrueif session configuration marks this instance as enabled.Default value is
false.
-
getBasedir
protected java.nio.file.Path getBasedir(org.eclipse.aether.RepositorySystemSession session, java.lang.String defaultValue, java.lang.String configPropKey, 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.
-
repositoryKey
protected java.util.List<java.lang.String> repositoryKey(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.repository.ArtifactRepository artifactRepository)
Returns repository keys to be used on file system layout. Always returns a list with at least one element. Elements are sorted from "most specific" to "least specific" keys.- Since:
- 2.0.14
-
-