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 2017/09/27 22:16:21 UTC

[1/7] incubator-guacamole-client git commit: GUACAMOLE-394: Deprecate ConnectionRecordSet. Refactor accordingly.

Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 9b5483edc -> 81ffa5c8e


GUACAMOLE-394: Deprecate ConnectionRecordSet. Refactor accordingly.


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/26122ebc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/26122ebc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/26122ebc

Branch: refs/heads/master
Commit: 26122ebc3eb07934264618c319f93738a230a973
Parents: cd5d238
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Sep 9 13:20:43 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 12:30:03 2017 -0700

----------------------------------------------------------------------
 .../jdbc/connection/ConnectionRecordSet.java    | 10 ++-
 .../ConnectionRecordSortPredicate.java          |  8 +-
 .../jdbc/sharing/user/SharedUserContext.java    |  9 ++-
 .../jdbc/connection/ConnectionRecordMapper.xml  |  4 +-
 .../jdbc/connection/ConnectionRecordMapper.xml  |  4 +-
 .../guacamole/auth/ldap/user/UserContext.java   |  9 ++-
 .../guacamole/net/auth/ConnectionRecordSet.java | 82 ++------------------
 .../apache/guacamole/net/auth/UserContext.java  |  5 +-
 .../auth/simple/SimpleActivityRecordSet.java    | 62 +++++++++++++++
 .../auth/simple/SimpleConnectionRecordSet.java  | 14 ++--
 .../net/auth/simple/SimpleUserContext.java      |  7 +-
 .../APIConnectionRecordSortPredicate.java       | 26 +++----
 .../guacamole/rest/history/HistoryResource.java |  4 +-
 13 files changed, 123 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSet.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSet.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSet.java
index f89a450..7b3d629 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSet.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSet.java
@@ -27,15 +27,17 @@ import java.util.List;
 import java.util.Set;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
+import org.apache.guacamole.net.auth.ActivityRecordSet.SortableProperty;
 import org.apache.guacamole.net.auth.ConnectionRecord;
 
 /**
- * A JDBC implementation of ConnectionRecordSet. Calls to asCollection() will 
- * query connection history records from the database. Which records are
- * returned will be determined by the values passed in earlier.
+ * A JDBC implementation of ActivityRecordSet for ConnectionRecords. Calls to
+ * asCollection() will query connection history records from the database. Which
+ * records are returned will be determined by the values passed in earlier.
  */
 public class ConnectionRecordSet extends RestrictedObject
-        implements org.apache.guacamole.net.auth.ConnectionRecordSet {
+        implements ActivityRecordSet<ConnectionRecord> {
 
     /**
      * Service for managing connection objects.

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSortPredicate.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSortPredicate.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSortPredicate.java
index 17f4380..69eee78 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSortPredicate.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordSortPredicate.java
@@ -19,7 +19,7 @@
 
 package org.apache.guacamole.auth.jdbc.connection;
 
-import org.apache.guacamole.net.auth.ConnectionRecordSet;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
 
 /**
  * A sort predicate which species the property to use when sorting connection
@@ -30,7 +30,7 @@ public class ConnectionRecordSortPredicate {
     /**
      * The property to use when sorting ConnectionRecords.
      */
-    private final ConnectionRecordSet.SortableProperty property;
+    private final ActivityRecordSet.SortableProperty property;
 
     /**
      * Whether the sort order is descending (true) or ascending (false).
@@ -47,7 +47,7 @@ public class ConnectionRecordSortPredicate {
      * @param descending 
      *     Whether the sort order is descending (true) or ascending (false).
      */
-    public ConnectionRecordSortPredicate(ConnectionRecordSet.SortableProperty property, 
+    public ConnectionRecordSortPredicate(ActivityRecordSet.SortableProperty property,
             boolean descending) {
         this.property   = property;
         this.descending = descending;
@@ -59,7 +59,7 @@ public class ConnectionRecordSortPredicate {
      * @return
      *     The property that should be used when sorting ConnectionRecords.
      */
-    public ConnectionRecordSet.SortableProperty getProperty() {
+    public ActivityRecordSet.SortableProperty getProperty() {
         return property;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
index 2092898..cdfe0fc 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
@@ -28,16 +28,17 @@ import org.apache.guacamole.auth.jdbc.sharing.connectiongroup.SharedRootConnecti
 import org.apache.guacamole.auth.jdbc.user.RemoteAuthenticatedUser;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
 import org.apache.guacamole.net.auth.Connection;
 import org.apache.guacamole.net.auth.ConnectionGroup;
-import org.apache.guacamole.net.auth.ConnectionRecordSet;
+import org.apache.guacamole.net.auth.ConnectionRecord;
 import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
 import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
-import org.apache.guacamole.net.auth.simple.SimpleConnectionRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleDirectory;
 
 /**
@@ -175,8 +176,8 @@ public class SharedUserContext implements UserContext {
     }
 
     @Override
-    public ConnectionRecordSet getConnectionHistory() {
-        return new SimpleConnectionRecordSet();
+    public ActivityRecordSet<ConnectionRecord> getConnectionHistory() {
+        return new SimpleActivityRecordSet<ConnectionRecord>();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
index c2c12c1..287ca02 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -129,7 +129,7 @@
         </foreach>
 
         <!-- Bind sort property enum values for sake of readability -->
-        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+        <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/>
 
         <!-- Sort predicates -->
         <foreach collection="sortPredicates" item="sortPredicate"
@@ -199,7 +199,7 @@
         </foreach>
 
         <!-- Bind sort property enum values for sake of readability -->
-        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+        <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/>
 
         <!-- Sort predicates -->
         <foreach collection="sortPredicates" item="sortPredicate"

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
index 2b3e193..4545332 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-postgresql/src/main/resources/org/apache/guacamole/auth/jdbc/connection/ConnectionRecordMapper.xml
@@ -127,7 +127,7 @@
         </foreach>
 
         <!-- Bind sort property enum values for sake of readability -->
-        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+        <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/>
 
         <!-- Sort predicates -->
         <foreach collection="sortPredicates" item="sortPredicate"
@@ -197,7 +197,7 @@
         </foreach>
 
         <!-- Bind sort property enum values for sake of readability -->
-        <bind name="START_DATE"      value="@org.apache.guacamole.net.auth.ConnectionRecordSet$SortableProperty@START_DATE"/>
+        <bind name="START_DATE" value="@org.apache.guacamole.net.auth.ActivityRecordSet$SortableProperty@START_DATE"/>
 
         <!-- Sort predicates -->
         <foreach collection="sortPredicates" item="sortPredicate"

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
index 39c32e4..98d65ea 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
@@ -28,17 +28,18 @@ import org.apache.guacamole.auth.ldap.connection.ConnectionService;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticatedUser;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
 import org.apache.guacamole.net.auth.Connection;
 import org.apache.guacamole.net.auth.ConnectionGroup;
-import org.apache.guacamole.net.auth.ConnectionRecordSet;
+import org.apache.guacamole.net.auth.ConnectionRecord;
 import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
+import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroup;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
-import org.apache.guacamole.net.auth.simple.SimpleConnectionRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleDirectory;
 import org.apache.guacamole.net.auth.simple.SimpleUser;
 import org.slf4j.Logger;
@@ -204,9 +205,9 @@ public class UserContext implements org.apache.guacamole.net.auth.UserContext {
     }
 
     @Override
-    public ConnectionRecordSet getConnectionHistory()
+    public ActivityRecordSet<ConnectionRecord> getConnectionHistory()
             throws GuacamoleException {
-        return new SimpleConnectionRecordSet();
+        return new SimpleActivityRecordSet<ConnectionRecord>();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
index 87f91bb..62c84ec 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
@@ -19,83 +19,13 @@
 
 package org.apache.guacamole.net.auth;
 
-import org.apache.guacamole.GuacamoleException;
-
 /**
  * The set of all available connection records, or a subset of those records.
+ *
+ * @deprecated
+ *     Use {@link ActivityRecordSet}&lt;{@link ConnectionRecord}&gt; instead.
  */
-public interface ConnectionRecordSet extends ActivityRecordSet<ConnectionRecord> {
-
-    /**
-     * Returns the subset of connection records to only those where the
-     * connection name, user identifier, or any associated date field contain
-     * the given value. This function may also affect the contents of the
-     * current ConnectionRecordSet. The contents of the current
-     * ConnectionRecordSet should NOT be relied upon after this function is
-     * called.
-     *
-     * @param value
-     *     The value which all connection records within the resulting subset
-     *     should contain within their associated connection name or user
-     *     identifier.
-     *
-     * @return
-     *     The subset of connection history records which contain the specified
-     *     value within their associated connection name or user identifier.
-     *
-     * @throws GuacamoleException
-     *     If an error occurs while restricting the current subset.
-     */
-    @Override
-    ConnectionRecordSet contains(String value) throws GuacamoleException;
-
-    /**
-     * Returns the subset of connection history records containing only the
-     * first <code>limit</code> records. If the subset has fewer than
-     * <code>limit</code> records, then this function has no effect. This
-     * function may also affect the contents of the current
-     * ConnectionRecordSet. The contents of the current ConnectionRecordSet
-     * should NOT be relied upon after this function is called.
-     *
-     * @param limit
-     *     The maximum number of records that the new subset should contain.
-     *
-     * @return
-     *     The subset of connection history records that containing only the
-     *     first <code>limit</code> records.
-     *
-     * @throws GuacamoleException
-     *     If an error occurs while limiting the current subset.
-     */
-    @Override
-    ConnectionRecordSet limit(int limit) throws GuacamoleException;
-
-    /**
-     * Returns a ConnectionRecordSet containing identically the records within
-     * this set, sorted according to the specified criteria. The sort operation
-     * performed is guaranteed to be stable with respect to any past call to
-     * sort(). This function may also affect the contents of the current
-     * ConnectionRecordSet. The contents of the current ConnectionRecordSet
-     * should NOT be relied upon after this function is called.
-     *
-     * @param property
-     *     The property by which the connection records within the resulting
-     *     set should be sorted.
-     *
-     * @param desc
-     *     Whether the records should be sorted according to the specified
-     *     property in descending order. If false, records will be sorted
-     *     according to the specified property in ascending order.
-     *
-     * @return
-     *     The ConnnectionRecordSet, sorted according to the specified
-     *     criteria.
-     *
-     * @throws GuacamoleException
-     *     If an error occurs while sorting the current subset.
-     */
-    @Override
-    ConnectionRecordSet sort(SortableProperty property, boolean desc)
-            throws GuacamoleException;
-
+@Deprecated
+public interface ConnectionRecordSet
+        extends ActivityRecordSet<ConnectionRecord> {
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
index 596c5d9..92f3604 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
@@ -145,7 +145,7 @@ public interface UserContext {
     /**
      * Retrieves all connection records visible to current user. The resulting
      * set of connection records can be further filtered and ordered using the
-     * methods defined on ConnectionRecordSet.
+     * methods defined on ActivityRecordSet.
      *
      * @return
      *     A set of all connection records visible to the current user.
@@ -153,7 +153,8 @@ public interface UserContext {
      * @throws GuacamoleException
      *     If an error occurs while retrieving the connection records.
      */
-    ConnectionRecordSet getConnectionHistory() throws GuacamoleException;
+    ActivityRecordSet<ConnectionRecord> getConnectionHistory()
+            throws GuacamoleException;
 
     /**
      * Retrieves a connection group which can be used to view and manipulate

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleActivityRecordSet.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleActivityRecordSet.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleActivityRecordSet.java
new file mode 100644
index 0000000..a9a3c3e
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleActivityRecordSet.java
@@ -0,0 +1,62 @@
+/*
+ * 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.simple;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.net.auth.ActivityRecord;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
+import org.apache.guacamole.net.auth.ActivityRecordSet.SortableProperty;
+
+/**
+ * An immutable and empty ActivityRecordSet.
+ *
+ * @param <RecordType>
+ *     The type of ActivityRecord contained within this set.
+ */
+public class SimpleActivityRecordSet<RecordType extends ActivityRecord>
+        implements ActivityRecordSet<RecordType> {
+
+    @Override
+    public Collection<RecordType> asCollection()
+            throws GuacamoleException {
+        return Collections.<RecordType>emptyList();
+    }
+
+    @Override
+    public ActivityRecordSet<RecordType> contains(String value)
+            throws GuacamoleException {
+        return this;
+    }
+
+    @Override
+    public ActivityRecordSet<RecordType> limit(int limit)
+            throws GuacamoleException {
+        return this;
+    }
+
+    @Override
+    public ActivityRecordSet<RecordType> sort(SortableProperty property,
+            boolean desc) throws GuacamoleException {
+        return this;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionRecordSet.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionRecordSet.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionRecordSet.java
index f18b3d6..41971c9 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionRecordSet.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnectionRecordSet.java
@@ -23,12 +23,16 @@ import java.util.Collection;
 import java.util.Collections;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.net.auth.ConnectionRecord;
-import org.apache.guacamole.net.auth.ConnectionRecordSet;
 
 /**
  * An immutable and empty ConnectionRecordSet.
+ *
+ * @deprecated
+ *     Use {@link SimpleActivityRecordSet}&lt;{@link ConnectionRecord}&gt;
+ *     instead.
  */
-public class SimpleConnectionRecordSet implements ConnectionRecordSet {
+@Deprecated
+public class SimpleConnectionRecordSet implements org.apache.guacamole.net.auth.ConnectionRecordSet {
 
     @Override
     public Collection<ConnectionRecord> asCollection()
@@ -37,19 +41,19 @@ public class SimpleConnectionRecordSet implements ConnectionRecordSet {
     }
 
     @Override
-    public ConnectionRecordSet contains(String value)
+    public org.apache.guacamole.net.auth.ConnectionRecordSet contains(String value)
             throws GuacamoleException {
         return this;
     }
 
     @Override
-    public ConnectionRecordSet limit(int limit)
+    public org.apache.guacamole.net.auth.ConnectionRecordSet limit(int limit)
             throws GuacamoleException {
         return this;
     }
 
     @Override
-    public ConnectionRecordSet sort(SortableProperty property, boolean desc)
+    public org.apache.guacamole.net.auth.ConnectionRecordSet sort(SortableProperty property, boolean desc)
             throws GuacamoleException {
         return this;
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
index d87cf95..97584ed 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
@@ -27,10 +27,11 @@ import java.util.UUID;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
 import org.apache.guacamole.net.auth.Connection;
 import org.apache.guacamole.net.auth.ConnectionGroup;
-import org.apache.guacamole.net.auth.ConnectionRecordSet;
+import org.apache.guacamole.net.auth.ConnectionRecord;
 import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
@@ -209,9 +210,9 @@ public class SimpleUserContext implements UserContext {
     }
 
     @Override
-    public ConnectionRecordSet getConnectionHistory()
+    public ActivityRecordSet<ConnectionRecord> getConnectionHistory()
             throws GuacamoleException {
-        return new SimpleConnectionRecordSet();
+        return new SimpleActivityRecordSet<ConnectionRecord>();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/guacamole/src/main/java/org/apache/guacamole/rest/history/APIConnectionRecordSortPredicate.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/history/APIConnectionRecordSortPredicate.java b/guacamole/src/main/java/org/apache/guacamole/rest/history/APIConnectionRecordSortPredicate.java
index 2a4c818..d2281d0 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/history/APIConnectionRecordSortPredicate.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/history/APIConnectionRecordSortPredicate.java
@@ -21,7 +21,7 @@ package org.apache.guacamole.rest.history;
 
 import javax.ws.rs.core.Response;
 import org.apache.guacamole.GuacamoleClientException;
-import org.apache.guacamole.net.auth.ConnectionRecordSet;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.rest.APIException;
 
 /**
@@ -38,7 +38,7 @@ public class APIConnectionRecordSortPredicate {
 
     /**
      * All possible property name strings and their corresponding
-     * ConnectionRecordSet.SortableProperty values.
+     * ActivityRecordSet.SortableProperty values.
      */
     public enum SortableProperty {
 
@@ -46,24 +46,24 @@ public class APIConnectionRecordSortPredicate {
          * The date that the connection associated with the connection record
          * began (connected).
          */
-        startDate(ConnectionRecordSet.SortableProperty.START_DATE);
+        startDate(ActivityRecordSet.SortableProperty.START_DATE);
 
         /**
-         * The ConnectionRecordSet.SortableProperty that this property name
+         * The ActivityRecordSet.SortableProperty that this property name
          * string represents.
          */
-        public final ConnectionRecordSet.SortableProperty recordProperty;
+        public final ActivityRecordSet.SortableProperty recordProperty;
 
         /**
          * Creates a new SortableProperty which associates the property name
          * string (identical to its own name) with the given
-         * ConnectionRecordSet.SortableProperty value.
+         * ActivityRecordSet.SortableProperty value.
          *
          * @param recordProperty
-         *     The ConnectionRecordSet.SortableProperty value to associate with
+         *     The ActivityRecordSet.SortableProperty value to associate with
          *     the new SortableProperty.
          */
-        SortableProperty(ConnectionRecordSet.SortableProperty recordProperty) {
+        SortableProperty(ActivityRecordSet.SortableProperty recordProperty) {
             this.recordProperty = recordProperty;
         }
 
@@ -72,7 +72,7 @@ public class APIConnectionRecordSortPredicate {
     /**
      * The property to use when sorting ConnectionRecords.
      */
-    private ConnectionRecordSet.SortableProperty property;
+    private ActivityRecordSet.SortableProperty property;
 
     /**
      * Whether the requested sort order is descending (true) or ascending
@@ -102,7 +102,7 @@ public class APIConnectionRecordSortPredicate {
             value = value.substring(DESCENDING_PREFIX.length());
         }
 
-        // Parse sorting property into ConnectionRecordSet.SortableProperty
+        // Parse sorting property into ActivityRecordSet.SortableProperty
         try {
             this.property = SortableProperty.valueOf(value).recordProperty;
         }
@@ -118,15 +118,15 @@ public class APIConnectionRecordSortPredicate {
     }
 
     /**
-     * Returns the SortableProperty defined by ConnectionRecordSet which
+     * Returns the SortableProperty defined by ActivityRecordSet which
      * represents the property requested.
      *
      * @return
-     *     The ConnectionRecordSet.SortableProperty which refers to the same
+     *     The ActivityRecordSet.SortableProperty which refers to the same
      *     property as the string originally provided when this
      *     APIConnectionRecordSortPredicate was created.
      */
-    public ConnectionRecordSet.SortableProperty getProperty() {
+    public ActivityRecordSet.SortableProperty getProperty() {
         return property;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/26122ebc/guacamole/src/main/java/org/apache/guacamole/rest/history/HistoryResource.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/history/HistoryResource.java b/guacamole/src/main/java/org/apache/guacamole/rest/history/HistoryResource.java
index 49695c4..53a8cdb 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/history/HistoryResource.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/history/HistoryResource.java
@@ -28,8 +28,8 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.ConnectionRecord;
-import org.apache.guacamole.net.auth.ConnectionRecordSet;
 import org.apache.guacamole.net.auth.UserContext;
 
 /**
@@ -92,7 +92,7 @@ public class HistoryResource {
             throws GuacamoleException {
 
         // Retrieve overall connection history
-        ConnectionRecordSet history = userContext.getConnectionHistory();
+        ActivityRecordSet<ConnectionRecord> history = userContext.getConnectionHistory();
 
         // Restrict to records which contain the specified strings
         for (String required : requiredContents) {


[4/7] incubator-guacamole-client git commit: GUACAMOLE-394: Remove UserRecord interface - recording historical auth tokens doesn't make sense, and removing that turns UserRecord into an empty interface.

Posted by vn...@apache.org.
GUACAMOLE-394: Remove UserRecord interface - recording historical auth tokens doesn't make sense, and removing that turns UserRecord into an empty interface.


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/700005e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/700005e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/700005e8

Branch: refs/heads/master
Commit: 700005e8238ec1cba18feb00c98c3a9997380811
Parents: 5340f55
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Sep 11 18:20:53 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 12:49:12 2017 -0700

----------------------------------------------------------------------
 .../jdbc/sharing/user/SharedUserContext.java    |  6 +--
 .../auth/jdbc/user/ModeledUserContext.java      |  6 +--
 .../guacamole/auth/ldap/user/UserContext.java   |  6 +--
 .../apache/guacamole/net/auth/UserContext.java  | 18 +++++----
 .../apache/guacamole/net/auth/UserRecord.java   | 39 --------------------
 .../net/auth/simple/SimpleUserContext.java      |  6 +--
 6 files changed, 23 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/700005e8/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
index 67cb6e4..4bc54b5 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
@@ -28,6 +28,7 @@ import org.apache.guacamole.auth.jdbc.sharing.connectiongroup.SharedRootConnecti
 import org.apache.guacamole.auth.jdbc.user.RemoteAuthenticatedUser;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
 import org.apache.guacamole.net.auth.Connection;
@@ -37,7 +38,6 @@ import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
 import org.apache.guacamole.net.auth.UserContext;
-import org.apache.guacamole.net.auth.UserRecord;
 import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
 import org.apache.guacamole.net.auth.simple.SimpleDirectory;
@@ -182,9 +182,9 @@ public class SharedUserContext implements UserContext {
     }
 
     @Override
-    public ActivityRecordSet<UserRecord> getUserHistory()
+    public ActivityRecordSet<ActivityRecord> getUserHistory()
             throws GuacamoleException {
-        return new SimpleActivityRecordSet<UserRecord>();
+        return new SimpleActivityRecordSet<ActivityRecord>();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/700005e8/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
index b18b955..1b238ab 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
@@ -36,6 +36,7 @@ import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
 import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileDirectory;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
 import org.apache.guacamole.net.auth.Connection;
@@ -43,7 +44,6 @@ import org.apache.guacamole.net.auth.ConnectionGroup;
 import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
-import org.apache.guacamole.net.auth.UserRecord;
 import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 
 /**
@@ -165,9 +165,9 @@ public class ModeledUserContext extends RestrictedObject
     }
 
     @Override
-    public ActivityRecordSet<UserRecord> getUserHistory()
+    public ActivityRecordSet<ActivityRecord> getUserHistory()
             throws GuacamoleException {
-        return new SimpleActivityRecordSet<UserRecord>();
+        return new SimpleActivityRecordSet<ActivityRecord>();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/700005e8/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
index b7e9e27..5e19dca 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
@@ -28,6 +28,7 @@ import org.apache.guacamole.auth.ldap.connection.ConnectionService;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticatedUser;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
@@ -37,7 +38,6 @@ import org.apache.guacamole.net.auth.ConnectionRecord;
 import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
-import org.apache.guacamole.net.auth.UserRecord;
 import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroup;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
@@ -212,9 +212,9 @@ public class UserContext implements org.apache.guacamole.net.auth.UserContext {
     }
 
     @Override
-    public ActivityRecordSet<UserRecord> getUserHistory()
+    public ActivityRecordSet<ActivityRecord> getUserHistory()
             throws GuacamoleException {
-        return new SimpleActivityRecordSet<UserRecord>();
+        return new SimpleActivityRecordSet<ActivityRecord>();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/700005e8/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
index 8c741b8..1c82f9c 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
@@ -143,9 +143,11 @@ public interface UserContext {
             throws GuacamoleException;
 
     /**
-     * Retrieves all connection records visible to current user. The resulting
-     * set of connection records can be further filtered and ordered using the
-     * methods defined on ActivityRecordSet.
+     * Retrieves all connection records visible to current user. Connection
+     * history records describe the start and end times of connections, and
+     * correspond to the times that users connect or disconnect to individual
+     * remote desktops. The resulting set of connection records can be further
+     * filtered and ordered using the methods defined on ActivityRecordSet.
      *
      * @return
      *     A set of all connection records visible to the current user.
@@ -157,9 +159,11 @@ public interface UserContext {
             throws GuacamoleException;
 
     /**
-     * Retrieves all user records visible to current user. The resulting
-     * set of user records can be further filtered and ordered using the
-     * methods defined on ActivityRecordSet.
+     * Retrieves all user history records visible to current user. User history
+     * records describe the start and end times of user sessions, and correspond
+     * to the times that users logged in or out. The resulting set of user
+     * records can be further filtered and ordered using the methods defined on
+     * ActivityRecordSet.
      *
      * @return
      *     A set of all user records visible to the current user.
@@ -167,7 +171,7 @@ public interface UserContext {
      * @throws GuacamoleException
      *     If an error occurs while retrieving the user records.
      */
-    ActivityRecordSet<UserRecord> getUserHistory() throws GuacamoleException;
+    ActivityRecordSet<ActivityRecord> getUserHistory() throws GuacamoleException;
 
     /**
      * Retrieves a connection group which can be used to view and manipulate

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/700005e8/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java
deleted file mode 100644
index 16ca2c6..0000000
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java
+++ /dev/null
@@ -1,39 +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.net.auth;
-
-/**
- * A logging record describing when a user started and ended their Guacamole
- * session.
- */
-public interface UserRecord extends ActivityRecord {
-
-    /**
-     * Returns the authentication token associated with the user's session, if
-     * known. If permission is not granted to view the authentication tokens of
-     * other users, this may be null.
-     *
-     * @return
-     *     The authentication token associated with the user's session, or null
-     *     if this information is unavailable.
-     */
-    public String getToken();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/700005e8/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
index 360d74a..1678d88 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
@@ -27,6 +27,7 @@ import java.util.UUID;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
 import org.apache.guacamole.net.auth.Connection;
@@ -36,7 +37,6 @@ import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
 import org.apache.guacamole.net.auth.UserContext;
-import org.apache.guacamole.net.auth.UserRecord;
 import org.apache.guacamole.protocol.GuacamoleConfiguration;
 
 /**
@@ -217,9 +217,9 @@ public class SimpleUserContext implements UserContext {
     }
 
     @Override
-    public ActivityRecordSet<UserRecord> getUserHistory()
+    public ActivityRecordSet<ActivityRecord> getUserHistory()
             throws GuacamoleException {
-        return new SimpleActivityRecordSet<UserRecord>();
+        return new SimpleActivityRecordSet<ActivityRecord>();
     }
 
     @Override


[2/7] incubator-guacamole-client git commit: GUACAMOLE-394: Separate definition of records and record sets into generalized interface.

Posted by vn...@apache.org.
GUACAMOLE-394: Separate definition of records and record sets into generalized interface.


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/cd5d2386
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/cd5d2386
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/cd5d2386

Branch: refs/heads/master
Commit: cd5d23866db316e5835cd7fcd5fcc3a9c9a3a67e
Parents: b64247d
Author: Michael Jumper <mj...@apache.org>
Authored: Tue Sep 5 13:45:45 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 12:30:03 2017 -0700

----------------------------------------------------------------------
 .../guacamole/net/auth/ActivityRecord.java      |  78 +++++++++++
 .../guacamole/net/auth/ActivityRecordSet.java   | 128 +++++++++++++++++++
 .../guacamole/net/auth/ConnectionRecord.java    |  48 +------
 .../guacamole/net/auth/ConnectionRecordSet.java |  32 +----
 4 files changed, 211 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/cd5d2386/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java
new file mode 100644
index 0000000..2324b0e
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecord.java
@@ -0,0 +1,78 @@
+/*
+ * 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.Date;
+
+/**
+ * A logging record describing when a user started and ended a particular
+ * activity.
+ */
+public interface ActivityRecord {
+
+    /**
+     * Returns the date and time the activity began.
+     *
+     * @return
+     *     The date and time the activity began.
+     */
+    public Date getStartDate();
+
+    /**
+     * Returns the date and time the activity ended, if applicable.
+     *
+     * @return
+     *     The date and time the activity ended, or null if the activity is
+     *     still ongoing or if the end time is unknown.
+     */
+    public Date getEndDate();
+
+    /**
+     * Returns the hostname or IP address of the remote host that performed the
+     * activity associated with this record, if known. If the hostname or IP
+     * address is not known, null is returned.
+     *
+     * @return
+     *     The hostname or IP address of the remote host, or null if this
+     *     information is not available.
+     */
+    public String getRemoteHost();
+
+    /**
+     * Returns the name of the user who performed or is performing the activity
+     * at the times given by this record.
+     *
+     * @return
+     *     The name of the user who performed or is performing the associated
+     *     activity.
+     */
+    public String getUsername();
+
+    /**
+     * Returns whether the activity associated with this record is still
+     * ongoing.
+     *
+     * @return
+     *     true if the activity associated with this record is still ongoing,
+     *     false otherwise.
+     */
+    public boolean isActive();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/cd5d2386/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecordSet.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecordSet.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecordSet.java
new file mode 100644
index 0000000..4cce03e
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ActivityRecordSet.java
@@ -0,0 +1,128 @@
+/*
+ * 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;
+
+/**
+ * A set of all available records related to a type of activity which has a
+ * defined start and end time, such as a user being logged in or connected, or a
+ * subset of those records.
+ *
+ * @param <RecordType>
+ *     The type of ActivityRecord contained within this set.
+ */
+public interface ActivityRecordSet<RecordType extends ActivityRecord> {
+
+    /**
+     * All properties of activity records which can be used as sorting
+     * criteria.
+     */
+    enum SortableProperty {
+
+        /**
+         * The date and time when the activity associated with the record
+         * began.
+         */
+        START_DATE
+
+    };
+
+    /**
+     * Returns all records within this set as a standard Collection.
+     *
+     * @return
+     *      A collection containing all records within this set.
+     *
+     * @throws GuacamoleException
+     *      If an error occurs while retrieving the records within this set.
+     */
+    Collection<RecordType> asCollection() throws GuacamoleException;
+
+    /**
+     * Returns the subset of records which contain the given value. The
+     * properties and semantics involved with determining whether a particular
+     * record "contains" the given value is implementation dependent. This
+     * function may affect the contents of the current ActivityRecordSet. The
+     * contents of the current ActivityRecordSet should NOT be relied upon
+     * after this function is called.
+     *
+     * @param value
+     *     The value which all records within the resulting subset should
+     *     contain.
+     *
+     * @return
+     *     The subset of records which contain the specified value.
+     *
+     * @throws GuacamoleException
+     *     If an error occurs while restricting the current subset.
+     */
+    ActivityRecordSet<RecordType> contains(String value)
+            throws GuacamoleException;
+
+    /**
+     * Returns the subset of records containing only the first
+     * <code>limit</code> records. If the subset has fewer than
+     * <code>limit</code> records, then this function has no effect. This
+     * function may also affect the contents of the current ActivityRecordSet.
+     * The contents of the current ActivityRecordSet should NOT be relied upon
+     * after this function is called.
+     *
+     * @param limit
+     *     The maximum number of records that the new subset should contain.
+     *
+     * @return
+     *     The subset of records that containing only the first
+     *     <code>limit</code> records.
+     *
+     * @throws GuacamoleException
+     *     If an error occurs while limiting the current subset.
+     */
+    ActivityRecordSet<RecordType> limit(int limit) throws GuacamoleException;
+
+    /**
+     * Returns a ActivityRecordSet containing identically the records within
+     * this set, sorted according to the specified criteria. The sort operation
+     * performed is guaranteed to be stable with respect to any past call to
+     * sort(). This function may also affect the contents of the current
+     * ActivityRecordSet. The contents of the current ActivityRecordSet
+     * should NOT be relied upon after this function is called.
+     *
+     * @param property
+     *     The property by which the records within the resulting set should be
+     *     sorted.
+     *
+     * @param desc
+     *     Whether the records should be sorted according to the specified
+     *     property in descending order. If false, records will be sorted
+     *     according to the specified property in ascending order.
+     *
+     * @return
+     *     The ActivityRecordSet, sorted according to the specified criteria.
+     *
+     * @throws GuacamoleException
+     *     If an error occurs while sorting the current subset, or if the given
+     *     property is not supported by the implementation.
+     */
+    ActivityRecordSet<RecordType> sort(SortableProperty property, boolean desc)
+            throws GuacamoleException;
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/cd5d2386/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java
index 95c5f6c..21e30a9 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecord.java
@@ -19,13 +19,11 @@
 
 package org.apache.guacamole.net.auth;
 
-import java.util.Date;
-
 /**
  * A logging record describing when a user started and ended usage of a
  * particular connection.
  */
-public interface ConnectionRecord {
+public interface ConnectionRecord extends ActivityRecord {
 
     /**
      * Returns the identifier of the connection associated with this
@@ -72,48 +70,4 @@ public interface ConnectionRecord {
      */
     public String getSharingProfileName();
 
-    /**
-     * Returns the date and time the connection began.
-     *
-     * @return The date and time the connection began.
-     */
-    public Date getStartDate();
-
-    /**
-     * Returns the date and time the connection ended, if applicable.
-     *
-     * @return The date and time the connection ended, or null if the
-     *         connection is still running or if the end time is unknown.
-     */
-    public Date getEndDate();
-
-    /**
-     * Returns the hostname or IP address of the remote host that used the
-     * connection associated with this record, if known. If the hostname or IP
-     * address is not known, null is returned.
-     *
-     * @return
-     *     The hostname or IP address of the remote host, or null if this
-     *     information is not available.
-     */
-    public String getRemoteHost();
-
-    /**
-     * Returns the name of the user who used or is using the connection at the
-     * times given by this connection record.
-     *
-     * @return The name of the user who used or is using the associated
-     *         connection.
-     */
-    public String getUsername();
-
-    /**
-     * Returns whether the connection associated with this record is still
-     * active.
-     *
-     * @return true if the connection associated with this record is still
-     *         active, false otherwise.
-     */
-    public boolean isActive();
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/cd5d2386/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
index 5198cfa..87f91bb 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/ConnectionRecordSet.java
@@ -19,39 +19,12 @@
 
 package org.apache.guacamole.net.auth;
 
-import java.util.Collection;
 import org.apache.guacamole.GuacamoleException;
 
 /**
  * The set of all available connection records, or a subset of those records.
  */
-public interface ConnectionRecordSet {
-
-    /**
-     * All properties of connection records which can be used as sorting
-     * criteria.
-     */
-    enum SortableProperty {
-
-        /**
-         * The date and time when the connection associated with the
-         * connection record began.
-         */
-        START_DATE
-
-    };
-
-    /**
-     * Returns all connection records within this set as a standard Collection.
-     *
-     * @return
-     *      A collection containing all connection records within this set.
-     *
-     * @throws GuacamoleException
-     *      If an error occurs while retrieving the connection records within
-     *      this set.
-     */
-    Collection<ConnectionRecord> asCollection() throws GuacamoleException;
+public interface ConnectionRecordSet extends ActivityRecordSet<ConnectionRecord> {
 
     /**
      * Returns the subset of connection records to only those where the
@@ -73,6 +46,7 @@ public interface ConnectionRecordSet {
      * @throws GuacamoleException
      *     If an error occurs while restricting the current subset.
      */
+    @Override
     ConnectionRecordSet contains(String value) throws GuacamoleException;
 
     /**
@@ -93,6 +67,7 @@ public interface ConnectionRecordSet {
      * @throws GuacamoleException
      *     If an error occurs while limiting the current subset.
      */
+    @Override
     ConnectionRecordSet limit(int limit) throws GuacamoleException;
 
     /**
@@ -119,6 +94,7 @@ public interface ConnectionRecordSet {
      * @throws GuacamoleException
      *     If an error occurs while sorting the current subset.
      */
+    @Override
     ConnectionRecordSet sort(SortableProperty property, boolean desc)
             throws GuacamoleException;
 


[3/7] incubator-guacamole-client git commit: GUACAMOLE-394: Add API support for user login/logout records.

Posted by vn...@apache.org.
GUACAMOLE-394: Add API support for user login/logout records.


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/5340f553
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/5340f553
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/5340f553

Branch: refs/heads/master
Commit: 5340f553616108283f399a811dc1eace14aa92d2
Parents: 26122eb
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Sep 9 13:43:49 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 12:48:37 2017 -0700

----------------------------------------------------------------------
 .../jdbc/sharing/user/SharedUserContext.java    |  7 ++++
 .../auth/jdbc/user/ModeledUserContext.java      |  9 +++++
 .../guacamole/auth/ldap/user/UserContext.java   |  7 ++++
 .../apache/guacamole/net/auth/UserContext.java  | 13 +++++++
 .../apache/guacamole/net/auth/UserRecord.java   | 39 ++++++++++++++++++++
 .../net/auth/simple/SimpleUserContext.java      |  7 ++++
 6 files changed, 82 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5340f553/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
index cdfe0fc..67cb6e4 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
@@ -37,6 +37,7 @@ import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
 import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.net.auth.UserRecord;
 import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
 import org.apache.guacamole.net.auth.simple.SimpleDirectory;
@@ -181,6 +182,12 @@ public class SharedUserContext implements UserContext {
     }
 
     @Override
+    public ActivityRecordSet<UserRecord> getUserHistory()
+            throws GuacamoleException {
+        return new SimpleActivityRecordSet<UserRecord>();
+    }
+
+    @Override
     public ConnectionGroup getRootConnectionGroup() {
         return rootGroup;
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5340f553/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
index 9d3ba69..b18b955 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
@@ -36,12 +36,15 @@ import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
 import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileDirectory;
 import org.apache.guacamole.form.Form;
 import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.ActivityRecordSet;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
 import org.apache.guacamole.net.auth.Connection;
 import org.apache.guacamole.net.auth.ConnectionGroup;
 import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
+import org.apache.guacamole.net.auth.UserRecord;
+import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 
 /**
  * UserContext implementation which is driven by an arbitrary, underlying
@@ -162,6 +165,12 @@ public class ModeledUserContext extends RestrictedObject
     }
 
     @Override
+    public ActivityRecordSet<UserRecord> getUserHistory()
+            throws GuacamoleException {
+        return new SimpleActivityRecordSet<UserRecord>();
+    }
+
+    @Override
     public ConnectionGroup getRootConnectionGroup() throws GuacamoleException {
 
         // Build and return a root group for the current user

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5340f553/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
index 98d65ea..b7e9e27 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/user/UserContext.java
@@ -37,6 +37,7 @@ import org.apache.guacamole.net.auth.ConnectionRecord;
 import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
+import org.apache.guacamole.net.auth.UserRecord;
 import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroup;
 import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
@@ -211,6 +212,12 @@ public class UserContext implements org.apache.guacamole.net.auth.UserContext {
     }
 
     @Override
+    public ActivityRecordSet<UserRecord> getUserHistory()
+            throws GuacamoleException {
+        return new SimpleActivityRecordSet<UserRecord>();
+    }
+
+    @Override
     public Collection<Form> getUserAttributes() {
         return Collections.<Form>emptyList();
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5340f553/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
index 92f3604..8c741b8 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserContext.java
@@ -157,6 +157,19 @@ public interface UserContext {
             throws GuacamoleException;
 
     /**
+     * Retrieves all user records visible to current user. The resulting
+     * set of user records can be further filtered and ordered using the
+     * methods defined on ActivityRecordSet.
+     *
+     * @return
+     *     A set of all user records visible to the current user.
+     *
+     * @throws GuacamoleException
+     *     If an error occurs while retrieving the user records.
+     */
+    ActivityRecordSet<UserRecord> getUserHistory() throws GuacamoleException;
+
+    /**
      * Retrieves a connection group which can be used to view and manipulate
      * connections, but only as allowed by the permissions given to the user of 
      * this UserContext.

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5340f553/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java
new file mode 100644
index 0000000..16ca2c6
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserRecord.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+/**
+ * A logging record describing when a user started and ended their Guacamole
+ * session.
+ */
+public interface UserRecord extends ActivityRecord {
+
+    /**
+     * Returns the authentication token associated with the user's session, if
+     * known. If permission is not granted to view the authentication tokens of
+     * other users, this may be null.
+     *
+     * @return
+     *     The authentication token associated with the user's session, or null
+     *     if this information is unavailable.
+     */
+    public String getToken();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5340f553/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
index 97584ed..360d74a 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserContext.java
@@ -36,6 +36,7 @@ import org.apache.guacamole.net.auth.Directory;
 import org.apache.guacamole.net.auth.SharingProfile;
 import org.apache.guacamole.net.auth.User;
 import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.net.auth.UserRecord;
 import org.apache.guacamole.protocol.GuacamoleConfiguration;
 
 /**
@@ -216,6 +217,12 @@ public class SimpleUserContext implements UserContext {
     }
 
     @Override
+    public ActivityRecordSet<UserRecord> getUserHistory()
+            throws GuacamoleException {
+        return new SimpleActivityRecordSet<UserRecord>();
+    }
+
+    @Override
     public Collection<Form> getUserAttributes() {
         return Collections.<Form>emptyList();
     }


[5/7] incubator-guacamole-client git commit: GUACAMOLE-394: Add history list at User object level (similar to Connection).

Posted by vn...@apache.org.
GUACAMOLE-394: Add history list at User object level (similar to Connection).


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/b61f14e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b61f14e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b61f14e4

Branch: refs/heads/master
Commit: b61f14e4db06bf2d2dfc1fd7e2098e0d96618b82
Parents: 700005e
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Sep 11 18:33:49 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 12:49:43 2017 -0700

----------------------------------------------------------------------
 .../auth/jdbc/sharing/user/SharedUser.java        | 10 ++++++++++
 .../guacamole/auth/jdbc/user/ModeledUser.java     |  7 +++++++
 .../java/org/apache/guacamole/net/auth/User.java  | 18 ++++++++++++++++++
 .../guacamole/net/auth/simple/SimpleUser.java     |  7 +++++++
 .../guacamole/rest/user/APIUserWrapper.java       |  8 ++++++++
 5 files changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b61f14e4/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
index 57120ea..07d762a 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
@@ -20,9 +20,11 @@
 package org.apache.guacamole.auth.jdbc.sharing.user;
 
 import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.auth.jdbc.sharing.permission.SharedObjectPermissionSet;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.AuthenticatedUser;
 import org.apache.guacamole.net.auth.Connection;
 import org.apache.guacamole.net.auth.ConnectionGroup;
@@ -89,6 +91,14 @@ public class SharedUser implements User {
     }
 
     @Override
+    public List<ActivityRecord> getHistory() throws GuacamoleException {
+
+        // History is not recorded for shared users
+        return Collections.<ActivityRecord>emptyList();
+
+    }
+
+    @Override
     public String getPassword() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b61f14e4/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
index 36a0be8..1d40c1f 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
@@ -29,6 +29,7 @@ import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
 import org.apache.guacamole.auth.jdbc.base.ModeledDirectoryObject;
@@ -49,6 +50,7 @@ import org.apache.guacamole.form.Form;
 import org.apache.guacamole.form.TextField;
 import org.apache.guacamole.form.TimeField;
 import org.apache.guacamole.form.TimeZoneField;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.User;
 import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
 import org.apache.guacamole.net.auth.permission.SystemPermission;
@@ -792,4 +794,9 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
         return getModel().isExpired();
     }
 
+    @Override
+    public List<ActivityRecord> getHistory() throws GuacamoleException {
+        return Collections.<ActivityRecord>emptyList();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b61f14e4/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 88756e4..43d57c0 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
@@ -19,6 +19,7 @@
 
 package org.apache.guacamole.net.auth;
 
+import java.util.List;
 import java.util.Map;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
@@ -101,6 +102,23 @@ public interface User extends Identifiable {
     void setAttributes(Map<String, String> attributes);
 
     /**
+     * Returns a list of ActivityRecords representing the login history
+     * of this user, including any active sessions. ActivityRecords
+     * in this list will be sorted in descending order of end time (active
+     * sessions are first), and then in descending order of start time
+     * (newer sessions are first).
+     *
+     * @return
+     *     A list of ActivityRecords representing the login history of this
+     *     User.
+     *
+     * @throws GuacamoleException
+     *     If an error occurs while reading the history of this user, or if
+     *     permission is denied.
+     */
+    List<? extends ActivityRecord> getHistory() throws GuacamoleException;
+
+    /**
      * Returns all system-level permissions given to this user.
      *
      * @return

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b61f14e4/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
index d6db92f..cd20f39 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
@@ -22,10 +22,12 @@ package org.apache.guacamole.net.auth.simple;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.net.auth.AbstractUser;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.permission.ObjectPermission;
 import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
 import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
@@ -164,6 +166,11 @@ public class SimpleUser extends AbstractUser {
     }
 
     @Override
+    public List<ActivityRecord> getHistory() throws GuacamoleException {
+        return Collections.<ActivityRecord>emptyList();
+    }
+
+    @Override
     public SystemPermissionSet getSystemPermissions()
             throws GuacamoleException {
         return new SimpleSystemPermissionSet();

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b61f14e4/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java b/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
index 35769fa..7f37be6 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
@@ -19,9 +19,12 @@
 
 package org.apache.guacamole.rest.user;
 
+import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.GuacamoleUnsupportedException;
+import org.apache.guacamole.net.auth.ActivityRecord;
 import org.apache.guacamole.net.auth.User;
 import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
 import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
@@ -112,4 +115,9 @@ public class APIUserWrapper implements User {
         throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access.");
     }
 
+    @Override
+    public List<? extends ActivityRecord> getHistory() throws GuacamoleException {
+        return Collections.<ActivityRecord>emptyList();
+    }
+
 }


[7/7] incubator-guacamole-client git commit: GUACAMOLE-394: Merge refactor extension API to define user history

Posted by vn...@apache.org.
GUACAMOLE-394: Merge refactor extension API to define user history


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/81ffa5c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/81ffa5c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/81ffa5c8

Branch: refs/heads/master
Commit: 81ffa5c8e16ee702bb9c2618bb3bf072a34a5c1d
Parents: 9b5483e 3cd7f45
Author: Nick Couchman <vn...@apache.org>
Authored: Wed Sep 27 18:14:43 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Wed Sep 27 18:14:43 2017 -0400

----------------------------------------------------------------------
 .../jdbc/connection/ConnectionRecordSet.java    |  10 +-
 .../ConnectionRecordSortPredicate.java          |   8 +-
 .../auth/jdbc/connection/ModeledConnection.java |   6 +
 .../sharing/connection/SharedConnection.java    |   6 +
 .../auth/jdbc/sharing/user/SharedUser.java      |  19 +++
 .../jdbc/sharing/user/SharedUserContext.java    |  16 ++-
 .../guacamole/auth/jdbc/user/ModeledUser.java   |  12 ++
 .../auth/jdbc/user/ModeledUserContext.java      |   9 ++
 .../jdbc/connection/ConnectionRecordMapper.xml  |   4 +-
 .../jdbc/connection/ConnectionRecordMapper.xml  |   4 +-
 .../guacamole/auth/ldap/user/UserContext.java   |  16 ++-
 .../guacamole/net/auth/ActivityRecord.java      |  78 +++++++++++
 .../guacamole/net/auth/ActivityRecordSet.java   | 128 +++++++++++++++++++
 .../apache/guacamole/net/auth/Connection.java   |  13 ++
 .../guacamole/net/auth/ConnectionRecord.java    |  48 +------
 .../guacamole/net/auth/ConnectionRecordSet.java | 106 +--------------
 .../org/apache/guacamole/net/auth/User.java     |  30 +++++
 .../apache/guacamole/net/auth/UserContext.java  |  26 +++-
 .../auth/simple/SimpleActivityRecordSet.java    |  62 +++++++++
 .../net/auth/simple/SimpleConnection.java       |   6 +
 .../auth/simple/SimpleConnectionRecordSet.java  |  14 +-
 .../guacamole/net/auth/simple/SimpleUser.java   |  13 ++
 .../net/auth/simple/SimpleUserContext.java      |  14 +-
 .../rest/connection/APIConnectionWrapper.java   |   6 +
 .../APIConnectionRecordSortPredicate.java       |  26 ++--
 .../guacamole/rest/history/HistoryResource.java |   4 +-
 .../guacamole/rest/user/APIUserWrapper.java     |  14 ++
 27 files changed, 504 insertions(+), 194 deletions(-)
----------------------------------------------------------------------



[6/7] incubator-guacamole-client git commit: GUACAMOLE-394: Add getLastActive() function, returning the time that a user/connection was last logged-in / used.

Posted by vn...@apache.org.
GUACAMOLE-394: Add getLastActive() function, returning the time that a user/connection was last logged-in / used.


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/3cd7f453
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/3cd7f453
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/3cd7f453

Branch: refs/heads/master
Commit: 3cd7f453c0a9ba8abd69c76cce8da8a917c0021e
Parents: b61f14e
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Sep 11 18:49:11 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 12:50:52 2017 -0700

----------------------------------------------------------------------
 .../auth/jdbc/connection/ModeledConnection.java        |  6 ++++++
 .../auth/jdbc/sharing/connection/SharedConnection.java |  6 ++++++
 .../guacamole/auth/jdbc/sharing/user/SharedUser.java   |  9 +++++++++
 .../apache/guacamole/auth/jdbc/user/ModeledUser.java   |  5 +++++
 .../java/org/apache/guacamole/net/auth/Connection.java | 13 +++++++++++++
 .../main/java/org/apache/guacamole/net/auth/User.java  | 12 ++++++++++++
 .../guacamole/net/auth/simple/SimpleConnection.java    |  6 ++++++
 .../apache/guacamole/net/auth/simple/SimpleUser.java   |  6 ++++++
 .../rest/connection/APIConnectionWrapper.java          |  6 ++++++
 .../org/apache/guacamole/rest/user/APIUserWrapper.java |  6 ++++++
 10 files changed, 75 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
index 365c40d..c596b27 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
@@ -24,6 +24,7 @@ import com.google.inject.Provider;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -233,6 +234,11 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
     }
 
     @Override
+    public Date getLastActive() {
+        return null;
+    }
+
+    @Override
     public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
         return connectionService.retrieveHistory(getCurrentUser(), this);
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connection/SharedConnection.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connection/SharedConnection.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connection/SharedConnection.java
index 1c955db..5483d02 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connection/SharedConnection.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/connection/SharedConnection.java
@@ -21,6 +21,7 @@ package org.apache.guacamole.auth.jdbc.sharing.connection;
 
 import com.google.inject.Inject;
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -147,6 +148,11 @@ public class SharedConnection implements Connection {
     }
 
     @Override
+    public Date getLastActive() {
+        return null;
+    }
+
+    @Override
     public List<? extends ConnectionRecord> getHistory()
             throws GuacamoleException {
         return Collections.<ConnectionRecord>emptyList();

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
index 07d762a..8e7931d 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUser.java
@@ -20,6 +20,7 @@
 package org.apache.guacamole.auth.jdbc.sharing.user;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import org.apache.guacamole.GuacamoleException;
@@ -91,6 +92,14 @@ public class SharedUser implements User {
     }
 
     @Override
+    public Date getLastActive() {
+
+        // History is not recorded for shared users
+        return null;
+
+    }
+
+    @Override
     public List<ActivityRecord> getHistory() throws GuacamoleException {
 
         // History is not recorded for shared users

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
index 1d40c1f..fc43e36 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
@@ -795,6 +795,11 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
     }
 
     @Override
+    public Date getLastActive() {
+        return null;
+    }
+
+    @Override
     public List<ActivityRecord> getHistory() throws GuacamoleException {
         return Collections.<ActivityRecord>emptyList();
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/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 b0795e2..85fd168 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
@@ -19,6 +19,7 @@
 
 package org.apache.guacamole.net.auth;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -103,6 +104,18 @@ public interface Connection extends Identifiable, Connectable {
     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
+     * may be null.
+     *
+     * @return
+     *     The date and time this connection was last used, or null if this
+     *     information is unavailable or inapplicable.
+     */
+    Date getLastActive();
+
+    /**
      * Returns a list of ConnectionRecords representing the usage history
      * of this Connection, including any active users. ConnectionRecords
      * in this list will be sorted in descending order of end time (active

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/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 43d57c0..f7bd61c 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
@@ -19,6 +19,7 @@
 
 package org.apache.guacamole.net.auth;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import org.apache.guacamole.GuacamoleException;
@@ -102,6 +103,17 @@ public interface User extends Identifiable {
     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.
+     *
+     * @return
+     *     The date and time this user was last active, or null if this
+     *     information is unavailable or inapplicable.
+     */
+    Date getLastActive();
+
+    /**
      * Returns a list of ActivityRecords representing the login history
      * of this user, including any active sessions. ActivityRecords
      * in this list will be sorted in descending order of end time (active

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnection.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnection.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnection.java
index 2251a9e..85783a0 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnection.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnection.java
@@ -20,6 +20,7 @@
 package org.apache.guacamole.net.auth.simple;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import org.apache.guacamole.GuacamoleException;
@@ -137,6 +138,11 @@ public class SimpleConnection extends AbstractConnection {
     }
 
     @Override
+    public Date getLastActive() {
+        return null;
+    }
+
+    @Override
     public List<ConnectionRecord> getHistory() throws GuacamoleException {
         return Collections.<ConnectionRecord>emptyList();
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
index cd20f39..19ed357 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java
@@ -21,6 +21,7 @@ package org.apache.guacamole.net.auth.simple;
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -166,6 +167,11 @@ public class SimpleUser extends AbstractUser {
     }
 
     @Override
+    public Date getLastActive() {
+        return null;
+    }
+
+    @Override
     public List<ActivityRecord> getHistory() throws GuacamoleException {
         return Collections.<ActivityRecord>emptyList();
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/guacamole/src/main/java/org/apache/guacamole/rest/connection/APIConnectionWrapper.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/connection/APIConnectionWrapper.java b/guacamole/src/main/java/org/apache/guacamole/rest/connection/APIConnectionWrapper.java
index e06e338..3a987e5 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/connection/APIConnectionWrapper.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/connection/APIConnectionWrapper.java
@@ -20,6 +20,7 @@
 package org.apache.guacamole.rest.connection;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -132,6 +133,11 @@ public class APIConnectionWrapper implements Connection {
     }
 
     @Override
+    public Date getLastActive() {
+        return null;
+    }
+
+    @Override
     public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
         return Collections.<ConnectionRecord>emptyList();
     }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3cd7f453/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java b/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
index 7f37be6..c4b85f9 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/user/APIUserWrapper.java
@@ -20,6 +20,7 @@
 package org.apache.guacamole.rest.user;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import org.apache.guacamole.GuacamoleException;
@@ -116,6 +117,11 @@ public class APIUserWrapper implements User {
     }
 
     @Override
+    public Date getLastActive() {
+        return null;
+    }
+
+    @Override
     public List<? extends ActivityRecord> getHistory() throws GuacamoleException {
         return Collections.<ActivityRecord>emptyList();
     }