abstract class AbstractChecksumPolicy extends java.lang.Object implements ChecksumPolicy
ChecksumPolicy.ChecksumKind
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger |
protected TransferResource |
resource |
Modifier | Constructor and Description |
---|---|
protected |
AbstractChecksumPolicy(TransferResource resource) |
Modifier and Type | Method and Description |
---|---|
void |
onChecksumError(java.lang.String algorithm,
ChecksumPolicy.ChecksumKind kind,
ChecksumFailureException exception)
Signals an error while computing the local checksum value or retrieving the checksum value from the remote
repository.
|
boolean |
onChecksumMatch(java.lang.String algorithm,
ChecksumPolicy.ChecksumKind kind)
Signals a match between the locally computed checksum value and the checksum value declared by the remote
repository.
|
void |
onChecksumMismatch(java.lang.String algorithm,
ChecksumPolicy.ChecksumKind kind,
ChecksumFailureException exception)
Signals a mismatch between the locally computed checksum value and the checksum value declared by the remote
repository.
|
void |
onNoMoreChecksums()
Signals that all available checksums have been processed.
|
void |
onTransferRetry()
Signals that the download is being retried after a previously thrown
ChecksumFailureException that is
retry-worthy . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onTransferChecksumFailure
protected final org.slf4j.Logger logger
protected final TransferResource resource
protected AbstractChecksumPolicy(TransferResource resource)
public boolean onChecksumMatch(java.lang.String algorithm, ChecksumPolicy.ChecksumKind kind)
ChecksumPolicy
onChecksumMatch
in interface ChecksumPolicy
algorithm
- The name of the checksum algorithm being used, must not be null
.kind
- A field providing further details about the checksum.true
to accept the download as valid and stop further validation, false
to continue
validation with the next checksum.public void onChecksumMismatch(java.lang.String algorithm, ChecksumPolicy.ChecksumKind kind, ChecksumFailureException exception) throws ChecksumFailureException
ChecksumPolicy
onChecksumMismatch
in interface ChecksumPolicy
algorithm
- The name of the checksum algorithm being used, must not be null
.kind
- A field providing further details about the checksum.exception
- The exception describing the checksum mismatch, must not be null
.ChecksumFailureException
- If the checksum validation is to be failed. If the method returns normally,
validation continues with the next checksum.public void onChecksumError(java.lang.String algorithm, ChecksumPolicy.ChecksumKind kind, ChecksumFailureException exception) throws ChecksumFailureException
ChecksumPolicy
onChecksumError
in interface ChecksumPolicy
algorithm
- The name of the checksum algorithm being used, must not be null
.kind
- A field providing further details about the checksum.exception
- The exception describing the checksum error, must not be null
.ChecksumFailureException
- If the checksum validation is to be failed. If the method returns normally,
validation continues with the next checksum.public void onNoMoreChecksums() throws ChecksumFailureException
ChecksumPolicy
onNoMoreChecksums
in interface ChecksumPolicy
ChecksumFailureException
- If the checksum validation is to be failed. If the method returns normally, the
download is assumed to be valid.public void onTransferRetry()
ChecksumPolicy
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.onTransferRetry
in interface ChecksumPolicy