-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathExtendedBagVerifier.java
More file actions
32 lines (26 loc) · 1.51 KB
/
ExtendedBagVerifier.java
File metadata and controls
32 lines (26 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package gov.loc.repository.bagit;
import gov.loc.repository.bagit.domain.Bag;
import gov.loc.repository.bagit.domain.Manifest;
import gov.loc.repository.bagit.exceptions.CorruptChecksumException;
import gov.loc.repository.bagit.exceptions.FileNotInPayloadDirectoryException;
import gov.loc.repository.bagit.exceptions.InvalidBagitFileFormatException;
import gov.loc.repository.bagit.exceptions.MaliciousPathException;
import gov.loc.repository.bagit.exceptions.UnsupportedAlgorithmException;
import gov.loc.repository.bagit.exceptions.VerificationException;
import gov.loc.repository.bagit.verify.BagVerifier;
import java.io.IOException;
// an example of extending the BagVerifier in order to add your own checks that suffice the specific
// verification rules for a bag, as defined by your project
// NOTE: this cannot override the BagVerifier.isComplete or BagVerifier.isValid, as they're defined
// by "The BagIt File Packaging Format" (https://tools.ietf.org/html/draft-kunze-bagit).
public class ExtendedBagVerifier extends BagVerifier {
public void isValidAccordingToMyValidation(final Bag bag, final boolean ignoreHiddenFiles)
throws InterruptedException, CorruptChecksumException, VerificationException,
MaliciousPathException, FileNotInPayloadDirectoryException, UnsupportedAlgorithmException,
InvalidBagitFileFormatException, IOException {
for (Manifest manifest : bag.getPayLoadManifests()) {
this.checkHashes(manifest);
}
getManifestVerifier().verifyPayload(bag, ignoreHiddenFiles);
}
}