Ticket #263: Switched to enum for connection group type.

This commit is contained in:
James Muehlner
2013-08-07 22:15:31 -07:00
parent a7f45e8244
commit 52490ca8ab
5 changed files with 36 additions and 53 deletions

View File

@@ -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() {

View File

@@ -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

View File

@@ -64,6 +64,7 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
Directory<String, ConnectionGroup> 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;
}
}