GUACAMOLE-102: Initial addition of connection weight to JDBC authentication extension

This commit is contained in:
Nick Couchman
2017-03-19 11:57:28 -04:00
committed by Nick Couchman
parent 91920d0b2d
commit 025f77d1c4
11 changed files with 180 additions and 8 deletions

View File

@@ -34,7 +34,6 @@ CREATE TABLE `guacamole_connection_group` (
`max_connections_per_user` int(11),
`enable_session_affinity` boolean NOT NULL DEFAULT 0,
PRIMARY KEY (`connection_group_id`),
UNIQUE KEY `connection_group_name_parent` (`connection_group_name`, `parent_id`),
@@ -65,6 +64,10 @@ CREATE TABLE `guacamole_connection` (
-- Concurrency limits
`max_connections` int(11),
`max_connections_per_user` int(11),
-- Connection weight
`connection_weight` int(11),
PRIMARY KEY (`connection_id`),
UNIQUE KEY `connection_name_parent` (`connection_name`, `parent_id`),

View File

@@ -0,0 +1,25 @@
--
-- 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.
--
--
-- Add per-user password set date
--
ALTER TABLE guacamole_connection
ADD COLUMN connection_weight int(11);

View File

@@ -87,6 +87,11 @@ public class MySQLEnvironment extends JDBCEnvironment {
*/
private int DEFAULT_MAX_CONNECTIONS = 0;
/**
* The default value for the connection weight for a connection in
* a balancing group.
private int DEFAULT_CONNECTION_WEIGHT = 0;
/**
* The default value for the default maximum number of connections to be
* allowed to any one connection group. Note that, as long as the legacy
@@ -194,6 +199,14 @@ public class MySQLEnvironment extends JDBCEnvironment {
);
}
@Override
public int getDefaultConnectionWeight() throws GuacamoleException {
return getProperty(
MySQLGuacamoleProperties.MYSQL_DEFAULT_CONNECTION_WEIGHT,
DEFAULT_CONNECTION_WEIGHT
);
}
@Override
public int getDefaultMaxGroupConnections() throws GuacamoleException {
return getProperty(

View File

@@ -174,6 +174,18 @@ public class MySQLGuacamoleProperties {
};
/**
* The connection weight for connections in balancing groups.
*/
public static final IntegerGuacamoleProperty
MYSQL_DEFAULT_CONNECTION_WEIGHT =
new IntegerGuacamoleProperty() {
@Overide
public String getName() { return "mysql-default-connection-weight"; }
};
/**
* The maximum number of concurrent connections to allow to any one
* connection group by an individual user. Zero denotes