mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-38: Clean up comments and make a couple of methods private.
This commit is contained in:
committed by
Nick Couchman
parent
6d0b6d6494
commit
97d2d3a2c9
@@ -31,8 +31,8 @@ import org.apache.guacamole.net.auth.Connection;
|
||||
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
|
||||
/**
|
||||
* Implementation of a directory to stored Connection objects
|
||||
* completely in-memory.
|
||||
* Implementation of a directory to store Connection objects
|
||||
* completely in memory.
|
||||
*/
|
||||
public class QuickConnectDirectory extends SimpleDirectory<Connection> {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class QuickConnectDirectory extends SimpleDirectory<Connection> {
|
||||
* identifier value of the new connection.
|
||||
*
|
||||
* @param config
|
||||
* The GuacamoleConfiguration to use to create the
|
||||
* The GuacamoleConfiguration object to use to create the
|
||||
* SimpleConnection object.
|
||||
*
|
||||
* @return
|
||||
@@ -100,23 +100,23 @@ public class QuickConnectDirectory extends SimpleDirectory<Connection> {
|
||||
*/
|
||||
public String create(GuacamoleConfiguration config) throws GuacamoleException {
|
||||
|
||||
// Get the next connection identifier.
|
||||
String connectionId = Integer.toString(getNextConnectionID());
|
||||
// Get the next available connection identifier.
|
||||
String newConnectionId = Integer.toString(getNextConnectionID());
|
||||
|
||||
// Generate a name for the configuration.
|
||||
String name = QCParser.getName(config);
|
||||
|
||||
// Create a new connection and set the parent identifier.
|
||||
Connection connection = new SimpleConnection(name, connectionId, config);
|
||||
Connection connection = new SimpleConnection(name, newConnectionId, config);
|
||||
connection.setParentIdentifier(QuickConnectUserContext.ROOT_IDENTIFIER);
|
||||
|
||||
// Place the object in this directory.
|
||||
add(connection);
|
||||
|
||||
// Add connection to the tree.
|
||||
this.rootGroup.addConnectionIdentifier(connectionId);
|
||||
rootGroup.addConnectionIdentifier(newConnectionId);
|
||||
|
||||
return connectionId;
|
||||
return newConnectionId;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ import org.apache.guacamole.net.auth.User;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleUser;
|
||||
|
||||
/**
|
||||
* A simple implementation of UserContext to support the QuickConnect
|
||||
* A simple implementation of UserContext to support this
|
||||
* extension, used for storing connections the user has created
|
||||
* with the QuickConnect bar in the webapp.
|
||||
*/
|
||||
@@ -71,12 +71,17 @@ public class QuickConnectUserContext extends AbstractUserContext {
|
||||
* this class.
|
||||
*
|
||||
* @param username
|
||||
* The name of the user logging in and using this class.
|
||||
* The name of the user logging in that will be associated
|
||||
* with this UserContext.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If errors occur initializing the ConnectionGroup,
|
||||
* ConnectionDirectory, or User.
|
||||
*/
|
||||
public QuickConnectUserContext(AuthenticationProvider authProvider,
|
||||
String username) throws GuacamoleException {
|
||||
|
||||
// Initialize the rootGroup to a basic connection group with a
|
||||
// Initialize the rootGroup to a QuickConnectionGroup with a
|
||||
// single root identifier.
|
||||
this.rootGroup = new QuickConnectionGroup(
|
||||
ROOT_IDENTIFIER,
|
||||
|
@@ -63,7 +63,7 @@ public class QuickConnectionGroup extends AbstractConnectionGroup {
|
||||
|
||||
/**
|
||||
* Add a connection identifier to this connection group, and
|
||||
* return the identifier if the add succeeds, otheriwse
|
||||
* return the identifier if the add succeeds, otherwise
|
||||
* return null.
|
||||
*
|
||||
* @param identifier
|
||||
@@ -81,6 +81,7 @@ public class QuickConnectionGroup extends AbstractConnectionGroup {
|
||||
|
||||
@Override
|
||||
public int getActiveConnections() {
|
||||
// This group does not track active connections.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -91,11 +92,13 @@ public class QuickConnectionGroup extends AbstractConnectionGroup {
|
||||
|
||||
@Override
|
||||
public Set<String> getConnectionGroupIdentifiers() {
|
||||
// This group contains only connections, not other groups.
|
||||
return Collections.<String>emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
// There are no attributes associated with this group.
|
||||
return Collections.<String, String>emptyMap();
|
||||
}
|
||||
|
||||
@@ -107,6 +110,7 @@ public class QuickConnectionGroup extends AbstractConnectionGroup {
|
||||
@Override
|
||||
public GuacamoleTunnel connect(GuacamoleClientInformation info)
|
||||
throws GuacamoleException {
|
||||
// This group does not support connections
|
||||
throw new GuacamoleSecurityException("Permission denied.");
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.guacamole.GuacamoleClientException;
|
||||
import org.apache.guacamole.GuacamoleServerException;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.quickconnect.QuickConnectException;
|
||||
@@ -65,17 +64,16 @@ public class QCParser {
|
||||
* The string form of the URI to be parsed.
|
||||
*
|
||||
* @return
|
||||
* A GuacamoleConfiguration using a combination of the parsed
|
||||
* URI values and default values when not specified in the
|
||||
* URI.
|
||||
* A GuacamoleConfiguration generated using the information
|
||||
* provided by the user in the URI.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* When an error occurs parsing the URI.
|
||||
* If an error occurs parsing the URI.
|
||||
*/
|
||||
public static GuacamoleConfiguration getConfiguration(String uri)
|
||||
throws GuacamoleException {
|
||||
|
||||
// Parse the URI object from provided string.
|
||||
// Parse the provided String into a URI object.
|
||||
URI qcUri;
|
||||
try {
|
||||
qcUri = new URI(uri);
|
||||
@@ -98,7 +96,7 @@ public class QCParser {
|
||||
// Generate a new GuacamoleConfiguration
|
||||
GuacamoleConfiguration qcConfig = new GuacamoleConfiguration();
|
||||
|
||||
// Check for provided protocol or use default
|
||||
// Check for protocol and set it, or throw an error if not present
|
||||
if (protocol != null && !protocol.isEmpty())
|
||||
qcConfig.setProtocol(protocol);
|
||||
else
|
||||
@@ -109,7 +107,7 @@ public class QCParser {
|
||||
if (port > 0)
|
||||
qcConfig.setParameter("port", Integer.toString(port));
|
||||
|
||||
// Check for provided host or use default
|
||||
// Check for provided host, or throw an error if not present
|
||||
if (host != null && !host.isEmpty())
|
||||
qcConfig.setParameter("hostname", host);
|
||||
else
|
||||
@@ -157,7 +155,7 @@ public class QCParser {
|
||||
* @throws UnsupportedEncodingException
|
||||
* If Java lacks UTF-8 support.
|
||||
*/
|
||||
public static Map<String, String> parseQueryString(String queryStr)
|
||||
private static Map<String, String> parseQueryString(String queryStr)
|
||||
throws UnsupportedEncodingException {
|
||||
|
||||
// Split the query string into the pairs
|
||||
@@ -189,7 +187,7 @@ public class QCParser {
|
||||
* @throws UnsupportedEncodingException
|
||||
* If Java lacks UTF-8 support.
|
||||
*/
|
||||
public static void parseUserInfo(String userInfo,
|
||||
private static void parseUserInfo(String userInfo,
|
||||
GuacamoleConfiguration config)
|
||||
throws UnsupportedEncodingException {
|
||||
|
||||
|
Reference in New Issue
Block a user