Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class UserData {

/**
* All connections accessible by this user. The key of each entry is both
* the connection identifier and the connection name.
* the connection identifier.
*/
private ConcurrentMap<String, Connection> connections;

Expand All @@ -63,6 +63,12 @@ public class UserData {
*/
public static class Connection {

/**
* The human-readable name of this connection. If unset, the connection
* key is used as the display name.
*/
private String name;

/**
* An arbitrary, opaque, unique ID for this connection. If specified
* via the "join" (primaryConnection) property of another connection,
Expand Down Expand Up @@ -98,6 +104,26 @@ public static class Connection {
*/
private boolean singleUse = false;

/**
* Returns the human-readable name of this connection, if any.
*
* @return
* The human-readable name of this connection, or null if unset.
*/
public String getName() {
return name;
}

/**
* Sets the human-readable name of this connection.
*
* @param name
* The human-readable name of this connection.
*/
public void setName(String name) {
this.name = name;
}

/**
* Returns an arbitrary, opaque, unique ID for this connection. If
* defined, this ID may be used via the "join" (primaryConnection)
Expand Down Expand Up @@ -319,7 +345,7 @@ public void setSingleUse(boolean singleUse) {
* Returns all connections stored within this UserData object as an
* unmodifiable map. Each of these connections is accessible by the user
* specified by getUsername(). The key of each entry within the map is the
* identifier and human-readable name of the corresponding connection.
* identifier of the corresponding connection.
*
* @return
* An unmodifiable map of all connections stored within this
Expand All @@ -334,7 +360,7 @@ public Map<String, Connection> getConnections() {
* Replaces all connections stored within this UserData object with the
* given connections. Each of these connections will be accessible by the
* user specified by getUsername(). The key of each entry within the map is
* the identifier and human-readable name of the corresponding connection.
* the identifier of the corresponding connection.
*
* @param connections
* A map of all connections to be stored within this UserData object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ public class UserDataConnection implements Connection {
private ConnectionService connectionService;

/**
* A human-readable value which both uniquely identifies this connection
* and serves as the connection display name.
* The unique identifier of this connection.
*/
private String identifier;

/**
* The human-readable name of this connection.
*/
private String name;

/**
* The UserData associated with this connection. This UserData will be
* automatically updated as this connection is used.
Expand All @@ -65,8 +69,8 @@ public class UserDataConnection implements Connection {

/**
* Initializes this UserDataConnection with the given data, unique
* identifier, and connection information. This function MUST be invoked
* before any particular UserDataConnection is actually used.
* identifier, display name, and connection information. This function MUST
* be invoked before any particular UserDataConnection is actually used.
*
* @param data
* The UserData that this connection should manage.
Expand All @@ -75,6 +79,9 @@ public class UserDataConnection implements Connection {
* The identifier associated with this connection within the given
* UserData.
*
* @param name
* The human-readable name of this connection.
*
* @param connection
* The connection data associated with this connection within the given
* UserData.
Expand All @@ -83,9 +90,10 @@ public class UserDataConnection implements Connection {
* A reference to this UserDataConnection.
*/
public UserDataConnection init(UserData data, String identifier,
UserData.Connection connection) {
String name, UserData.Connection connection) {

this.identifier = identifier;
this.name = name;
this.data = data;
this.connection = connection;

Expand All @@ -105,7 +113,7 @@ public void setIdentifier(String identifier) {

@Override
public String getName() {
return identifier;
return name;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,16 @@ public Directory<Connection> getConnectionDirectory(UserData userData) {
// Pull connection and associated identifier
String identifier = entry.getKey();
UserData.Connection connection = entry.getValue();
String name = connection.getName();
if (name == null || name.isEmpty())
name = identifier;

// Create Guacamole connection containing the defined identifier
// and parameters
Connection guacConnection = userDataConnectionProvider.get().init(
userData,
identifier,
name,
connection
);

Expand Down