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/02/01 18:32:51 UTC
[08/10] guacamole-client git commit: GUACAMOLE-96: Extract Attributes
interface from objects which provide getAttributes() / setAttributes().
GUACAMOLE-96: Extract Attributes interface from objects which provide getAttributes() / setAttributes().
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/fff14117
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/fff14117
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/fff14117
Branch: refs/heads/master
Commit: fff14117681d333c6b93fa274235df7c3ddb25ee
Parents: 79936c4
Author: Michael Jumper <mj...@apache.org>
Authored: Sun Oct 29 15:33:10 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed Jan 31 15:26:16 2018 -0800
----------------------------------------------------------------------
.../apache/guacamole/net/auth/Attributes.java | 59 ++++++++++++++++++++
.../apache/guacamole/net/auth/Connection.java | 33 +----------
.../guacamole/net/auth/ConnectionGroup.java | 33 +----------
.../guacamole/net/auth/SharingProfile.java | 32 +----------
.../org/apache/guacamole/net/auth/User.java | 33 +----------
5 files changed, 63 insertions(+), 127 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/fff14117/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Attributes.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Attributes.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Attributes.java
new file mode 100644
index 0000000..050017d
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Attributes.java
@@ -0,0 +1,59 @@
+/*
+ * 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.Map;
+
+/**
+ * An object which is associated with a set of arbitrary attributes, defined
+ * as name/value pairs.
+ */
+public interface Attributes {
+
+ /**
+ * Returns all attributes associated with this object. The returned map
+ * may not be modifiable.
+ *
+ * @return
+ * A map of all attribute identifiers to their corresponding values,
+ * for all attributes associated with this object, which may not be
+ * modifiable.
+ */
+ Map<String, String> getAttributes();
+
+ /**
+ * Sets the given attributes. If an attribute within the map is not
+ * supported, it will simply be dropped. Any attributes not within the given
+ * map will be left untouched. Attributes which are not declared within the
+ * associated UserContext MUST NOT be submitted, but other extensions may
+ * manipulate the declared attributes through decorate() and redecorate().
+ *
+ * Implementations may optionally allow storage of unsupported attributes.
+ * Extensions which rely on other extensions to store their attribute
+ * values should verify that such storage is supported by first testing
+ * that the attribute value is retrievable via getAttributes() after being
+ * set.
+ *
+ * @param attributes
+ * A map of all attribute identifiers to their corresponding values.
+ */
+ void setAttributes(Map<String, String> attributes);
+
+}
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/fff14117/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java
index 313d89e..5b1d13d 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Connection.java
@@ -21,7 +21,6 @@ package org.apache.guacamole.net.auth;
import java.util.Date;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.protocol.GuacamoleConfiguration;
@@ -32,7 +31,7 @@ import org.apache.guacamole.protocol.GuacamoleConfiguration;
* backing GuacamoleConfiguration may be intentionally obfuscated or tokenized
* to protect sensitive configuration information.
*/
-public interface Connection extends Identifiable, Connectable {
+public interface Connection extends Identifiable, Connectable, Attributes {
/**
* Returns the name assigned to this Connection.
@@ -83,36 +82,6 @@ public interface Connection extends Identifiable, Connectable {
public void setConfiguration(GuacamoleConfiguration config);
/**
- * Returns all attributes associated with this connection. The returned map
- * may not be modifiable.
- *
- * @return
- * A map of all attribute identifiers to their corresponding values,
- * for all attributes associated with this connection, which may not be
- * modifiable.
- */
- Map<String, String> getAttributes();
-
- /**
- * Sets the given attributes. If an attribute within the map is not
- * supported, it will simply be dropped. Any attributes not within the given
- * map will be left untouched. Attributes which are not declared within
- * getConnectionAttributes() of the associated UserContext MUST NOT be
- * submitted, but other extensions may manipulate the declared attributes
- * through decorate() and redecorate().
- *
- * Implementations may optionally allow storage of unsupported attributes.
- * Extensions which rely on other extensions to store their attribute
- * values should verify that such storage is supported by first testing
- * that the attribute value is retrievable via getAttributes() after being
- * set.
- *
- * @param attributes
- * A map of all attribute identifiers to their corresponding values.
- */
- void setAttributes(Map<String, String> attributes);
-
- /**
* Returns the date and time that this connection was last used. If the
* connection was never used, the time that the connection was last used is
* unknown, or this information is not visible to the current user, this
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/fff14117/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java
index 04b494a..74412de 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionGroup.java
@@ -19,7 +19,6 @@
package org.apache.guacamole.net.auth;
-import java.util.Map;
import java.util.Set;
import org.apache.guacamole.GuacamoleException;
@@ -27,7 +26,7 @@ import org.apache.guacamole.GuacamoleException;
* Represents a connection group, which can contain both other connection groups
* as well as connections.
*/
-public interface ConnectionGroup extends Identifiable, Connectable {
+public interface ConnectionGroup extends Identifiable, Connectable, Attributes {
/**
* All legal types of connection group.
@@ -124,34 +123,4 @@ public interface ConnectionGroup extends Identifiable, Connectable {
public Set<String> getConnectionGroupIdentifiers()
throws GuacamoleException;
- /**
- * Returns all attributes associated with this connection group. The
- * returned map may not be modifiable.
- *
- * @return
- * A map of all attribute identifiers to their corresponding values,
- * for all attributes associated with this connection group, which may
- * not be modifiable.
- */
- Map<String, String> getAttributes();
-
- /**
- * Sets the given attributes. If an attribute within the map is not
- * supported, it will simply be dropped. Any attributes not within the given
- * map will be left untouched. Attributes which are not declared within
- * getConnectionGroupAttributes() of the associated UserContext MUST NOT be
- * submitted, but other extensions may manipulate the declared attributes
- * through decorate() and redecorate().
- *
- * Implementations may optionally allow storage of unsupported attributes.
- * Extensions which rely on other extensions to store their attribute
- * values should verify that such storage is supported by first testing
- * that the attribute value is retrievable via getAttributes() after being
- * set.
- *
- * @param attributes
- * A map of all attribute identifiers to their corresponding values.
- */
- void setAttributes(Map<String, String> attributes);
-
}
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/fff14117/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java
index 3b4ec65..2d4c432 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/SharingProfile.java
@@ -25,7 +25,7 @@ import java.util.Map;
* Represents the semantics which apply to an existing connection when shared,
* along with a human-readable name and unique identifier.
*/
-public interface SharingProfile extends Identifiable {
+public interface SharingProfile extends Identifiable, Attributes {
/**
* Returns the human-readable name assigned to this SharingProfile.
@@ -93,34 +93,4 @@ public interface SharingProfile extends Identifiable {
*/
public void setParameters(Map<String, String> parameters);
- /**
- * Returns all attributes associated with this sharing profile. The returned
- * map may not be modifiable.
- *
- * @return
- * A map of all attribute identifiers to their corresponding values,
- * for all attributes associated with this sharing profile, which may
- * not be modifiable.
- */
- Map<String, String> getAttributes();
-
- /**
- * Sets the given attributes. If an attribute within the map is not
- * supported, it will simply be dropped. Any attributes not within the
- * given map will be left untouched. Attributes which are not declared
- * within getSharingProfileAttributes() of the associated UserContext MUST
- * NOT be submitted, but other extensions may manipulate the declared
- * attributes through decorate() and redecorate().
- *
- * Implementations may optionally allow storage of unsupported attributes.
- * Extensions which rely on other extensions to store their attribute
- * values should verify that such storage is supported by first testing
- * that the attribute value is retrievable via getAttributes() after being
- * set.
- *
- * @param attributes
- * A map of all attribute identifiers to their corresponding values.
- */
- void setAttributes(Map<String, String> attributes);
-
}
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/fff14117/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java
index 49e1f99..a39a772 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java
@@ -21,7 +21,6 @@ package org.apache.guacamole.net.auth;
import java.util.Date;
import java.util.List;
-import java.util.Map;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
@@ -30,7 +29,7 @@ import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
/**
* A user of the Guacamole web application.
*/
-public interface User extends Identifiable {
+public interface User extends Identifiable, Attributes {
/**
* All standard attribute names with semantics defined by the Guacamole web
@@ -82,36 +81,6 @@ public interface User extends Identifiable {
public void setPassword(String password);
/**
- * Returns all attributes associated with this user. The returned map may
- * not be modifiable.
- *
- * @return
- * A map of all attribute identifiers to their corresponding values,
- * for all attributes associated with this user, which may not be
- * modifiable.
- */
- Map<String, String> getAttributes();
-
- /**
- * Sets the given attributes. If an attribute within the map is not
- * supported, it will simply be dropped. Any attributes not within the given
- * map will be left untouched. Attributes which are not declared within
- * getUserAttributes() of the associated UserContext MUST NOT be submitted,
- * but other extensions may manipulate the declared attributes through
- * decorate() and redecorate().
- *
- * Implementations may optionally allow storage of unsupported attributes.
- * Extensions which rely on other extensions to store their attribute
- * values should verify that such storage is supported by first testing
- * that the attribute value is retrievable via getAttributes() after being
- * set.
- *
- * @param attributes
- * A map of all attribute identifiers to their corresponding values.
- */
- void setAttributes(Map<String, String> attributes);
-
- /**
* Returns the date and time that this user was last active. If the user
* was never active, the time that the user was last active is unknown, or
* this information is not visible to the current user, this may be null.