[vlma-devel] Split data.xml into several files

Adrien Grand jpountz at videolan.org
Thu Aug 7 00:09:34 CEST 2008


Le mercredi 06 août 2008 à 11:31:58, Sylvain Cadilhac a écrit :
> This choice (an only configuration file) has been made because... it was
> easier to have relationships between objects restored when deserializing
> data. Lazyiness won against logic!  Therefore your suggestion is most
> welcome :)

Yes, I didn't think of it before proposing it. :s However, I've read
XStream documentation and although it seems possible to split the file
into separate smaller files and keep references between objects across
these files, I'm afraid this could lead to problems which would be hard
to track (imagine two references of the same satellite, one loaded with
the satellites.xml file and the other inside a SatChannel). Maybe we
would never realize that these are two different objects according to
Java and it would cause incomprehensible bugs.

Another issue I don't like in VLMa is how remote objects modifications
are handled. Since the remote instance is not the same as the daemon's
one (because of serialization and deserialization), all objects
modifications have to be done using a method exposed by the RMI exporter
(like adding a program to a media). This is quite painful. I would
really much prefer to modify the object remotely and then call some king
of "void data.upgrade(Object o)" method which would synchronize the
local instance of the object with the remote one.

Moreover there are lots of methods (like get<whatever object> or in the
WelcomeController where all existing medias are checked in order to know
whether or not they have a program) which run on a entire set of data to
find one (or sometimes a few) objects according to their id or a field
value. This kind of process looks like what a database is designed for,
so I think we could try to move VLMa data persistence management to a
database rather than XML serialization.

What I liked with the current system is that it is written on disk in a
simple file, and that you just have to remove it from your disk to reset
VLMa data, and you even can modify it by hand if you want. So a file
based database (rather than a database that relies on a connection to a
server like MySQL or PostgreSQL) could do the trick (even if
modification by hand would be a little more tricky :p) and would be
really more robust for all the features that we need and that
serialization is maybe not made to:
 - complex queries,
 - only save the data that you need to save,
 - etc.

When I thought of it, I first thought to SQLite, but then I discovered
Apache Derby (http://db.apache.org/derby) which is a database
implemented entirely in Java (so that it could be fully embedded into
VLMa). A tutorial explaining how to embed Derby in another application
is described here:
  http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html

Adrien, Sylvain, any thoughts about that?

-- 
jpountz


More information about the vlma-devel mailing list