Refine search
public void start() { System.out.println("running H2 server"); if (realH2Server == null || !realH2Server.isRunning(false)) { try { DeleteDbFiles.execute("", "JPADroolsFlow", true); realH2Server = Server.createTcpServer(new String[0]); realH2Server.start(); } catch (SQLException e) { throw new RuntimeException("Can't start h2 server db", e); } } }
/** * Deletes the database files. * * @param dir the directory * @param db the database name (null for all databases) * @param quiet don't print progress information */ public static void execute(String dir, String db, boolean quiet) { new DeleteDbFiles().process(dir, db, quiet); }
/** * Deletes the database files. * * @param dir the directory * @param db the database name (null for all databases) * @param quiet don't print progress information */ private void process(String dir, String db, boolean quiet) { ArrayList<String> files = FileLister.getDatabaseFiles(dir, db, true); if (files.isEmpty() && !quiet) { printNoDatabaseFilesFound(dir, db); } for (String fileName : files) { process(fileName, quiet); if (!quiet) { out.println("Processed: " + fileName); } } }
/** * Options are case sensitive. Supported options are: * <table> * <tr><td>[-help] or [-?]</td> * <td>Print the list of options</td></tr> * <tr><td>[-dir <dir>]</td> * <td>The directory (default: .)</td></tr> * <tr><td>[-db <database>]</td> * <td>The database name</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 DeleteDbFiles().runTool(args); }
@Override public void runTool(String... args) throws SQLException { 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("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } process(dir, db, quiet); }
@AfterClass public static void stopH2Database() throws Exception { h2Server.stop(); DeleteDbFiles.execute("", "DroolsFlow", true); }
@AfterClass public static void tearDownClass() throws Exception { if (setupDataSource) { DeleteDbFiles.execute("~", "jbpm-db", true);
@Before public void setUp() { DeleteDbFiles.execute("~", "mydb", false); System.out.println("Staring DB for white pages ..."); try { server = Server.createTcpServer(new String[] {"-tcp","-tcpAllowOthers","-tcpDaemon","-trace"}).start(); } catch (SQLException ex) { System.out.println("ERROR: "+ex.getMessage()); } System.out.println("DB for white pages started! "); }
String directory = FileUtils.getParent(databaseName); String name = FileUtils.getName(databaseName); DeleteDbFiles.execute(directory, name, true); } catch (Exception e) {
/** * Deletes the database files. * * @param dir the directory * @param db the database name (null for all databases) * @param quiet don't print progress information * @throws SQLException */ private void process(String dir, String db, boolean quiet) throws SQLException { DeleteDbFiles delete = new DeleteDbFiles(); ArrayList files = FileLister.getDatabaseFiles(dir, db, true); if (files.size() == 0 && !quiet) { printNoDatabaseFilesFound(dir, db); } for (int i = 0; i < files.size(); i++) { String fileName = (String) files.get(i); delete.process(fileName, quiet); if (!quiet) { out.println("Processed: " + fileName); } } }
public void run(String[] args) throws SQLException { 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("-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(dir, db, quiet); }
tool = new Recover(); } else if ("DeleteDbFiles".equals(toolName)) { tool = new DeleteDbFiles(); } else if ("ChangeFileEncryption".equals(toolName)) { tool = new ChangeFileEncryption();
/** * 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>-dir database directory (the default is the current directory) * </li><li>-db database name (all databases 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 DeleteDbFiles().run(args); }
@AfterClass public static void stopH2Database() throws Exception { h2Server.stop(); DeleteDbFiles.execute("", "DroolsFlow", true); }
@AfterClass public static void destroy() throws Exception { DeleteDbFiles.execute("target/monitoring", "monitoring", false); }
@BeforeClass public static void startH2Database() throws Exception { DeleteDbFiles.execute("", "DroolsFlow", true); h2Server = Server.createTcpServer(new String[0]); h2Server.start(); }