/** * Options are case sensitive. Supported options are: * <table> * <tr><td>[-help] or [-?]</td> * <td>Print the list of options</td></tr> * <tr><td>[-file <filename>]</td> * <td>The source file name (default: backup.zip)</td></tr> * <tr><td>[-dir <dir>]</td> * <td>The target directory (default: .)</td></tr> * <tr><td>[-db <database>]</td> * <td>The target database name (as stored if not set)</td></tr> * <tr><td>[-quiet]</td> * <td>Do not print progress information</td></tr> * </table> * @h2.resource * * @param args the command line arguments */ public static void main(String... args) throws SQLException { new Restore().runTool(args); }
int originalDbLen = 0; if (db != null) { originalDbName = getOriginalDbName(zipFileName, db); if (originalDbName == null) { throw new IOException("No database named " + db + " found");
@Override public void runTool(String... args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { // ignore } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } execute(zipFileName, dir, db); }
tool = new Backup(); } else if ("Restore".equals(toolName)) { tool = new Restore(); } else if ("Recover".equals(toolName)) { tool = new Recover();
/** * Restores database files. * * @param zipFileName the name of the backup file * @param directory the directory name * @param db the database name (null for all databases) * @param quiet don't print progress information * @throws SQLException */ public static void execute(String zipFileName, String directory, String db, boolean quiet) throws SQLException { new Restore().process(zipFileName, directory, db, quiet); }
/** * The command line interface for this tool. * The options must be split into strings like this: "-db", "test",... * Options are case sensitive. The following options are supported: * <ul> * <li>-help or -? (print the list of options) * </li><li>-file filename (the default is backup.zip) * </li><li>-dir database directory (the default is the current directory) * </li><li>-db database name (as stored in the backup if no name is specified) * </li><li>-quiet does not print progress information * </li></ul> * * @param args the command line arguments * @throws SQLException */ public static void main(String[] args) throws SQLException { new Restore().run(args); }
public void run(String[] args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { out.println("Unsupported option: " + arg); showUsage(); return; } } process(zipFileName, dir, db, quiet); }
String name = getDatabaseNameFromFileName(entryName); if (name != null) { if (db.equals(name)) {
tool = new Backup(); } else if ("Restore".equals(toolName)) { tool = new Restore(); } else if ("Recover".equals(toolName)) { tool = new Recover();
String name = getDatabaseNameFromFileName(entryName); if (name != null) { if (db.equals(name)) {
@Override public void runTool(String... args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { // ignore } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } execute(zipFileName, dir, db); }
/** * Options are case sensitive. Supported options are: * <table> * <tr><td>[-help] or [-?]</td> * <td>Print the list of options</td></tr> * <tr><td>[-file <filename>]</td> * <td>The source file name (default: backup.zip)</td></tr> * <tr><td>[-dir <dir>]</td> * <td>The target directory (default: .)</td></tr> * <tr><td>[-db <database>]</td> * <td>The target database name (as stored if not set)</td></tr> * <tr><td>[-quiet]</td> * <td>Do not print progress information</td></tr> * </table> * @h2.resource * * @param args the command line arguments */ public static void main(String... args) throws SQLException { new Restore().runTool(args); }
tool = new Backup(); } else if ("Restore".equals(toolName)) { tool = new Restore(); } else if ("Recover".equals(toolName)) { tool = new Recover();
int originalDbLen = 0; if (db != null) { originalDbName = getOriginalDbName(zipFileName, db); if (originalDbName == null) { throw new IOException("No database named " + db + " found");
String name = getDatabaseNameFromFileName(entryName); if (name != null) { if (db.equals(name)) {
@Override public void runTool(String... args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { // ignore } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } execute(zipFileName, dir, db); }
/** * Options are case sensitive. Supported options are: * <table> * <tr><td>[-help] or [-?]</td> * <td>Print the list of options</td></tr> * <tr><td>[-file <filename>]</td> * <td>The source file name (default: backup.zip)</td></tr> * <tr><td>[-dir <dir>]</td> * <td>The target directory (default: .)</td></tr> * <tr><td>[-db <database>]</td> * <td>The target database name (as stored if not set)</td></tr> * <tr><td>[-quiet]</td> * <td>Do not print progress information</td></tr> * </table> * @h2.resource * * @param args the command line arguments */ public static void main(String... args) throws SQLException { new Restore().runTool(args); }
tool = new Backup(); } else if ("Restore".equals(toolName)) { tool = new Restore(); } else if ("Recover".equals(toolName)) { tool = new Recover();
int originalDbLen = 0; if (db != null) { originalDbName = getOriginalDbName(zipFileName, db); if (originalDbName == null) { throw new IOException("No database named " + db + " found");
originalDbName = getOriginalDbName(zipFileName, db); if (originalDbName == null) { throw new IOException("No database named " + db + " found");