[Date Prev][Date Next] [Thread Prev][Thread Next]
Re: [libvirt] libvirt-java
- From: Tóth István <stoty tvnet hu>
- To: veillard redhat com
- Cc: libvir-list redhat com, Daniel Schwager <Daniel Schwager dtnet de>, Tóth István <stoty tvnet hu>
- Subject: Re: [libvirt] libvirt-java
- Date: Mon, 07 Jul 2008 13:17:48 +0200
Daniel Veillard wrote:
> On Fri, Jul 04, 2008 at 09:23:36PM +0200, Tóth István wrote:
>> I took at a look at that code.
>> The JNI code is basically unchanged from the 0.1 version.
>> The interesting part is the code is for handling the XML structures used
>> by libvirt.
>> You can see how Daniel Schweger's added functionality is meant to be
>> used in the srtc/testclient/org/libvirt/TestXen.java file.
>> The way I imagined the java-libvirt architecture is that there is a
>> lower 'core' level, which is basically a function-for function
>> equivalent of the C libvirt functionality, with the bare minimum of
>> object-orientedness thrown in to pass for a proper java library (the
>> current libvirt in CVS)
> Okay so far i agree.
>> Plus, there should/can be anotherl API, that exposes the XML files as
>> java objects with get/set functions, etc. (It's in the
>> org.libvirt.schema package in Daniel Schweger's code)
>> Optionally, there could be higher level API that uses the core and XML
>> api, and provides a really clean java-style object model, but IO haven't
>> given it much thought yet.
>> I think these two or three layers should be clearly demarcated, maybe
>> even shipped as separate packages, becuse anything that layers on more
>> functionaity that what the current cvs provides represents design
>> decisions that are not inherent to libvirt.
>> One may not want to use the XML technology/object model/whatever that
>> libvirt-java ships, but rather add their own XML handling stuff/ higher
>> level abstractions on top of the core libvirt bindings. (for example,
>> Daniel Schweger's code uses XMLBeans, my original idea was to use JAXB
>> for the same purpose).
> Ah, okay.... Well my perspective is that libvirt-java should include
> only parts which are directly releated to using libvirt on Java. I would
> really not try to reinvent or push any XML related APIs there, at least
> as part of libvirt bindings (I still have the scars from libxml2, believe
> me you don't want to push new XML APIs to programmers even specialized ones).
My thoughts exactly.
> But things like the XSD descriptiond might be useful generally, and
> IMHO are very tied to libvirt, so i think they are a good fit.
Absolutely. I've had major problems when I tried to use some Java XML
mapping libraries, because they can only process xsd,
and not the language you use. So having high-quality xsd definitions is
high on my personal wish-list.
> the fact that there may be multiple environment to work on the XML files
> means to me that it's better left off, or maybe provided as a contribution on
> libvirt.org FTP site, but probably better not integrated, because different
> users are likely to do things differently.
> IMHO the key point of libvirt-java is to make sufficient bindings to allow
> Java developpers to integrate libvirt without pain, while trying to not force
> them into a specific model (at least not beyond what libvirt itself imposes).
> Also fitting into this model are build makefiles for other environment,
> I understand that for most Java developpers, configure and make are really
> foreign tools, so adding ant/Eclipse/... build recipes for the package also
> makes a lot of sense.
Well, they certainly wouldn't hurt, but I don't see that as a priority.
Java-only programmers (end users) won't touch the JNI core parts.
They will just install the package, and get on with using it, by adding
to their devel enviroment, and perhaps the JNI lib file to the command line.
These kind of users don't really care about the java-libvirt build
If you want to do something more interesting than renaming the java
classes and methods,
the you have to hit the JNI bindings, and that code is so ugly, that
no-one without some C experience will want to touch it.
Having said that, I think that an ant build file would be the most
useful, as it can be used directly in all major
development enviroments. There is also this maven thing, that seems to
be widely used, but I still haven't figured out
exactly what that is :-)
> What do you think ?
>> BTW I am working on adding the core bindings for the storage stuff, but
>> don't expect anything soon, as my day job is currently eating all my time.
> Okay, cool. BTW libvirt-java review for Fedora seems done now,
> so hopefully i should be able to push it to more people real soon now.
> I also got Solaris portability feedback from John Levon which I need to
> integrate, there is clearly some work left, but there is no rush :-)
My current plans for java-libvirt are:
1. Add the storage API: It's really mostly just copy-paste-search
replace but it still takes some work
2. There are some consistency problems with the naming of classes and
methods. I'd like to revisit the java api, and make some changes in
names, and maybe class structure
3. There are many places where the C part leaks memory, this should also
be audited/ fixed.
Number 2 is what worries me, I don't know if it's a good idea to push
toFedora, when I know I want to make incompatible API changes soon.
(Or you can just say that you won't accept them, but I'm a big fan of
clean and consistent APIs, and the current one can be improved)
I believe that I will get around to doing 1. and 2. at least in late
july/early august, It's about a three day job, I just don't have that
three days right now :-(
[Date Prev][Date Next] [Thread Prev][Thread Next]