|
9 | 9 | import java.nio.file.Path; |
10 | 10 | import java.text.Normalizer; |
11 | 11 | import java.util.Collection; |
| 12 | +import java.util.Collections; |
12 | 13 | import java.util.HashSet; |
13 | 14 | import java.util.List; |
14 | 15 | import java.util.Set; |
@@ -48,6 +49,26 @@ public BagLinter(final BagitAlgorithmNameToSupportedAlgorithmMapping nameMapping |
48 | 49 | reader = new BagReader(nameMapping); |
49 | 50 | } |
50 | 51 |
|
| 52 | + /** |
| 53 | + * The BagIt specification is very flexible in what it allows which leads to situations |
| 54 | + * where something may be technically allowed, but should be discouraged. |
| 55 | + * This method checks a bag for potential problems, or other items that are allowed but discouraged. |
| 56 | + * This <strong>does not</strong> validate a bag. See {@link BagVerifier} instead. |
| 57 | + * |
| 58 | + * @param rootDir the root directory of the bag |
| 59 | + * |
| 60 | + * @return a set of {@link BagitWarning} detailing all items that should be fixed. |
| 61 | + * |
| 62 | + * @throws InvalidBagMetadataException if the bag metadata does not conform to the bagit specification |
| 63 | + * @throws UnparsableVersionException if there is an error reading the bagit version |
| 64 | + * @throws IOException if there was an error reading a file |
| 65 | + * @throws UnsupportedAlgorithmException if the {@link BagReader} does not support reading the manifest |
| 66 | + * @throws MaliciousPathException If the manifest was crafted to try and access a file outside the bag directory |
| 67 | + */ |
| 68 | + public Set<BagitWarning> lintBag(final Path rootDir) throws IOException, UnparsableVersionException, InvalidBagMetadataException, MaliciousPathException, UnsupportedAlgorithmException{ |
| 69 | + return this.lintBag(rootDir, Collections.emptyList()); |
| 70 | + } |
| 71 | + |
51 | 72 | /** |
52 | 73 | * The BagIt specification is very flexible in what it allows which leads to situations |
53 | 74 | * where something may be technically allowed, but should be discouraged. |
|
0 commit comments