GitHub user mike-jumper opened a pull request:
https://github.com/apache/incubator-guacamole-client/pull/26
GUACAMOLE-5: Refactor /api/data/... REST services into resources
The REST API changes required for the interface side of screen sharing
require exposing additional resources beneath the existing `TunnelRESTService`,
but this is inconvenient due to the structure of the REST services within
Guacamole in general. Each such REST service re-implements the same lookup
logic for every single subresource, and there is little potential for reuse
among services that might need to return resources of a common type.
This enormous change refactors the main REST services under `/api/data` as
resources, with the root `/api/data` being the only remaining REST service:
`SessionDataRESTService`.
Beneath that, each `UserContext` applying to the user's session is exposed
via a `UserContextResource`, which contains resources for each directory within
the `UserContext`, which contain resources for each object within the
directory, etc.
Common base classes have been used where possible, so the universal
add/update/remove operations which apply to `Directory` need not be
re-implemented across all resources which expose a `Directory`, though there
are still cases where such operations are overridden to enforce additional
semantics (such as denying access to editing your own user account).
Each new resource is split across a dedicated module which loads the
required injections, an optional `DirectoryResource` implementation which
exposes the related `Directory` (if the base class is insufficient), a
`DirectoryObjectResource` implementation which exposes the objects themselves
(always required as assisted injection cannot handle the additional
generically-typed parameter for the corresponding factory `create()` method),
and a `DirectoryObjectTranslator` implementation which translates between the
internal and external versions of an object. The various types of resources are
all created with factories, the implementations of which are generated
dynamically by Guice's assisted injection extension.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mike-jumper/incubator-guacamole-client
subresources
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-guacamole-client/pull/26.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #26
----
commit d3a9cecb17f12903141a616bf051cf832b06fb69
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T06:44:56Z
GUACAMOLE-5: Define base classes for REST API subresource locators.
commit e579eae95cd93bf1defb8f64d8990a2d31e5331f
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T07:15:18Z
GUACAMOLE-5: Add root-level resources exposing UserContexts.
commit f440f558230e474032948f52f04f17bf4f17192a
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T07:20:36Z
GUACAMOLE-5: Validate that data was provided when creating/updating
resources.
commit bca4e34b512e5b3935ffd41c94d14b95100d898c
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T07:31:52Z
GUACAMOLE-5: Provide UserContext to DirectoryObjectResourceFactory, in case
needed by a particular resource (such as for additional permission checks).
commit 06b7887807d15b253ec8e1198e2cf865660402c1
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T07:49:46Z
GUACAMOLE-5: Replace ConnectionRESTService with new resource-driven
implementation.
commit 71c2b4e4d4c274f5ef1fe2d3f5ecfcd40639de3a
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T18:41:59Z
GUACAMOLE-5: Replace ConnectionGroupRESTService with new resource-driven
implementation.
commit 61d581ef0dced3ec1bf13d15de26a1980cc30413
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T19:25:24Z
GUACAMOLE-5: Replace ActiveConnectionRESTService with new resource-driven
implementation.
commit 4430bd5a49a625632cd20971454e4fd603e4b0b4
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T20:01:42Z
GUACAMOLE-5: Replace UserRESTService with new resource-driven
implementation.
commit c85ce75eb9fad0e18000496690e60314180df22c
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T20:19:19Z
GUACAMOLE-5: Move permission management to own resource.
commit 26ec6d1e322ee890da183ac8d0c9b71756c4538c
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T20:22:10Z
GUACAMOLE-5: Ensure random password is generated for new users (if not
otherwise specified).
commit a8f407ccdfcfbc768f0eca6c71a33e0cb1ad6c5e
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T20:43:37Z
GUACAMOLE-5: Refactor HistoryRESTService as a resource.
commit a0a72e6a2c8b106eb277a79014c08ba4faaf5e0d
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T21:00:17Z
GUACAMOLE-5: Expose UserContext schema as a resource, not a separate REST
service. Refactor URLs accordingly.
commit 3b2e1ee7fd3a1890ac3d583492103e3da350cdb9
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T21:02:34Z
GUACAMOLE-5: Rename SessionResource to SessionDataRESTService for
consistency.
commit e20ba39c8b2be0f5de34be56d462c5d297e2e5e5
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T21:12:11Z
GUACAMOLE-5: Remove unneeded functions from ObjectRetrievalService.
commit b17d264201eedb5f7977444bb37c8c4d6e0c0433
Author: Michael Jumper <[email protected]>
Date: 2016-07-12T21:47:47Z
GUACAMOLE-5: Take superclass into account when determining whether a method
is a REST method.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---