Class AbstractChecksumPolicy

    • Field Detail

      • logger

        protected final org.slf4j.Logger logger
    • Constructor Detail

      • AbstractChecksumPolicy

        protected AbstractChecksumPolicy​(TransferResource resource)
    • Method Detail

      • onChecksumMatch

        public boolean onChecksumMatch​(java.lang.String algorithm,
                                       int kind)
        Description copied from interface: ChecksumPolicy
        Signals a match between the locally computed checksum value and the checksum value declared by the remote repository.
        Specified by:
        onChecksumMatch in interface ChecksumPolicy
        Parameters:
        algorithm - The name of the checksum algorithm being used, must not be null.
        kind - A bit field providing further details about the checksum. See the KIND_* constants in this interface for possible bit flags.
        Returns:
        true to accept the download as valid and stop further validation, false to continue validation with the next checksum.
      • onChecksumMismatch

        public void onChecksumMismatch​(java.lang.String algorithm,
                                       int kind,
                                       ChecksumFailureException exception)
                                throws ChecksumFailureException
        Description copied from interface: ChecksumPolicy
        Signals a mismatch between the locally computed checksum value and the checksum value declared by the remote repository. A simple policy would just rethrow the provided exception. More sophisticated policies could update their internal state and defer a conclusion until all available checksums have been processed.
        Specified by:
        onChecksumMismatch in interface ChecksumPolicy
        Parameters:
        algorithm - The name of the checksum algorithm being used, must not be null.
        kind - A bit field providing further details about the checksum. See the KIND_* constants in this interface for possible bit flags.
        exception - The exception describing the checksum mismatch, must not be null.
        Throws:
        ChecksumFailureException - If the checksum validation is to be failed. If the method returns normally, validation continues with the next checksum.
      • onChecksumError

        public void onChecksumError​(java.lang.String algorithm,
                                    int kind,
                                    ChecksumFailureException exception)
                             throws ChecksumFailureException
        Description copied from interface: ChecksumPolicy
        Signals an error while computing the local checksum value or retrieving the checksum value from the remote repository.
        Specified by:
        onChecksumError in interface ChecksumPolicy
        Parameters:
        algorithm - The name of the checksum algorithm being used, must not be null.
        kind - A bit field providing further details about the checksum. See the KIND_* constants in this interface for possible bit flags.
        exception - The exception describing the checksum error, must not be null.
        Throws:
        ChecksumFailureException - If the checksum validation is to be failed. If the method returns normally, validation continues with the next checksum.
      • onTransferRetry

        public void onTransferRetry()
        Description copied from interface: ChecksumPolicy
        Signals that the download is being retried after a previously thrown ChecksumFailureException that is retry-worthy. Policies that maintain internal state will usually have to reset some of this state at this point to prepare for a new round of validation.
        Specified by:
        onTransferRetry in interface ChecksumPolicy