private boolean deleteDirectory(String directory) { boolean result = false; if (directory != null) { File file = new File(directory); if (file.exists() && file.isDirectory()) { // 1. delete content of directory: File[] files = file.listFiles(); result = true; //init result flag int count = files.length; for (int i = 0; i < count; i++) { //for each file: File f = files[i]; if (f.isFile()) { result = result && f.delete(); } else if (f.isDirectory()) { result = result && deleteDirectory(f.getAbsolutePath()); } }//next file file.delete(); //finally delete (empty) input directory }//else: input directory does not exist or is not a directory }//else: no input value return result; }//deleteDirectory()
if (m_conn instanceof MulgaraConnector){ String path = m_conn.getConfiguration().get("path"); dropIndex(path);
if (m_conn instanceof MulgaraConnector){ String path = m_conn.getConfiguration().get("path"); dropIndex(path);
private boolean deleteDirectory(String directory) { boolean result = false; if (directory != null) { File file = new File(directory); if (file.exists() && file.isDirectory()) { // 1. delete content of directory: File[] files = file.listFiles(); result = true; //init result flag int count = files.length; for (int i = 0; i < count; i++) { //for each file: File f = files[i]; if (f.isFile()) { result = result && f.delete(); } else if (f.isDirectory()) { result = result && deleteDirectory(f.getAbsolutePath()); } }//next file file.delete(); //finally delete (empty) input directory }//else: input directory does not exist or is not a directory }//else: no input value return result; }//deleteDirectory()
private void dropIndex(String tsPath){ if (tsPath == null) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println(); System.out .println("NOTE: You must now manually re-initialize (clear) "); System.out .println(" the existing triplestore. The RI rebuilder"); System.out .println(" cannot yet automatically perform this step "); System.out .println(" for this type of triplestore. Press enter"); System.out.println(" when finished."); try { reader.readLine(); } catch (IOException e) { } System.out.println("OK, continuing..."); } else { System.out.println("Clearing directory " + tsPath + "..."); deleteDirectory(tsPath); File cleanDir = new File(tsPath); cleanDir.mkdir(); } }
private void dropIndex(String tsPath){ if (tsPath == null) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println(); System.out .println("NOTE: You must now manually re-initialize (clear) "); System.out .println(" the existing triplestore. The RI rebuilder"); System.out .println(" cannot yet automatically perform this step "); System.out .println(" for this type of triplestore. Press enter"); System.out.println(" when finished."); try { reader.readLine(); } catch (IOException e) { } System.out.println("OK, continuing..."); } else { System.out.println("Clearing directory " + tsPath + "..."); deleteDirectory(tsPath); File cleanDir = new File(tsPath); cleanDir.mkdir(); } }