-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPII-4273iii LFM gets repository revision and computes URL to solutions registry therein #840
Open
klown
wants to merge
93
commits into
GPII:master
Choose a base branch
from
klown:GPII-4273iii
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
44e0f86
GPII-4273: Working version of revision requester and its tests
klown 06104ec
GPII-4273: Improved require statement to import GpiiRevisionRequeste…
klown 1541231
GPII-4273: Fixed lint errors
klown 1d92148
GPII-4273: Merged branch 'GPII-4273ii' into GPII-4273iii
klown 81be7b4
GPII-4273: Improved specification of the URL members
klown 0bb842d
GPII-4273: Added documentation for GpiiRevisionRequester's getRevision()
klown 0f416fc
GPII-4273: LFM modified to run in development and production configur…
klown 8902184
GPII-4273: (GPII-4273iii) Merged branch 'GPII-4273ii' into GPII-4273iii
klown a0c721f
GPII-4273: (GPII-4273iii) Fixed untrusted config files
klown 52ed7cb
GPII-4273: (GPII-4273iii) Used platform reporter for the solutions re…
klown 7a44636
GPII-4273: (GPII-4273iii) Merged from upstream master branch and 'GPI…
klown 28b2cc4
GPII-4273: (GPII-4273iv) Added repositorySolutionsLoader component
klown 76f6453
GPII-4273: (GPII-4273iv) Added more tests
klown 9066f8f
GPII-4273: (GPII-4273iv) Fixed config file error, and typo in option…
klown c47f65a
GPII-4273: (GPII-4273iv) Added latest tests to "all-tests.js"
klown b07a486
GPII-4273: (GPII-4273iv) Added test checking writing solutions regist…
klown ce79b5b
GPII-4273: (GPII-4273iv) Removed writing of local solutions registry …
klown 2fbacf7
GPII-4273: (GPII-4273iii) Removed cruft and improved function name
klown 3a93c64
GPII-4273: (GPII-4273v) Merged changes from upstream GPII master branch
klown 575797f
GPII-4273: (GPII-4273iii) Added solutions ID to solutions registry me…
klown 97a9cee
GPII-4273: (GPII-4273iv) Repository solutions registry fetch part of…
klown b8d2743
GPII-4273: (GPII-4273iv) Debugging: removing some tests
klown 013ccfc
GPII-4273: (GPII-4273iv) Handles failure to fetch repository solution…
klown d99c936
GPII-4273: (GPII-4273iv) Debugging: putting tests back
klown b460d5f
GPII-4273: (GPII-4273iv) Reworked flowManagerReady sequence
klown 7c9763c
GPII-4273: (GPII-4273iv) Modified sequence leading up to flowManagerR…
klown c9813d6
GPII-4273: (GPII-4273iv) Reverted to flowManagerReady composite event…
klown beb6da6
GPII-4273: Fix the failing production config test for login/logout pr…
cindyli 2feddda
GPII-4273: (GPII-4273iv/v) Refactored solutions registry data source
klown 7ae3e54
GPII-4273: (GPII-4273iv/v) Merged branch 'GPII-4273ii' into GPII-4273iii
klown a4e87bb
GPII-4273: (GPII-4273iv/v) Fixed missing require
klown 493b8e8
GPII-4273: (GPII-4273iv/v) Merged cindy's GPII-4273 changes into GPII…
klown 9cbbc4a
GPII-4273: (GPII-4273iv/v) Removed old comment
klown 86be6bf
GPII-4273: (GPII-4273iv/v) Different getImpl() depending on type of S…
klown afe4475
GPII-4273: (GPII-4273iv/v) Improved comments
klown dc8e7c9
GPII-4273: (GPII-4273iv) Incorporated Cindy's refactoring
klown ee2d432
GPII-4273: (GPII-4273iv) Modified to respect latest SolutionsRegistry…
klown bfaec91
GPII-4273: (GPII-4273iii) Merged changes from GPII-4273ii
klown 22415f7
GPII-4273: (GPII-4273iv) Return the bare solutions when request is fo…
klown 31839fe
GPII-4273: (GPII-4273iv) Removed tests for the startup API
klown fc065f6
GPII-4273: (GPII-4273iv) Merged changes from branch 'GPII-4273ii'
klown 4ff02a0
GPII-4273: (GPII-4273iv) Merged CouchDB docker image version fix for …
klown 1b15ec5
GPII-4273: (GPII-4273iv) Added tests for SolutionsRegistryDataSource
klown 2e9e51b
GPII-4273: (GPII-4273iv) Waiting for solutions registry "ready" event…
klown 44ff147
GPII-4273: (GPII-4273iv) Modified CBFM solutions registry tests
klown 1dfa823
GPII-427333: (GPII-4273iv) Improved some test messages
klown 8738df4
GPII-4273: (GPII-4273iv) Improved overlay code
klown 62342c0
GPII-4273: (GPII-4273iv) Removed version of get() that retrieved the …
klown d058493
GPII-4273: (GPII-4273iii) Merged branch 'GPII-4273ii' into GPII-4273iii
klown fb8a3cf
GPII-4273: (GPII-4273iv) Used distributeOptions in config file for Ca…
klown 33774c3
GPII-4273: (GPII-4273iv) Fixed lint error
klown 58d31c1
GPII-4273: (GPII-4273iii) Distribute platformReporter into SolutionsR…
klown 8b72c7e
GPII-4273: (GPII-4273iv) Updated based on Cindy's review comments
klown cf25187
GPII-4273: (GPII-4273iv) Addressed review comments for capture tests
klown 1dafa91
GPII-4273: (GPII-4273iv) More changes to RepositorySolutionsLoader du…
klown 9223344
GPII-4273: (GPII-4273iv) Modifications due to review comments
klown b59d2d3
GPII-4273: (GPII-4273iii) Merged branch GPII-4273ii, including chang…
klown 71614d3
GPII-4273: (GPII-4273iv) Improved error message
klown c21ebf3
GPII-4273: (GPII-4273iv) Added documentation for the SolutionsRegistr…
klown 634fa2f
GPII-4273: (GPII-4273iv) Improved check function in SolutionsRegistry…
klown a0b4abc
GPII-4273: (GPII-4273iv) Fixed lint errors, spelling, and grammar
klown d942849
GPII-4273: (GPII-4273iv) Modified configurations to squelch irreleva…
klown 58afffa
GPII-4273: (GPII-4273iv) Another way to squelch irrelevant "FATAL" er…
klown f2f3904
GPII-4273: (GPII-4273iv) New configuration for revision requests
klown 59bafa3
GPII-4273: (GPII-4273iv) Removed extra line
klown bc3cb7b
GPII-4273: Merged branch 'GPII-4273ii' into GPII-4273iii
klown 65f4d86
GPII-4273: (GPII-4273iv) Address review comments
klown 5507e83
GPII-4273: (GPII-4273iv) Addressed review comments
klown 5611440
GPII-4273: (GPII-4273iv) More tweaking of configuration files
klown ffa5b06
GPII-4273: (GPII-4273iv) Better way to detect solutionsRegistryReady
klown 77a36c5
GPII-4273: (GPII-4273iv) Fixed documentation
klown b0c0a1b
GPII-4273: (GPII-4273iv) Fixed documentation of configuration file
klown fe85739
GPII-4273: (GPII-4273iv) Fixed an url
klown 088c077
GPII-4273: (GPII-4273iv) Adding production test of the SRDS loading s…
klown 2ea71a8
GPII-4273: (GPII-4273iv) Re-ordering the production tests.
klown a98a543
GPII-4273: (GPII-4273iv) Moved load sequence tests back into all-test…
klown 008c4bd
GPII-4273: (GPII-4273i) Modified technique for getting a revision
klown a5d316a
GPII-4273: (GPII-4273i) Fixed bug in getting revision
klown 5418f50
GPII-4273: Fixed spelling
klown 9eaccbc
GPII-4273: Merged branch GPII-4273ii into GPII-4273iii
klown 308e3bb
GPII-4273: Merged branch 'GPII-4273ii' into GPII-4273iii
klown a4c8a02
GPII-4273: (GPII-4273iii) Removed accidentally commented out line
klown a93ae03
GPII-4273: (GPII-4273iii) Merged changes from branch 'GPII-4273ii'
klown f5ce552
GPII-4273: Merged branch 'GPII-4273ii' into GPII-4273iii
klown 4ca4aaa
GPII-4273: Merged changes from upstream master GPII branch
klown 04b713d
GPII-4273: Merged upstream master branch into GPII-4273iii
klown 304a970
GPII-4273: Merged upstream master GPII branch
klown 4e965cd
GPII-4273: Merged changed from upstream master GPII branch
klown 1a4f0ef
GPII-4273: Merged changes from upstream master universal branch
klown dca6660
GPII-4273: Merged remote-tracking master GPII branch into GPII-4273iii
klown 76e8c35
GPII-4273: (GPII-4273iii) Merged universal's master branch into GPII-…
klown c61e6c8
Merge upstream master GPII branch into GPII-4273iii
klown d5cc898
Merged upstream master GPII branch into GPII-4273iii
klown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Solutions Registry Data Source | ||
|
||
The solutions registry data source provides a RESTful means of fetching | ||
solutions registries via the [FlowManager](FlowManager.md) in order to determine | ||
which solutions are available and appropriate for a user's preferences. A | ||
solution is an application, such as the NVDA screen reader, or an operating | ||
system feature set using a control panel, such as the Windows high contrast | ||
theme. Each solution entry in the registry declares a set of preferences that | ||
it supports and describes how to configure the solution, launch it, reset it, | ||
and stop it. | ||
|
||
The solutions are listed in `JSON` files called "solutions registries". The | ||
structure of a solutions registry is documented in | ||
[SolutionsRegistryFormat](SolutionsRegistryFormat.md). Since solutions are | ||
frequently specific to an operating system, or "platform", there are separate | ||
solution registries for each platform. Examples of platforms are Windows, | ||
GNOME-Linux, MacOS, and Android. | ||
|
||
The SolutionsRegistryDataSource is a component that loads and caches | ||
solutions registries when the GPII starts up, and then serves solutions to the | ||
rest of the system upon request. The flow manager coordinates retrieval of | ||
solutions, user preferences, device information, and so on, passing these to the | ||
[MatchMaker Framework](MatchMakerFramework.md) and [LifecycleManager](LifecycleManager.md). | ||
|
||
There are two initialization workflows with respect to solutions registries | ||
depending on whether the flow manager is running in the cloud or locally on the | ||
client device. The Cloud Based Flow Manager uses a Solutions Registry Data | ||
Source implemented to run in that context, whereas the Local Flow Manager uses a | ||
Solutions Registry Data Source appropriate for running on client machines. | ||
These two scenarios are described in the following two sections. | ||
|
||
## Cloud Based Flow Manager Solutions Registry Data Source | ||
|
||
With respect to the Cloud Based Flow Manager, the solutions registries are | ||
included in the distribution of `gpii-universal` along with the other components | ||
of the GPII -- the flow manager, lifecycle manager and so on. The Cloud Based | ||
FlowManager is a central service for GPII clients, and these clients run on a | ||
variety of platforms. As such, the platform that the Cloud Based FlowManager is | ||
executing on is irrelevant in terms of providing solutions for the client. When | ||
a request for a solutionsvregistry is made, the flow manager needs to have | ||
access to all platform solutions in order to respond with the solutions relevant | ||
to a particular client. | ||
|
||
Here, the SolutionsRegistryDataSource component loads the solutions | ||
registries from the local file system at system startup. In this context, | ||
"local" refers to the file system associated with machine that the Cloud Based | ||
Flow Manager is running on. The SolutionsRegistryDataSource is a | ||
subcomponent of the flow manager, and the sequence of operations and | ||
events that occur during its instantiation are: | ||
|
||
<ol> | ||
<li><code>loadSolutions.loadFromLocalDisk</code>, | ||
<ul> | ||
<li>The solutions registry files are loaded from the local file system,</li> | ||
</ul> | ||
</li> | ||
<li><code>loadSolutions.solutionsLoaded</code> | ||
<ul> | ||
<li>Fires a <code>solutionsRegistryReady</code> event.</li> | ||
</ul> | ||
</li> | ||
</ol> | ||
|
||
The `solutionsRegistryReady` informs the flow manager that its | ||
SolutionsRegistryDataSource is ready to provide solutions upon request. | ||
|
||
## Local Flow Manager Solutions Registry Data Source | ||
|
||
As in the case of the Cloud Based FlowManager, the solutions registries are | ||
included in the distribution of GPII for the client. However, they are not | ||
updated as frequently as those in the cloud. In particular, the solutions | ||
registry may be stale for the platform that the client is running on. However, | ||
the registry associated with the latest version of the cloud based GPII is | ||
available in `gpii-universal`'s source code repository (github), and can be | ||
downloaded from there. In this regard, the Cloud Based FlowManager provides a | ||
`/revision` end-point that responds with the full `SHA256` of the revision of | ||
the source associated with the latest solutions registries. | ||
|
||
The SolutionsRegistryDataSource associated with the Local FlowManager uses the | ||
following sequence of events and operations at startup: | ||
|
||
<ol> | ||
<li><code>loadSolutions.loadFromLocalDisk</code>, | ||
<ul> | ||
<li>The solutions registry files are loaded from the local file system,</li> | ||
</ul> | ||
</li> | ||
<li><code>loadSolutions.getRevision</code>, | ||
<ul> | ||
<li>Make an http request of the Cloud Based FlowManager for the revision of | ||
the source code of the GPII used by the cloud, | ||
</li> | ||
</ul> | ||
</li> | ||
<li><code>loadSolutions.loadFromRepository</code>, | ||
<ul> | ||
<li>Make an http request of the source code respository, passing: | ||
<ul> | ||
<li>the platform ID associated with the OS that the client is running on, | ||
e.g. "darwin", | ||
</li> | ||
<li>the revision fetched at the previous step,</li> | ||
</ul> | ||
</li> | ||
<li>The solutions registry corresponding to the platform and revision provided | ||
is downloaded from the source code repository and overlays the one fetched | ||
from the local file system at the first step. | ||
</li> | ||
</ul> | ||
</li> | ||
<li><code>loadSolutions.solutionsLoaded</code> | ||
<ul> | ||
<li>Fires a <code>solutionsRegistryReady</code> event</li> | ||
</ul> | ||
</li> | ||
</ol> | ||
|
||
The above sequence is embeded within the Local FlowManager's `flowManagerReady` | ||
startup interlock such that all initialization is completed before the GPII | ||
client responds to user interactions. | ||
|
||
Note that both the `getRevision` and/or the `loadFromRepository` steps could | ||
fail. In that case, the latest solutions registry for the client platform will | ||
not be downloaded and cached within the client. When solutions for the client | ||
platform are requested, the SolutionsRegistryDataSource uses a fallback where | ||
the solutions loaded from the local file system during the first | ||
`loadFromLocalDisk` step are provided. | ||
|
||
Further note that the `getRevision` step feeds its result into the | ||
`loadFromRepository` step. The revision is necessary to fetch the | ||
correct solutions registry from the repository. If a developer wants to avoid | ||
that, they can set the `cloudURL` of the `GpiiRevisionRequester` to `null`, | ||
effectively stopping the entire sequence. No solutions registry will be | ||
downloaded from the repository in that case. |
21 changes: 21 additions & 0 deletions
21
...dules/flowManager/configs/gpii.config.local.flowManager.loadSolutionsFromRepository.json5
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
gpii/node_modules/flowManager/configs/gpii.flowManager.config.base.json5
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
gpii/node_modules/flowManager/configs/gpii.flowManager.config.local.base.json5
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
gpii/node_modules/flowManager/src/GpiiRevisionRequester.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/*! | ||
GPII Full SHA Revision DataSource | ||
|
||
Copyright 2020 OCAD University | ||
|
||
Licensed under the New BSD license. You may not use this file except in | ||
compliance with this License. | ||
|
||
You may obtain a copy of the License at | ||
https://github.com/GPII/universal/blob/master/LICENSE.txt | ||
*/ | ||
|
||
"use strict"; | ||
|
||
var fluid = require("infusion"), | ||
gpii = fluid.registerNamespace("gpii"); | ||
|
||
require("kettle"); | ||
|
||
fluid.registerNamespace("gpii.flowmanager.revisionRequester"); | ||
|
||
fluid.defaults("gpii.flowmanager.revisionRequester", { | ||
gradeNames: ["fluid.component"], | ||
|
||
// Prepend CBFM host/port distributed down from, e.g., gpii.flowManager.config.untrusted | ||
// For development tests where there is no valid /revision endpoint in the | ||
// cloud, this is left as null. | ||
cloudURL: null, | ||
urlTemplate: "%cloudURL/revision", | ||
|
||
// Compute url from CBFM base URL and template | ||
revisionGetUrl: { | ||
expander: { | ||
funcName: "fluid.stringTemplate", | ||
args: ["{that}.options.urlTemplate", { | ||
cloudURL: "{that}.options.cloudURL" | ||
}] | ||
} | ||
}, | ||
components: { | ||
gpiiRevisionDataSource: { | ||
type: "kettle.dataSource.URL", | ||
options: { | ||
url: "{revisionRequester}.options.revisionGetUrl" | ||
} | ||
} | ||
}, | ||
invokers: { | ||
getRevision: { | ||
funcName: "gpii.flowmanager.revisionRequester.getRevision", | ||
args: ["{that}"] | ||
} | ||
} | ||
}); | ||
|
||
/** | ||
* Retrieve the respository revision's full SHA256 from the cloud. | ||
* @param {Component} that - An instance of gpii.flowManager.revisionRequester. | ||
* @return {Promise} A promise whose resolved value is eiher the revision or, if | ||
* there is an error, an object with an "isError: true" property. The revision | ||
* has the form { "sha256": "86a83d2f93a6f8f954a4fef618ca6aea1399c980" }. | ||
*/ | ||
gpii.flowmanager.revisionRequester.getRevision = function (that) { | ||
var togo = fluid.promise(); | ||
if (that.options.cloudURL !== null) { | ||
var revisionPromise = that.gpiiRevisionDataSource.get(); | ||
revisionPromise.then(function (/*revision*/) { | ||
fluid.promise.follow(revisionPromise, togo); | ||
}, function (err) { | ||
togo.resolve(err); | ||
}); | ||
} else { | ||
// If the url to the CBFM is null, assume this is running in a | ||
// development testing enviroment or, generally, a scenario where | ||
// requests for the revision are to be suppressed. | ||
togo.resolve(null); | ||
} | ||
return togo; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component can be replaced by the subcomponent
gpiiRevisionDataSource
and provides a get() API.