Remove trailing whitespace from lines.

This commit is contained in:
Michael Jumper
2013-02-21 11:31:29 -08:00
parent 3116ada14a
commit b2c3daf85f
24 changed files with 194 additions and 194 deletions

View File

@@ -290,12 +290,12 @@ public abstract class AuthenticatingHttpServlet extends HttpServlet {
* Function called after the credentials given in the request (if any) * Function called after the credentials given in the request (if any)
* are authenticated. If the current session is not associated with * are authenticated. If the current session is not associated with
* valid credentials, this function will not be called. * valid credentials, this function will not be called.
* *
* @param context The current UserContext. * @param context The current UserContext.
* @param request The HttpServletRequest being serviced. * @param request The HttpServletRequest being serviced.
* @param response An HttpServletResponse which controls the HTTP response * @param response An HttpServletResponse which controls the HTTP response
* of this servlet. * of this servlet.
* *
* @throws ServletException If an error occurs that interferes with the * @throws ServletException If an error occurs that interferes with the
* normal operation of this servlet. * normal operation of this servlet.
* @throws IOException If an error occurs that prevents this servlet from * @throws IOException If an error occurs that prevents this servlet from

View File

@@ -81,7 +81,7 @@ public class BasicFileAuthenticationProvider extends SimpleAuthenticationProvide
* the XML file specified by the "basic-user-mapping" property in * the XML file specified by the "basic-user-mapping" property in
* guacamole.properties. If the XML file has been modified or has not yet * guacamole.properties. If the XML file has been modified or has not yet
* been read, this function may reread the file. * been read, this function may reread the file.
* *
* @return A UserMapping containing all authorization data within the * @return A UserMapping containing all authorization data within the
* user mapping XML file. * user mapping XML file.
* @throws GuacamoleException If the user mapping property is missing or * @throws GuacamoleException If the user mapping property is missing or
@@ -106,7 +106,7 @@ public class BasicFileAuthenticationProvider extends SimpleAuthenticationProvide
// Get handler for root element // Get handler for root element
UserMappingTagHandler userMappingHandler = UserMappingTagHandler userMappingHandler =
new UserMappingTagHandler(); new UserMappingTagHandler();
// Set up document handler // Set up document handler
DocumentHandler contentHandler = new DocumentHandler( DocumentHandler contentHandler = new DocumentHandler(
"user-mapping", userMappingHandler); "user-mapping", userMappingHandler);

View File

@@ -177,12 +177,12 @@ public class BasicGuacamoleTunnelServlet extends AuthenticatingHttpServlet {
// Get connection directory // Get connection directory
Directory<String, Connection> directory = context.getConnectionDirectory(); Directory<String, Connection> directory = context.getConnectionDirectory();
// If no credentials in session, not authorized // If no credentials in session, not authorized
if (credentials == null) if (credentials == null)
throw new GuacamoleSecurityException("Cannot connect - user not logged in."); throw new GuacamoleSecurityException("Cannot connect - user not logged in.");
// Get authorized connection // Get authorized connection
Connection connection = directory.get(id); Connection connection = directory.get(id);
if (connection == null) { if (connection == null) {
logger.warn("Connection id={} not found.", id); logger.warn("Connection id={} not found.", id);
@@ -193,7 +193,7 @@ public class BasicGuacamoleTunnelServlet extends AuthenticatingHttpServlet {
// Get client information // Get client information
GuacamoleClientInformation info = new GuacamoleClientInformation(); GuacamoleClientInformation info = new GuacamoleClientInformation();
// Set width if provided // Set width if provided
String width = request.getParameter("width"); String width = request.getParameter("width");
if (width != null) if (width != null)
@@ -203,12 +203,12 @@ public class BasicGuacamoleTunnelServlet extends AuthenticatingHttpServlet {
String height = request.getParameter("height"); String height = request.getParameter("height");
if (height != null) if (height != null)
info.setOptimalScreenHeight(Integer.parseInt(height)); info.setOptimalScreenHeight(Integer.parseInt(height));
// Add audio mimetypes // Add audio mimetypes
String[] audio_mimetypes = request.getParameterValues("audio"); String[] audio_mimetypes = request.getParameterValues("audio");
if (audio_mimetypes != null) if (audio_mimetypes != null)
info.getAudioMimetypes().addAll(Arrays.asList(audio_mimetypes)); info.getAudioMimetypes().addAll(Arrays.asList(audio_mimetypes));
// Add video mimetypes // Add video mimetypes
String[] video_mimetypes = request.getParameterValues("video"); String[] video_mimetypes = request.getParameterValues("video");
if (video_mimetypes != null) if (video_mimetypes != null)

View File

@@ -84,7 +84,7 @@ public class GuacamoleClassLoader extends ClassLoader {
/** /**
* Creates a new GuacamoleClassLoader which reads classes from the given * Creates a new GuacamoleClassLoader which reads classes from the given
* directory. * directory.
* *
* @param libDirectory The directory to load classes from. * @param libDirectory The directory to load classes from.
* @throws GuacamoleException If the file given is not a director, or if * @throws GuacamoleException If the file given is not a director, or if
* an error occurs while constructing the URL * an error occurs while constructing the URL

View File

@@ -29,7 +29,7 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
* Mapping of username/password pair to configuration set. In addition to basic * Mapping of username/password pair to configuration set. In addition to basic
* storage of the username, password, and configurations, this class also * storage of the username, password, and configurations, this class also
* provides password validation functions. * provides password validation functions.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class Authorization { public class Authorization {
@@ -83,7 +83,7 @@ public class Authorization {
/** /**
* Produces a String containing the bytes provided in hexadecimal notation. * Produces a String containing the bytes provided in hexadecimal notation.
* *
* @param bytes The bytes to convert into hex. * @param bytes The bytes to convert into hex.
* @return A String containing the hex representation of the given bytes. * @return A String containing the hex representation of the given bytes.
*/ */
@@ -110,7 +110,7 @@ public class Authorization {
/** /**
* Returns the username associated with this authorization. * Returns the username associated with this authorization.
* *
* @return The username associated with this authorization. * @return The username associated with this authorization.
*/ */
public String getUsername() { public String getUsername() {
@@ -119,7 +119,7 @@ public class Authorization {
/** /**
* Sets the username associated with this authorization. * Sets the username associated with this authorization.
* *
* @param username The username to associate with this authorization. * @param username The username to associate with this authorization.
*/ */
public void setUsername(String username) { public void setUsername(String username) {
@@ -129,7 +129,7 @@ public class Authorization {
/** /**
* Returns the password associated with this authorization, which may be * Returns the password associated with this authorization, which may be
* encoded or hashed. * encoded or hashed.
* *
* @return The password associated with this authorization. * @return The password associated with this authorization.
*/ */
public String getPassword() { public String getPassword() {
@@ -140,7 +140,7 @@ public class Authorization {
* Sets the password associated with this authorization, which must be * Sets the password associated with this authorization, which must be
* encoded using the encoding specified with setEncoding(). By default, * encoded using the encoding specified with setEncoding(). By default,
* passwords are plain text. * passwords are plain text.
* *
* @param password Sets the password associated with this authorization. * @param password Sets the password associated with this authorization.
*/ */
public void setPassword(String password) { public void setPassword(String password) {
@@ -149,7 +149,7 @@ public class Authorization {
/** /**
* Returns the encoding used to hash the password, if any. * Returns the encoding used to hash the password, if any.
* *
* @return The encoding used to hash the password. * @return The encoding used to hash the password.
*/ */
public Encoding getEncoding() { public Encoding getEncoding() {
@@ -159,7 +159,7 @@ public class Authorization {
/** /**
* Sets the encoding which will be used to hash the password or when * Sets the encoding which will be used to hash the password or when
* comparing a given password for validation. * comparing a given password for validation.
* *
* @param encoding The encoding to use for password hashing. * @param encoding The encoding to use for password hashing.
*/ */
public void setEncoding(Encoding encoding) { public void setEncoding(Encoding encoding) {
@@ -170,7 +170,7 @@ public class Authorization {
* Returns whether a given username/password pair is authorized based on * Returns whether a given username/password pair is authorized based on
* the stored username and password. The password given must be plain text. * the stored username and password. The password given must be plain text.
* It will be hashed as necessary to perform the validation. * It will be hashed as necessary to perform the validation.
* *
* @param username The username to validate. * @param username The username to validate.
* @param password The password to validate. * @param password The password to validate.
* @return true if the username/password pair given is authorized, false * @return true if the username/password pair given is authorized, false
@@ -217,7 +217,7 @@ public class Authorization {
/** /**
* Returns the GuacamoleConfiguration having the given name and associated * Returns the GuacamoleConfiguration having the given name and associated
* with the username/password pair stored within this authorization. * with the username/password pair stored within this authorization.
* *
* @param name The name of the GuacamoleConfiguration to return. * @param name The name of the GuacamoleConfiguration to return.
* @return The GuacamoleConfiguration having the given name, or null if no * @return The GuacamoleConfiguration having the given name, or null if no
* such GuacamoleConfiguration exists. * such GuacamoleConfiguration exists.
@@ -229,19 +229,19 @@ public class Authorization {
/** /**
* Adds the given GuacamoleConfiguration to the set of stored configurations * Adds the given GuacamoleConfiguration to the set of stored configurations
* under the given name. * under the given name.
* *
* @param name The name to associate this GuacamoleConfiguration with. * @param name The name to associate this GuacamoleConfiguration with.
* @param config The GuacamoleConfiguration to store. * @param config The GuacamoleConfiguration to store.
*/ */
public void addConfiguration(String name, GuacamoleConfiguration config) { public void addConfiguration(String name, GuacamoleConfiguration config) {
configs.put(name, config); configs.put(name, config);
} }
/** /**
* Returns a Map of all stored GuacamoleConfigurations associated with the * Returns a Map of all stored GuacamoleConfigurations associated with the
* username/password pair stored within this authorization, indexed by * username/password pair stored within this authorization, indexed by
* configuration name. * configuration name.
* *
* @return A Map of all stored GuacamoleConfigurations. * @return A Map of all stored GuacamoleConfigurations.
*/ */
public Map<String, GuacamoleConfiguration> getConfigurations() { public Map<String, GuacamoleConfiguration> getConfigurations() {

View File

@@ -24,7 +24,7 @@ import java.util.Map;
/** /**
* Mapping of all usernames to corresponding authorizations. * Mapping of all usernames to corresponding authorizations.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class UserMapping { public class UserMapping {
@@ -34,10 +34,10 @@ public class UserMapping {
*/ */
private Map<String, Authorization> authorizations = private Map<String, Authorization> authorizations =
new HashMap<String, Authorization>(); new HashMap<String, Authorization>();
/** /**
* Adds the given authorization to the user mapping. * Adds the given authorization to the user mapping.
* *
* @param authorization The authorization to add to the user mapping. * @param authorization The authorization to add to the user mapping.
*/ */
public void addAuthorization(Authorization authorization) { public void addAuthorization(Authorization authorization) {
@@ -47,7 +47,7 @@ public class UserMapping {
/** /**
* Returns the authorization corresponding to the user having the given * Returns the authorization corresponding to the user having the given
* username, if any. * username, if any.
* *
* @param username The username to find the authorization for. * @param username The username to find the authorization for.
* @return The authorization corresponding to the user having the given * @return The authorization corresponding to the user having the given
* username, or null if no such authorization exists. * username, or null if no such authorization exists.
@@ -55,5 +55,5 @@ public class UserMapping {
public Authorization getAuthorization(String username) { public Authorization getAuthorization(String username) {
return authorizations.get(username); return authorizations.get(username);
} }
} }

View File

@@ -42,7 +42,7 @@ public class Create extends AuthenticatingHttpServlet {
* specific parameter meant for the configuration. * specific parameter meant for the configuration.
*/ */
public static final String PARAMETER_PREFIX = "_"; public static final String PARAMETER_PREFIX = "_";
@Override @Override
protected void authenticatedService( protected void authenticatedService(
UserContext context, UserContext context,
@@ -52,7 +52,7 @@ public class Create extends AuthenticatingHttpServlet {
// Get ID and protocol // Get ID and protocol
String identifier = request.getParameter("id"); String identifier = request.getParameter("id");
String protocol = request.getParameter("protocol"); String protocol = request.getParameter("protocol");
try { try {
// Attempt to get connection directory // Attempt to get connection directory
@@ -74,22 +74,22 @@ public class Create extends AuthenticatingHttpServlet {
config.setParameter( config.setParameter(
param.substring(PARAMETER_PREFIX.length()), param.substring(PARAMETER_PREFIX.length()),
request.getParameter(param)); request.getParameter(param));
} }
// Create connection skeleton // Create connection skeleton
Connection connection = new DummyConnection(); Connection connection = new DummyConnection();
connection.setIdentifier(identifier); connection.setIdentifier(identifier);
connection.setConfiguration(config); connection.setConfiguration(config);
// Add connection // Add connection
directory.add(connection); directory.add(connection);
} }
catch (GuacamoleException e) { catch (GuacamoleException e) {
throw new ServletException("Unable to create connection.", e); throw new ServletException("Unable to create connection.", e);
} }
} }
} }

View File

@@ -43,21 +43,21 @@ public class Delete extends AuthenticatingHttpServlet {
// Get ID // Get ID
String identifier = request.getParameter("id"); String identifier = request.getParameter("id");
try { try {
// Attempt to get connection directory // Attempt to get connection directory
Directory<String, Connection> directory = Directory<String, Connection> directory =
context.getConnectionDirectory(); context.getConnectionDirectory();
// Remove connection // Remove connection
directory.remove(identifier); directory.remove(identifier);
} }
catch (GuacamoleException e) { catch (GuacamoleException e) {
throw new ServletException("Unable to remove connection.", e); throw new ServletException("Unable to remove connection.", e);
} }
} }
} }

View File

@@ -15,7 +15,7 @@ import net.sourceforge.guacamole.protocol.GuacamoleClientInformation;
* semantics that would otherwise be present because of the authentication * semantics that would otherwise be present because of the authentication
* provider. It is up to the authentication provider to create a new * provider. It is up to the authentication provider to create a new
* Connection based on the information contained herein. * Connection based on the information contained herein.
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
public class DummyConnection extends AbstractConnection { public class DummyConnection extends AbstractConnection {

View File

@@ -52,11 +52,11 @@ public class List extends AuthenticatingHttpServlet {
* Checks whether the given user has permission to perform the given * Checks whether the given user has permission to perform the given
* system operation. Security exceptions are handled appropriately - only * system operation. Security exceptions are handled appropriately - only
* non-security exceptions pass through. * non-security exceptions pass through.
* *
* @param user The user whose permissions should be verified. * @param user The user whose permissions should be verified.
* @param type The type of operation to check for permission for. * @param type The type of operation to check for permission for.
* @return true if permission is granted, false otherwise. * @return true if permission is granted, false otherwise.
* *
* @throws GuacamoleException If an error occurs while checking permissions. * @throws GuacamoleException If an error occurs while checking permissions.
*/ */
private boolean hasConfigPermission(User user, SystemPermission.Type type) private boolean hasConfigPermission(User user, SystemPermission.Type type)
@@ -81,13 +81,13 @@ public class List extends AuthenticatingHttpServlet {
* Checks whether the given user has permission to perform the given * Checks whether the given user has permission to perform the given
* object operation. Security exceptions are handled appropriately - only * object operation. Security exceptions are handled appropriately - only
* non-security exceptions pass through. * non-security exceptions pass through.
* *
* @param user The user whose permissions should be verified. * @param user The user whose permissions should be verified.
* @param type The type of operation to check for permission for. * @param type The type of operation to check for permission for.
* @param identifier The identifier of the connection the operation * @param identifier The identifier of the connection the operation
* would be performed upon. * would be performed upon.
* @return true if permission is granted, false otherwise. * @return true if permission is granted, false otherwise.
* *
* @throws GuacamoleException If an error occurs while checking permissions. * @throws GuacamoleException If an error occurs while checking permissions.
*/ */
private boolean hasConfigPermission(User user, ObjectPermission.Type type, private boolean hasConfigPermission(User user, ObjectPermission.Type type,
@@ -110,7 +110,7 @@ public class List extends AuthenticatingHttpServlet {
} }
} }
@Override @Override
protected void authenticatedService( protected void authenticatedService(
UserContext context, UserContext context,
@@ -123,7 +123,7 @@ public class List extends AuthenticatingHttpServlet {
// Write XML content type // Write XML content type
response.setHeader("Content-Type", "text/xml"); response.setHeader("Content-Type", "text/xml");
// Attempt to get connections // Attempt to get connections
Directory<String, Connection> directory; Directory<String, Connection> directory;
try { try {
@@ -134,28 +134,28 @@ public class List extends AuthenticatingHttpServlet {
catch (GuacamoleException e) { catch (GuacamoleException e) {
throw new ServletException("Unable to retrieve connections.", e); throw new ServletException("Unable to retrieve connections.", e);
} }
// Write actual XML // Write actual XML
try { try {
// Get self // Get self
User self = context.self(); User self = context.self();
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
XMLStreamWriter xml = outputFactory.createXMLStreamWriter(response.getWriter()); XMLStreamWriter xml = outputFactory.createXMLStreamWriter(response.getWriter());
// Begin document // Begin document
xml.writeStartDocument(); xml.writeStartDocument();
xml.writeStartElement("connections"); xml.writeStartElement("connections");
// Save connection create permission attribute // Save connection create permission attribute
if (hasConfigPermission(self, SystemPermission.Type.CREATE)) if (hasConfigPermission(self, SystemPermission.Type.CREATE))
xml.writeAttribute("create", "yes"); xml.writeAttribute("create", "yes");
// For each entry, write corresponding connection element // For each entry, write corresponding connection element
for (String identifier : directory.getIdentifiers()) { for (String identifier : directory.getIdentifiers()) {
// Get connection // Get connection
Connection connection = directory.get(identifier); Connection connection = directory.get(identifier);
// Write connection // Write connection
@@ -168,12 +168,12 @@ public class List extends AuthenticatingHttpServlet {
if (hasConfigPermission(self, ObjectPermission.Type.ADMINISTER, if (hasConfigPermission(self, ObjectPermission.Type.ADMINISTER,
identifier)) identifier))
xml.writeAttribute("admin", "yes"); xml.writeAttribute("admin", "yes");
// Save delete permission attribute // Save delete permission attribute
if (hasConfigPermission(self, ObjectPermission.Type.DELETE, if (hasConfigPermission(self, ObjectPermission.Type.DELETE,
identifier)) identifier))
xml.writeAttribute("delete", "yes"); xml.writeAttribute("delete", "yes");
// Save update permission attribute, include parameters // Save update permission attribute, include parameters
if (hasConfigPermission(self, ObjectPermission.Type.UPDATE, if (hasConfigPermission(self, ObjectPermission.Type.UPDATE,
identifier)) { identifier)) {
@@ -209,7 +209,7 @@ public class List extends AuthenticatingHttpServlet {
if (record.getEndDate() != null) if (record.getEndDate() != null)
xml.writeAttribute("end", xml.writeAttribute("end",
Long.toString(record.getEndDate().getTime())); Long.toString(record.getEndDate().getTime()));
// User involved // User involved
xml.writeCharacters(record.getUser().getUsername()); xml.writeCharacters(record.getUser().getUsername());

View File

@@ -42,7 +42,7 @@ public class Update extends AuthenticatingHttpServlet {
* specific parameter meant for the configuration. * specific parameter meant for the configuration.
*/ */
public static final String PARAMETER_PREFIX = "_"; public static final String PARAMETER_PREFIX = "_";
@Override @Override
protected void authenticatedService( protected void authenticatedService(
UserContext context, UserContext context,
@@ -52,7 +52,7 @@ public class Update extends AuthenticatingHttpServlet {
// Get ID and protocol // Get ID and protocol
String identifier = request.getParameter("id"); String identifier = request.getParameter("id");
String protocol = request.getParameter("protocol"); String protocol = request.getParameter("protocol");
try { try {
// Attempt to get connection directory // Attempt to get connection directory
@@ -74,22 +74,22 @@ public class Update extends AuthenticatingHttpServlet {
config.setParameter( config.setParameter(
param.substring(PARAMETER_PREFIX.length()), param.substring(PARAMETER_PREFIX.length()),
request.getParameter(param)); request.getParameter(param));
} }
// Create connection skeleton // Create connection skeleton
Connection connection = new DummyConnection(); Connection connection = new DummyConnection();
connection.setIdentifier(identifier); connection.setIdentifier(identifier);
connection.setConfiguration(config); connection.setConfiguration(config);
// Update connection // Update connection
directory.update(connection); directory.update(connection);
} }
catch (GuacamoleException e) { catch (GuacamoleException e) {
throw new ServletException("Unable to update connection.", e); throw new ServletException("Unable to update connection.", e);
} }
} }
} }

View File

@@ -46,24 +46,24 @@ import net.sourceforge.guacamole.net.basic.AuthenticatingHttpServlet;
* @author Michael Jumper * @author Michael Jumper
*/ */
public class List extends AuthenticatingHttpServlet { public class List extends AuthenticatingHttpServlet {
/** /**
* Returns the XML attribute value representation of the given * Returns the XML attribute value representation of the given
* SystemPermission.Type. * SystemPermission.Type.
* *
* @param type The SystemPermission.Type to translate into a String. * @param type The SystemPermission.Type to translate into a String.
* @return The XML attribute value representation of the given * @return The XML attribute value representation of the given
* SystemPermission.Type. * SystemPermission.Type.
* *
* @throws GuacamoleException If the type given is not implemented. * @throws GuacamoleException If the type given is not implemented.
*/ */
private String toString(SystemPermission.Type type) private String toString(SystemPermission.Type type)
throws GuacamoleException { throws GuacamoleException {
switch (type) { switch (type) {
case CREATE: return "create"; case CREATE: return "create";
} }
throw new GuacamoleException("Unknown permission type: " + type); throw new GuacamoleException("Unknown permission type: " + type);
} }
@@ -71,14 +71,14 @@ public class List extends AuthenticatingHttpServlet {
/** /**
* Returns the XML attribute value representation of the given * Returns the XML attribute value representation of the given
* ObjectPermission.Type. * ObjectPermission.Type.
* *
* @param type The ObjectPermission.Type to translate into a String. * @param type The ObjectPermission.Type to translate into a String.
* @return The XML attribute value representation of the given * @return The XML attribute value representation of the given
* ObjectPermission.Type. * ObjectPermission.Type.
* *
* @throws GuacamoleException If the type given is not implemented. * @throws GuacamoleException If the type given is not implemented.
*/ */
private String toString(ObjectPermission.Type type) private String toString(ObjectPermission.Type type)
throws GuacamoleException { throws GuacamoleException {
switch (type) { switch (type) {
@@ -91,7 +91,7 @@ public class List extends AuthenticatingHttpServlet {
throw new GuacamoleException("Unknown permission type: " + type); throw new GuacamoleException("Unknown permission type: " + type);
} }
@Override @Override
protected void authenticatedService( protected void authenticatedService(
UserContext context, UserContext context,
@@ -105,14 +105,14 @@ public class List extends AuthenticatingHttpServlet {
try { try {
User user; User user;
// Get username // Get username
String username = request.getParameter("user"); String username = request.getParameter("user");
if (username != null) { if (username != null) {
// Get user directory // Get user directory
Directory<String, User> users = context.getUserDirectory(); Directory<String, User> users = context.getUserDirectory();
// Get specific user // Get specific user
user = users.get(username); user = users.get(username);
if (user == null) if (user == null)
@@ -121,10 +121,10 @@ public class List extends AuthenticatingHttpServlet {
} }
else else
user = context.self(); user = context.self();
// Write XML content type // Write XML content type
response.setHeader("Content-Type", "text/xml"); response.setHeader("Content-Type", "text/xml");
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
XMLStreamWriter xml = outputFactory.createXMLStreamWriter(response.getWriter()); XMLStreamWriter xml = outputFactory.createXMLStreamWriter(response.getWriter());
@@ -132,7 +132,7 @@ public class List extends AuthenticatingHttpServlet {
xml.writeStartDocument(); xml.writeStartDocument();
xml.writeStartElement("permissions"); xml.writeStartElement("permissions");
xml.writeAttribute("user", user.getUsername()); xml.writeAttribute("user", user.getUsername());
// For each entry, write corresponding user element // For each entry, write corresponding user element
for (Permission permission : user.getPermissions()) { for (Permission permission : user.getPermissions()) {
@@ -142,8 +142,8 @@ public class List extends AuthenticatingHttpServlet {
// Get permission // Get permission
ConnectionDirectoryPermission cdp = ConnectionDirectoryPermission cdp =
(ConnectionDirectoryPermission) permission; (ConnectionDirectoryPermission) permission;
// Write permission // Write permission
xml.writeEmptyElement("connections"); xml.writeEmptyElement("connections");
xml.writeAttribute("type", toString(cdp.getType())); xml.writeAttribute("type", toString(cdp.getType()));
@@ -155,8 +155,8 @@ public class List extends AuthenticatingHttpServlet {
// Get permission // Get permission
ConnectionPermission cp = ConnectionPermission cp =
(ConnectionPermission) permission; (ConnectionPermission) permission;
// Write permission // Write permission
xml.writeEmptyElement("connection"); xml.writeEmptyElement("connection");
xml.writeAttribute("type", toString(cp.getType())); xml.writeAttribute("type", toString(cp.getType()));
xml.writeAttribute("name", cp.getObjectIdentifier()); xml.writeAttribute("name", cp.getObjectIdentifier());
@@ -169,8 +169,8 @@ public class List extends AuthenticatingHttpServlet {
// Get permission // Get permission
UserDirectoryPermission udp = UserDirectoryPermission udp =
(UserDirectoryPermission) permission; (UserDirectoryPermission) permission;
// Write permission // Write permission
xml.writeEmptyElement("users"); xml.writeEmptyElement("users");
xml.writeAttribute("type", toString(udp.getType())); xml.writeAttribute("type", toString(udp.getType()));
@@ -181,8 +181,8 @@ public class List extends AuthenticatingHttpServlet {
// Get permission // Get permission
UserPermission up = (UserPermission) permission; UserPermission up = (UserPermission) permission;
// Write permission // Write permission
xml.writeEmptyElement("user"); xml.writeEmptyElement("user");
xml.writeAttribute("type", toString(up.getType())); xml.writeAttribute("type", toString(up.getType()));
xml.writeAttribute("name", up.getObjectIdentifier()); xml.writeAttribute("name", up.getObjectIdentifier());

View File

@@ -44,7 +44,7 @@ public class Create extends AuthenticatingHttpServlet {
// Create user as specified // Create user as specified
String username = request.getParameter("name"); String username = request.getParameter("name");
try { try {
// Attempt to get user directory // Attempt to get user directory
@@ -55,16 +55,16 @@ public class Create extends AuthenticatingHttpServlet {
User user = new DummyUser(); User user = new DummyUser();
user.setUsername(username); user.setUsername(username);
user.setPassword(UUID.randomUUID().toString()); user.setPassword(UUID.randomUUID().toString());
// Add user // Add user
directory.add(user); directory.add(user);
} }
catch (GuacamoleException e) { catch (GuacamoleException e) {
throw new ServletException("Unable to create user.", e); throw new ServletException("Unable to create user.", e);
} }
} }
} }

View File

@@ -41,22 +41,22 @@ public class Delete extends AuthenticatingHttpServlet {
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException { throws IOException, ServletException {
// Get username // Get username
String username = request.getParameter("name"); String username = request.getParameter("name");
try { try {
// Attempt to get user directory // Attempt to get user directory
Directory<String, User> directory = context.getUserDirectory(); Directory<String, User> directory = context.getUserDirectory();
// Remove user // Remove user
directory.remove(username); directory.remove(username);
} }
catch (GuacamoleException e) { catch (GuacamoleException e) {
throw new ServletException("Unable to remove user.", e); throw new ServletException("Unable to remove user.", e);
} }
} }
} }

View File

@@ -22,7 +22,7 @@ public class DummyUser extends AbstractUser {
* Set of all available permissions. * Set of all available permissions.
*/ */
private Set<Permission> permissions = new HashSet<Permission>(); private Set<Permission> permissions = new HashSet<Permission>();
@Override @Override
public Set<Permission> getPermissions() throws GuacamoleException { public Set<Permission> getPermissions() throws GuacamoleException {
return permissions; return permissions;

View File

@@ -49,11 +49,11 @@ public class List extends AuthenticatingHttpServlet {
* Checks whether the given user has permission to perform the given * Checks whether the given user has permission to perform the given
* system operation. Security exceptions are handled appropriately - only * system operation. Security exceptions are handled appropriately - only
* non-security exceptions pass through. * non-security exceptions pass through.
* *
* @param user The user whose permissions should be verified. * @param user The user whose permissions should be verified.
* @param type The type of operation to check for permission for. * @param type The type of operation to check for permission for.
* @return true if permission is granted, false otherwise. * @return true if permission is granted, false otherwise.
* *
* @throws GuacamoleException If an error occurs while checking permissions. * @throws GuacamoleException If an error occurs while checking permissions.
*/ */
private boolean hasUserPermission(User user, SystemPermission.Type type) private boolean hasUserPermission(User user, SystemPermission.Type type)
@@ -77,13 +77,13 @@ public class List extends AuthenticatingHttpServlet {
* Checks whether the given user has permission to perform the given * Checks whether the given user has permission to perform the given
* object operation. Security exceptions are handled appropriately - only * object operation. Security exceptions are handled appropriately - only
* non-security exceptions pass through. * non-security exceptions pass through.
* *
* @param user The user whose permissions should be verified. * @param user The user whose permissions should be verified.
* @param type The type of operation to check for permission for. * @param type The type of operation to check for permission for.
* @param identifier The identifier of the user the operation would be * @param identifier The identifier of the user the operation would be
* performed upon. * performed upon.
* @return true if permission is granted, false otherwise. * @return true if permission is granted, false otherwise.
* *
* @throws GuacamoleException If an error occurs while checking permissions. * @throws GuacamoleException If an error occurs while checking permissions.
*/ */
private boolean hasUserPermission(User user, ObjectPermission.Type type, private boolean hasUserPermission(User user, ObjectPermission.Type type,
@@ -103,7 +103,7 @@ public class List extends AuthenticatingHttpServlet {
} }
} }
@Override @Override
protected void authenticatedService( protected void authenticatedService(
UserContext context, UserContext context,
@@ -121,7 +121,7 @@ public class List extends AuthenticatingHttpServlet {
// Get user directory // Get user directory
Directory<String, User> directory = context.getUserDirectory(); Directory<String, User> directory = context.getUserDirectory();
// Get users // Get users
Set<String> users = directory.getIdentifiers(); Set<String> users = directory.getIdentifiers();
@@ -134,18 +134,18 @@ public class List extends AuthenticatingHttpServlet {
// Begin document // Begin document
xml.writeStartDocument(); xml.writeStartDocument();
xml.writeStartElement("users"); xml.writeStartElement("users");
// Save user create permission attribute // Save user create permission attribute
if (hasUserPermission(self, SystemPermission.Type.CREATE)) if (hasUserPermission(self, SystemPermission.Type.CREATE))
xml.writeAttribute("create", "yes"); xml.writeAttribute("create", "yes");
// For each entry, write corresponding user element // For each entry, write corresponding user element
for (String username : users) { for (String username : users) {
// Get user // Get user
User user = directory.get(username); User user = directory.get(username);
// Write user // Write user
xml.writeEmptyElement("user"); xml.writeEmptyElement("user");
xml.writeAttribute("name", user.getUsername()); xml.writeAttribute("name", user.getUsername());
@@ -153,17 +153,17 @@ public class List extends AuthenticatingHttpServlet {
if (hasUserPermission(self, ObjectPermission.Type.UPDATE, if (hasUserPermission(self, ObjectPermission.Type.UPDATE,
user.getUsername())) user.getUsername()))
xml.writeAttribute("update", "yes"); xml.writeAttribute("update", "yes");
// Save admin permission attribute // Save admin permission attribute
if (hasUserPermission(self, ObjectPermission.Type.ADMINISTER, if (hasUserPermission(self, ObjectPermission.Type.ADMINISTER,
user.getUsername())) user.getUsername()))
xml.writeAttribute("admin", "yes"); xml.writeAttribute("admin", "yes");
// Save delete permission attribute // Save delete permission attribute
if (hasUserPermission(self, ObjectPermission.Type.DELETE, if (hasUserPermission(self, ObjectPermission.Type.DELETE,
user.getUsername())) user.getUsername()))
xml.writeAttribute("delete", "yes"); xml.writeAttribute("delete", "yes");
} }
// End document // End document

View File

@@ -46,22 +46,22 @@ public class Update extends AuthenticatingHttpServlet {
* String given for directory creation permission. * String given for directory creation permission.
*/ */
private static final String CREATE_PERMISSION = "create"; private static final String CREATE_PERMISSION = "create";
/** /**
* Prefix given before an object identifier for read permission. * Prefix given before an object identifier for read permission.
*/ */
private static final String READ_PREFIX = "read:"; private static final String READ_PREFIX = "read:";
/** /**
* Prefix given before an object identifier for delete permission. * Prefix given before an object identifier for delete permission.
*/ */
private static final String DELETE_PREFIX = "delete:"; private static final String DELETE_PREFIX = "delete:";
/** /**
* Prefix given before an object identifier for update permission. * Prefix given before an object identifier for update permission.
*/ */
private static final String UPDATE_PREFIX = "update:"; private static final String UPDATE_PREFIX = "update:";
/** /**
* Prefix given before an object identifier for administration permission. * Prefix given before an object identifier for administration permission.
*/ */
@@ -69,7 +69,7 @@ public class Update extends AuthenticatingHttpServlet {
/** /**
* Given a permission string, returns the corresponding user permission. * Given a permission string, returns the corresponding user permission.
* *
* @param str The permission string to parse. * @param str The permission string to parse.
* @return The parsed user permission. * @return The parsed user permission.
* @throws GuacamoleException If the given string could not be parsed. * @throws GuacamoleException If the given string could not be parsed.
@@ -80,18 +80,18 @@ public class Update extends AuthenticatingHttpServlet {
// Create permission // Create permission
if (str.equals(CREATE_PERMISSION)) if (str.equals(CREATE_PERMISSION))
return new UserDirectoryPermission(SystemPermission.Type.CREATE); return new UserDirectoryPermission(SystemPermission.Type.CREATE);
// Read // Read
if (str.startsWith(READ_PREFIX)) if (str.startsWith(READ_PREFIX))
return new UserPermission(ObjectPermission.Type.READ, return new UserPermission(ObjectPermission.Type.READ,
str.substring(READ_PREFIX.length())); str.substring(READ_PREFIX.length()));
// Update // Update
if (str.startsWith(UPDATE_PREFIX)) if (str.startsWith(UPDATE_PREFIX))
return new UserPermission(ObjectPermission.Type.UPDATE, return new UserPermission(ObjectPermission.Type.UPDATE,
str.substring(UPDATE_PREFIX.length())); str.substring(UPDATE_PREFIX.length()));
// Delete // Delete
if (str.startsWith(DELETE_PREFIX)) if (str.startsWith(DELETE_PREFIX))
return new UserPermission(ObjectPermission.Type.DELETE, return new UserPermission(ObjectPermission.Type.DELETE,
str.substring(DELETE_PREFIX.length())); str.substring(DELETE_PREFIX.length()));
@@ -100,15 +100,15 @@ public class Update extends AuthenticatingHttpServlet {
if (str.startsWith(ADMIN_PREFIX)) if (str.startsWith(ADMIN_PREFIX))
return new UserPermission(ObjectPermission.Type.ADMINISTER, return new UserPermission(ObjectPermission.Type.ADMINISTER,
str.substring(ADMIN_PREFIX.length())); str.substring(ADMIN_PREFIX.length()));
throw new GuacamoleException("Invalid permission string."); throw new GuacamoleException("Invalid permission string.");
} }
/** /**
* Given a permission string, returns the corresponding connection * Given a permission string, returns the corresponding connection
* permission. * permission.
* *
* @param str The permission string to parse. * @param str The permission string to parse.
* @return The parsed connection permission. * @return The parsed connection permission.
* @throws GuacamoleException If the given string could not be parsed. * @throws GuacamoleException If the given string could not be parsed.
@@ -119,18 +119,18 @@ public class Update extends AuthenticatingHttpServlet {
// Create permission // Create permission
if (str.equals(CREATE_PERMISSION)) if (str.equals(CREATE_PERMISSION))
return new ConnectionDirectoryPermission(SystemPermission.Type.CREATE); return new ConnectionDirectoryPermission(SystemPermission.Type.CREATE);
// Read // Read
if (str.startsWith(READ_PREFIX)) if (str.startsWith(READ_PREFIX))
return new ConnectionPermission(ObjectPermission.Type.READ, return new ConnectionPermission(ObjectPermission.Type.READ,
str.substring(READ_PREFIX.length())); str.substring(READ_PREFIX.length()));
// Update // Update
if (str.startsWith(UPDATE_PREFIX)) if (str.startsWith(UPDATE_PREFIX))
return new ConnectionPermission(ObjectPermission.Type.UPDATE, return new ConnectionPermission(ObjectPermission.Type.UPDATE,
str.substring(UPDATE_PREFIX.length())); str.substring(UPDATE_PREFIX.length()));
// Delete // Delete
if (str.startsWith(DELETE_PREFIX)) if (str.startsWith(DELETE_PREFIX))
return new ConnectionPermission(ObjectPermission.Type.DELETE, return new ConnectionPermission(ObjectPermission.Type.DELETE,
str.substring(DELETE_PREFIX.length())); str.substring(DELETE_PREFIX.length()));
@@ -139,11 +139,11 @@ public class Update extends AuthenticatingHttpServlet {
if (str.startsWith(ADMIN_PREFIX)) if (str.startsWith(ADMIN_PREFIX))
return new ConnectionPermission(ObjectPermission.Type.ADMINISTER, return new ConnectionPermission(ObjectPermission.Type.ADMINISTER,
str.substring(ADMIN_PREFIX.length())); str.substring(ADMIN_PREFIX.length()));
throw new GuacamoleException("Invalid permission string."); throw new GuacamoleException("Invalid permission string.");
} }
@Override @Override
protected void authenticatedService( protected void authenticatedService(
UserContext context, UserContext context,
@@ -153,7 +153,7 @@ public class Update extends AuthenticatingHttpServlet {
// Create user as specified // Create user as specified
String username = request.getParameter("name"); String username = request.getParameter("name");
String password = request.getParameter("password"); String password = request.getParameter("password");
try { try {
// Attempt to get user directory // Attempt to get user directory
@@ -165,7 +165,7 @@ public class Update extends AuthenticatingHttpServlet {
user.setUsername(username); user.setUsername(username);
if (password != null) if (password != null)
user.setPassword(password); user.setPassword(password);
// Set user permissions // Set user permissions
String[] user_permission = request.getParameterValues("user"); String[] user_permission = request.getParameterValues("user");
if (user_permission != null) { if (user_permission != null) {
@@ -179,15 +179,15 @@ public class Update extends AuthenticatingHttpServlet {
for (String str : connection_permission) for (String str : connection_permission)
user.addPermission(parseConnectionPermission(str)); user.addPermission(parseConnectionPermission(str));
} }
// Update user // Update user
directory.update(user); directory.update(user);
} }
catch (GuacamoleException e) { catch (GuacamoleException e) {
throw new ServletException("Unable to update user.", e); throw new ServletException("Unable to update user.", e);
} }
} }
} }

View File

@@ -27,7 +27,7 @@ import org.xml.sax.helpers.DefaultHandler;
* A simple ContentHandler implementation which digests SAX document events and * A simple ContentHandler implementation which digests SAX document events and
* produces simpler tag-level events, maintaining its own stack for the * produces simpler tag-level events, maintaining its own stack for the
* convenience of the tag handlers. * convenience of the tag handlers.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class DocumentHandler extends DefaultHandler { public class DocumentHandler extends DefaultHandler {
@@ -36,7 +36,7 @@ public class DocumentHandler extends DefaultHandler {
* The name of the root element of the document. * The name of the root element of the document.
*/ */
private String rootElementName; private String rootElementName;
/** /**
* The handler which will be used to handle element events for the root * The handler which will be used to handle element events for the root
* element of the document. * element of the document.
@@ -55,7 +55,7 @@ public class DocumentHandler extends DefaultHandler {
/** /**
* Creates a new DocumentHandler which will use the given TagHandler * Creates a new DocumentHandler which will use the given TagHandler
* to handle the root element. * to handle the root element.
* *
* @param rootElementName The name of the root element of the document * @param rootElementName The name of the root element of the document
* being handled. * being handled.
* @param root The TagHandler to use for the root element. * @param root The TagHandler to use for the root element.
@@ -64,11 +64,11 @@ public class DocumentHandler extends DefaultHandler {
this.root = root; this.root = root;
this.rootElementName = rootElementName; this.rootElementName = rootElementName;
} }
/** /**
* Returns the current element state. The current element state is the * Returns the current element state. The current element state is the
* state of the element the parser is currently within. * state of the element the parser is currently within.
* *
* @return The current element state. * @return The current element state.
*/ */
private DocumentHandlerState getCurrentState() { private DocumentHandlerState getCurrentState() {
@@ -79,14 +79,14 @@ public class DocumentHandler extends DefaultHandler {
return stack.getLast(); return stack.getLast();
} }
@Override @Override
public void startElement(String uri, String localName, String qName, public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException { Attributes attributes) throws SAXException {
// Get current state // Get current state
DocumentHandlerState current = getCurrentState(); DocumentHandlerState current = getCurrentState();
// Handler for tag just read // Handler for tag just read
TagHandler handler; TagHandler handler;
@@ -96,7 +96,7 @@ public class DocumentHandler extends DefaultHandler {
// Validate element name // Validate element name
if (!localName.equals(rootElementName)) if (!localName.equals(rootElementName))
throw new SAXException("Root element must be '" + rootElementName + "'"); throw new SAXException("Root element must be '" + rootElementName + "'");
handler = root; handler = root;
} }
@@ -109,10 +109,10 @@ public class DocumentHandler extends DefaultHandler {
// If no handler returned, the element was not expected // If no handler returned, the element was not expected
if (handler == null) if (handler == null)
throw new SAXException("Unexpected element: '" + localName + "'"); throw new SAXException("Unexpected element: '" + localName + "'");
// Append new element state to stack // Append new element state to stack
stack.addLast(new DocumentHandlerState(handler)); stack.addLast(new DocumentHandlerState(handler));
} }
@Override @Override
@@ -152,12 +152,12 @@ public class DocumentHandler extends DefaultHandler {
* element currently being parsed. * element currently being parsed.
*/ */
private TagHandler tagHandler; private TagHandler tagHandler;
/** /**
* Creates a new DocumentHandlerState which will maintain the state * Creates a new DocumentHandlerState which will maintain the state
* of parsing of the current element, as well as contain the TagHandler * of parsing of the current element, as well as contain the TagHandler
* which will receive events related to that element. * which will receive events related to that element.
* *
* @param tagHandler The TagHandler which should receive any events * @param tagHandler The TagHandler which should receive any events
* related to the element being parsed. * related to the element being parsed.
*/ */
@@ -168,7 +168,7 @@ public class DocumentHandler extends DefaultHandler {
/** /**
* Returns the mutable StringBuilder which contains the current text * Returns the mutable StringBuilder which contains the current text
* content of the element being parsed. * content of the element being parsed.
* *
* @return The mutable StringBuilder which contains the current text * @return The mutable StringBuilder which contains the current text
* content of the element being parsed. * content of the element being parsed.
*/ */
@@ -179,14 +179,14 @@ public class DocumentHandler extends DefaultHandler {
/** /**
* Returns the TagHandler which must handle any events relating to the * Returns the TagHandler which must handle any events relating to the
* element being parsed. * element being parsed.
* *
* @return The TagHandler which must handle any events relating to the * @return The TagHandler which must handle any events relating to the
* element being parsed. * element being parsed.
*/ */
public TagHandler getTagHandler() { public TagHandler getTagHandler() {
return tagHandler; return tagHandler;
} }
} }
} }

View File

@@ -24,14 +24,14 @@ import org.xml.sax.SAXException;
/** /**
* A simple element-level event handler for events triggered by the * A simple element-level event handler for events triggered by the
* SAX-driven DocumentHandler parser. * SAX-driven DocumentHandler parser.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public interface TagHandler { public interface TagHandler {
/** /**
* Called when a child element of the current element is parsed. * Called when a child element of the current element is parsed.
* *
* @param localName The local name of the child element seen. * @param localName The local name of the child element seen.
* @param attributes The attributes of the child element seen. * @param attributes The attributes of the child element seen.
* @return The TagHandler which should handle all element-level events * @return The TagHandler which should handle all element-level events
@@ -42,16 +42,16 @@ public interface TagHandler {
*/ */
public TagHandler childElement(String localName, Attributes attributes) public TagHandler childElement(String localName, Attributes attributes)
throws SAXException; throws SAXException;
/** /**
* Called when this element, and all child elements, have been fully parsed, * Called when this element, and all child elements, have been fully parsed,
* and the entire text content of this element (if any) is available. * and the entire text content of this element (if any) is available.
* *
* @param textContent The full text content of this element, if any. * @param textContent The full text content of this element, if any.
* @throws SAXException If the text content received is not valid for any * @throws SAXException If the text content received is not valid for any
* reason, or the child elements parsed are not * reason, or the child elements parsed are not
* correct. * correct.
*/ */
public void complete(String textContent) throws SAXException; public void complete(String textContent) throws SAXException;
} }

View File

@@ -26,8 +26,8 @@ import org.xml.sax.SAXException;
/** /**
* TagHandler for the "authorize" element. * TagHandler for the "authorize" element.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class AuthorizeTagHandler implements TagHandler { public class AuthorizeTagHandler implements TagHandler {
@@ -43,11 +43,11 @@ public class AuthorizeTagHandler implements TagHandler {
* tags occur outside a "connection" tag. * tags occur outside a "connection" tag.
*/ */
private GuacamoleConfiguration default_config = null; private GuacamoleConfiguration default_config = null;
/** /**
* Creates a new handler for an "authorize" tag having the given * Creates a new handler for an "authorize" tag having the given
* attributes. * attributes.
* *
* @param attributes The attributes of the "authorize" tag. * @param attributes The attributes of the "authorize" tag.
* @throws SAXException If the attributes given are not valid. * @throws SAXException If the attributes given are not valid.
*/ */
@@ -73,9 +73,9 @@ public class AuthorizeTagHandler implements TagHandler {
else else
throw new SAXException( throw new SAXException(
"Invalid encoding: '" + encoding + "'"); "Invalid encoding: '" + encoding + "'");
} }
} }
@Override @Override
@@ -90,7 +90,7 @@ public class AuthorizeTagHandler implements TagHandler {
// Store configuration stub // Store configuration stub
GuacamoleConfiguration config_stub = tagHandler.asGuacamoleConfiguration(); GuacamoleConfiguration config_stub = tagHandler.asGuacamoleConfiguration();
authorization.addConfiguration(tagHandler.getName(), config_stub); authorization.addConfiguration(tagHandler.getName(), config_stub);
return tagHandler; return tagHandler;
} }
@@ -119,7 +119,7 @@ public class AuthorizeTagHandler implements TagHandler {
} }
return null; return null;
} }
@Override @Override
@@ -132,12 +132,12 @@ public class AuthorizeTagHandler implements TagHandler {
* handler. This Authorization is guaranteed to at least have the username, * handler. This Authorization is guaranteed to at least have the username,
* password, and encoding available. Any associated configurations will be * password, and encoding available. Any associated configurations will be
* added dynamically as the authorize tag is parsed. * added dynamically as the authorize tag is parsed.
* *
* @return An Authorization backed by the data of this authorize tag * @return An Authorization backed by the data of this authorize tag
* handler. * handler.
*/ */
public Authorization asAuthorization() { public Authorization asAuthorization() {
return authorization; return authorization;
} }
} }

View File

@@ -25,8 +25,8 @@ import org.xml.sax.SAXException;
/** /**
* TagHandler for the "connection" element. * TagHandler for the "connection" element.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class ConnectionTagHandler implements TagHandler { public class ConnectionTagHandler implements TagHandler {
@@ -34,16 +34,16 @@ public class ConnectionTagHandler implements TagHandler {
* The GuacamoleConfiguration backing this tag handler. * The GuacamoleConfiguration backing this tag handler.
*/ */
private GuacamoleConfiguration config = new GuacamoleConfiguration(); private GuacamoleConfiguration config = new GuacamoleConfiguration();
/** /**
* The name associated with the connection being parsed. * The name associated with the connection being parsed.
*/ */
private String name; private String name;
/** /**
* Creates a new handler for an "connection" tag having the given * Creates a new handler for an "connection" tag having the given
* attributes. * attributes.
* *
* @param attributes The attributes of the "connection" tag. * @param attributes The attributes of the "connection" tag.
* @throws SAXException If the attributes given are not valid. * @throws SAXException If the attributes given are not valid.
*/ */
@@ -61,20 +61,20 @@ public class ConnectionTagHandler implements TagHandler {
return new ProtocolTagHandler(config); return new ProtocolTagHandler(config);
return null; return null;
} }
@Override @Override
public void complete(String textContent) throws SAXException { public void complete(String textContent) throws SAXException {
// Do nothing // Do nothing
} }
/** /**
* Returns a GuacamoleConfiguration whose contents are populated from data * Returns a GuacamoleConfiguration whose contents are populated from data
* within this connection element and child elements. This * within this connection element and child elements. This
* GuacamoleConfiguration will continue to be modified as the user mapping * GuacamoleConfiguration will continue to be modified as the user mapping
* is parsed. * is parsed.
* *
* @return A GuacamoleConfiguration whose contents are populated from data * @return A GuacamoleConfiguration whose contents are populated from data
* within this connection element. * within this connection element.
*/ */
@@ -84,11 +84,11 @@ public class ConnectionTagHandler implements TagHandler {
/** /**
* Returns the name associated with this connection. * Returns the name associated with this connection.
* *
* @return The name associated with this connection. * @return The name associated with this connection.
*/ */
public String getName() { public String getName() {
return name; return name;
} }
} }

View File

@@ -25,8 +25,8 @@ import org.xml.sax.SAXException;
/** /**
* TagHandler for the "param" element. * TagHandler for the "param" element.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class ParamTagHandler implements TagHandler { public class ParamTagHandler implements TagHandler {
@@ -35,16 +35,16 @@ public class ParamTagHandler implements TagHandler {
* the tag handled by this tag handler. * the tag handled by this tag handler.
*/ */
private GuacamoleConfiguration config; private GuacamoleConfiguration config;
/** /**
* The name of the parameter. * The name of the parameter.
*/ */
private String name; private String name;
/** /**
* Creates a new handler for an "param" tag having the given * Creates a new handler for an "param" tag having the given
* attributes. * attributes.
* *
* @param config The GuacamoleConfiguration to update with the data parsed * @param config The GuacamoleConfiguration to update with the data parsed
* from the "protocol" tag. * from the "protocol" tag.
* @param attributes The attributes of the "param" tag. * @param attributes The attributes of the "param" tag.
@@ -67,5 +67,5 @@ public class ParamTagHandler implements TagHandler {
public void complete(String textContent) throws SAXException { public void complete(String textContent) throws SAXException {
config.setParameter(name, textContent); config.setParameter(name, textContent);
} }
} }

View File

@@ -25,8 +25,8 @@ import org.xml.sax.SAXException;
/** /**
* TagHandler for the "protocol" element. * TagHandler for the "protocol" element.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class ProtocolTagHandler implements TagHandler { public class ProtocolTagHandler implements TagHandler {
@@ -35,11 +35,11 @@ public class ProtocolTagHandler implements TagHandler {
* the tag handled by this tag handler. * the tag handled by this tag handler.
*/ */
private GuacamoleConfiguration config; private GuacamoleConfiguration config;
/** /**
* Creates a new handler for a "protocol" tag having the given * Creates a new handler for a "protocol" tag having the given
* attributes. * attributes.
* *
* @param config The GuacamoleConfiguration to update with the data parsed * @param config The GuacamoleConfiguration to update with the data parsed
* from the "protocol" tag. * from the "protocol" tag.
* @throws SAXException If the attributes given are not valid. * @throws SAXException If the attributes given are not valid.
@@ -57,5 +57,5 @@ public class ProtocolTagHandler implements TagHandler {
public void complete(String textContent) throws SAXException { public void complete(String textContent) throws SAXException {
config.setProtocol(textContent); config.setProtocol(textContent);
} }
} }

View File

@@ -26,8 +26,8 @@ import org.xml.sax.SAXException;
/** /**
* TagHandler for the "user-mapping" element. * TagHandler for the "user-mapping" element.
* *
* @author Mike Jumper * @author Mike Jumper
*/ */
public class UserMappingTagHandler implements TagHandler { public class UserMappingTagHandler implements TagHandler {
@@ -35,13 +35,13 @@ public class UserMappingTagHandler implements TagHandler {
* The UserMapping which will contain all data parsed by this tag handler. * The UserMapping which will contain all data parsed by this tag handler.
*/ */
private UserMapping user_mapping = new UserMapping(); private UserMapping user_mapping = new UserMapping();
@Override @Override
public TagHandler childElement(String localName, Attributes attributes) throws SAXException { public TagHandler childElement(String localName, Attributes attributes) throws SAXException {
// Start parsing of authorize tags, add to list of all authorizations // Start parsing of authorize tags, add to list of all authorizations
if (localName.equals("authorize")) { if (localName.equals("authorize")) {
// Get tag handler for authorize tag // Get tag handler for authorize tag
AuthorizeTagHandler tagHandler = AuthorizeTagHandler tagHandler =
new AuthorizeTagHandler(attributes); new AuthorizeTagHandler(attributes);
@@ -49,13 +49,13 @@ public class UserMappingTagHandler implements TagHandler {
// Store authorization stub in map of authorizations // Store authorization stub in map of authorizations
Authorization auth_stub = tagHandler.asAuthorization(); Authorization auth_stub = tagHandler.asAuthorization();
user_mapping.addAuthorization(auth_stub); user_mapping.addAuthorization(auth_stub);
return tagHandler; return tagHandler;
} }
return null; return null;
} }
@Override @Override
@@ -70,12 +70,12 @@ public class UserMappingTagHandler implements TagHandler {
* in the object returned by this function even after this function has * in the object returned by this function even after this function has
* returned, once the data corresponding to those authorizations or * returned, once the data corresponding to those authorizations or
* configurations has been parsed. * configurations has been parsed.
* *
* @return A user mapping containing all authorizations and configurations * @return A user mapping containing all authorizations and configurations
* parsed so far. * parsed so far.
*/ */
public UserMapping asUserMapping() { public UserMapping asUserMapping() {
return user_mapping; return user_mapping;
} }
} }