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 Object implements org.eclipse.aether.spi.checksums.TrustedChecksumsSource
Support class for implementing TrustedChecksumsSource backed 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 enabled
  • aether.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
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.eclipse.aether.spi.checksums.TrustedChecksumsSource

    org.eclipse.aether.spi.checksums.TrustedChecksumsSource.Writer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Experimental: Configuration for "repository key" function.
    protected static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    FileTrustedChecksumsSourceSupport(org.eclipse.aether.spi.remoterepo.RepositoryKeyFunctionFactory repositoryKeyFunctionFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract Map<String,String>
    doGetTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, List<org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory> checksumAlgorithmFactories)
    Implementors MUST NOT return null at this point, as this source is enabled.
    protected org.eclipse.aether.spi.checksums.TrustedChecksumsSource.Writer
    doGetTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)
    Implementors may override this method and return TrustedChecksumsSource.Writer instance.
    protected Path
    getBasedir(org.eclipse.aether.RepositorySystemSession session, String defaultValue, String configPropKey, boolean mayCreate)
    Uses utility DirectoryUtils.resolveDirectory(RepositorySystemSession, String, String, boolean) to calculate (and maybe create) basedir for this implementation, never returns null.
    getTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, List<org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory> checksumAlgorithmFactories)
    This implementation will call into underlying code only if enabled, and will enforce non-null return value.
    org.eclipse.aether.spi.checksums.TrustedChecksumsSource.Writer
    getTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)
    This implementation will call into underlying code only if enabled.
    protected abstract boolean
    isEnabled(org.eclipse.aether.RepositorySystemSession session)
    Returns true if session configuration marks this instance as enabled.
    protected String
    repositoryKey(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.repository.ArtifactRepository artifactRepository)
    Returns repository key to be used on file system layout.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • FileTrustedChecksumsSourceSupport

      protected FileTrustedChecksumsSourceSupport(org.eclipse.aether.spi.remoterepo.RepositoryKeyFunctionFactory repositoryKeyFunctionFactory)
  • Method Details

    • getTrustedArtifactChecksums

      public Map<String,String> getTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, List<org.eclipse.aether.spi.connector.checksum.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 interface org.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 return null.
      Specified by:
      getTrustedArtifactChecksumsWriter in interface org.eclipse.aether.spi.checksums.TrustedChecksumsSource
    • doGetTrustedArtifactChecksums

      protected abstract Map<String,String> doGetTrustedArtifactChecksums(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.repository.ArtifactRepository artifactRepository, List<org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory> checksumAlgorithmFactories)
      Implementors MUST NOT return null at this point, as this source is enabled.
    • doGetTrustedArtifactChecksumsWriter

      protected org.eclipse.aether.spi.checksums.TrustedChecksumsSource.Writer doGetTrustedArtifactChecksumsWriter(org.eclipse.aether.RepositorySystemSession session)
      Implementors may override this method and return TrustedChecksumsSource.Writer instance.
    • isEnabled

      protected abstract boolean isEnabled(org.eclipse.aether.RepositorySystemSession session)
      Returns true if session configuration marks this instance as enabled.

      Default value is false.

    • getBasedir

      protected Path getBasedir(org.eclipse.aether.RepositorySystemSession session, String defaultValue, String configPropKey, boolean mayCreate)
      Uses utility DirectoryUtils.resolveDirectory(RepositorySystemSession, String, String, boolean) to calculate (and maybe create) basedir for this implementation, never returns null. The returned Path may not exist, if invoked with mayCreate being false.

      Default value is ${LOCAL_REPOSITORY}/.checksums.

      Returns:
      The Path of basedir, never null.
    • repositoryKey

      protected String repositoryKey(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.repository.ArtifactRepository artifactRepository)
      Returns repository key to be used on file system layout.
      Since:
      2.0.14