Hi all, Is there any Java binding patch exist for Hivex library? If not, any plan for a Java binding in near future? Thanks, Michael
On Wed, Apr 27, 2011 at 02:46:30PM +0000, Michael Huang wrote:
Is there any Java binding patch exist for Hivex library? If not, any plan for a Java binding in near future?
There is not currently any binding. I don't particularly have a plan for a binding, except that we do want to eventually cover all languages. On the other hand it would be fairly simple to do by looking at the libguestfs java binding generator and modifying it a bit. Do you have the required skills to do that? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Thanks. I'm an experienced C++ developer, but a Java beginner. I'll see how far I can go by following libguestfs java binding generator. Could you please help me with where to start? and do I have to know OCaml for this work? Thanks, Michael -----Original Message----- From: Richard W.M. Jones [mailto:rjones@redhat.com] Sent: Wednesday, April 27, 2011 12:16 PM To: Michael Huang Cc: libguestfs@redhat.com Subject: Re: [Libguestfs] Hivex java binding On Wed, Apr 27, 2011 at 02:46:30PM +0000, Michael Huang wrote:
Is there any Java binding patch exist for Hivex library? If not, any plan for a Java binding in near future?
There is not currently any binding. I don't particularly have a plan for a binding, except that we do want to eventually cover all languages. On the other hand it would be fairly simple to do by looking at the libguestfs java binding generator and modifying it a bit. Do you have the required skills to do that? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Wed, Apr 27, 2011 at 05:50:42PM +0000, Michael Huang wrote:
Thanks. I'm an experienced C++ developer, but a Java beginner. I'll see how far I can go by following libguestfs java binding generator. Could you please help me with where to start?
In both libguestfs and hivex we take a very aggressive approach to boilerplate code, like bindings. The approach is that we generate it all in a large generator program (in both cases, in the generator/ directory of the source). Grab the latest libguestfs source tarball (not git) since it has the generator and the generated Java bindings. It's helpful to compare the two things. # generator generator/generator_java.ml # generated files $ grep ^java generator/files-generated.txt java/Bindtests.java java/Makefile.inc java/com/redhat/et/libguestfs/Application.java java/com/redhat/et/libguestfs/Dirent.java java/com/redhat/et/libguestfs/GuestFS.java java/com/redhat/et/libguestfs/INotifyEvent.java java/com/redhat/et/libguestfs/IntBool.java java/com/redhat/et/libguestfs/LV.java java/com/redhat/et/libguestfs/PV.java java/com/redhat/et/libguestfs/Partition.java java/com/redhat/et/libguestfs/Stat.java java/com/redhat/et/libguestfs/StatVFS.java java/com/redhat/et/libguestfs/VG.java java/com/redhat/et/libguestfs/Version.java java/com/redhat/et/libguestfs/XAttr.java java/com_redhat_et_libguestfs_GuestFS.c The idea is to take hivex/generator/generator.ml and write an equivalent generator for Java. Each function in the hivex API is defined here, for example: "value_key", (RString, [AHive; AValue "val"]), (hivex_value_key, returning a string, taking as parameters a hive handle and a value). Most of the code in the generator is pretty simplistic. It just iterates over the list of API functions, and generates the appropriate bits of boilerplate for each parameter and the return value.
and do I have to know OCaml for this work?
It'll help, but it's not really that hard, and mostly it's just using our custom 'pr' command to print things (like printf), and List.iter to iterate over things. There is a tutorial here: http://mirror.ocamlcore.org/ocaml-tutorial.org/index.html and this book is excellent if you need more detail: http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
I've downloaded hivex-1.2.5.tar.gz, there is no /generator directory exist in the tarball. But the files in /ocaml, /python and /perl bindings do indicate they were generated by generator. Looks like the generators are missing in the tarball. I do see generators in libguestfs-1.10.2 tarball. Michael -----Original Message----- From: Richard W.M. Jones [mailto:rjones@redhat.com] Sent: Wednesday, April 27, 2011 2:10 PM To: Michael Huang Cc: libguestfs@redhat.com Subject: Re: [Libguestfs] Hivex java binding On Wed, Apr 27, 2011 at 05:50:42PM +0000, Michael Huang wrote:
Thanks. I'm an experienced C++ developer, but a Java beginner. I'll see how far I can go by following libguestfs java binding generator. Could you please help me with where to start?
In both libguestfs and hivex we take a very aggressive approach to boilerplate code, like bindings. The approach is that we generate it all in a large generator program (in both cases, in the generator/ directory of the source). Grab the latest libguestfs source tarball (not git) since it has the generator and the generated Java bindings. It's helpful to compare the two things. # generator generator/generator_java.ml # generated files $ grep ^java generator/files-generated.txt java/Bindtests.java java/Makefile.inc java/com/redhat/et/libguestfs/Application.java java/com/redhat/et/libguestfs/Dirent.java java/com/redhat/et/libguestfs/GuestFS.java java/com/redhat/et/libguestfs/INotifyEvent.java java/com/redhat/et/libguestfs/IntBool.java java/com/redhat/et/libguestfs/LV.java java/com/redhat/et/libguestfs/PV.java java/com/redhat/et/libguestfs/Partition.java java/com/redhat/et/libguestfs/Stat.java java/com/redhat/et/libguestfs/StatVFS.java java/com/redhat/et/libguestfs/VG.java java/com/redhat/et/libguestfs/Version.java java/com/redhat/et/libguestfs/XAttr.java java/com_redhat_et_libguestfs_GuestFS.c The idea is to take hivex/generator/generator.ml and write an equivalent generator for Java. Each function in the hivex API is defined here, for example: "value_key", (RString, [AHive; AValue "val"]), (hivex_value_key, returning a string, taking as parameters a hive handle and a value). Most of the code in the generator is pretty simplistic. It just iterates over the list of API functions, and generates the appropriate bits of boilerplate for each parameter and the return value.
and do I have to know OCaml for this work?
It'll help, but it's not really that hard, and mostly it's just using our custom 'pr' command to print things (like printf), and List.iter to iterate over things. There is a tutorial here: http://mirror.ocamlcore.org/ocaml-tutorial.org/index.html and this book is excellent if you need more detail: http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
On Thu, Apr 28, 2011 at 03:31:20PM +0000, Michael Huang wrote:
I've downloaded hivex-1.2.5.tar.gz, there is no /generator directory exist in the tarball.
Yes, I noticed that we didn't put that into the tarball and fixed it this morning: http://git.annexia.org/?p=hivex.git;a=commitdiff;h=b84194b377ed3cf42b45c30a3... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
participants (2)
-
Michael Huang -
Richard W.M. Jones