You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/01/30 19:32:13 UTC
[2/9] guacamole-client git commit: GUACAMOLE-96: Add convenience
class for overriding the behavior of an existing UserContext.
GUACAMOLE-96: Add convenience class for overriding the behavior of an existing UserContext.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/41059f5e
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/41059f5e
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/41059f5e
Branch: refs/heads/master
Commit: 41059f5e09016669b7384f71fd636ee28a8bc7c6
Parents: ffad189
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Oct 27 11:08:08 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat Jan 13 17:23:02 2018 -0800
----------------------------------------------------------------------
.../net/auth/DelegatingUserContext.java | 134 +++++++++++++++++++
1 file changed, 134 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/41059f5e/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserContext.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserContext.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserContext.java
new file mode 100644
index 0000000..a37faf9
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserContext.java
@@ -0,0 +1,134 @@
+/*
+ * 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.net.auth;
+
+import java.util.Collection;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.form.Form;
+
+/**
+ * UserContext implementation which simply delegates all function calls to
+ * an underlying UserContext.
+ */
+public class DelegatingUserContext implements UserContext {
+
+ /**
+ * The wrapped UserContext.
+ */
+ private final UserContext userContext;
+
+ /**
+ * Wraps the given UserContext such that all function calls against this
+ * DelegatingUserContext will be delegated to it.
+ *
+ * @param userContext
+ * The UserContext to wrap.
+ */
+ public DelegatingUserContext(UserContext userContext) {
+ this.userContext = userContext;
+ }
+
+ @Override
+ public User self() {
+ return userContext.self();
+ }
+
+ @Override
+ public Object getResource() throws GuacamoleException {
+ return userContext.getResource();
+ }
+
+ @Override
+ public AuthenticationProvider getAuthenticationProvider() {
+ return userContext.getAuthenticationProvider();
+ }
+
+ @Override
+ public Directory<User> getUserDirectory() throws GuacamoleException {
+ return userContext.getUserDirectory();
+ }
+
+ @Override
+ public Directory<Connection> getConnectionDirectory()
+ throws GuacamoleException {
+ return userContext.getConnectionDirectory();
+ }
+
+ @Override
+ public Directory<ConnectionGroup> getConnectionGroupDirectory()
+ throws GuacamoleException {
+ return userContext.getConnectionGroupDirectory();
+ }
+
+ @Override
+ public Directory<ActiveConnection> getActiveConnectionDirectory()
+ throws GuacamoleException {
+ return userContext.getActiveConnectionDirectory();
+ }
+
+ @Override
+ public Directory<SharingProfile> getSharingProfileDirectory()
+ throws GuacamoleException {
+ return userContext.getSharingProfileDirectory();
+ }
+
+ @Override
+ public ActivityRecordSet<ConnectionRecord> getConnectionHistory()
+ throws GuacamoleException {
+ return userContext.getConnectionHistory();
+ }
+
+ @Override
+ public ActivityRecordSet<ActivityRecord> getUserHistory()
+ throws GuacamoleException {
+ return userContext.getUserHistory();
+ }
+
+ @Override
+ public ConnectionGroup getRootConnectionGroup() throws GuacamoleException {
+ return userContext.getRootConnectionGroup();
+ }
+
+ @Override
+ public Collection<Form> getUserAttributes() {
+ return userContext.getUserAttributes();
+ }
+
+ @Override
+ public Collection<Form> getConnectionAttributes() {
+ return userContext.getConnectionAttributes();
+ }
+
+ @Override
+ public Collection<Form> getConnectionGroupAttributes() {
+ return userContext.getConnectionGroupAttributes();
+ }
+
+ @Override
+ public Collection<Form> getSharingProfileAttributes() {
+ return userContext.getSharingProfileAttributes();
+ }
+
+ @Override
+ public void invalidate() {
+ userContext.invalidate();
+ }
+
+}