GUACAMOLE-244: Rename DereferenceAliases class to DereferenceAliasesMode, fix several comment issues and spelling mistakes.

This commit is contained in:
Nick Couchman
2017-03-20 20:24:46 -04:00
parent daf4e9d262
commit f2b4053192
4 changed files with 27 additions and 27 deletions

View File

@@ -224,7 +224,7 @@ public class ConfigurationService {
* @throws GuacamoleException
* If guacamole.properties cannot be parsed.
*/
public int getMaxResults() throws GuacamoleException {
private int getMaxResults() throws GuacamoleException {
return environment.getProperty(
LDAPGuacamoleProperties.LDAP_MAX_SEARCH_RESULTS,
1000
@@ -234,7 +234,7 @@ public class ConfigurationService {
/**
* Returns whether or not LDAP aliases will be dereferenced,
* as configured with guacamole.properties. The default
* behavior if not explicityly defined is to never
* behavior if not explicitly defined is to never
* dereference them.
*
* @return
@@ -244,21 +244,17 @@ public class ConfigurationService {
* @throws GuacamoleException
* If guacamole.properties cannot be parsed.
*/
public DereferenceAliases getDereferenceAliases() throws GuacamoleException {
private DereferenceAliasesMode getDereferenceAliases() throws GuacamoleException {
return environment.getProperty(
LDAPGuacamoleProperties.LDAP_DEREFERENCE_ALIASES,
DereferenceAliases.NEVER
DereferenceAliasesMode.NEVER
);
}
/**
* Returns a set of LDAPSearchConstraints to apply globally
* to all LDAP searches rather than having various instances
* dispersed throughout the code. Currently contains the
* maximum number of LDAP results to return in a search, as
* well as whether or not aliases should be dereferenced
* during LDAP operations.
* to all LDAP searches.
*
* @return
* A LDAPSearchConstraints object containing constraints

View File

@@ -19,41 +19,44 @@
package org.apache.guacamole.auth.ldap;
import com.novell.ldap.LDAPSearchConstraints;
/**
* Acceptable values for configuring the dereferencing of aliases in
* talking to LDAP servers.
* Data type that handles acceptable values for configuring
* alias dereferencing behavior when querying LDAP servers.
*/
public enum DereferenceAliases {
public enum DereferenceAliasesMode {
/**
* Never dereference aliases. This is the default.
*/
NEVER(0),
NEVER(LDAPSearchConstraints.DEREF_NEVER),
/**
* Aliases are dereferenced below the base object, but not to locate
* the base object itself. So, if the base object is itself an alias
* the search will not complete.
*/
SEARCHING(1),
SEARCHING(LDAPSearchConstraints.DEREF_SEARCHING),
/**
* Aliases are only dereferenced to locate the base object, but not
* after that. So, a search against a base object that is an alias will
* find any subordinates of the real object the aliase references, but
* find any subordinates of the real object the alias references, but
* further aliases in the search will not be dereferenced.
*/
FINDING(2),
FINDING(LDAPSearchConstraints.DEREF_FINDING),
/**
* Aliases will always be dereferenced, both to locate the base object
* and when handling results returned by the search.
*/
ALWAYS(3);
ALWAYS(LDAPSearchConstraints.DEREF_ALWAYS);
/**
* The integer value that the enum represents, which is used in
* configuring the JLDAP library.
* The integer constant as defined in the JLDAP library that
* the LDAPSearchConstraints class uses to define the
* dereferencing behavior during search operations.
*/
public final int DEREF_VALUE;
@@ -64,7 +67,7 @@ public enum DereferenceAliases {
* @param derefValue
* The value associated with this dereference setting
*/
private DereferenceAliases(int derefValue) {
private DereferenceAliasesMode(int derefValue) {
this.DEREF_VALUE = derefValue;
}

View File

@@ -28,10 +28,10 @@ import org.apache.guacamole.properties.GuacamoleProperty;
* "never", "searching", "finding", and "always" are mapped to their values as a
* DereferenceAliases enum. Anything else results in a parse error.
*/
public abstract class DereferenceAliasesProperty implements GuacamoleProperty<DereferenceAliases> {
public abstract class DereferenceAliasesProperty implements GuacamoleProperty<DereferenceAliasesMode> {
@Override
public DereferenceAliases parseValue(String value) throws GuacamoleException {
public DereferenceAliasesMode parseValue(String value) throws GuacamoleException {
// No value provided, so return null.
if (value == null)
@@ -39,19 +39,19 @@ public abstract class DereferenceAliasesProperty implements GuacamoleProperty<De
// Never dereference aliases
if (value.equals("never"))
return DereferenceAliases.NEVER;
return DereferenceAliasesMode.NEVER;
// Dereference aliases during search operations, but not at base
if (value.equals("searching"))
return DereferenceAliases.SEARCHING;
return DereferenceAliasesMode.SEARCHING;
// Dereference aliases to locate base, but not during searches
if (value.equals("finding"))
return DereferenceAliases.FINDING;
return DereferenceAliasesMode.FINDING;
// Always dereference aliases
if (value.equals("always"))
return DereferenceAliases.ALWAYS;
return DereferenceAliasesMode.ALWAYS;
// Anything else is invalid and results in an error
throw new GuacamoleServerException("Dereference aliases must be one of \"never\", \"searching\", \"finding\", or \"always\".");

View File

@@ -154,7 +154,8 @@ public class LDAPGuacamoleProperties {
};
/**
* The behavior of alias dereferencing for the LDAP connections.
* Property that controls whether or not the LDAP connection follows
* (dereferences) aliases as it searches the tree.
*/
public static final DereferenceAliasesProperty LDAP_DEREFERENCE_ALIASES = new DereferenceAliasesProperty() {