All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.chains_project.maven_lockfile.checksum.ChecksumModes Maven / Gradle / Ivy

Go to download

This plugin is a state-of-the-art solution that can be used to validate the integrity of a maven repository. It does this by generating a lock file that contains the checksums of all the artifacts in the repository. The lock file can then be used to validate the integrity of the repository. This guards the supply chain against malicious actors that might tamper with the artifacts in the repository.

The newest version!
package io.github.chains_project.maven_lockfile.checksum;

/**
 * The checksum modes that are supported by the plugin.
 * A checksum mode is a way to calculate the checksum of a dependency.
 */
public enum ChecksumModes {
    /**
     * Downloads the checksum from the maven repository.
     */
    MAVEN_CENTRAL("maven_central"),
    /**
     * Calculates the checksum from the downloaded artifact.
     */
    MAVEN_LOCAL("maven_local");

    /**
     * The name of the checksum mode.
     */
    private final String name;

    ChecksumModes(String name) {
        this.name = name;
    }

    /**
     * Gets a checksum mode from its name. Throws an exception if no checksum mode with the given name exists.
     * @param name  The name of the checksum mode.
     * @return  The checksum mode.
     */
    public static ChecksumModes fromName(String name) {
        for (ChecksumModes mode : ChecksumModes.values()) {
            if (mode.name.equals(name)) {
                return mode;
            }
        }
        throw new IllegalArgumentException("No checksum mode with name " + name + " found.");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy