ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [5/6] ignite git commit: ignite-1596 Fixed after test
Date Mon, 12 Oct 2015 10:32:16 GMT
ignite-1596 Fixed after test


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/947dad88
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/947dad88
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/947dad88

Branch: refs/heads/ignite-843
Commit: 947dad8805a39eb63f0490f40c7013a34b8d376b
Parents: ae09fa9
Author: Andrey <anovikov@gridgain.com>
Authored: Mon Oct 12 17:31:50 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Mon Oct 12 17:31:50 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/agent/AgentConfiguration.java | 24 ++++++--------
 .../org/apache/ignite/agent/AgentLauncher.java  | 33 ++++++++++----------
 .../org/apache/ignite/agent/AgentSocket.java    | 14 ++++++---
 3 files changed, 35 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/947dad88/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 3412e74..8ed3613 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
@@ -29,18 +29,14 @@ import java.util.Properties;
  * Agent configuration.
  */
 public class AgentConfiguration {
-    /** Default server URI. */
-    private static final String DFLT_SERVER_URI = "wss://localhost:3001";
-
     /** Default server port. */
     public static final int DFLT_SERVER_PORT = 3001;
-
-    /** Default Ignite node HTTP URI. */
-    private static final String DFLT_NODE_URI = "http://localhost:8080";
-
     /** Default Ignite node HTTP port. */
     public static final int DFLT_NODE_PORT = 8080;
-
+    /** Default server URI. */
+    private static final String DFLT_SERVER_URI = "wss://localhost:3001";
+    /** Default Ignite node HTTP URI. */
+    private static final String DFLT_NODE_URI = "http://localhost:8080";
     /** */
     @Parameter(names = {"-t", "--token"}, description = "User's security token used to establish
connection to Ignite Console.")
     private String tok;
@@ -227,28 +223,28 @@ public class AgentConfiguration {
      * @param cmd Command.
      */
     public void merge(AgentConfiguration cmd) {
-        if (cmd.token() != null)
+        if (tok == null)
             token(cmd.token());
 
-        if (cmd.serverUri() != null)
+        if (srvUri == null)
             serverUri(cmd.serverUri());
 
         if (srvUri == null)
             serverUri(DFLT_SERVER_URI);
 
-        if (cmd.nodeUri() != null)
+        if (nodeUri == null)
             nodeUri(cmd.nodeUri());
 
         if (nodeUri == null)
             nodeUri(DFLT_NODE_URI);
 
-        if (cmd.driversFolder() != null)
+        if (driversFolder == null)
             driversFolder(cmd.driversFolder());
 
-        if (cmd.testDriveMetadata())
+        if (testDriveMetadata())
             testDriveMetadata(true);
 
-        if (cmd.testDriveSql())
+        if (testDriveSql())
             testDriveSql(true);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/947dad88/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 d4f5fd6..08d701a 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
@@ -36,17 +36,16 @@ import static org.apache.ignite.agent.AgentConfiguration.DFLT_SERVER_PORT;
  * Control Center Agent launcher.
  */
 public class AgentLauncher {
-    /** Static initializer. */
-    static {
-        AgentLoggingConfigurator.configure();
-    }
-
     /** */
     private static final Logger log = Logger.getLogger(AgentLauncher.class.getName());
-
     /** */
     private static final int RECONNECT_INTERVAL = 3000;
 
+    /** Static initializer. */
+    static {
+        AgentLoggingConfigurator.configure();
+    }
+
     /**
      * @param args Args.
      */
@@ -56,41 +55,41 @@ public class AgentLauncher {
 
         AgentConfiguration cfg = new AgentConfiguration();
 
-        AgentConfiguration cmdCfg = new AgentConfiguration();
-
-        JCommander jCommander = new JCommander(cmdCfg, args);
+        JCommander jCommander = new JCommander(cfg, args);
 
         String osName = System.getProperty("os.name").toLowerCase();
 
         jCommander.setProgramName("ignite-web-agent." + (osName.contains("win") ? "bat" :
"sh"));
 
-        String prop = cmdCfg.configPath();
+        String prop = cfg.configPath();
+
+        AgentConfiguration propCfg = new AgentConfiguration();
 
         try {
-            cfg.load(new File(cmdCfg.configPath()).toURI().toURL());
+            propCfg.load(new File(prop).toURI().toURL());
         }
         catch (IOException ignore) {
             log.log(Level.WARNING, "Failed to load agent property file: '" + prop + "'",
ignore);
         }
 
-        cfg.merge(cmdCfg);
+        cfg.merge(propCfg);
 
-        if (cmdCfg.help()) {
+        if (cfg.help()) {
             jCommander.usage();
 
             return;
         }
 
         System.out.println();
-        System.out.println("Configuration settings:");
-        System.out.println(cmdCfg);
+        System.out.println("Agent configuration:");
+        System.out.println(cfg);
         System.out.println();
 
-        if (cmdCfg.testDriveSql() && cmdCfg.nodeUri() != null)
+        if (cfg.testDriveSql() && cfg.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()) {
+        if (!cfg.testDriveSql() && !cfg.testDriveMetadata()) {
             System.out.println("To start web-agent in test-drive mode, pass \"-tm\" and \"-ts\"
parameters");
             System.out.println();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/947dad88/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
index 7ab6b06..d9fc3e7 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentSocket.java
@@ -26,6 +26,7 @@ import java.net.ConnectException;
 import java.util.concurrent.CountDownLatch;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import javax.net.ssl.SSLHandshakeException;
 import org.apache.ignite.agent.handlers.DatabaseMetadataExtractor;
 import org.apache.ignite.agent.handlers.RestExecutor;
 import org.apache.ignite.agent.remote.Remote;
@@ -46,14 +47,11 @@ import org.eclipse.jetty.websocket.api.annotations.WebSocket;
 @WebSocket
 public class AgentSocket implements WebSocketSender {
     /** */
-    private static final Logger log = Logger.getLogger(AgentSocket.class.getName());
-
-    /** */
     public static final Gson GSON = new Gson();
-
     /** */
     public static final JsonParser PARSER = new JsonParser();
-
+    /** */
+    private static final Logger log = Logger.getLogger(AgentSocket.class.getName());
     /** */
     private final CountDownLatch closeLatch = new CountDownLatch(1);
 
@@ -143,6 +141,12 @@ public class AgentSocket implements WebSocketSender {
     public void onError(Session ses, Throwable error) {
         if (error instanceof ConnectException)
             log.log(Level.WARNING, error.getMessage());
+        else if (error instanceof SSLHandshakeException) {
+            log.log(Level.SEVERE, "Failed to establish SSL connection to Ignite Console.
Start agent with " +
+                "\"-Dtrust.all=true\" to skip certificate validation in case of using self-signed
certificate.", error);
+
+            System.exit(1);
+        }
         else
             log.log(Level.SEVERE, "Connection error.", error);
 


Mime
View raw message