guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vn...@apache.org
Subject [2/7] incubator-guacamole-client git commit: GUACAMOLE-317: Expose "failover-only" attribute for connections.
Date Fri, 16 Jun 2017 01:08:32 GMT
GUACAMOLE-317: Expose "failover-only" attribute for connections.


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

Branch: refs/heads/master
Commit: 31519061dc8eacc6efd7fb8a3a02c7ecc1bfb37e
Parents: 3c553b9
Author: Michael Jumper <mjumper@apache.org>
Authored: Tue Jun 6 13:31:29 2017 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Tue Jun 6 17:32:38 2017 -0700

----------------------------------------------------------------------
 .../auth/jdbc/connection/ModeledConnection.java    | 17 ++++++++++++++++-
 .../src/main/resources/translations/en.json        |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/31519061/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
index 3d6e625..e2cafe1 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
@@ -32,6 +32,7 @@ import org.apache.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
 import org.apache.guacamole.auth.jdbc.base.ModeledChildDirectoryObject;
+import org.apache.guacamole.form.BooleanField;
 import org.apache.guacamole.form.EnumField;
 import org.apache.guacamole.form.Field;
 import org.apache.guacamole.form.Form;
@@ -122,6 +123,13 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
     public static final String CONNECTION_WEIGHT = "weight";
 
     /**
+     * The name of the attribute which controls whether the connection should
+     * be used as a spare only (all other non-spare connections within the same
+     * balancing group should be preferred).
+     */
+    public static final String FAILOVER_ONLY_NAME = "failover-only";
+
+    /**
      * All attributes related to restricting user accounts, within a logical
      * form.
      */
@@ -134,7 +142,8 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
      * All attributes related to load balancing in a logical form.
      */
     public static final Form LOAD_BALANCING = new Form("load-balancing", Arrays.<Field>asList(
-        new NumericField(CONNECTION_WEIGHT)
+        new NumericField(CONNECTION_WEIGHT),
+        new BooleanField(FAILOVER_ONLY_NAME, "true")
     ));
 
     /**
@@ -281,6 +290,9 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
         // Set connection weight
         attributes.put(CONNECTION_WEIGHT, NumericField.format(getModel().getConnectionWeight()));
 
+        // Set whether connection is failover-only
+        attributes.put(FAILOVER_ONLY_NAME, getModel().isFailoverOnly() ? "true" : null);
+
         return attributes;
     }
 
@@ -333,6 +345,9 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
             logger.debug("Unable to parse numeric attribute.", e);
         }
 
+        // Translate failover-only attribute
+        getModel().setFailoverOnly("true".equals(attributes.get(FAILOVER_ONLY_NAME)));
+
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/31519061/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json
index 0bc2db3..c781c15 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/resources/translations/en.json
@@ -20,6 +20,7 @@
         "FIELD_HEADER_MAX_CONNECTIONS"          : "Maximum number of connections:",
         "FIELD_HEADER_MAX_CONNECTIONS_PER_USER" : "Maximum number of connections per user:",
 
+        "FIELD_HEADER_FAILOVER_ONLY"            : "Use for failover only:",
         "FIELD_HEADER_WEIGHT"                   : "Connection weight:",
 
         "FIELD_HEADER_GUACD_HOSTNAME"   : "Hostname:",


Mime
View raw message