}
}
}
private void backup(File sourceDir) throws Exception {
RepositoryConfig source;
if (command.hasOption("conf")) {
source = RepositoryConfig.create(
new File(command.getOptionValue("conf")), sourceDir);
} else {
source = RepositoryConfig.create(sourceDir);
}
File targetDir;
if (command.hasOption("backup-repo")) {
targetDir = new File(command.getOptionValue("backup-repo"));
} else {
int i = 1;
do {
targetDir = new File("jackrabbit-backup" + i++);
} while (targetDir.exists());
}
RepositoryConfig target;
if (command.hasOption("backup-conf")) {
target = RepositoryConfig.install(
new File(command.getOptionValue("backup-conf")), targetDir);
} else {
target = RepositoryConfig.install(targetDir);