Object paths naming conventions?

Colin Walters walters at verbum.org
Sat Jul 19 01:47:00 PDT 2008


On Fri, Jul 18, 2008 at 12:46 PM, Havoc Pennington <hp at pobox.com> wrote:

>
> Anyway, you're right the object path is just an arbitrary string and
> can be anything; but, it needs to be a unique string for each distinct
> object. So that means either random/guid type strings (like mktemp or
> uuid), or namespaced strings, or guids inside a namespace is another
> common pattern (like /org/foo/{guid}).


This gets to my current recommendation, which boils down to:

If your app has a global singleton object, namespace it like
/org/myapp/MyService

If your app has dynamic objects, use GUIDs
(/org/myapp/8f1569af-2893-478b-84da-743b04c52121), or a runtime-specific
unique object mapping (in C, this could just be the pointer address; on the
JVM you might be able to use System.identityHashCode() for this purpose
though I'm not entirely sure.).

Don't try to create a human-readable string for the object as the
restrictions on names in the object path will likely trip you up.  This has
happened now with both HAL and NetworkManager.  Or if you do, be really sure
you URL quote it everywhere.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080719/ba29e979/attachment.html 


More information about the dbus mailing list