diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionGroup.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionGroup.java index 1a58b8375..2543396cb 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionGroup.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionGroup.java @@ -64,11 +64,6 @@ public class MySQLConnectionGroup extends AbstractConnectionGroup { * The ID of the parent connection group for this connection group. */ private Integer parentID; - - /** - * The type of this connection group. - */ - private String type; /** * The ID of the user who queried or created this connection group. @@ -160,7 +155,6 @@ public class MySQLConnectionGroup extends AbstractConnectionGroup { this.parentID = parentID; setName(name); setIdentifier(identifier); - this.type = type; this.userID = userID; connectionDirectory = connectionDirectoryProvider.get(); @@ -194,34 +188,5 @@ public class MySQLConnectionGroup extends AbstractConnectionGroup { public Directory getConnectionGroupDirectory() throws GuacamoleException { return connectionGroupDirectory; } - - /** - * Returns the connection group type. - * @return the connection group type. - */ - public String getType() { - return type; - } - - /** - * Sets the connection group type. - * @param type the connection group type. - */ - public void setType(String type) { - this.type = type; - } - - @Override - public void setBalancing(boolean balancing) { - if(balancing) - this.type = MySQLConstants.CONNECTION_GROUP_BALANCING; - else - this.type = MySQLConstants.CONNECTION_GROUP_ORGANIZATIONAL; - } - - @Override - public boolean isBalancing() { - return MySQLConstants.CONNECTION_GROUP_BALANCING.equals(this.type); - } } diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionGroupService.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionGroupService.java index 6201397ca..c265af9ed 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionGroupService.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/service/ConnectionGroupService.java @@ -50,6 +50,7 @@ import java.util.Map; import java.util.Set; import net.sourceforge.guacamole.net.GuacamoleSocket; import net.sourceforge.guacamole.net.auth.mysql.MySQLConnectionGroup; +import net.sourceforge.guacamole.net.auth.mysql.MySQLConstants; import net.sourceforge.guacamole.net.auth.mysql.dao.ConnectionGroupMapper; import net.sourceforge.guacamole.net.auth.mysql.model.ConnectionGroup; import net.sourceforge.guacamole.net.auth.mysql.model.ConnectionGroupExample; @@ -353,7 +354,15 @@ public class ConnectionGroupService { connectionGroup.setConnection_group_id(mySQLConnectionGroup.getConnectionGroupID()); connectionGroup.setParent_id(mySQLConnectionGroup.getParentID()); connectionGroup.setConnection_group_name(mySQLConnectionGroup.getName()); - connectionGroup.setType(mySQLConnectionGroup.getType()); + + switch(mySQLConnectionGroup.getType()) { + case BALANCING : + connectionGroup.setType(MySQLConstants.CONNECTION_GROUP_BALANCING); + break; + case ORGANIZATIONAL: + connectionGroup.setType(MySQLConstants.CONNECTION_GROUP_ORGANIZATIONAL); + break; + } // Update the connection in the database connectionGroupDAO.updateByPrimaryKeySelective(connectionGroup); diff --git a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AbstractConnectionGroup.java b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AbstractConnectionGroup.java index 7150aa305..8ba59f929 100644 --- a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AbstractConnectionGroup.java +++ b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AbstractConnectionGroup.java @@ -55,6 +55,11 @@ public abstract class AbstractConnectionGroup implements ConnectionGroup { */ private String identifier; + /** + * The type of this connection group. + */ + private ConnectionGroup.Type type; + @Override public String getName() { return name; @@ -74,6 +79,16 @@ public abstract class AbstractConnectionGroup implements ConnectionGroup { public void setIdentifier(String identifier) { this.identifier = identifier; } + + @Override + public ConnectionGroup.Type getType() { + return type; + } + + @Override + public void setType(ConnectionGroup.Type type) { + this.type = type; + } @Override public int hashCode() { diff --git a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/ConnectionGroup.java b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/ConnectionGroup.java index ac8eddd0f..b8d42293a 100644 --- a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/ConnectionGroup.java +++ b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/ConnectionGroup.java @@ -49,6 +49,10 @@ import net.sourceforge.guacamole.protocol.GuacamoleClientInformation; * @author James Muehlner */ public interface ConnectionGroup { + + public enum Type { + ORGANIZATIONAL, BALANCING + }; /** * Returns the name assigned to this ConnectionGroup. @@ -77,17 +81,17 @@ public interface ConnectionGroup { public void setIdentifier(String identifier); /** - * Sets whether this is a balancing ConnectionGroup. + * Set the type of this ConnectionGroup. * - * @param balancing whether this is a balancing ConnectionGroup. + * @param type The type of this ConnectionGroup. */ - public void setBalancing(boolean balancing); + public void setType(Type type); /** - * Returns true if this is a balancing ConnectionGroup, false otherwise. - * @return true if this is a balancing ConnectionGroup, false otherwise. + * Returns the type of this connection. + * @return the type of this connection. */ - public boolean isBalancing(); + public Type getType(); /** * Retrieves a Directory which can be used to view and manipulate diff --git a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionGroup.java b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionGroup.java index 338bf255e..8973367c0 100644 --- a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionGroup.java +++ b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionGroup.java @@ -64,6 +64,7 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup { Directory connectionGroupDirectory) { this.connectionDirectory = connectionDirectory; this.connectionGroupDirectory = connectionGroupDirectory; + this.setType(ConnectionGroup.Type.ORGANIZATIONAL); } @Override @@ -84,15 +85,4 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup { throw new GuacamoleSecurityException("Permission denied."); } - @Override - public void setBalancing(boolean balancing) { - // All SimpleConnectionGroups are organizational only - } - - @Override - public boolean isBalancing() { - // All SimpleConnectionGroups are organizational only - return false; - } - }