You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/07/13 05:09:53 UTC

[15/24] incubator-guacamole-client git commit: GUACAMOLE-5: Rename SessionResource to SessionDataRESTService for consistency.

GUACAMOLE-5: Rename SessionResource to SessionDataRESTService for consistency.


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

Branch: refs/heads/master
Commit: 3c9da92e9ce7c918907405fbeab8d031c3a47b04
Parents: 89eabc1
Author: Michael Jumper <mj...@apache.org>
Authored: Tue Jul 12 14:02:34 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Tue Jul 12 21:23:47 2016 -0700

----------------------------------------------------------------------
 .../guacamole/rest/RESTServiceModule.java       |   4 +-
 .../rest/session/SessionDataRESTService.java    | 100 +++++++++++++++++++
 .../guacamole/rest/session/SessionResource.java | 100 -------------------
 3 files changed, 102 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3c9da92e/guacamole/src/main/java/org/apache/guacamole/rest/RESTServiceModule.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/RESTServiceModule.java b/guacamole/src/main/java/org/apache/guacamole/rest/RESTServiceModule.java
index 88551b3..a94f836 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/RESTServiceModule.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/RESTServiceModule.java
@@ -20,7 +20,7 @@
 package org.apache.guacamole.rest;
 
 import org.apache.guacamole.rest.session.UserContextResourceFactory;
-import org.apache.guacamole.rest.session.SessionResource;
+import org.apache.guacamole.rest.session.SessionDataRESTService;
 import com.google.inject.Scopes;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
 import com.google.inject.matcher.Matchers;
@@ -92,7 +92,7 @@ public class RESTServiceModule extends ServletModule {
         bind(TunnelRESTService.class);
 
         // Root-level resources
-        bind(SessionResource.class);
+        bind(SessionDataRESTService.class);
         install(new FactoryModuleBuilder().build(UserContextResourceFactory.class));
 
         // Resources below root

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3c9da92e/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionDataRESTService.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionDataRESTService.java b/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionDataRESTService.java
new file mode 100644
index 0000000..e21eaa4
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionDataRESTService.java
@@ -0,0 +1,100 @@
+/*
+ * 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.rest.session;
+
+import com.google.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+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.GuacamoleSession;
+import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.rest.ObjectRetrievalService;
+import org.apache.guacamole.rest.auth.AuthenticationService;
+
+/**
+ * A REST service which exposes all data associated with a Guacamole user's
+ * session via the underlying UserContexts.
+ *
+ * @author Michael Jumper
+ */
+@Path("/data")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public class SessionDataRESTService {
+
+    /**
+     * A service for authenticating users from auth tokens.
+     */
+    @Inject
+    private AuthenticationService authenticationService;
+
+    /**
+     * Service for convenient retrieval of objects.
+     */
+    @Inject
+    private ObjectRetrievalService retrievalService;
+
+    /**
+     * Factory for creating UserContextResources which expose a given
+     * UserContext.
+     */
+    @Inject
+    private UserContextResourceFactory userContextResourceFactory;
+
+    /**
+     * Retrieves a resource representing the UserContext associated with the
+     * AuthenticationProvider having the given identifier.
+     *
+     * @param authToken
+     *     The authentication token that is used to authenticate the user
+     *     performing the operation.
+     *
+     * @param authProviderIdentifier
+     *     The unique identifier of the AuthenticationProvider associated with
+     *     the UserContext being retrieved.
+     *
+     * @return
+     *     A resource representing the UserContext associated with the
+     *     AuthenticationProvider having the given identifier.
+     *
+     * @throws GuacamoleException
+     *     If the authentication token or AuthenticationProvider identifier are
+     *     invalid.
+     */
+    @Path("{dataSource}")
+    public UserContextResource getUserContextResource(
+            @QueryParam("token") String authToken,
+            @PathParam("dataSource") String authProviderIdentifier)
+            throws GuacamoleException {
+
+        // Pull UserContext defined by the given auth provider identifier
+        GuacamoleSession session = authenticationService.getGuacamoleSession(authToken);
+        UserContext userContext = retrievalService.retrieveUserContext(session, authProviderIdentifier);
+
+        // Return a resource exposing the retrieved UserContext
+        return userContextResourceFactory.create(userContext);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3c9da92e/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionResource.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionResource.java b/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionResource.java
deleted file mode 100644
index 7c98a65..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/rest/session/SessionResource.java
+++ /dev/null
@@ -1,100 +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.rest.session;
-
-import com.google.inject.Inject;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-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.GuacamoleSession;
-import org.apache.guacamole.net.auth.UserContext;
-import org.apache.guacamole.rest.ObjectRetrievalService;
-import org.apache.guacamole.rest.auth.AuthenticationService;
-
-/**
- * A REST resource which exposes all UserContexts within a Guacamole user's
- * session.
- *
- * @author mjumper
- */
-@Path("/data")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public class SessionResource {
-
-    /**
-     * A service for authenticating users from auth tokens.
-     */
-    @Inject
-    private AuthenticationService authenticationService;
-
-    /**
-     * Service for convenient retrieval of objects.
-     */
-    @Inject
-    private ObjectRetrievalService retrievalService;
-
-    /**
-     * Factory for creating UserContextResources which expose a given
-     * UserContext.
-     */
-    @Inject
-    private UserContextResourceFactory userContextResourceFactory;
-
-    /**
-     * Retrieves a resource representing the UserContext associated with the
-     * AuthenticationProvider having the given identifier.
-     *
-     * @param authToken
-     *     The authentication token that is used to authenticate the user
-     *     performing the operation.
-     *
-     * @param authProviderIdentifier
-     *     The unique identifier of the AuthenticationProvider associated with
-     *     the UserContext being retrieved.
-     *
-     * @return
-     *     A resource representing the UserContext associated with the
-     *     AuthenticationProvider having the given identifier.
-     *
-     * @throws GuacamoleException
-     *     If the authentication token or AuthenticationProvider identifier are
-     *     invalid.
-     */
-    @Path("{dataSource}")
-    public UserContextResource getUserContextResource(
-            @QueryParam("token") String authToken,
-            @PathParam("dataSource") String authProviderIdentifier)
-            throws GuacamoleException {
-
-        // Pull UserContext defined by the given auth provider identifier
-        GuacamoleSession session = authenticationService.getGuacamoleSession(authToken);
-        UserContext userContext = retrievalService.retrieveUserContext(session, authProviderIdentifier);
-
-        // Return a resource exposing the retrieved UserContext
-        return userContextResourceFactory.create(userContext);
-
-    }
-
-}