Dbus Inspector & Introspect

John (J5) Palmieri johnp at redhat.com
Sun Sep 14 07:42:48 PDT 2008


On Fri, 2008-09-12 at 23:50 +0200, Thiago Macieira wrote:
> Sander Jansen wrote:
> >Currently DBus Inspector won't list any of these methods, since it
> >doesn't know about the object on path "/org/fifthplanet/gogglesmm". I
> >see DBus Inspector calling "Introspect" on path "/". Would I have to
> >respond with the following then?:
> >
> ><!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection
> > 1.0//EN"
> > "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node
> > name="/">
> >  <interface name="org.freedesktop.DBus.Introspectable">
> >    <method name="Introspect">
> >      <arg name="xml_data" direction="out" type="s"/>
> >    </method>
> >  </interface>
> >  <node name="/org/fifthplanet/gogglesmm"/>
> ></node>
> >
> >Would this be the correct and standard way of doing this?
> 
> No.
> 
> You have to reply with almost the same as above, but the inner <node> tag 
> should be:
> 
>   <node name="org" />
> 
> Then the introspect on /org should reply with:
> 
>   <node name="fifthplanet" />
> 
> And so on.

While this is good style advice in general (think tabs vs. spaces in
coding) I don't think it is part of the spec and most certainly
shouldn't break any tools since tools should just be recursing each
node. In fact, having org/ then fifthplanet/, etc. becomes less
efficient since tools have to make an introspect call for each object
path. 

> >The last 
> >response on my question on the list about object path naming
> >conventions seems to discourage using the "/" path...
> 
> You misunderstood the problem. We were saying that using the / object for 
> your purposes was probably wrong, if you were writing an interface that 
> was meant to be implemented by other applications.
> 
> It could also be a bad practice even if it's just your application, since 
> you may want in the future to do things differently.
> 
> However, the / object is the root object in the object tree. It's always 
> present and the introspection starts by it. You have to provide the 
> correct tree leading to your objects.

Yes, the biggest problem with using / is like the old problem of
starting with 1 in BASIC.  There is little room to correct errors.
Also / is not descriptive which in most cases is not a real issue.
Technically object paths are just like pointers but in reality they do
convey some meaning and allow an app to provide a logical hierarchy for
referencing functionality.


-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list