Author: mduerig Date: Tue Jul 8 07:53:48 2014 New Revision: 1608685 URL: http://svn.apache.org/r1608685 Log: OAK-1955: oak-run main method should print available run modes
Modified: jackrabbit/oak/trunk/oak-run/README.md jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Modified: jackrabbit/oak/trunk/oak-run/README.md URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/README.md?rev=1608685&r1=1608684&r2=1608685&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/README.md (original) +++ jackrabbit/oak/trunk/oak-run/README.md Tue Jul 8 07:53:48 2014 @@ -4,13 +4,17 @@ Oak Runnable Jar This jar contains everything you need for a simple Oak installation. The following runmodes are currently available: - * backup : Backup an existing Oak repository - * benchmark : Run benchmark tests against different Oak repository fixtures. - * debug : Print status information about an Oak repository. - * upgrade : Upgrade from Jackrabbit 2.x repository to Oak. - * server : Run the Oak Server - * console : Start an interactive console - * explore : Starts a GUI browser based on java swing + * backup : Backup an existing Oak repository. + * restore : Restore a backup of an Oak repository. + * benchmark : Run benchmark tests against different Oak repository fixtures. + * debug : Print status information about an Oak repository. + * compact : Segment compaction on a TarMK repository. + * upgrade : Upgrade from Jackrabbit 2.x repository to Oak. + * server : Run the Oak Server. + * console : Start an interactive console. + * explore : Starts a GUI browser based on java swing. + * scalability : Run scalability tests against different Oak repository fixtures. + * help : Print a list of available runmodes See the subsections below for more details on how to use these modes. Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java?rev=1608685&r1=1608684&r2=1608685&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java (original) +++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Tue Jul 8 07:53:48 2014 @@ -38,6 +38,7 @@ import java.util.regex.Pattern; import javax.jcr.Repository; +import com.google.common.base.Joiner; import com.google.common.collect.Maps; import com.google.common.collect.Queues; import com.google.common.io.Closer; @@ -99,7 +100,12 @@ public class Main { Mode mode = Mode.SERVER; if (args.length > 0) { - mode = Mode.valueOf(args[0].toUpperCase(Locale.ENGLISH)); + try { + mode = Mode.valueOf(args[0].toUpperCase(Locale.ENGLISH)); + } catch (IllegalArgumentException e) { + System.err.println("Unknown run mode: " + args[0]); + mode = Mode.HELP; + } String[] tail = new String[args.length - 1]; System.arraycopy(args, 1, tail, 0, tail.length); args = tail; @@ -135,8 +141,10 @@ public class Main { case EXPLORE: Explorer.main(args); break; + case HELP: default: - System.err.println("Unknown command: " + mode); + System.err.print("Available run modes: "); + System.err.println(Joiner.on(',').join(Mode.values())); System.exit(1); } @@ -653,13 +661,14 @@ public class Main { BACKUP("backup"), RESTORE("restore"), BENCHMARK("benchmark"), - CONSOLE("debug"), + CONSOLE("console"), DEBUG("debug"), COMPACT("compact"), SERVER("server"), UPGRADE("upgrade"), SCALABILITY("scalability"), - EXPLORE("explore"); + EXPLORE("explore"), + HELP("help"); private final String name;