Skip to content

Latest commit

 

History

History
897 lines (701 loc) · 17.1 KB

File metadata and controls

897 lines (701 loc) · 17.1 KB

PackageManager Plugin

Version: 1.0

Status: ⚫⚫⚫

PackageManager plugin for Thunder framework.

Table of Contents

Introduction

Scope

This document describes purpose and functionality of the PackageManager plugin. It includes detailed specification about its configuration, methods provided and notifications sent.

Case Sensitivity

All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.

Acronyms, Abbreviations and Terms

The table below provides and overview of acronyms used in this document and their definitions.

Acronym Description
API Application Programming Interface
HTTP Hypertext Transfer Protocol
JSON JavaScript Object Notation; a data interchange format
JSON-RPC A remote procedure call protocol encoded in JSON

The table below provides and overview of terms and abbreviations used in this document and their definitions.

Term Description
callsign The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique.

References

Ref ID Description
HTTP HTTP specification
JSON-RPC JSON-RPC 2.0 specification
JSON JSON specification
Thunder Thunder API Reference

Description

The Package Manager plugin allows installation of packages on the system from a remote repository.

The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].

Configuration

The table below lists configuration options of the plugin.

Name Type Description
callsign string Plugin instance name (default: PackageManager)
classname string Class name: PackageManager
locator string Library name: libThunderPackageManager.so
autostart boolean Determines if the plugin shall be started automatically along with the framework

Interfaces

This plugin implements the following interfaces:

Methods

The following methods are provided by the PackageManager plugin:

PackageManager interface methods:

Method Description
install Download the application bundle
uninstall Uninstall the application
download Download arbitrary application's resource file
reset Delete persistent data stored locally
getstoragedetails Information on the storage usage
setauxmetadata Set an arbitrary metadata
clearauxmetadata Clears an arbitrary metadata
getmetadata Get application metadata
cancel Cancel asynchronous request
getprogress Estimated progress of a request
getlist List installed applications
lock Lock the application
unlock Unlock application
getlockinfo Get lock info

install method

Download the application bundle.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.url string
params.appname string
params.category string

Result

Name Type Description
handle string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.install",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "url": "...",
    "appname": "...",
    "category": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

uninstall method

Uninstall the application.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.uninstalltype string

Result

Name Type Description
handle string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.uninstall",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "uninstalltype": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

download method

Download arbitrary application's resource file.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.reskey string
params.url string

Result

Name Type Description
handle string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.download",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "reskey": "...",
    "url": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

reset method

Delete persistent data stored locally.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.resettype string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.reset",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "resettype": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getstoragedetails method

Information on the storage usage.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string

Result

Name Type Description
storageinfo object
storageinfo.apps object
storageinfo.apps.path string
storageinfo.apps.quotakb string
storageinfo.apps.usedkb string
storageinfo.persistent object
storageinfo.persistent.path string
storageinfo.persistent.quotakb string
storageinfo.persistent.usedkb string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.getstoragedetails",
  "params": {
    "type": "...",
    "id": "...",
    "version": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "apps": {
      "path": "...",
      "quotakb": "...",
      "usedkb": "..."
    },
    "persistent": {
      "path": "...",
      "quotakb": "...",
      "usedkb": "..."
    }
  }
}

setauxmetadata method

Set an arbitrary metadata.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.key string
params.value string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.setauxmetadata",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "key": "...",
    "value": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

clearauxmetadata method

Clears an arbitrary metadata.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.key string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.clearauxmetadata",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "key": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getmetadata method

Get application metadata.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string

Result

Name Type Description
result object
result.metadata object
result.metadata.appname string
result.metadata.type string
result.metadata.category string
result.metadata.url string
result.resources array
result.resources[#] object
result.resources[#].key string
result.resources[#].value string
result.auxmetadata array
result.auxmetadata[#] object
result.auxmetadata[#].key string
result.auxmetadata[#].value string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.getmetadata",
  "params": {
    "type": "...",
    "id": "...",
    "version": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "metadata": {
      "appname": "...",
      "type": "...",
      "category": "...",
      "url": "..."
    },
    "resources": [
      {
        "key": "...",
        "value": "..."
      }
    ],
    "auxmetadata": [
      {
        "key": "...",
        "value": "..."
      }
    ]
  }
}

cancel method

Cancel asynchronous request.

Parameters

Name Type Description
params object
params.handle string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.cancel",
  "params": {
    "handle": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getprogress method

Estimated progress of a request.

Parameters

Name Type Description
params object
params.handle string

Result

Name Type Description
progress integer

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.getprogress",
  "params": {
    "handle": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": 0
}

getlist method

List installed applications.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.appname string
params.category string

Result

Name Type Description
installedids array
installedids[#] object
installedids[#].id string
installedids[#].version string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.getlist",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "appname": "...",
    "category": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    {
      "id": "...",
      "version": "..."
    }
  ]
}

lock method

Lock the application. Preventing uninstallation.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string
params.reason string
params.owner string

Result

Name Type Description
handle string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.lock",
  "params": {
    "type": "...",
    "id": "...",
    "version": "...",
    "reason": "...",
    "owner": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "..."
}

unlock method

Unlock application.

Parameters

Name Type Description
params object
params.handle string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.unlock",
  "params": {
    "handle": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

getlockinfo method

Get lock info.

Parameters

Name Type Description
params object
params.type string
params.id string
params.version string

Result

Name Type Description
result object
result.reason string
result.owner string

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "PackageManager.1.getlockinfo",
  "params": {
    "type": "...",
    "id": "...",
    "version": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "reason": "...",
    "owner": "..."
  }
}

Notifications

Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.

The following events are provided by the PackageManager plugin:

PackageManager interface events:

Event Description
operationstatus Completion of asynchronous operation

operationstatus event

Completion of asynchronous operation.

Parameters

Name Type Description
params object
params.handle string
params.operation string
params.type string
params.id string
params.version string
params.status string
params.details string

Example

{
  "jsonrpc": "2.0",
  "method": "client.events.1.operationstatus",
  "params": {
    "handle": "...",
    "operation": "...",
    "type": "...",
    "id": "...",
    "version": "...",
    "status": "...",
    "details": "..."
  }
}