You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/10/12 10:25:21 UTC
ignite git commit: ignite-1596 Print default value on new line,
fixed description, print out values for all the configuration settings.
Repository: ignite
Updated Branches:
refs/heads/ignite-843 7565b71ad -> 1251c4cb5
ignite-1596 Print default value on new line, fixed description, print out values for all the configuration settings.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1251c4cb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1251c4cb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1251c4cb
Branch: refs/heads/ignite-843
Commit: 1251c4cb56f387496f5618d7697ba96a645631a2
Parents: 7565b71
Author: Andrey <an...@gridgain.com>
Authored: Mon Oct 12 15:25:20 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Oct 12 15:25:20 2015 +0700
----------------------------------------------------------------------
modules/control-center-agent/pom.xml | 6 ++
.../apache/ignite/agent/AgentConfiguration.java | 74 +++++++++++++-------
.../org/apache/ignite/agent/AgentLauncher.java | 47 +++++++++----
.../main/js/views/templates/agent-download.jade | 2 +-
4 files changed, 91 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1251c4cb/modules/control-center-agent/pom.xml
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/pom.xml b/modules/control-center-agent/pom.xml
index 5204913..7f0b4d9 100644
--- a/modules/control-center-agent/pom.xml
+++ b/modules/control-center-agent/pom.xml
@@ -78,6 +78,12 @@
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-rest-http</artifactId>
<version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/ignite/blob/1251c4cb/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 7946515..3412e74 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
@@ -18,6 +18,7 @@
package org.apache.ignite.agent;
import com.beust.jcommander.Parameter;
+import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -41,26 +42,31 @@ public class AgentConfiguration {
public static final int DFLT_NODE_PORT = 8080;
/** */
- @Parameter(names = {"-t", "--token"}, description = "User's security token")
- private String token;
+ @Parameter(names = {"-t", "--token"}, description = "User's security token used to establish connection to Ignite Console.")
+ private String tok;
/** */
- @Parameter(names = {"-s", "--server-uri"}, description = "URI for connect to Ignite Web Console via " +
- "web-socket protocol, default value: wss://localhost:3001")
+ @Parameter(names = {"-s", "--server-uri"}, description = "URI for connect to Ignite Console via web-socket protocol" +
+ " " +
+ " Default value: wss://localhost:3001")
private String srvUri;
/** */
- @Parameter(names = {"-n", "--node-uri"},
- description = "URI for connect to Ignite REST server, default value: http://localhost:8080")
+ @Parameter(names = {"-n", "--node-uri"}, description = "URI for connect to Ignite node REST server" +
+ " " +
+ " Default value: http://localhost:8080")
private String nodeUri;
/** */
- @Parameter(names = {"-c", "--config"}, description = "Path to configuration file")
+ @Parameter(names = {"-c", "--config"}, description = "Path to agent property file" +
+ " " +
+ " Default value: ./default.properties")
private String cfgPath;
/** */
- @Parameter(names = {"-d", "--driver-folder"},
- description = "Path to folder with JDBC drivers, default value: ./jdbc-drivers")
+ @Parameter(names = {"-d", "--driver-folder"}, description = "Path to folder with JDBC drivers" +
+ " " +
+ " Default value: ./jdbc-drivers")
private String driversFolder;
/** */
@@ -82,14 +88,14 @@ public class AgentConfiguration {
* @return Token.
*/
public String token() {
- return token;
+ return tok;
}
/**
- * @param token Token.
+ * @param tok Token.
*/
- public void token(String token) {
- this.token = token;
+ public void token(String tok) {
+ this.tok = tok;
}
/**
@@ -124,7 +130,7 @@ public class AgentConfiguration {
* @return Configuration path.
*/
public String configPath() {
- return cfgPath;
+ return cfgPath == null ? "./default.properties" : cfgPath;
}
/**
@@ -173,17 +179,7 @@ public class AgentConfiguration {
* @return {@code true} If agent options usage should be printed.
*/
public Boolean help() {
- boolean noArgs =
- token == null &&
- srvUri == null &&
- nodeUri == null &&
- cfgPath == null &&
- driversFolder == null &&
- meta == null &&
- sql == null &&
- help == null;
-
- return noArgs || (help != null ? help : false);
+ return help != null ? help : false;
}
/**
@@ -255,4 +251,32 @@ public class AgentConfiguration {
if (cmd.testDriveSql())
testDriveSql(true);
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ if (tok != null)
+ sb.append("User's security token : ").append(token()).append('\n');
+
+ sb.append("URI to Ignite node REST server: ").append(nodeUri == null ? DFLT_NODE_URI : nodeUri).append('\n');
+ sb.append("URI to Ignite Console server : ").append(srvUri == null ? DFLT_SERVER_URI : srvUri).append('\n');
+ sb.append("Path to agent property file : ").append(configPath()).append('\n');
+
+ String drvFld = driversFolder();
+
+ if (drvFld == null) {
+ File agentHome = AgentUtils.getAgentHome();
+
+ if (agentHome != null)
+ drvFld = new File(agentHome, "jdbc-drivers").getPath();
+ }
+
+ sb.append("Path to JDBC drivers folder : ").append(drvFld).append('\n');
+
+ sb.append("Test-drive for load metadata : ").append(testDriveMetadata()).append('\n');
+ sb.append("Test-drive for execute query : ").append(testDriveSql());
+
+ return sb.toString();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1251c4cb/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 a698b19..d4f5fd6 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
@@ -21,6 +21,7 @@ import com.beust.jcommander.JCommander;
import java.io.File;
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.ignite.agent.handlers.RestExecutor;
@@ -63,32 +64,53 @@ public class AgentLauncher {
jCommander.setProgramName("ignite-web-agent." + (osName.contains("win") ? "bat" : "sh"));
+ String prop = cmdCfg.configPath();
+
+ try {
+ cfg.load(new File(cmdCfg.configPath()).toURI().toURL());
+ }
+ catch (IOException ignore) {
+ log.log(Level.WARNING, "Failed to load agent property file: '" + prop + "'", ignore);
+ }
+
+ cfg.merge(cmdCfg);
+
if (cmdCfg.help()) {
jCommander.usage();
return;
}
+ System.out.println();
+ System.out.println("Configuration settings:");
+ System.out.println(cmdCfg);
+ System.out.println();
+
if (cmdCfg.testDriveSql() && cmdCfg.nodeUri() != null)
log.log(Level.WARNING,
"URI for connect to Ignite REST server will be ignored because --test-drive-sql option was specified.");
+ if (!cmdCfg.testDriveSql() && !cmdCfg.testDriveMetadata()) {
+ System.out.println("To start web-agent in test-drive mode, pass \"-tm\" and \"-ts\" parameters");
+ System.out.println();
+ }
+
+ if (cfg.token() == null) {
+ String webHost= "";
- if (cmdCfg.configPath() != null)
- cfg.load(new File(cmdCfg.configPath()).toURI().toURL());
- else {
try {
- cfg.load(new File("./default.properties").toURI().toURL());
+ webHost = new URI(cfg.serverUri()).getHost();
}
- catch (IOException ignore) {
- // No-op.
+ catch (URISyntaxException e) {
+ log.log(Level.SEVERE, "Failed to parse Ignite Web Console uri", e);
+
+ return;
}
- }
- cfg.merge(cmdCfg);
+ System.out.println("Security token is required to establish connection to the web console.");
+ System.out.println(String.format("It is available on the Profile page: https://%s/profile", webHost));
- if (cfg.token() == null) {
- System.out.print("Token: ");
+ System.out.print("Enter security token: ");
cfg.token(new String(System.console().readPassword()));
}
@@ -106,8 +128,9 @@ public class AgentLauncher {
try {
SslContextFactory sslCtxFactory = new SslContextFactory();
- // TODO IGNITE-843 Fix issue with trust all: if (Boolean.TRUE.equals(Boolean.getBoolean("trust.all")))
- sslCtxFactory.setTrustAll(true);
+ // Workaround for use self-signed certificate:
+ if (Boolean.getBoolean("trust.all"))
+ sslCtxFactory.setTrustAll(true);
WebSocketClient client = new WebSocketClient(sslCtxFactory);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1251c4cb/modules/control-center-web/src/main/js/views/templates/agent-download.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/agent-download.jade b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
index ea99515..47b0940 100644
--- a/modules/control-center-web/src/main/js/views/templates/agent-download.jade
+++ b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
@@ -45,5 +45,5 @@
i.tipLabel.fa.fa-clipboard(ng-click-copy='{{user.token}}' bs-tooltip='' data-title='Copy security token to clipboard')
i.tipLabel.fa.fa-question-circle(ng-if=lines bs-tooltip='' data-title='The security token is used for authorization of web agent')
.modal-footer
- button.btn.btn-default(ng-if='checkConnection' ng-click='goHome()') Home
+ button.btn.btn-default(ng-if='checkConnection' ng-click='goHome()') Back to Configuration
button.btn.btn-primary(ng-click='downloadAgent()') Download zip