|
22 | 22 | import gov.loc.repository.bagit.domain.Manifest; |
23 | 23 | import gov.loc.repository.bagit.domain.Version; |
24 | 24 | import gov.loc.repository.bagit.hash.Hasher; |
25 | | -import gov.loc.repository.bagit.verify.BagVerifier; |
26 | 25 | import javafx.util.Pair; |
27 | 26 |
|
28 | 27 | /** |
29 | 28 | * responsible for writing out a bag. |
30 | 29 | */ |
31 | 30 | public class BagWriter { |
32 | | - private static final Logger logger = LoggerFactory.getLogger(BagVerifier.class); |
| 31 | + private static final Logger logger = LoggerFactory.getLogger(BagWriter.class); |
33 | 32 |
|
34 | 33 | private BagWriter(){} |
35 | 34 |
|
@@ -71,7 +70,7 @@ protected static Path writeVersionDependentPayloadFiles(Bag bag, Path outputDir) |
71 | 70 | else{ |
72 | 71 | Path dataDir = outputDir.resolve("data"); |
73 | 72 | Files.createDirectories(dataDir); |
74 | | - writePayloadFiles(bag.getPayLoadManifests(), dataDir, bag.getRootDir()); |
| 73 | + writePayloadFiles(bag.getPayLoadManifests(), dataDir, bag.getRootDir().resolve("data")); |
75 | 74 | } |
76 | 75 |
|
77 | 76 | return bagitDir; |
@@ -102,14 +101,14 @@ public static void writeBagitFile(Version version, String encoding, Path outputD |
102 | 101 | * Write the payload <b>file(s)</b> to the output directory |
103 | 102 | * @param payloadManifests the set of objects representing the payload manifests |
104 | 103 | * @param outputDir the data directory of the bag |
105 | | - * @param bagRootDir the root directory of the bag |
| 104 | + * @param bagDataDir the data directory of the bag |
106 | 105 | * @throws IOException if there was a problem writing a file |
107 | 106 | */ |
108 | | - public static void writePayloadFiles(Set<Manifest> payloadManifests, Path outputDir, Path bagRootDir) throws IOException{ |
| 107 | + public static void writePayloadFiles(Set<Manifest> payloadManifests, Path outputDir, Path bagDataDir) throws IOException{ |
109 | 108 | logger.info("Writing payload files"); |
110 | 109 | for(Manifest payloadManifest : payloadManifests){ |
111 | 110 | for(Path payloadFile : payloadManifest.getFileToChecksumMap().keySet()){ |
112 | | - Path relativePayloadPath = bagRootDir.relativize(payloadFile); |
| 111 | + Path relativePayloadPath = bagDataDir.relativize(payloadFile); |
113 | 112 |
|
114 | 113 | Path writeToPath = outputDir.resolve(relativePayloadPath); |
115 | 114 | logger.debug("Writing payload file [{}] to [{}]", payloadFile, writeToPath); |
|
0 commit comments