001package co.codewizards.cloudstore.client; 002 003import co.codewizards.cloudstore.local.RepairDatabase; 004 005/** 006 * {@link SubCommand} implementation for repairing a database. 007 * 008 * @author Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de 009 */ 010public class RepairDatabaseSubCommand extends SubCommandWithExistingLocalRepo 011{ 012 private RepairDatabase repairDatabase; 013 private RepoInfoSubCommand repoInfoSubCommand; 014 015 public RepairDatabaseSubCommand() { } 016 017 @Override 018 public String getSubCommandDescription() { 019 return "Check and repair the Derby database."; 020 } 021 022 @Override 023 public void prepare() throws Exception { 024 super.prepare(); 025 repairDatabase = new RepairDatabase(localRoot); 026 027 repoInfoSubCommand = new RepoInfoSubCommand(localRoot); 028 repoInfoSubCommand.prepare(); 029 } 030 031 @Override 032 public void run() throws Exception { 033 repairDatabase.run(); 034 repoInfoSubCommand.run(); 035 } 036 037 @Override 038 public void cleanUp() throws Exception { 039 repoInfoSubCommand.cleanUp(); 040 super.cleanUp(); 041 } 042}