bindings, introspection - Properties need to attach to interfaces, NOT directly to the object

David A. Wheeler dwheeler at dwheeler.com
Sun Jan 30 13:05:58 PST 2005


Havoc Pennington wrote:
> Hi,
> 
> I updated the spec to have some discussion of the current introspection
> format.

Thanks so much!!


> I also changed the recommendation for mapping attributes/properties,
> previously it was:
> 
>  get_PropName/set_PropName methods
> 
> Now it's an interface:
> 
>  interface org.freedesktop.Properties {
>     variant Get (in string interface, in string propname);
>     void    Set (in string interface, in string propname, in variant
> value);
>  }
> 
> I changed the introspection format to have a <property> element for
> this.

I think switching to Get() and Set() methods makes sense,
instead of having get_xxx and set_xxx names; it makes it
much simpler to create dynamic queries.
And having a <property...> value inside the <interface> in
the XML is sensible too.

HOWEVER, if I understand your interface
org.freedesktop.Properties notation correctly above,
I see a problem.  It _appears_ to me that when an object
receives a request to Get/Set a property, it'll always
have the request sent to the same interface: org.freedesktop.Properties.

I think properties need to be attached to a particular
interface, like methods -- and NOT to a particular object.
That way, if two different interfaces provide properties with
identical names, you can distinguish between them,
just like you can when method names happen to have overlapping names.
Your XML example DOES capture the notion that properties are attached to
interfaces, instead of the object.  CORBA also attaches attributes to specific
interfaces too, instead of the object, so there's precedence for attaching
properties to specific interfaces.

Since ANY interface might support Get-ting and Set-ting properties,
you'll need to distinguish the calls that Get & Set the properties
other than using a special interface name. Here are some approaches:
1. The method names "Get" and "Set" are special, and can't be
    used for normal methods. But that's limiting.
2. Use method names "_Get" and "_Set" internally to D-BUS to
    get and set values.  I like this one, it's simple.
    The _Get() and _Set() methods take the parameters as noted above,
    if there are ANY properties on the object.  Note that
    the bindings will need to pass the name of the interface
    on to the object, so that objects can differentiate them
    if necessary.
3. Identify this somewhere in the call, e.g., special
    field name, or even making this a new message type.
    This seems more complicated than needed though.
I prefer #2, but that's my preference.

--- David A. Wheeler



More information about the dbus mailing list