Lifecycle Manager

From wiki.gpii
Jump to: navigation, search

DRAFT...

See Also

Lifecycle Manager API

Overview

The Lifecycle Manager is responsible for setting up appropriate solutions, based on solution and settings information provided to it by the Flow Manager. It coordinates the process of storing the solution's existing settings, applying desired settings, launching the solution, and restoring the system after the user is done.

The Lifecycle Manager Kettle app deployed in the server is actually a "lifecycle manager server" i.e. it is of type gpii.lifecycleManagerServer. This app implements the gpii.lifecycleManager grade.

Requests

The Lifecycle Manager coordinates responses several requests, as described below. For more information on the request handling, see the page for the particular request handler.

Start

Description Start the solution(s) identified for a user
Request type POST
Request format <url to lifecycle manager>/start/<user token>
Handled by Lifecycle Manager Start Request Handler

Stop

Description Stop the solution(s) previously started for a user
Request type POST
Request format <url to lifecycle manager>/stop/<user token>
Handled by Lifecycle Manager Stop Request Handler

Update

Description Change the settings for a solution
Request type POST
Request format <url to lifecycle manager>/update/<user token>
Handled by Lifecycle Manager Update Request Handler
Note Only supported for dynamic solutions, i.e. solutions that don't require a restart

Configuration

Each solution configuration file includes a section for configuring the lifecycle manager for that solution. The general format of the lifecycle manager configuration block is as shown below:

{
    ...
    "lifecycleManager": {
        "start": [...],
        "stop": [...]
    }
    ...
}

The start and stop arrays define a list of lifecycle handlers. As the lifecycle manager starts up a solution, it works through the list of lifecycle handlers specified by the start, running each in turn. When the solution is shut down, the lifecycle manager works through the list of lifecycle handlers specified by the stop.

Example Lifecycle Manager Configurations

{
    "name": "FreeSpeech",
    ...
    "lifecycleManager": {
        "start": [
            {
             "type": "gpii.androidActivityManager.startFreespeech"
            }
        ],
        "stop": [
            {
            }
        ]
    }
}
{
    "name": "Windows Built-in Screen Magnifier",
    ...
    "lifecycleManager": {
        "start": [
            "setSettings",
            {
                "type": "gpii.launch.exec",
                "command": "${{environment}.SystemRoot}\\System32\\Magnify.exe"
            }
        ],
        "stop": [ {
                "type": "gpii.launch.exec",
                "command": "${{environment}.SystemRoot}\\System32\\taskkill.exe /f /im Magnify.exe"
            },
            "restoreSettings"
        ]
    }
}
{
    "name": "GNOME Interface Settings",
    ...
    "lifecycleManager": {
        "start": [ "setSettings" ],
        "stop": [ "restoreSettings" ]
    }
}