Proposing ObjectManager interface
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Feb 28 07:40:28 PST 2011
On Mon, 28 Feb 2011 at 16:04:53 +0100, Thiago Macieira wrote:
> For one thing, I'd like to see something us use D-Bus for introspecting
> D-Bus, not have to fall back to XML, which is expensive to produce and/or
> store and then to parse.
I endorse this general principle. (Telepathy has a very small version of it,
which is that we list optional interfaces in an 'as' (string-array) property
on each of our "class-like" interfaces.)
However, I also think application code should never need to list the methods,
signals, properties in an interface, except in debugging tools like
d-feet - if you're interacting with a D-Bus interface, you should already know
what its methods, signals and properties mean.
I'd be prepared to consider qdbus/gdbus/dbus-send to be in the same category
as d-feet, although having said that, dbus-send and gdbus require you to be
explicit about types anyway (and I think that's good).
> QtDBus doesn't allow adding or removing interfaces to an existing object
> today, but that's an internal limitation that could be lifted. I'm wondering
> however what's the interest in this. Do others rely on interfaces appearing
> and disappearing on existing objects? I've never seen this.
dbus-glib has the same restriction as QtDBus - the interfaces present on an
exported GObject are (conceptually) part of the GObjectClass, so they can never
change (indeed, they can't be different between instances of a class).
However, in Telepathy we make a distinction between the interfaces present
in the C code, and the interfaces "advertised" on D-Bus. For instance, our XMPP
implementation can only provide new mail notifications on servers with Google
Talk's XMPP extension (and you can't tell whether the server has that
extension until you've finished connecting to it).
We deal with that as follows: in our Introspect() output (and our dbus-glib
code), every connection produced by our XMPP implementation has the
MailNotification interface, but the Interfaces string-array property only
lists that interface when (a) connecting has progressed far enough to tell
whether this server has the feature, and (b) it does have the feature.
S
More information about the dbus
mailing list