ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [21/50] incubator-ignite git commit: IGNITE-1155 Remove AgentCommanLineOption class.
Date Wed, 05 Aug 2015 01:15:12 GMT
IGNITE-1155 Remove AgentCommanLineOption class.


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

Branch: refs/heads/ignite-843
Commit: c958a1170c0e888a53da4aca631c914672dbdeba
Parents: 4ce2092
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Fri Jul 31 15:13:40 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Fri Jul 31 15:13:40 2015 +0300

----------------------------------------------------------------------
 .../ignite/agent/AgentCommandLineOptions.java   | 116 -------------------
 .../apache/ignite/agent/AgentConfiguration.java |  50 ++++++--
 .../org/apache/ignite/agent/AgentLauncher.java  |  14 +--
 3 files changed, 45 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c958a117/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLineOptions.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLineOptions.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLineOptions.java
deleted file mode 100644
index 5b45f5a..0000000
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentCommandLineOptions.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.agent;
-
-import com.beust.jcommander.*;
-
-/**
- * Command line bean.
- */
-public class AgentCommandLineOptions {
-    /** */
-    @Parameter(names = {"-l", "--login"}, description = "User's login (email) on web-control-center")
-    private String login;
-
-    /** */
-    @Parameter(names = {"-p", "--password"}, description = "User's password")
-    private String pwd;
-
-    /** */
-    @Parameter(names = {"-s", "--serverUri"},
-        description = "Link to web-control-center web-socket server, for example: wss://control-center.gridgain.com")
-    private String serverUri;
-
-    /** */
-    @Parameter(names = {"-n", "--nodeUri"}, description = "ignite REST server, for example:
http://localhost:8080")
-    private String nodeUri;
-
-    /** */
-    @Parameter(names = {"-c", "--config"}, description = "Path to configuration file")
-    private String cfgPath;
-
-    /**
-     * @return Login.
-     */
-    public String getLogin() {
-        return login;
-    }
-
-    /**
-     * @param login Login.
-     */
-    public void setLogin(String login) {
-        this.login = login;
-    }
-
-    /**
-     * @return Password.
-     */
-    public String getPassword() {
-        return pwd;
-    }
-
-    /**
-     * @param pwd Password.
-     */
-    public void setPassword(String pwd) {
-        this.pwd = pwd;
-    }
-
-    /**
-     * @return Server URI.
-     */
-    public String getServerUri() {
-        return serverUri;
-    }
-
-    /**
-     * @param srvUri Server uri.
-     */
-    public void setServerUri(String srvUri) {
-        serverUri = srvUri;
-    }
-
-    /**
-     * @return Node URI.
-     */
-    public String getNodeUri() {
-        return nodeUri;
-    }
-
-    /**
-     * @param nodeUri Node uri.
-     */
-    public void setNodeUri(String nodeUri) {
-        this.nodeUri = nodeUri;
-    }
-
-    /**
-     * @return Config file URL.
-     */
-    public String getConfigFile() {
-        return cfgPath;
-    }
-
-    /**
-     * @param cfgPath Config path.
-     */
-    public void setConfigPath(String cfgPath) {
-        this.cfgPath = cfgPath;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c958a117/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 6b44086..4ac3072 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
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.agent;
 
+import com.beust.jcommander.*;
+
 import java.io.*;
 import java.net.*;
 import java.util.*;
@@ -26,16 +28,25 @@ import java.util.*;
  */
 public class AgentConfiguration {
     /** */
+    @Parameter(names = {"-l", "--login"}, description = "User's login (email) on web-control-center")
     private String login;
 
     /** */
+    @Parameter(names = {"-p", "--password"}, description = "User's password")
     private String pwd;
 
     /** */
-    private URI serverUri;
+    @Parameter(names = {"-s", "--serverUri"},
+        description = "Link to web-control-center web-socket server, for example: wss://control-center.gridgain.com")
+    private String serverUri;
+
+    /** */
+    @Parameter(names = {"-n", "--nodeUri"}, description = "ignite REST server, for example:
http://localhost:8080")
+    private String nodeUri;
 
     /** */
-    private URI nodeUri;
+    @Parameter(names = {"-c", "--config"}, description = "Path to configuration file")
+    private String cfgPath;
 
     /**
      * @return Login.
@@ -68,32 +79,46 @@ public class AgentConfiguration {
     /**
      * @return Server URI.
      */
-    public URI getServerUri() {
+    public String getServerUri() {
         return serverUri;
     }
 
     /**
      * @param srvUri URI.
      */
-    public void setServerUri(URI srvUri) {
+    public void setServerUri(String srvUri) {
         this.serverUri = srvUri;
     }
 
     /**
      * @return Node URI.
      */
-    public URI getNodeUri() {
+    public String getNodeUri() {
         return nodeUri;
     }
 
     /**
      * @param nodeUri Node URI.
      */
-    public void setNodeUri(URI nodeUri) {
+    public void setNodeUri(String nodeUri) {
         this.nodeUri = nodeUri;
     }
 
     /**
+     * @return Configuration path.
+     */
+    public String getConfigPath() {
+        return cfgPath;
+    }
+
+    /**
+     * @param cfgPath Config path.
+     */
+    public void setConfigPath(String cfgPath) {
+        this.cfgPath = cfgPath;
+    }
+
+    /**
      * @param cfgUrl URL.
      */
     public void load(URL cfgUrl) throws IOException {
@@ -116,18 +141,18 @@ public class AgentConfiguration {
         val = (String)props.remove("serverURI");
 
         if (val != null)
-            setServerUri(URI.create(val));
+            setServerUri(val);
 
         val = (String)props.remove("nodeURI");
 
         if (val != null)
-            setNodeUri(URI.create(val));
+            setNodeUri(val);
     }
 
     /**
      * @param cmd Command.
      */
-    public void assign(AgentCommandLineOptions cmd) {
+    public void merge(AgentConfiguration cmd) {
         if (cmd.getLogin() != null)
             setLogin(cmd.getLogin());
 
@@ -135,9 +160,12 @@ public class AgentConfiguration {
             setPassword(cmd.getPassword());
 
         if (cmd.getServerUri() != null)
-            setServerUri(URI.create(cmd.getServerUri()));
+            setServerUri(cmd.getServerUri());
 
         if (cmd.getNodeUri() != null)
-            setNodeUri(URI.create(cmd.getNodeUri()));
+            setNodeUri(cmd.getNodeUri());
+
+        if (cmd.getConfigPath() != null)
+            setNodeUri(cmd.getNodeUri());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c958a117/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 d45be43..141652e 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
@@ -52,18 +52,16 @@ public class AgentLauncher {
     protected static AgentConfiguration getConfiguration(String[] args) throws IOException
{
         AgentConfiguration cfg = new AgentConfiguration();
 
-        URL dfltCfgUrl = AgentLauncher.class.getResource("/default.config.properties");
+        cfg.load(AgentLauncher.class.getResource("/default.config.properties"));
 
-        cfg.load(dfltCfgUrl);
-
-        AgentCommandLineOptions cmdCfg = new AgentCommandLineOptions();
+        AgentConfiguration cmdCfg = new AgentConfiguration();
 
         new JCommander(cmdCfg, args);
 
-        if (cmdCfg.getConfigFile() != null)
-            cfg.load(new File(cmdCfg.getConfigFile()).toURI().toURL());
+        if (cmdCfg.getConfigPath() != null)
+            cfg.load(new File(cmdCfg.getConfigPath()).toURI().toURL());
 
-        cfg.assign(cmdCfg);
+        cfg.merge(cmdCfg);
 
         if (cfg.getLogin() == null) {
             System.out.print("Login: ");
@@ -108,7 +106,7 @@ public class AgentLauncher {
 
                     log.log(Level.INFO, "Connecting to: " + cfg.getServerUri());
 
-                    client.connect(agentSock, cfg.getServerUri());
+                    client.connect(agentSock, URI.create(cfg.getServerUri()));
 
                     agentSock.waitForClose();
 


Mime
View raw message