Class RepositoryLayout.Checksum

  • Enclosing interface:
    RepositoryLayout

    public static final class RepositoryLayout.Checksum
    extends java.lang.Object
    A descriptor for a checksum file. This descriptor simply associates the location of a checksum file with the underlying algorithm used to calculate/verify it. Checksum algorithms are denoted by names as used with MessageDigest.getInstance(String), e.g. "SHA-1" or "MD5".
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String algorithm  
      private java.net.URI location  
    • Constructor Summary

      Constructors 
      Constructor Description
      Checksum​(java.lang.String algorithm, java.net.URI location)
      Creates a new checksum file descriptor with the specified algorithm and location.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static RepositoryLayout.Checksum forLocation​(java.net.URI location, java.lang.String algorithm)
      Creates a checksum file descriptor for the specified artifact/metadata location and algorithm.
      java.lang.String getAlgorithm()
      Gets the name of the algorithm that is used to calculate the checksum.
      java.net.URI getLocation()
      Gets the location of the checksum file with a remote repository.
      java.lang.String toString()  
      private static void verify​(java.lang.String algorithm, java.net.URI location)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • algorithm

        private final java.lang.String algorithm
      • location

        private final java.net.URI location
    • Constructor Detail

      • Checksum

        public Checksum​(java.lang.String algorithm,
                        java.net.URI location)
        Creates a new checksum file descriptor with the specified algorithm and location. The method forLocation(URI, String) is usually more convenient though.
        Parameters:
        algorithm - The algorithm used to calculate the checksum, must not be null.
        location - The relative URI to the checksum file within a repository, must not be null.
    • Method Detail

      • forLocation

        public static RepositoryLayout.Checksum forLocation​(java.net.URI location,
                                                            java.lang.String algorithm)
        Creates a checksum file descriptor for the specified artifact/metadata location and algorithm. The location of the checksum file itself is derived from the supplied resource URI by appending the file extension corresponding to the algorithm. The file extension in turn is derived from the algorithm name by stripping out any hyphen ('-') characters and lower-casing the name, e.g. "SHA-1" is mapped to ".sha1".
        Parameters:
        location - The relative URI to the artifact/metadata whose checksum file is being obtained, must not be null and must not have a query or fragment part.
        algorithm - The algorithm used to calculate the checksum, must not be null.
        Returns:
        The checksum file descriptor, never null.
      • verify

        private static void verify​(java.lang.String algorithm,
                                   java.net.URI location)
      • getAlgorithm

        public java.lang.String getAlgorithm()
        Gets the name of the algorithm that is used to calculate the checksum.
        Returns:
        The algorithm name, never null.
        See Also:
        MessageDigest.getInstance(String)
      • getLocation

        public java.net.URI getLocation()
        Gets the location of the checksum file with a remote repository. The URI is relative to the root directory of the repository.
        Returns:
        The relative URI to the checksum file, never null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object