a7fcd493fcd14e4cdab72145007f6b4d901a0f8f
[src/app-framework-main.git] / doc / afm-user-daemon.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta charset="utf-8">
5   <meta name="generator" content="pandoc">
6   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
7   <meta name="author" content="José Bollo">
8   <meta name="author" content="Fulup Ar Foll">
9   <title>The afm-user-daemon</title>
10   <style type="text/css">code{white-space: pre;}</style>
11   <!--[if lt IE 9]>
12     <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
13   <![endif]-->
14   <link rel="stylesheet" href="doc.css">
15 </head>
16 <body>
17 <header>
18 <h1 class="title">The afm-user-daemon</h1>
19 <h2 class="author">José Bollo</h2>
20 <h2 class="author">Fulup Ar Foll</h2>
21 <h3 class="date">30 mai 2016</h3>
22 </header>
23 <nav id="TOC">
24 <ul>
25 <li><a href="#the-afm-user-daemon">The afm-user-daemon</a><ul>
26 <li><a href="#foreword">Foreword</a></li>
27 <li><a href="#introduction">Introduction</a></li>
28 <li><a href="#tasks-of-afm-user-daemon">Tasks of <strong>afm-user-daemon</strong></a><ul>
29 <li><a href="#maintaining-list-of-applications">Maintaining list of applications</a></li>
30 <li><a href="#launching-application">Launching application</a></li>
31 <li><a href="#managing-instances-of-running-applications">Managing instances of running applications</a></li>
32 <li><a href="#installing-and-uninstalling-applications">Installing and uninstalling applications</a></li>
33 </ul></li>
34 <li><a href="#starting-afm-user-daemon">Starting <strong>afm-user-daemon</strong></a></li>
35 <li><a href="#launcher-configuration">Launcher Configuration</a><ul>
36 <li><a href="#mode-local">mode local</a></li>
37 <li><a href="#mode-remote">mode remote</a></li>
38 <li><a href="#substitutions">%substitutions</a></li>
39 </ul></li>
40 <li><a href="#the-d-bus-interface">The D-Bus interface</a><ul>
41 <li><a href="#overview-of-the-dbus-interface">Overview of the dbus interface</a></li>
42 <li><a href="#using-afm-util">Using <strong><em>afm-util</em></strong></a></li>
43 <li><a href="#the-protocol-over-d-bus">The protocol over D-Bus</a></li>
44 </ul></li>
45 </ul></li>
46 </ul>
47 </nav>
48 <h1 id="the-afm-user-daemon">The afm-user-daemon</h1>
49 <pre><code>version: 1
50 Date:    30 mai 2016
51 Author:  José Bollo</code></pre>
52 <p>TABLE-OF-CONTENT-HERE</p>
53 <h2 id="foreword">Foreword</h2>
54 <p>This document describes application framework user daemon fundamentals. FCF (Fully Conform to Specification) implementation is still under development. It may happen that current implementation somehow diverges with specifications.</p>
55 <h2 id="introduction">Introduction</h2>
56 <p>The daemon <strong>afm-user-daemon</strong> is in charge of handling applications on behalf of a user. Its main tasks are:</p>
57 <ul>
58 <li><p>enumerate applications that end user can run and keep this list available on demand</p></li>
59 <li><p>start applications on behalf of end user, set user running environment, set user security context</p></li>
60 <li><p>list current runnable or running applications</p></li>
61 <li><p>stop (aka pause), continue (aka resume), terminate a running instance of a given application</p></li>
62 <li><p>transfer requests for installation/uninstallation of applications to the corresponding system daemon <strong>afm-system-daemon</strong></p></li>
63 </ul>
64 <p>The <strong>afm-user-daemon</strong> takes its orders from the session instance of D-Bus.</p>
65 <p>The figure below summarizes the situation of <strong>afm-user-daemon</strong> in the system.</p>
66 <pre><code>+------------------------------------------------------------+
67 |                          User                              |
68 |                                 +---------------------+    |
69 |     +---------------------+     |   Smack isolated    |    |
70 |     |   D-Bus   session   +     |    APPLICATIONS     |    |
71 |     +----------+----------+     +---------+-----------+    |
72 |                |                          |                |
73 |                |                          |                |
74 |     +----------+--------------------------+-----------+    |
75 |     |                                                 |    |
76 |     |                  afm-user-daemon                |    |
77 |     |                                                 |    |
78 |     +----------+----------------------+----------+----+    |
79 |                |                      |          :         |
80 |                |                      |          :         |
81 :================|======================|==========:=========:
82 |                |                      |          :         |
83 |     +----------+----------+     +-----+-----+    :         |
84 |     |   D-Bus   system    +-----+  CYNARA   |    :         |
85 |     +----------+----------+     +-----+-----+    :         |
86 |                |                      |          :         |
87 |     +----------+---------+    +-------+----------+----+    |
88 |     | afm-system-daemon  +----+   SECURITY-MANAGER    |    |
89 |     +--------------------+    +-----------------------+    |
90 |                                                            |
91 |                          System                            |
92 +------------------------------------------------------------+</code></pre>
93 <h2 id="tasks-of-afm-user-daemon">Tasks of <strong>afm-user-daemon</strong></h2>
94 <h3 id="maintaining-list-of-applications">Maintaining list of applications</h3>
95 <p>At start <strong>afm-user-daemon</strong> scans the directories containing applications and load in memory a list of avaliable applications accessible by current user.</p>
96 <p>When <strong>afm-system-daemon</strong> installs or removes an application. On success it sends the signal <em>org.AGL.afm.system.changed</em>. When receiving such a signal, <strong>afm-user-daemon</strong> rebuilds its applications list.</p>
97 <p><strong>afm-user-daemon</strong> provides the data it collects about applications to its clients. Clients may either request the full list of avaliable applications or a more specific information about a given application.</p>
98 <h3 id="launching-application">Launching application</h3>
99 <p><strong>afm-user-daemon</strong> launches application. Its builds a secure environment for the application before starting it within a secured environment.</p>
100 <p>Different kind of applications can be launched.</p>
101 <p>This is set using a configuration file that describes how to launch an application of a given kind within a given mode.</p>
102 <p>There is two launching modes: local or remote.</p>
103 <p>Launching an application locally means that the application and its binder are launched together.</p>
104 <p>Launching application remotely translates in only launching the application binder. The UI by itself has to be activated remotely by the requested (ie: HTML5 homescreen in a browser)</p>
105 <p>Once launched, running instances of application receive a runid that identify them.</p>
106 <h3 id="managing-instances-of-running-applications">Managing instances of running applications</h3>
107 <p><strong>afm-user-daemon</strong> manages the list of applications that it launched.</p>
108 <p>When owning the right permissions, a client can get the list of running instances and details about a specific running instance. It can also terminates, stops or continues a given application.</p>
109 <h3 id="installing-and-uninstalling-applications">Installing and uninstalling applications</h3>
110 <p>If the client own the right permissions, <strong>afm-user-daemon</strong> delegates that task to <strong>afm-system-daemon</strong>.</p>
111 <h2 id="starting-afm-user-daemon">Starting <strong>afm-user-daemon</strong></h2>
112 <p><strong>afm-user-daemon</strong> is launched as a <strong>systemd</strong> service attached to user sessions. Normally, the service file is located at /usr/lib/systemd/user/afm-user-daemon.service.</p>
113 <p>The options for launching <strong>afm-user-daemon</strong> are:</p>
114 <pre><code>-a
115 --application directory
116
117      Includes the given application directory to
118      the database base of applications.
119
120      Can be repeated.
121
122 -r
123 --root directory 
124
125      Includes root application directory or directories when
126      passing multiple rootdir to
127      applications database.
128
129      Note that default root directory for
130      applications is always added. In current version
131      /usr/share/afm/applications is used as default.
132     
133 -m
134 --mode (local|remote)
135
136      Set the default launch mode.
137      The default value is &#39;local&#39;
138
139 -d
140 --daemon
141
142      Daemonizes the process. It is not needed by sytemd.
143
144 -q
145 --quiet
146
147      Reduces the verbosity (can be repeated).
148
149 -v
150 --verbose
151
152      Increases the verbosity (can be repeated).
153
154 -h
155 --help
156
157      Prints a short help.</code></pre>
158 <h2 id="launcher-configuration">Launcher Configuration</h2>
159 <p>It contains rules for launching applications. When <strong>afm-user-daemon</strong> has to launch an application, it looks for launch mode (local or remote), as well as for the type of application describe in <strong><em>config.xml</em></strong> widget configuration file.</p>
160 <p>This tuple mode+type allows to select the adequate rule.</p>
161 <p>Configuration file is <strong>/etc/afm/afm-launch.conf</strong>.</p>
162 <p>It contains sections and rules. It can also contain comments and empty lines to improve readability.</p>
163 <p>The separators are space and tabulation, any other character should have a meaning.</p>
164 <p>The format is line oriented. The new line character separate the lines.</p>
165 <p>Lines having only separators are blank lines and ignored. Line having character #(sharp) at first position are comment lines and ignored.</p>
166 <p>Lines not starting with a separator are different from lines starting with a separator character.</p>
167 <p>The grammar of the configuration file is defined below:</p>
168 <pre><code>CONF: *COMMENT *SECTION
169
170 SECTION: MODE *RULE
171
172 RULE: +TYPE VECTOR ?VECTOR
173
174 MODE: &#39;mode&#39; +SEP (&#39;local&#39; | &#39;remote&#39;) *SEP EOL
175
176 TYPE: DATA *SEP EOL
177
178 VECTOR: +SEP DATA *(+SEP NDATA) *SEP EOL
179
180 DATA: CHAR *NCHAR
181 NDATA: +NCHAR
182
183 EOL: NL *COMMENT
184 COMMENT: *SEP CMT *(SEP | NCHAR) NL
185
186 NL: &#39;\x0a&#39;
187 SEP: &#39;\x20&#39; | &#39;\x09&#39;
188 CMT: &#39;#&#39;
189 CHAR: &#39;\x00&#39;..&#39;\x08&#39; | &#39;\x0b&#39;..&#39;\x1f&#39; | &#39;\x21&#39; | &#39;\x22&#39; | &#39;\x24&#39;..&#39;\xff&#39;
190 NCHAR: CMT | CHAR</code></pre>
191 <p>Here is a sample of configuration file for defining how to launch an application of types <em>application/x-executable</em>, <em>text/x-shellscript</em> and <em>text/html</em> in local mode:</p>
192 <pre><code>mode local
193
194 application/x-executable
195 text/x-shellscript
196     %r/%c
197
198 text/html
199     /usr/bin/afb-daemon --mode=local --readyfd=%R --alias=/icons:%I --port=%P --rootdir=%r --token=%S --sessiondir=%D/.afb-daemon
200     /usr/bin/web-runtime http://localhost:%P/%c?token=%S</code></pre>
201 <p>This shows that:</p>
202 <ul>
203 <li>within a section, several rules can be defined</li>
204 <li>within a rule, several types can be defined</li>
205 <li>within a rule, one or two vectors can be defined</li>
206 <li>vectors are using %substitution</li>
207 <li>launched binaries must be defined with their full path</li>
208 </ul>
209 <h3 id="mode-local">mode local</h3>
210 <p>Within this mode, the launchers have either one or two description vectors. All of those vectors are treated as programs and are executed with 'execve' system call.</p>
211 <p>The first vector is the leader vector and it defines the process group. The second vector (if any) is attached to the group defined by this first vector.</p>
212 <h3 id="mode-remote">mode remote</h3>
213 <p>Within this mode, the launchers have either one or two vectors describing them.</p>
214 <p>The first vector is process as a program and is executed with system call 'execve'.</p>
215 <p>The second vector (if any) defines a text that is returned to the caller. This mechanism can be used to return a uri for remote UI to connect on the newly launched application.</p>
216 <p>The daemon <strong><em>afm-user-daemon</em></strong> allocates a port for each new remote application. The current implementation port allocation is incremental. A smarter (cacheable and discoverable) allocation should be defined.</p>
217 <h3 id="substitutions">%substitutions</h3>
218 <p>Vectors can include sequences of 2 characters that have a special meaning. These sequences are named <em>%substitution</em> because their first character is the percent sign (%) and because each occurrence of the sequence is replaced, at launch time, by the value associated to sequences.</p>
219 <p>Here is the list of <em>%substitutions</em>:</p>
220 <ul>
221 <li><strong><em>%%</em></strong>: %.</li>
222 </ul>
223 <p>This simply emits the percent sign %</p>
224 <ul>
225 <li><strong><em>%a</em></strong>: appid</li>
226 </ul>
227 <p>Holds application Id of launched application.</p>
228 <p>Defined by the attribute <strong>id</strong> of the element <strong><widget></strong> of <strong>config.xml</strong>.</p>
229 <ul>
230 <li><strong><em>%c</em></strong>: content</li>
231 </ul>
232 <p>The file within the widget directory that is the entry point.</p>
233 <p>For HTML applications, it represents the relative path to main page (aka index.html).</p>
234 <p>Defined by attribute <strong>src</strong> of the element <strong><content></strong> within <strong>config.xml</strong>.</p>
235 <ul>
236 <li><strong><em>%D</em></strong>: datadir</li>
237 </ul>
238 <p>Path of the directory where the application runs (cwd) and stores its data.</p>
239 <p>It is equal to %h/%a.</p>
240 <ul>
241 <li><strong><em>%H</em></strong>: height</li>
242 </ul>
243 <p>Requested height for the widget.</p>
244 <p>Defined by the attribute <strong>height</strong> of the element <strong><widget></strong> of <strong>config.xml</strong>.</p>
245 <ul>
246 <li><strong><em>%h</em></strong>: homedir</li>
247 </ul>
248 <p>Path of the home directory for all applications.</p>
249 <p>It is generally equal to $HOME/app-data</p>
250 <ul>
251 <li><strong><em>%I</em></strong>: icondir</li>
252 </ul>
253 <p>Path of the directory were the icons of the applications can be found.</p>
254 <ul>
255 <li><strong><em>%m</em></strong>: mime-type</li>
256 </ul>
257 <p>Mime type of the launched application.</p>
258 <p>Defined by the attribute <strong>type</strong> of the element <strong><content></strong> of <strong>config.xml</strong>.</p>
259 <ul>
260 <li><strong><em>%n</em></strong>: name</li>
261 </ul>
262 <p>Name of the application as defined by the content of the element <strong><name></strong> of <strong>config.xml</strong>.</p>
263 <ul>
264 <li><strong><em>%p</em></strong>: plugins</li>
265 </ul>
266 <p>In the future should represent the list of plugins and plugins directory separated by ','. Warning: not supported in current version.</p>
267 <ul>
268 <li><strong><em>%P</em></strong>: port</li>
269 </ul>
270 <p>A port to use. It is currently a kind of random port. The precise model is to be defined later.</p>
271 <ul>
272 <li><strong><em>%R</em></strong>: readyfd</li>
273 </ul>
274 <p>Number of file descriptor to use for signaling readiness of launched process.</p>
275 <ul>
276 <li><strong><em>%r</em></strong>: rootdir</li>
277 </ul>
278 <p>Path of directory containing the widget and its data.</p>
279 <ul>
280 <li><strong><em>%S</em></strong>: secret</li>
281 </ul>
282 <p>An hexadecimal number that can be used to initialize pairing of client and application binder.</p>
283 <ul>
284 <li><strong><em>%W</em></strong>: width</li>
285 </ul>
286 <p>Requested width for the widget.</p>
287 <p>Defined by the attribute <strong>width</strong> of the element <strong><widget></strong> of <strong>config.xml</strong>.</p>
288 <h2 id="the-d-bus-interface">The D-Bus interface</h2>
289 <h3 id="overview-of-the-dbus-interface">Overview of the dbus interface</h3>
290 <p><strong><em>afm-user-daemon</em></strong> takes its orders from the session instance of D-Bus. D-Bus is nice to use in this context because it allows discovery and signaling.</p>
291 <p>The dbus session is by default addressed by environment variable <strong><em>DBUS_SESSION_BUS_ADDRESS</em></strong>. Using <strong>systemd</strong> variable <em>DBUS_SESSION_BUS_ADDRESS</em> is automatically set for user sessions.</p>
292 <p>The <strong>afm-user-daemon</strong> is listening on destination name <strong><em>org.AGL.afm.user</em></strong> at object path <strong><em>/org/AGL/afm/user</em></strong> on interface <strong><em>org.AGL.afm.user</em></strong> for following members: <strong><em>runnables</em></strong>, <strong><em>detail</em></strong>, <strong><em>start</em></strong>, <strong><em>terminate</em></strong>, <strong><em>stop</em></strong>, <strong><em>continue</em></strong>, <strong><em>runners</em></strong>, <strong><em>state</em></strong>, <strong><em>install</em></strong> and <strong><em>uninstall</em></strong>.</p>
293 <p>D-Bus is mainly used for signaling and discovery. Its optimized typed protocol is not used except for transmission of standalone strings.</p>
294 <p>Clients and Services are using JSON serialisation to exchange data.</p>
295 <p>The D-Bus interface is defined by:</p>
296 <ul>
297 <li><p>DESTINATION: <strong>org.AGL.afm.user</strong></p></li>
298 <li><p>PATH: <strong>/org/AGL/afm/user</strong></p></li>
299 <li><p>INTERFACE: <strong>org.AGL.afm.user</strong></p></li>
300 </ul>
301 <p>The signature of any member of the interface is <strong><em>string -&gt; string</em></strong> for <strong><em>JSON -&gt; JSON</em></strong>.</p>
302 <p>This is the normal case. In case of error, the current implementation returns a dbus error as a string.</p>
303 <p>Here an example using <em>dbus-send</em> to query data on installed applications.</p>
304 <pre><code>dbus-send --session --print-reply \
305     --dest=org.AGL.afm.user \
306     /org/AGL/afm/user \
307     org.AGL.afm.user.runnables string:true</code></pre>
308 <h3 id="using-afm-util">Using <strong><em>afm-util</em></strong></h3>
309 <p>The command line tool <strong><em>afm-util</em></strong> uses dbus-send to send orders to <strong>afm-user-daemon</strong>. This small scripts allows to send command to <strong><em>afm-user-daemon</em></strong> either interactively at shell prompt or scriptically.</p>
310 <p>The syntax is simple: it accept a command and when requires attached arguments.</p>
311 <p>Here is the summary of <strong><em>afm-util</em></strong>:</p>
312 <ul>
313 <li><strong>afm-util runnables </strong>:</li>
314 </ul>
315 <p>list the runnable widgets installed</p>
316 <ul>
317 <li><strong>afm-util install wgt </strong>:</li>
318 </ul>
319 <p>install the wgt file</p>
320 <ul>
321 <li><strong>afm-util uninstall id </strong>:</li>
322 </ul>
323 <p>remove the installed widget of id</p>
324 <ul>
325 <li><strong>afm-util detail id </strong>:</li>
326 </ul>
327 <p>print detail about the installed widget of id</p>
328 <ul>
329 <li><strong>afm-util runners </strong>:</li>
330 </ul>
331 <p>list the running instance</p>
332 <ul>
333 <li><strong>afm-util start id </strong>:</li>
334 </ul>
335 <p>start an instance of the widget of id</p>
336 <ul>
337 <li><strong>afm-util terminate rid </strong>:</li>
338 </ul>
339 <p>terminate the running instance rid</p>
340 <ul>
341 <li><strong>afm-util stop rid </strong>:</li>
342 </ul>
343 <p>stop the running instance rid</p>
344 <ul>
345 <li><strong>afm-util continue rid </strong>:</li>
346 </ul>
347 <p>continue the previously rid</p>
348 <ul>
349 <li><strong>afm-util state rid </strong>:</li>
350 </ul>
351 <p>get status of the running instance rid</p>
352 <p>Here is how to list applications using <strong><em>afm-util</em></strong>:</p>
353 <pre><code>afm-util runnables</code></pre>
354 <hr />
355 <h3 id="the-protocol-over-d-bus">The protocol over D-Bus</h3>
356 <p>Recall:</p>
357 <ul>
358 <li><p><strong>DESTINATION</strong>: org.AGL.afm.user</p></li>
359 <li><p><strong>PATH</strong>: /org/AGL/afm/user</p></li>
360 <li><p><strong>INTERFACE</strong>: org.AGL.afm.user</p></li>
361 </ul>
362 <hr />
363 <h4 id="method-org.agl.afm.user.detail">Method org.AGL.afm.user.detail</h4>
364 <p><strong>Description</strong>: Get details about an application from its id.</p>
365 <p><strong>Input</strong>: the id of the application as below.</p>
366 <p>Either just a string:</p>
367 <pre><code>&quot;appli@x.y&quot;</code></pre>
368 <p>Or an object having the field &quot;id&quot; of type string:</p>
369 <pre><code>{&quot;id&quot;:&quot;appli@x.y&quot;}</code></pre>
370 <p><strong>Output</strong>: A JSON object describing the application containing the fields described below.</p>
371 <pre><code>{
372   &quot;id&quot;:          string, the application id (id@version)
373   &quot;version&quot;:     string, the version of the application
374   &quot;width&quot;:       integer, requested width of the application
375   &quot;height&quot;:      integer, resqueted height of the application
376   &quot;name&quot;:        string, the name of the application
377   &quot;description&quot;: string, the description of the application
378   &quot;shortname&quot;:   string, the short name of the application
379   &quot;author&quot;:      string, the author of the application
380 }</code></pre>
381 <hr />
382 <h4 id="method-org.agl.afm.user.runnables">Method org.AGL.afm.user.runnables</h4>
383 <p><strong>Description</strong>: Get the list of applications that can be run.</p>
384 <p><strong>Input</strong>: any valid json entry, can be anything except null.</p>
385 <p><strong>output</strong>: An array of description of the runnable applications. Each item of the array contains an object containing the detail of an application as described above for the method <em>org.AGL.afm.user.detail</em>.</p>
386 <hr />
387 <h4 id="method-org.agl.afm.user.install">Method org.AGL.afm.user.install</h4>
388 <p><strong>Description</strong>: Install an application from its widget file.</p>
389 <p>If an application of the same <em>id</em> and <em>version</em> exists, it is not reinstalled except when <em>force=true</em>.</p>
390 <p>Applications are installed in the subdirectories of the common directory reserved for applications. If <em>root</em> is specified, the application is installed under sub-directories of defined <em>root</em>.</p>
391 <p>Note that this methods is a simple accessor to the method <strong><em>org.AGL.afm.system.install</em></strong> of <strong><em>afm-system-daemon</em></strong>.</p>
392 <p>After the installation and before returning to the sender, <strong><em>afm-user-daemon</em></strong> sends the signal <strong><em>org.AGL.afm.user.changed</em></strong>.</p>
393 <p><strong>Input</strong>: The <em>path</em> of widget file to be installed. Optionally, a flag to <em>force</em> reinstallation and/or a <em>root</em> directory.</p>
394 <p>Simple form a simple string containing the absolute widget path:</p>
395 <pre><code>&quot;/a/path/driving/to/the/widget&quot;</code></pre>
396 <p>Or an object:</p>
397 <pre><code>{
398   &quot;wgt&quot;: &quot;/a/path/to/the/widget&quot;,
399   &quot;force&quot;: false,
400   &quot;root&quot;: &quot;/a/path/to/the/root&quot;
401 }</code></pre>
402 <p>&quot;wgt&quot; and &quot;root&quot; MUST be absolute paths.</p>
403 <p><strong>output</strong>: An object containing field &quot;added&quot; to use as application ID.</p>
404 <pre><code>{&quot;added&quot;:&quot;appli@x.y&quot;}</code></pre>
405 <hr />
406 <h4 id="method-org.agl.afm.user.uninstall">Method org.AGL.afm.user.uninstall</h4>
407 <p><strong>Description</strong>: Uninstall an application from its id.</p>
408 <p>Note that this methods is a simple accessor to <strong><em>org.AGL.afm.system.uninstall</em></strong> method from <strong><em>afm-system-daemon</em></strong>.</p>
409 <p>After the uninstallation and before returning to the sender, <strong><em>afm-user-daemon</em></strong> sends the signal <strong><em>org.AGL.afm.user.changed</em></strong>.</p>
410 <p><strong>Input</strong>: the <em>id</em> of the application and, optionally, the path to application <em>root</em>.</p>
411 <p>Either a string:</p>
412 <pre><code>&quot;appli@x.y&quot;</code></pre>
413 <p>Or an object:</p>
414 <pre><code>{
415   &quot;id&quot;: &quot;appli@x.y&quot;,
416   &quot;root&quot;: &quot;/a/path/to/the/root&quot;
417 }</code></pre>
418 <p><strong>output</strong>: the value 'true'.</p>
419 <hr />
420 <h4 id="method-org.agl.afm.user.start">Method org.AGL.afm.user.start</h4>
421 <p><strong>Description</strong>:</p>
422 <p><strong>Input</strong>: the <em>id</em> of the application and, optionally, the start <em>mode</em> as below.</p>
423 <p>Either just a string:</p>
424 <pre><code>&quot;appli@x.y&quot;</code></pre>
425 <p>Or an object containing field &quot;id&quot; of type string and optionally a field mode:</p>
426 <pre><code>{&quot;id&quot;:&quot;appli@x.y&quot;,&quot;mode&quot;:&quot;local&quot;}</code></pre>
427 <p>The field &quot;mode&quot; is a string equal to either &quot;local&quot; or &quot;remote&quot;.</p>
428 <p><strong>output</strong>: The <em>runid</em> of the application launched. <em>runid</em> is an integer.</p>
429 <hr />
430 <h4 id="method-org.agl.afm.user.terminate">Method org.AGL.afm.user.terminate</h4>
431 <p><strong>Description</strong>: Terminates the application attached to <em>runid</em>.</p>
432 <p><strong>Input</strong>: The <em>runid</em> (an integer) of running instance to terminate.</p>
433 <p><strong>output</strong>: the value 'true'.</p>
434 <hr />
435 <h4 id="method-org.agl.afm.user.stop">Method org.AGL.afm.user.stop</h4>
436 <p><strong>Description</strong>: Stops the application attached to <em>runid</em> until terminate or continue.</p>
437 <p><strong>Input</strong>: The <em>runid</em> (integer) of the running instance to stop.</p>
438 <p><strong>output</strong>: the value 'true'.</p>
439 <hr />
440 <h4 id="method-org.agl.afm.user.continue">Method org.AGL.afm.user.continue</h4>
441 <p><strong>Description</strong>: Continues the application attached to <em>runid</em> previously stopped.</p>
442 <p><strong>Input</strong>: The <em>runid</em> (integer) of the running instance to continue.</p>
443 <p><strong>output</strong>: the value 'true'.</p>
444 <hr />
445 <h4 id="method-org.agl.afm.user.state">Method org.AGL.afm.user.state</h4>
446 <p><strong>Description</strong>: Get informations about a running instance of <em>runid</em>.</p>
447 <p><strong>Input</strong>: The <em>runid</em> (integer) of the running instance inspected.</p>
448 <p><strong>output</strong>: An object describing instance state. It contains: the runid (integer), the id of the running application (string), the state of the application (string either: &quot;starting&quot;, &quot;running&quot;, &quot;stopped&quot;).</p>
449 <p>Example of returned state:</p>
450 <pre><code>{
451   &quot;runid&quot;: 2,
452   &quot;state&quot;: &quot;running&quot;,
453   &quot;id&quot;: &quot;appli@x.y&quot;
454 }</code></pre>
455 <hr />
456 <h4 id="method-org.agl.afm.user.runners">Method org.AGL.afm.user.runners</h4>
457 <p><strong>Description</strong>: Get the list of currently running instances.</p>
458 <p><strong>Input</strong>: anything.</p>
459 <p><strong>output</strong>: An array of states, one per running instance, as returned by the methodd <strong><em>org.AGL.afm.user.state</em></strong>.</p>
460 </body>
461 </html>