use of com.enonic.xp.repo.impl.dump.FilePaths in project xp by enonic.
the class AbstractMetaDumpUpgrader method doUpgrade.
@Override
public void doUpgrade(final String dumpName) {
super.doUpgrade(dumpName);
final String timeMillis = Long.toString(System.currentTimeMillis());
FilePaths tmpFilePaths = new DefaultFilePaths() {
@Override
public PathRef branchMetaPath(final RepositoryId repositoryId, final Branch branch) {
return branchRootPath(repositoryId).resolve(branch.toString()).resolve("meta-" + timeMillis + ".tar.gz");
}
@Override
public PathRef versionMetaPath(final RepositoryId repositoryId) {
return branchRootPath(repositoryId).resolve("versions-" + timeMillis + ".tar.gz");
}
};
tmpDumpReader = FileDumpReader.create(null, basePath, dumpName, tmpFilePaths);
tmpDumpWriter = FileDumpWriter.create(basePath, dumpName, null, tmpFilePaths);
try {
dumpReader.getRepositories().forEach(this::upgradeRepository);
overwriteSourceFiles();
} catch (Exception e) {
try {
deleteBufferFiles();
} catch (Exception e2) {
LOG.error("Error while deleting buffer files", e);
}
throw new DumpUpgradeException("Error while upgrading dump [" + dumpName + "]", e);
} finally {
try {
tmpDumpReader.close();
tmpDumpWriter.close();
} catch (IOException e) {
LOG.error("Error while closing dump writer", e);
}
}
}
Aggregations