예제 #1
0
  private void attemptRecoveryOrCheckStateOfLogicalLogs(Args arguments, String storeDir) {
    if (arguments.getBoolean(RECOVERY, false, true)) {
      dbFactory.newEmbeddedDatabase(storeDir).shutdown();
    } else {
      try {
        if (recoveryChecker.recoveryNeededAt(new File(storeDir))) {
          systemError.print(
              lines(
                  "Active logical log detected, this might be a source of inconsistencies.",
                  "Consider allowing the database to recover before running the consistency check.",
                  "Consistency checking will continue, abort if you wish to perform recovery first.",
                  "To perform recovery before checking consistency, use the '--recovery' flag."));

          exitHandle.pull();
        }
      } catch (IOException e) {
        systemError.printf(
            "Failure when checking for recovery state: '%s', continuing as normal.%n", e);
      }
    }
  }
예제 #2
0
  private void startLocal(Args args, CtrlCHandler signalHandler) {
    String dbPath = args.get(ARG_PATH, null);
    if (dbPath == null) {
      System.err.println(
          "ERROR: To start a local Neo4j service and a "
              + "shell client on top of that you need to supply a path to a "
              + "Neo4j store or just a new path where a new store will "
              + "be created if it doesn't exist. -"
              + ARG_PATH
              + " /my/path/here");
      return;
    }

    try {
      boolean readOnly = args.getBoolean(ARG_READONLY, false, true);
      tryStartLocalServerAndClient(dbPath, readOnly, args, signalHandler);
    } catch (Exception e) {
      handleException(e, args);
    }
    System.exit(0);
  }
예제 #3
0
 public static Printer getPrinter(Args args) {
   boolean toFile = args.getBoolean("tofile", false, true).booleanValue();
   return toFile ? new FilePrinter() : SYSTEM_OUT_PRINTER;
 }