mapping object paths to method calls

Chris Rebert cvrebert at gmail.com
Sun Apr 9 11:24:35 PDT 2006


Thiago -
Thank you very much for your advice. I don't know why it didn't occur to 
me to have a method dynamically register an object and return a path.
Now my project can start getting somewhere.
Long live D-BUS!
- Chris Rebert


Thiago Macieira wrote:
> Chris Rebert wrote:
> 
>>I'm new at D-BUS and was wondering if it is possible to have an object
>>path mapped to a method call, e.g. accessing /org/foo/bar/1123 would
>>return the result of /org/foo/bar.someMeth("1123"). I couldn't find an
>>answer in this list's archives or the documentation, so I'm doubtful
>>this is possible.
> 
> 
> It doesn't really make sense because an object path by itself is 
> meaningless. You must have at least a method name associated in order to 
> make anything useful with it.
> 
> What you seem to be asking, though, is something like we're used to in 
> programming:
>   Object obj = someMeth("1123")
>   obj.anotherMeth(...)
> 
> is that it? Then, if so, there is no problem in your program having a 
> method call that returns an object path. The only issue is that the 
> object path has to exist at all times. There's no reference counting 
> involved here -- unless you provide a Release method and remember to call 
> it.
> 
> 
>>My application will have a large database of objects accessible via an
>>object path that incorporates their ids (e.g. /org/foo/bar/41254), and
>>even using the flyweight pattern, I believe there would not be enough
>>memory to register an object path for each object, therefore I would
>>like to generate each object on demand if possible, as only a few of the
>>many will be in use at any one time.
>>If you have any ideas on how to accomplish this, I would be most
>>appreciative.
> 
> 
> See above.
> 
> Registering the object depends on how your binding does it. Technically 
> speaking, with a message filter, you could catch the call to any object, 
> without the need to call any specific "register object" function.
> 


More information about the dbus mailing list