NetworkManager.ActivateConnection and java-dbus

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Apr 29 07:47:14 PDT 2013


On 29/04/13 13:23, Matthew Johnson wrote:
> Well, I don't think "/" is actually a valid path.

It is. It's called out as a special case in the spec (albeit not
amazingly clearly): it is the only object path allowed to end with "/".
I am not aware of any D-Bus implementations that don't support it. If
such implementations exist, that would be a bug.

Services shouldn't usually export APIs at "/" (except for
org.freedesktop.DBus.Introspectable and ...DBus.Peer, which are
typically provided automatically by libraries) for the reasons described
at <http://0pointer.de/blog/projects/versioning-dbus.html>.

Some D-Bus APIs, like Telepathy and NetworkManager, work around the fact
that we don't have GVariant-like "maybe types" by using the root
object-path "/" as a null value. For instance, a Telepathy Account's
Connection property is of type "o" (object path), and is either
"/org/freedesktop/Telepathy/Connection/SOMETHING" (if the account is
connecting or connected), or "/" (if not).

If we had "maybe types", it would be of type "mo" (maybe object-path)
and have values (using GVariant's notation) 'just
"/org/freedesktop/Telepathy/Connection/SOMETHING"' or 'nothing'.

> I _think_
> http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path
> implies that you must always have at least one element of at least one
> character, but maybe I'm wrong.

This is a misinterpretation: it also says

    A trailing '/' character is not allowed unless the path is the root
    path (a single '/' character)

which wouldn't make sense unless "/" was a valid object-path. A patch
clarifying this would be welcome (preferably via Bugzilla and cc'ing me).

> I'd just use Path and keep track of what they should be when you
> need to call it.

Does DBusInterface have an accessor that returns a Path? If not, I think
that'd be a reasonable feature request; then you could call either

    ActivateConnection(..., new Path("/"))

or

    ActivateConnection(..., mySpecificObject.getPath())

    S


More information about the dbus mailing list