Question on service activation

Havoc Pennington hp at redhat.com
Thu Feb 22 05:46:59 PST 2007


Kevin Krammer wrote:
> 
> Examples from the Maemo documentation and an activation tutorial linked from 
> the D-Bus tutorial suggest that interface name == D-Bus name == object path 
> (with slash as separator), e.g. a .service file specifying a 
> service "org.example.Foo" will result in a process available at D-Bus 
> name "org.example.Foo", with an object at "/org/example/Foo" having the 
> interface "org.example.Foo"

When the three line up, it is just a coincidence - for example I 
recently defined a "Prefs" interface which was implemented by a couple 
different object paths under a couple different bus names.

When people are implementing a global singleton, then the three names 
are redundant, but anytime you have multiple apps implementing something 
you have multiple bus names, anytime you have multiple distinct APIs on 
the same object you have multiple interfaces, and anytime you have 
multiple objects in the same app implementing the same interface, you 
have distinct object paths.

> However, we weren't sure how service providers (i.e. processes with a D-Bus 
> connection providing interface implementations) would specify multiple 
> interfaces.

Interfaces are implemented by objects within a process, while bus names 
are owned on the bus (by a process's connection).

> For example consider PIM interfaces (kept short to ease typing): pim.EMail, 
> pim.Contacts, pim.Calendar.

Do you mean interface or bus name here? (just to be sure)

Think
   interface = programming language interface, e.g. Java interface
   bus name = domain name, i.e. a way to contact a remote app by name

> A "just email" application like Thunderbird would probably just implement 
> pim.EMail and pim.Contacts, a full PIM suite like Evolution would implement 
> all.
> 
> (1) If none if the is running yet and an application would make a call to 
> pim.Contacts, will the bus wait until it has registered all its names?

If you have multiple bus names then for a given activation, the bus will 
only care about one of them. i.e. it will only block the pim.Contacts 
call until pim.Contacts has an owner.

> (2) Is there a race condition if two applications activate two different 
> services?

Bus name ownership is only atomic for a single bus name. So yes you 
could get different apps owning the different names.

> (3) If Evolution is the default handler as configured by the desktop, can 
> Thunderbird be prevented from claiming the default names if started manually?

Not right now. It's not clear this is right anyway (if someone has 
thunderbird open, maybe it should be used for mail - at least, it seems 
as good a guess as any)

You can imagine various solutions, obviously, but in general nobody has 
yet defined the connection between the default handler choices and dbus 
activation.

Havoc


More information about the dbus mailing list