services & auto activation
Jim Carter
jimc at math.ucla.edu
Fri Mar 14 09:44:57 PDT 2008
On Fri, 14 Mar 2008, John (J5) Palmieri wrote:
> On Fri, 2008-03-14 at 11:04 +0100, mehdi bayarassou wrote:
> > applications through DBus. I want some further information about auto
> > activation mechanism, .service files, XML descriptor files ( i have
--snip--
> If you look in /usr/share/dbus-1/services you can see a number of
> service examples. For instance gnome-vfs-daemon.service looks like
> this:
>
> [D-BUS Service]
> Name=org.gnome.GnomeVFS.Daemon
> Exec=/usr/libexec/gnome-vfs-daemon
Simon McVittie replied to me (paraphrasing): D-Bus provides the channel,
you provide the content. However, I think D-Bus was intended to be not
just another IPC mechanism (with filters), but a way to organize the chaos
that now forms the Freedesktop. In this case, what happens if several
programs serve the same Service Name? How does the D-Bus daemon decide
which one to auto-start?
Here's an example. Suppose Bill Gates at age 19 had been a little more
aggressive bringing the UNIX paradigm into MS-DOS (think MS-Minix); let's
re-fight the Browser Wars on X-Windows. Suppose an app has a URL it wants
displayed. Netscape (and Mozilla spawn) have a kludge involving a property
on the X-server's root window so the app can deposit the URL and a running
Netscape will deal with it. But this is the D-Bus mailing list: the "right
way" is a D-Bus method call, with the significant advantage that the D-Bus
daemon can auto-activate the user's preferred browser if no program holds
the relevant service name.
If the user has installed MSIE for UNIX, Netscape-12.x, Firefox, Iceweasel,
Mainline Mozilla, W3M and Opera, all of which (in the fantasy scenario)
have installed service files, how does the app know which service name to
use, and how does the daemon know which is the preferred browser du jour?
I think Simon would say / has said that the browser community needs to
agree on a name and interface. The D-Bus team could help get this started
by saying "you guys need to get on D-Bus and you can use our neutral
territory, org.freedesktop.service, to put a generic servce name in."
Otherwise each company (think Microsoft) is going to insist on its own
incompatible namespace, and the app has no chance of being able to use
D-Bus to make a service happen, since it will not know the idiosyncratic
names and interfaces that have been or will be kludged together.
As for preferences, I'd suggest an addition to the service file: the
Preference keyword. The value is an integer; highest wins. Packagers are
instructed to install their service file with a conventional preference of
10; if a distro has a preferred browser the preference should
conventionally be set to 20; and the user should have a nice GUI to adjust
the numbers to taste; specifically to override the distro's default by
setting (e.g.) Opera to have preference 30. (A case could be made that the
distro default should be lower than 10, since if a user explicitly picks a
different browser to be installed, presumably he wants it to be used.)
The names of the service files: must the name match exactly the contained
service name? (All the ones I see in SuSE 10.3 do so.) Or must it be a
prefix? Or is it arbitrary except for ending in .service? I'm guessing
the latter, since on Maemo-4.0, osso-backup.service says
Name=com.nokia.backup. But if the spec required the filename to have the
service name as a prefix, the daemon could identify all relevant service
files just by reading the directory, not needing to open every single file
(71 of them on Maemo). If no prefix match were found it could fall back to
opening every file.
James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 520 Portola Plaza; Los Angeles, CA, USA 90095-1555
Email: jimc at math.ucla.edu http://www.math.ucla.edu/~jimc (q.v. for PGP key)
More information about the dbus
mailing list