Skip to content

Commit

Permalink
Enabled setting of metadata file version number.
Browse files Browse the repository at this point in the history
  • Loading branch information
csrster committed Oct 18, 2016
1 parent 72df8d7 commit 4ab432f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ public class HarvesterSettings {
*/
public static String METADATA_ARCHIVE_FILES_REPORT_HEADER = "settings.harvester.harvesting.metadata.archiveFilesReport.fileHeader";

/**
* The version number which goes in metadata file names like 12345-metadata-<version number>.warc.gz
*/
public static String METADATA_FILE_VERSION_NUMBER = "settings.harvester.harvesting.metadata.filename.versionnumber";

/**
* <b>settings.harvester.aliases.timeout</b> The amount of time in seconds before an alias times out, and needs to
* be re-evaluated. The default value is one year, i.e 31536000 seconds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,19 @@ public static String getMetadataArchiveFileName(String jobID, Long harvestID) th
if (compressionOn) {
possibleGzSuffix = ".gz";
}
int versionNumber = Settings.getInt(HarvesterSettings.METADATA_FILE_VERSION_NUMBER);
switch (metadataFormat) {
case MDF_ARC:
if(isPrefix) {
return collectionName + "-" + jobID + "-" + harvestID + "-metadata-" + 1 + ".arc" + possibleGzSuffix;
return collectionName + "-" + jobID + "-" + harvestID + "-metadata-" + versionNumber + ".arc" + possibleGzSuffix;
} else {
return jobID + "-metadata-" + 1 + ".arc" + possibleGzSuffix;
return jobID + "-metadata-" + versionNumber + ".arc" + possibleGzSuffix;
}
case MDF_WARC:
if(isPrefix) {
return collectionName + "-" + jobID + "-" + harvestID + "-metadata-" + 1 + ".warc" + possibleGzSuffix;
return collectionName + "-" + jobID + "-" + harvestID + "-metadata-" + versionNumber + ".warc" + possibleGzSuffix;
} else {
return jobID + "-metadata-" + 1 + ".warc" + possibleGzSuffix;
return jobID + "-metadata-" + versionNumber + ".warc" + possibleGzSuffix;
}
default:
throw new ArgumentNotValid("Configuration of '" + HarvesterSettings.METADATA_FORMAT + "' is invalid!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ National Library.
<metadataFormat>warc</metadataFormat>
<compression>false</compression>
<metadataFileNameFormat>default</metadataFileNameFormat>
<filename>
<versionnumber>1</versionnumber>
</filename>
</metadata>
</harvesting>
<indexserver>
Expand Down

0 comments on commit 4ab432f

Please sign in to comment.