private static void deleteRecursively(File file) {
    if (!file.exists()) {
      return;
    }

    if (file.isDirectory()) {
      for (File child : file.listFiles()) {
        deleteRecursively(child);
      }
    }
    if (!file.delete()) {
      throw new RuntimeException("Couldn't empty database. Offending file:" + file);
    }
  }
 public ImpermanentGraphDatabase(String storeDir, Map<String, String> params) {
   this.storeDir = storeDir;
   deleteRecursively(new File(storeDir));
   inner = new EmbeddedGraphDatabase(storeDir, params);
 }
 public void shutdown() {
   inner.shutdown();
   deleteRecursively(new File(storeDir));
 }