From 998f95bfc01392c70d797bfa243446a9ed9ad7b3 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Sat, 17 Aug 2013 12:00:25 -0700 Subject: [PATCH] More javadoc, minor cleanup --- .../java/org/eclipse/jetty/start/Main.java | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index f62b44cbfb1..47062ff526b 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -221,7 +221,7 @@ public class Main continue; } - + // Alternative start.config file if (arg.startsWith("--config=")) { _startConfig = arg.substring(9); @@ -230,6 +230,9 @@ public class Main // Special internal indicator that jetty was started by the jetty.sh Daemon + // All this does is setup a start.log that captures startup console output + // in the tiny window of time before the real logger kicks in. + // Useful for capturing when things go horribly wrong if ("--daemon".equals(arg)) { File startDir = new File(System.getProperty("jetty.logs","logs")); @@ -260,6 +263,7 @@ public class Main continue; } + // Start Property (syntax similar to System Property) if (arg.startsWith("-D")) { String[] assign = arg.substring(2).split("=",2); @@ -278,6 +282,7 @@ public class Main continue; } + // Anything else is a JVM argument if (arg.startsWith("-")) { _jvmArgs.add(arg); @@ -379,8 +384,7 @@ public class Main location.replaceAll("/",File.separator); File file = new File(location); - if (Config.isDebug()) - System.err.println("Download to "+file.getAbsolutePath()+(file.exists()?" Exists!":"")); + Config.debug("Download to %s %s",file.getAbsolutePath(),(file.exists()?"[Exists!]":"")); if (file.exists()) return; @@ -536,18 +540,34 @@ public class Main System.exit(EXIT_USAGE); } - String path(String path) + /** + * Replace/Shorten arbitrary path with property strings "${jetty.home}" or "${jetty.base}" where appropriate. + * + * @param path + * the path to shorten + * @return the potentially shortened path + */ + private String path(String path) { - if (path==null) + if (path == null) + { return path; + } if (path.startsWith(_config.getJettyHome())) - path = "${jetty.home}" + path.substring(_config.getJettyHome().length()); - if (_config.getJettyBase()!=null && path.startsWith(_config.getJettyBase())) - path = "${jetty.base}" + path.substring(_config.getJettyBase().length()); + { + return "${jetty.home}" + path.substring(_config.getJettyHome().length()); + } + if (_config.getJettyBase() != null && path.startsWith(_config.getJettyBase())) + { + return "${jetty.base}" + path.substring(_config.getJettyBase().length()); + } return path; } - String path(File file) + /** + * Convenience method for path(file.getCanonicalPath()) + */ + private String path(File file) { try { @@ -679,7 +699,7 @@ public class Main System.out.println(cmd.toString()); } - + // Informational command line, don't run jetty if (_noRun) return; @@ -1214,7 +1234,7 @@ public class Main /** * Convert a start.ini format file into an argument list. */ - List loadStartIni(File ini,String name) + private List loadStartIni(File ini,String name) { if (ini==null || !ini.exists() || ini.isDirectory() || !ini.canRead()) {