GUACAMOLE-244: Rename DereferenceAliases class to DereferenceAliasesMode, fix several comment issues and spelling mistakes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/f2b40531 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/f2b40531 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/f2b40531 Branch: refs/heads/master Commit: f2b4053192c9ccd236e33361bf55456836d22ac7 Parents: daf4e9d Author: Nick Couchman <[email protected]> Authored: Mon Mar 20 20:24:46 2017 -0400 Committer: Nick Couchman <[email protected]> Committed: Mon Mar 20 20:24:46 2017 -0400 ---------------------------------------------------------------------- .../auth/ldap/ConfigurationService.java | 14 ++-- .../guacamole/auth/ldap/DereferenceAliases.java | 71 ------------------- .../auth/ldap/DereferenceAliasesMode.java | 74 ++++++++++++++++++++ .../auth/ldap/DereferenceAliasesProperty.java | 12 ++-- .../auth/ldap/LDAPGuacamoleProperties.java | 3 +- 5 files changed, 87 insertions(+), 87 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/f2b40531/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java index c33e320..3d9ea64 100644 --- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java +++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/ConfigurationService.java @@ -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 http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/f2b40531/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliases.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliases.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliases.java deleted file mode 100644 index 5c339d6..0000000 --- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliases.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.guacamole.auth.ldap; - -/** - * Acceptable values for configuring the dereferencing of aliases in - * talking to LDAP servers. - */ -public enum DereferenceAliases { - - /** - * Never dereference aliases. This is the default. - */ - NEVER(0), - - /** - * 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), - - /** - * 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 - * further aliases in the search will not be dereferenced. - */ - FINDING(2), - - /** - * Aliases will always be dereferenced, both to locate the base object - * and when handling results returned by the search. - */ - ALWAYS(3); - - /** - * The integer value that the enum represents, which is used in - * configuring the JLDAP library. - */ - public final int DEREF_VALUE; - - /** - * Initializes the dereference aliases object with the integer - * value the setting maps to per the JLDAP implementation. - * - * @param derefValue - * The value associated with this dereference setting - */ - private DereferenceAliases(int derefValue) { - this.DEREF_VALUE = derefValue; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/f2b40531/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesMode.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesMode.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesMode.java new file mode 100644 index 0000000..406c247 --- /dev/null +++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesMode.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.auth.ldap; + +import com.novell.ldap.LDAPSearchConstraints; + +/** + * Data type that handles acceptable values for configuring + * alias dereferencing behavior when querying LDAP servers. + */ +public enum DereferenceAliasesMode { + + /** + * Never dereference aliases. This is the default. + */ + 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(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 alias references, but + * further aliases in the search will not be dereferenced. + */ + FINDING(LDAPSearchConstraints.DEREF_FINDING), + + /** + * Aliases will always be dereferenced, both to locate the base object + * and when handling results returned by the search. + */ + ALWAYS(LDAPSearchConstraints.DEREF_ALWAYS); + + /** + * 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; + + /** + * Initializes the dereference aliases object with the integer + * value the setting maps to per the JLDAP implementation. + * + * @param derefValue + * The value associated with this dereference setting + */ + private DereferenceAliasesMode(int derefValue) { + this.DEREF_VALUE = derefValue; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/f2b40531/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesProperty.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesProperty.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesProperty.java index 61a8944..7888347 100644 --- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesProperty.java +++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/DereferenceAliasesProperty.java @@ -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\"."); http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/f2b40531/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java index 9a8af58..266af8e 100644 --- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java +++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPGuacamoleProperties.java @@ -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() {
