[libvirt] RFC: libvirt java bindings based on JNA

Bryan Kearney bkearney at redhat.com
Sat Jul 25 11:56:36 UTC 2009


I would like to get some comments on an initial cut of the java bindings 
on top of JNA[1]. They are not 100% complete (see below), but they are 
good enough to be criticized. In addition, if there are features 
additions to the API which people are interested in, I would appreciate 
the feedback on that.

JNA is a java implementation of the Foreign Function Interface [2]. The 
main benefit is that it removes the need for all the nasty C glue code.
What replaces it is pure java mapping files. If you look in the 
org.libvirt.jna package in the code, you will see that the 2928 lines of 
jni code have been replaced by 427 lines of java code. To be fair, some 
of the business logic from the C code is now in the org.libvirt 
package... but you get the point.

The original java API has remained the same. The open issues with the 
code are:

1) Authorization callback has not been tested.
2) GetUUID is not returning the correct int array.
3) Find by UUID is not working

These all are mapping issues to be worked out. The rest of the code 
should be working, but I would appreciate it being exercised. The main 
drawback to this approach is that it requires the use of java 1.6. I 
looked on EPEL, F10, and F11.. and java 1.6 and the JNA jar file are 
available so I did not believe this was an issue.

I will send a patch stream to the list, but you can also get the code 
via an SRPM [3] or via github [4].

-- bk

[1] https://jna.dev.java.net/
[2] http://en.wikipedia.org/wiki/Foreign_function_interface
[3] http://bkearney.fedorapeople.org/libvirt-java-0.3.0pre-1.fc10.src.rpm
[4] http://github.com/bkearney/libvirt-java/tree/jna




More information about the libvir-list mailing list