You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by al...@apache.org on 2014/08/07 12:41:18 UTC
svn commit: r1616466 - in /jackrabbit/oak/branches/1.0: ./
oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
Author: alexparvulescu
Date: Thu Aug 7 10:41:17 2014
New Revision: 1616466
URL: http://svn.apache.org/r1616466
Log:
OAK-2017 Add checkpoint management to oak-run
- merged rev 1616463
Modified:
jackrabbit/oak/branches/1.0/ (props changed)
jackrabbit/oak/branches/1.0/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
Propchange: jackrabbit/oak/branches/1.0/
------------------------------------------------------------------------------
Merged /jackrabbit/oak/trunk:r1616463
Modified: jackrabbit/oak/branches/1.0/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java?rev=1616466&r1=1616465&r2=1616466&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java (original)
+++ jackrabbit/oak/branches/1.0/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Thu Aug 7 10:41:17 2014
@@ -168,6 +168,9 @@ public class Main {
if (args.length != 1) {
System.err.println("usage: compact <path>");
System.exit(1);
+ } else if (!isValidFileStore(args[0])) {
+ System.err.println("Invalid FileStore directory " + args[0]);
+ System.exit(1);
} else {
File directory = new File(args[0]);
System.out.println("Compacting " + directory);
@@ -199,6 +202,10 @@ public class Main {
.println("usage: checkpoints <path> [list|rm-all|rm <checkpoint>]");
System.exit(1);
}
+ if (!isValidFileStore(args[0])) {
+ System.err.println("Invalid FileStore directory " + args[0]);
+ System.exit(1);
+ }
String path = args[0];
String op = "list";
@@ -275,6 +282,9 @@ public class Main {
if (args.length == 0) {
System.err.println("usage: debug <path> [id...]");
System.exit(1);
+ } else if (!isValidFileStore(args[0])) {
+ System.err.println("Invalid FileStore directory " + args[0]);
+ System.exit(1);
} else {
// TODO: enable debug information for other node store implementations
System.out.println("Debug " + args[0]);
@@ -376,6 +386,25 @@ public class Main {
}
}
+ /**
+ * Checks if the provided directory is a valid FileStore
+ *
+ * @return true if the provided directory is a valid FileStore
+ */
+ private static boolean isValidFileStore(String path) {
+ File store = new File(path);
+ if (store == null || !store.isDirectory()) {
+ return false;
+ }
+ // for now the only check is the existence of the journal file
+ for (String f : store.list()) {
+ if ("journal.log".equals(f)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private static void upgrade(String[] args) throws Exception {
OptionParser parser = new OptionParser();
parser.accepts("datastore", "keep data store");