use of org.haiku.haikudepotserver.support.ArchiveInfo in project haikudepotserver by haiku.
the class PkgDumpExportJobRunner method createArchiveInfo.
private ArchiveInfo createArchiveInfo(ObjectContext context, PkgDumpExportJobSpecification specification) {
RepositorySource repositorySource = RepositorySource.tryGetByCode(context, specification.getRepositorySourceCode()).orElseThrow(() -> new IllegalStateException("unable to find the repository source [" + specification.getRepositorySourceCode() + "]"));
Date modifyTimestamp = pkgService.getLastModifyTimestampSecondAccuracy(context, repositorySource);
return new ArchiveInfo(DateTimeHelper.secondAccuracyDatePlusOneSecond(modifyTimestamp), runtimeInformationService.getProjectVersion());
}
use of org.haiku.haikudepotserver.support.ArchiveInfo in project haikudepotserver by haiku.
the class AbstractPkgResourceExportArchiveJobRunner method appendArchiveInfo.
/**
* <p>Adds a little informational file into the tar-ball.</p>
*/
private void appendArchiveInfo(State state) throws IOException {
ArchiveInfo archiveInfo = new ArchiveInfo(DateTimeHelper.secondAccuracyDatePlusOneSecond(state.latestModifiedTimestamp), runtimeInformationService.getProjectVersion());
byte[] payload = objectMapper.writeValueAsBytes(archiveInfo);
TarArchiveEntry tarEntry = new TarArchiveEntry(getPathComponentTop() + "/info.json");
tarEntry.setSize(payload.length);
tarEntry.setModTime(roundTimeToSecondPlusOne(state.latestModifiedTimestamp));
state.tarArchiveOutputStream.putArchiveEntry(tarEntry);
state.tarArchiveOutputStream.write(payload);
state.tarArchiveOutputStream.closeArchiveEntry();
}
Aggregations