GUACAMOLE-38: Clean up comments and make a couple of methods private.

Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/97d2d3a2
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/97d2d3a2
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/97d2d3a2

Branch: refs/heads/master
Commit: 97d2d3a2c95403784bc3b0324194ef8be4333e13
Parents: 6d0b6d6
Author: Nick Couchman <nick_couch...@cotyinc.com>
Authored: Wed May 30 11:23:00 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Fri Jun 1 13:40:53 2018 -0400

----------------------------------------------------------------------
 .../auth/quickconnect/QuickConnectDirectory.java  | 16 ++++++++--------
 .../quickconnect/QuickConnectUserContext.java     | 11 ++++++++---
 .../auth/quickconnect/QuickConnectionGroup.java   |  6 +++++-
 .../auth/quickconnect/utility/QCParser.java       | 18 ++++++++----------
 4 files changed, 29 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/97d2d3a2/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectDirectory.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectDirectory.java
 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectDirectory.java
index 8841944..37b07ba 100644
--- 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectDirectory.java
+++ 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectDirectory.java
@@ -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;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/97d2d3a2/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectUserContext.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectUserContext.java
 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectUserContext.java
index 36a5a8f..d7e23ed 100644
--- 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectUserContext.java
+++ 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectUserContext.java
@@ -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,

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/97d2d3a2/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectionGroup.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectionGroup.java
 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectionGroup.java
index dfb60d1..cbce379 100644
--- 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectionGroup.java
+++ 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectionGroup.java
@@ -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.");
     }
 

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/97d2d3a2/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/utility/QCParser.java
----------------------------------------------------------------------
diff --git 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/utility/QCParser.java
 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/utility/QCParser.java
index f61f510..2924c0d 100644
--- 
a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/utility/QCParser.java
+++ 
b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/utility/QCParser.java
@@ -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 {
 

Reply via email to