Object serialization
Luigi Paioro
luigi at lambrate.inaf.it
Tue Feb 26 08:51:40 PST 2008
Thank you Simon...
> Encoding things for D-Bus in this way involves the same sort of design
> decisions you'd make when choosing how to encode something in JSON or XML.
>
> Now, if what you want is some sort of generic object storage/retrieval system,
> you have exactly the same issues as if you were doing generic object
> storage and retrieval using files on disk. You'll have to define a way to
> construct an object instance from a dictionary, struct or byte-array,
> enforcing use of a "safe" constructor that cannot crash or
> cause unwanted code to execute when it is fed invalid data, then have
> objects provide a method that dumps their state into such a format.
...
> I believe that attempting to "solve" this problem in a generic way, without
> having any particular use-case in mind, is likely to lead to a system that's
> not particularly useful for *any* use case.
Indeed. You have stricken the target. I do have a specific use case in
mind that I already have partially implemented for a possible SOAP
service (starting from a UML design). I'm dealing with a framework that
should be able to exploit different RPC systems (at least at design
level). One of them is SOAP, another is XML-RPC, and my team proposed
also DBus.
So, what I have to do is to call a (remote) service passing a complex
data structure as argument. This complex data structure should also be
stored (serialized) in a file, but not necessarily. We can see it like
an XML document exchanged in a SOAP communication, or an object encoded
in JSON format and exchanged, for instance, via HTTP GET.
As I said above, I have already implemented this complex data model
using XML for SOAP messaging and data storage in files, and now I'm
trying to find a way to do the same for DBus (and XML-RPC... the data
model serialization as a dictionary could follow the same rules I suppose).
I don't know whether you find it interesting or useful, but here you can
get an example of this data model serialization as XML document instance:
http://cosmos.iasf-milano.inaf.it/luigi/projects/fase/data/xml/examples/PSetExample.xml
Thank you again.
Luigi
More information about the dbus
mailing list