GUACAMOLE-542: Deprecate SimpleConnectionDirectory, etc., relying instead on SimpleDirectory.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/57ff8b84 Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/57ff8b84 Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/57ff8b84 Branch: refs/heads/master Commit: 57ff8b84e6bd7f02f70999b4a77853bdc5279e8a Parents: 9b7ef0d Author: Michael Jumper <mjum...@apache.org> Authored: Wed Apr 11 17:04:07 2018 -0700 Committer: Michael Jumper <mjum...@apache.org> Committed: Wed Apr 11 21:29:23 2018 -0700 ---------------------------------------------------------------------- .../auth/simple/SimpleConnectionDirectory.java | 3 +++ .../simple/SimpleConnectionGroupDirectory.java | 3 +++ .../net/auth/simple/SimpleDirectory.java | 21 +++++++++++++++++--- .../net/auth/simple/SimpleUserDirectory.java | 3 +++ 4 files changed, 27 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/57ff8b84/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionDirectory.java ---------------------------------------------------------------------- diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionDirectory.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionDirectory.java index 3f9c4c8..77eaf98 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionDirectory.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionDirectory.java @@ -28,7 +28,10 @@ import org.apache.guacamole.net.auth.Connection; * An extremely simple read-only implementation of a Directory of * GuacamoleConfigurations which provides access to a pre-defined Map of * GuacamoleConfigurations. + * + * @deprecated Use {@link SimpleDirectory} instead. */ +@Deprecated public class SimpleConnectionDirectory extends SimpleDirectory<Connection> { /** http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/57ff8b84/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionGroupDirectory.java ---------------------------------------------------------------------- diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionGroupDirectory.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionGroupDirectory.java index a2597d4..e087054 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionGroupDirectory.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionGroupDirectory.java @@ -28,7 +28,10 @@ import org.apache.guacamole.net.auth.ConnectionGroup; * An extremely simple read-only implementation of a Directory of * ConnectionGroup which provides which provides access to a pre-defined * Collection of ConnectionGroups. + * + * @deprecated Use {@link SimpleDirectory} instead. */ +@Deprecated public class SimpleConnectionGroupDirectory extends SimpleDirectory<ConnectionGroup> { http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/57ff8b84/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleDirectory.java ---------------------------------------------------------------------- diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleDirectory.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleDirectory.java index 1e184c4..4f64ec8 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleDirectory.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleDirectory.java @@ -23,9 +23,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleSecurityException; import org.apache.guacamole.net.auth.Directory; @@ -57,7 +57,7 @@ public class SimpleDirectory<ObjectType extends Identifiable> /** * Creates a new SimpleDirectory which provides access to the objects * contained within the given Map. The given Map will be used to back all - * operations on the SimpleDirectory, and must be threadsafe. + * operations on the SimpleDirectory. * * @param objects * The Map of objects to provide access to. @@ -66,10 +66,25 @@ public class SimpleDirectory<ObjectType extends Identifiable> this.objects = objects; } + /** + * Creates a new SimpleDirectory which provides access to the given object. + * + * @param object + * The object to provide access to. + */ public SimpleDirectory(ObjectType object) { this(Collections.singletonMap(object.getIdentifier(), object)); } + /** + * Creates a new SimpleDirectory which provides access to the given + * objects. Note that a new Map will be created to store the given objects. + * If the objects are already available in Map form, it is more efficient + * to use the {@link #SimpleDirectory(java.util.Map)} constructor. + * + * @param objects + * The objects that should be present in this directory. + */ public SimpleDirectory(ObjectType... objects) { this(Arrays.asList(objects)); } @@ -85,7 +100,7 @@ public class SimpleDirectory<ObjectType extends Identifiable> * A Collection of all objects that should be present in this directory. */ public SimpleDirectory(Collection<ObjectType> objects) { - this.objects = new ConcurrentHashMap<String, ObjectType>(objects.size()); + this.objects = new HashMap<String, ObjectType>(objects.size()); for (ObjectType object : objects) this.objects.put(object.getIdentifier(), object); } http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/57ff8b84/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserDirectory.java ---------------------------------------------------------------------- diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserDirectory.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserDirectory.java index f9068d4..bb5e37a 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserDirectory.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserDirectory.java @@ -25,7 +25,10 @@ import org.apache.guacamole.net.auth.User; /** * An extremely simple read-only implementation of a Directory of Users which * provides access to a single pre-defined User. + * + * @deprecated Use {@link SimpleDirectory} instead. */ +@Deprecated public class SimpleUserDirectory extends SimpleDirectory<User> { /**