Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 8a3dc178c -> e29a3c483
IGNITE-843 Added output for agent options usage. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e29a3c48 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e29a3c48 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e29a3c48 Branch: refs/heads/ignite-843 Commit: e29a3c48312f029ae6cc66d15515901240deaef7 Parents: 8a3dc17 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Wed Aug 5 10:20:03 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Wed Aug 5 10:20:03 2015 +0700 ---------------------------------------------------------------------- .../apache/ignite/agent/AgentConfiguration.java | 11 +++++++++ .../org/apache/ignite/agent/AgentLauncher.java | 24 ++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e29a3c48/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java index 0c887f6..48b9d2d 100644 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java +++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java @@ -52,6 +52,10 @@ public class AgentConfiguration { @Parameter(names = {"-drv", "--driver-folder"}, description = "Path to folder with JDBC drivers, for example /home/user/drivers") private String driversFolder; + /** */ + @Parameter(names = { "-h", "--help" }, description = "Print this help message") + private boolean help; + /** * @return Login. */ @@ -189,4 +193,11 @@ public class AgentConfiguration { if (cmd.getDriversFolder() != null) setDriversFolder(cmd.getDriversFolder()); } + + /** + * @return {@code true} If agent options usage should be printed. + */ + public boolean help() { + return help; + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e29a3c48/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java index aec7e92..35223de 100644 --- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java +++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentLauncher.java @@ -43,14 +43,21 @@ public class AgentLauncher { /** * @param args Args. - * @return Agent configuration. */ - protected static AgentConfiguration getConfiguration(String[] args) throws IOException { + public static void main(String[] args) throws Exception { + log.log(Level.INFO, "Starting Apache Ignite Control Center Agent..."); + AgentConfiguration cfg = new AgentConfiguration(); AgentConfiguration cmdCfg = new AgentConfiguration(); - new JCommander(cmdCfg, args); + JCommander jCommander = new JCommander(cmdCfg, args); + + if (cmdCfg.help()) { + jCommander.usage(); + + return; + } if (cmdCfg.getConfigPath() != null) cfg.load(new File(cmdCfg.getConfigPath()).toURI().toURL()); @@ -69,17 +76,6 @@ public class AgentLauncher { cfg.setPassword(new String(System.console().readPassword())); } - return cfg; - } - - /** - * @param args Args. - */ - public static void main(String[] args) throws Exception { - log.log(Level.INFO, "Starting Apache Ignite Control Center Agent..."); - - AgentConfiguration cfg = getConfiguration(args); - RestExecutor restExecutor = new RestExecutor(cfg); restExecutor.start();