Ticket #263: More work on connection groups.

This commit is contained in:
James Muehlner
2013-08-06 23:39:30 -07:00
parent 6747c51b38
commit bdc7a3db96
15 changed files with 778 additions and 107 deletions

View File

@@ -47,6 +47,11 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
*/
public abstract class AbstractConnection implements Connection {
/**
* The name associated with this connection.
*/
private String name;
/**
* The unique identifier associated with this connection.
*/
@@ -57,6 +62,16 @@ public abstract class AbstractConnection implements Connection {
*/
private GuacamoleConfiguration configuration;
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getIdentifier() {
return identifier;

View File

@@ -45,10 +45,25 @@ package net.sourceforge.guacamole.net.auth;
*/
public abstract class AbstractConnectionGroup implements ConnectionGroup {
/**
* The name associated with this connection group.
*/
private String name;
/**
* The unique identifier associated with this connection group.
*/
private String identifier;
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getIdentifier() {

View File

@@ -54,6 +54,19 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
*/
public interface Connection {
/**
* Returns the name assigned to this Connection.
* @return The name assigned to this Connection.
*/
public String getName();
/**
* Sets the name assigned to this Connection.
*
* @param identifier The name to assign.
*/
public void setName(String name);
/**
* Returns the unique identifier assigned to this Connection.
* @return The unique identifier assigned to this Connection.

View File

@@ -50,6 +50,19 @@ import net.sourceforge.guacamole.protocol.GuacamoleClientInformation;
*/
public interface ConnectionGroup {
/**
* Returns the name assigned to this ConnectionGroup.
* @return The name assigned to this ConnectionGroup.
*/
public String getName();
/**
* Sets the name assigned to this ConnectionGroup.
*
* @param identifier The name to assign.
*/
public void setName(String name);
/**
* Returns the unique identifier assigned to this ConnectionGroup.
* @return The unique identifier assigned to this ConnectionGroup.
@@ -62,6 +75,19 @@ public interface ConnectionGroup {
* @param identifier The identifier to assign.
*/
public void setIdentifier(String identifier);
/**
* Sets whether this is a balancing ConnectionGroup.
*
* @param balancing whether this is a balancing ConnectionGroup.
*/
public void setBalancing(boolean balancing);
/**
* Returns true if this is a balancing ConnectionGroup, false otherwise.
* @return true if this is a balancing ConnectionGroup, false otherwise.
*/
public boolean isBalancing();
/**
* Retrieves a Directory which can be used to view and manipulate

View File

@@ -73,12 +73,16 @@ public class SimpleConnection extends AbstractConnection {
* Creates a new SimpleConnection having the given identifier and
* GuacamoleConfiguration.
*
* @param identifier The identifier to associated with this connection.
* @param name The name to associate with this connection.
* @param identifier The identifier to associate with this connection.
* @param config The configuration describing how to connect to this
* connection.
*/
public SimpleConnection(String identifier,
public SimpleConnection(String name, String identifier,
GuacamoleConfiguration config) {
// Set name
setName(name);
// Set identifier
setIdentifier(identifier);

View File

@@ -76,7 +76,8 @@ public class SimpleConnectionDirectory
// Create connections for each config
for (Entry<String, GuacamoleConfiguration> entry : configs.entrySet())
connections.put(entry.getKey(),
new SimpleConnection(entry.getKey(), entry.getValue()));
new SimpleConnection(entry.getKey(), entry.getKey(),
entry.getValue()));
}

View File

@@ -84,4 +84,15 @@ 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;
}
}