1 # Configuration file - config.xml
3 The widgets are described by the W3C's technical recommendations
4 [Packaged Web Apps (Widgets)][widgets] and [XML Digital Signatures for Widgets][widgets-digsig]
5 that specifies the configuration file **config.xml**.
9 The file **config.xml** describes important data of the application
12 - the unique identifier of the application
13 - the name of the application
14 - the type of the application
15 - the icon of the application
16 - the permissions linked to the application
17 - the services and dependencies of the application
19 The file MUST be at the root of the widget and MUST be case sensitively name
22 The file **config.xml** is a XML file described by the document
25 Here is the example of the config file for the QML application SmartHome.
28 <?xml version="1.0" encoding="UTF-8"?>
29 <widget xmlns="http://www.w3.org/ns/widgets" id="smarthome" version="0.1">
30 <name>SmartHome</name>
31 <icon src="smarthome.png"/>
32 <content src="qml/smarthome/smarthome.qml" type="text/vnd.qt.qml"/>
33 <description>This is the Smarthome QML demo application. It shows some user interfaces for controlling an
34 automated house. The user interface is completely done with QML.</description>
35 <author>Qt team</author>
36 <license>GPL</license>
40 The most important items are:
42 - **<widget id="......"\>**: gives the id of the widget. It must be unique.
44 - **<widget version="......"\>**: gives the version of the widget
46 - **<icon src="..."\>**: gives a path to the icon of the application
47 (can be repeated with different sizes)
49 - **<content src="..." type="..."\>**: this indicates the entry point and its type.
51 ## Standard elements of "config.xml"
53 ### The element widget
55 #### the attribute id of widget
57 The attribute *id* is mandatory (for version 2.x, blowfish) and must be unique.
59 Values for *id* are any non empty string containing only latin letters,
60 arabic digits, and the three characters '.' (dot), '-' (dash) and
63 Authors can use a mnemonic id or can pick a unique id using
64 command **uuid** or **uuidgen**.
66 ### the attribute version of widget
68 The attribute *version* is mandatory (for version 2.x, blowfish).
70 Values for *version* are any non empty string containing only latin letters,
71 arabic digits, and the three characters '.' (dot), '-' (dash) and
74 Version values are dot separated fields MAJOR.MINOR.REVISION.
75 Such version would preferably follow guidelines of
76 [semantic versioning][semantic-version].
78 ### The element content
80 The element *content* is mandatory (for version 2.x, blowfish) and must designate a file
81 (subject to localization) with its attribute *src*.
83 The content designed depends on its type. See below for the known types.
87 The element *icon* is mandatory (for version 2.x, blowfish) and must
88 be unique. It must designate an image file with its attribute *src*.
92 The AGL framework uses the feature tag for specifying security and binding
93 requirement of the widget.
95 Since the migration of the framework to leverage systemd power,
96 the features are of important use to:
98 - declare more than just an application
99 - declare the expected dependencies
100 - declare the expected permissions
101 - declare the exported apis
103 The specification of [widgets][widgets] is intended to describe
104 only one application.
105 In the present case, we expect to describe more than just an application.
106 For example, a publisher could provide a widget containing a service,
107 an application for tuning that service, an application that
108 leverage the service.
109 Here, the term of service means a background application that
110 runs without IHM and whose public api can be accessed by other
113 So the features are used to describe each of the possible
115 The "standard" unit in the meaning of [widgets][widgets]
116 is called the "main" unit.
118 ### required-api: feature name="urn:AGL:widget:required-api"
120 List of the api required by the widget.
122 Each required api must be explicited using a `<param>` entry.
127 <feature name="urn:AGL:widget:required-api">
128 <param name="#target" value="main" />>
129 <param name="gps" value="auto" />
130 <param name="afm-main" value="link" />
134 This will be *virtually* translated for mustaches to the JSON
138 { "name": "gps", "value": "auto" },
139 { "name": "afm-main", "value": "link" }
143 #### required-api: param name="#target"
147 Declares the name of the unit requiring the listed apis.
148 Only one instance of the param "#target" is allowed.
149 When there is not instance of this param, it behave as if
150 the target main was specified.
152 #### required-api: param name=[required api name]
154 The name is the name of the required API.
156 The value describes how to connect to the required api.
160 The binding is a local shared object.
161 In that case, the name is the relative path of the
162 shared object to be loaded.
165 The framework set automatically the kind of
166 the connection to the API
169 The framework connect using internal websockets
172 The framework connect using internal dbus
175 The framework connect in memory by dynamically linking
177 - cloud: [PROPOSAL - NOT IMPLEMENTED]
178 The framework connect externally using websock.
179 In that case, the name includes data to access the service.
180 Example: `<param name="log:https://oic@agl.iot.bzh/cloud/log" value="cloud" />`
182 ### required-permission: feature name="urn:AGL:widget:required-permission"
184 List of the permissions required by the unit.
186 Each required permission must be explicited using a `<param>` entry.
191 <feature name="urn:AGL:widget:required-permission">
192 <param name="#target" value="geoloc" />
193 <param name="urn:AGL:permission:real-time" value="required" />
194 <param name="urn:AGL:permission:syscall:*" value="required" />
198 This will be *virtually* translated for mustaches to the JSON
201 "required-permission":{
202 "urn:AGL:permission:real-time":{
203 "name":"urn:AGL:permission:real-time",
206 "urn:AGL:permission:syscall:*":{
207 "name":"urn:AGL:permission:syscall:*",
213 #### required-permission: param name="#target"
217 Declares the name of the unit requiring the listed permissions.
218 Only one instance of the param "#target" is allowed.
219 When there is not instance of this param, it behave as if
220 the target main was specified.
222 #### required-permission: param name=[required permission name]
226 - required: the permission is mandatorily needed except if the feature
227 isn't required (required="false") and in that case it is optional.
228 - optional: the permission is optional
230 ### provided-unit: feature name="urn:AGL:widget:provided-unit"
232 This feature is made for declaring new units
234 Using this feature, a software publisher
235 can provide more than one application in the same widget.
240 <feature name="urn:AGL:widget:provided-unit">
241 <param name="#target" value="geoloc" />
242 <param name="description" value="binding of name geoloc" />
243 <param name="content.src" value="index.html" />
244 <param name="content.type" value="application/vnd.agl.service" />
248 This will be *virtually* translated for mustaches to the JSON
253 "description":"binding of name geoloc",
256 "type":"application\/vnd.agl.service"
262 #### provided-unit: param name="#target"
266 Declares the name of the unit. The default unit, the unit
267 of the main of the widget, has the name "main".
268 The value given here must be unique within the widget file.
269 It will be used in other places of the widget config.xml file to
272 Only one instance of the param "#target" is allowed.
273 The value can't be "main".
275 #### provided-unit: param name="content.type"
279 The mimetype of the provided unit.
281 #### provided-unit: param name="content.src"
285 #### other parameters
287 The items that can be set for the main unit
288 can also be set using the params if needed.
295 ### provided-api: feature name="urn:AGL:widget:provided-api"
297 Use this feature for exporting one or more API of a unit
298 to other widgets of the platform.
300 This feature is an important feature of the framework.
305 <feature name="urn:AGL:widget:provided-api">
306 <param name="#target" value="geoloc" />
307 <param name="geoloc" value="auto" />
308 <param name="moonloc" value="auto" />
312 This will be *virtually* translated for mustaches to the JSON
327 #### provided-api: param name="#target"
331 Declares the name of the unit exporting the listed apis.
332 Only one instance of the param "#target" is allowed.
333 When there is not instance of this param, it behave as if
334 the target main was specified.
336 #### provided-api: param name=[name of exported api]
338 The name give the name of the api that is exported.
340 The value is one of the following values:
343 export the api using UNIX websocket
346 export the API using dbus
349 export the api using the default method(s).
351 ## Known content types
353 The configuration file ***/etc/afm/afm-unit.conf*** defines
354 how to create systemd units for widgets.
356 Known types for the type of content are:
360 content.src designates the home page of the application
362 - ***application/vnd.agl.native***
363 AGL compatible native,
364 content.src designates the relative path of the binary.
366 - ***application/vnd.agl.service***:
367 AGL service, content.src is not used.
369 - ***application/x-executable***:
371 content.src designates the relative path of the binary.
372 For such application, only security setup is made.
374 Adding more types is easy, it just need to edit the configuration
375 file ***afm-unit.conf***.
377 ### Older content type currently not supported at the moment
379 This types were defined previously when the framework was not
381 The transition to systemd let these types out at the moment.
383 - ***application/vnd.agl.url***
384 - ***text/vnd.qt.qml***, ***application/vnd.agl.qml***
385 - ***application/vnd.agl.qml.hybrid***
386 - ***application/vnd.agl.html.hybrid***
390 ## The configuration file afm-unit.conf
392 The integration of the framework with systemd
393 mainly consists of creating the systemd unit
394 files corresponding to the need and requirements
395 of the installed widgets.
397 This configuration file named `afm-unit.conf` installed
398 on the system with the path `/etc/afm/afm-unit.conf`
399 describes how to generate all units from the *config.xml*
400 configuration files of widgets.
401 The description uses an extended version of the templating
402 formalism of [mustache][] to describes all the units.
404 Let present how it works using the following diagram that
405 describes graphically the workflow of creating the unit
406 files for systemd `afm-unit.conf` from the configuration
407 file of the widget `config.xml`:
409 ![make-units](pictures/make-units.svg)
411 In a first step, and because [mustache][] is intended
412 to work on JSON representations, the configuration file is
413 translated to an internal JSON representation.
414 This representation is shown along the examples of the documentation
415 of the config files of widgets.
417 In a second step, the mustache template `afm-unit.conf`
418 is instantiated using the C library [mustach][] that follows
419 the rules of [mustache][mustache] and with all its available
422 - use of colon (:) for explicit substitution
423 - test of values with = or =!
425 In a third step, the result of instantiating `afm-unit.conf`
426 for the widget is split in units.
427 To achieve that goal, the lines containing specific directives are searched.
428 Any directive occupy one full line.
432 Produce an empty line at the end
433 - %begin systemd-unit
435 Delimit the produced unit, its begin and its end
437 - %systemd-unit system
438 Tells the kind of unit (user/system)
439 - %systemd-unit service NAME
440 - %systemd-unit socket NAME
441 Gives the name and type (service or socket) of the unit.
442 The extension is automatically computed from the type
443 and must not be set in the name.
444 - %systemd-unit wanted-by NAME
445 Tells to install a link to the unit in the wants of NAME
447 Then the computed units are then written to the filesystem
448 and inserted in systemd.
450 The generated unit files will contain variables for internal
451 use of the framework.
452 These variables are starting with `X-AFM-`.
453 The variables starting with `X-AFM-` but not with `X-AFM--` are
454 the public variables.
455 These variables will be returned by the
456 framework as the details of an application (see **afm-util detail ...**).
458 Variables starting with `X-AFM--` are private to the framework.
459 By example, the variable `X-AFM--http-port` is used to
460 record the allocated port for applications.
462 [mustach]: https://gitlab.com/jobol/mustach "basic C implementation of mustache"
463 [mustache]: http://mustache.github.io/mustache.5.html "mustache - Logic-less templates"
464 [widgets]: http://www.w3.org/TR/widgets "Packaged Web Apps"
465 [widgets-digsig]: http://www.w3.org/TR/widgets-digsig "XML Digital Signatures for Widgets"
466 [libxml2]: http://xmlsoft.org/html/index.html "libxml2"
467 [app-manifest]: http://www.w3.org/TR/appmanifest "Web App Manifest"
468 [meta-intel]: https://github.com/01org/meta-intel-iot-security "A collection of layers providing security technologies"
469 [openssl]: https://www.openssl.org "OpenSSL"
470 [xmlsec]: https://www.aleksey.com/xmlsec "XMLSec"
471 [json-c]: https://github.com/json-c/json-c "JSON-c"
472 [d-bus]: http://www.freedesktop.org/wiki/Software/dbus "D-Bus"
473 [libzip]: http://www.nih.at/libzip "libzip"
474 [cmake]: https://cmake.org "CMake"
475 [security-manager]: https://wiki.tizen.org/wiki/Security/Tizen_3.X_Security_Manager "Security-Manager"
476 [tizen-security]: https://wiki.tizen.org/wiki/Security "Tizen security home page"
477 [tizen-secu-3]: https://wiki.tizen.org/wiki/Security/Tizen_3.X_Overview "Tizen 3 security overview"
478 [semantic-version]: http://semver.org/ "Semantic versioning"