From: Bryan Kearney Date: Wed, 29 Jul 2009 21:28:50 +0000 (+0200) Subject: Update the java bindings page X-Git-Tag: v0.7.0~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13e5668a84cb919713b7a9da5e07ab673ee52235;p=thirdparty%2Flibvirt.git Update the java bindings page * docs/java.html[.in]: update the java bindings html page to reflect the new repositories, JNA usage, and maven access --- diff --git a/docs/java.html b/docs/java.html index c1b4f65e88..dbb830c219 100644 --- a/docs/java.html +++ b/docs/java.html @@ -107,74 +107,75 @@

Java API bindings

Presentation

-

The Java bindings are currently a work in progress based mostly -on the work of Toth Istvan. The first usable release is 0.2.0, where -most of the naming conventions were defined. Further release will try -as much as possible to stay compatible

+

The Java bindings make use of JNA + to expose the C API in a Java friendly way. The bindings are are based on + work initiated by Toth Istvan.

Getting it

The latest versions of the libvirt Java bindings can be downloaded from:

-

Hourly development snapshots

-

Once an hour, an automated snapshot is made from the latest CVS server - source tree. These snapshots should be usable, but we make no guarantees - about their stability:

- -

CVS repository access

-

The master source repository uses CVS and anonymous access -is provided. Prior to accessing the server is it necessary to authenticate -using the password anoncvs. This can be accomplished with -the cvs login command: +

Maven

+

A maven repository is located at http://www.libvirt.org/maven2/ +which you can use to include this in your maven projects.

+

GIT source repository

+

The Java bindings code source is now maintained in a git repository available on +libvirt.org:

-  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs login
+git clone git://libvirt.org/libvirt-java.git
 

- Once authenticated, a checkout can be obtained using +It can also be browsed at

 
-  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs co libvirt-java
+http://libvirt.org/git/?p=libvirt-java.git;a=summary
 
+

+

GIT repository mirror

-The libvirt-java build process uses GNU autotools, so after obtaining a checkout -it is necessary to generate the configure script and Makefile.in templates -using the autogen.sh command. As an example, to do a complete -build and install it into your home directory run: + The source code is also mirrored on gitorious + to aid in public development. You clone the repo with

-  ./autogen.sh --prefix=$HOME/usr
-  make
-  make install
+  git clone git://gitorious.org/libvirt/libvirt-java.git
 
-

Other build system are not currently available but as usual we take patches -(Eclipse/ant/...) would be welcome !

-

currently libvirt-java requires a version of libvirt >= 0.4.0 to be -installed as well as the associated libvirt development files/package. It -should compile with any java implementation >= 1.5, the bindings uses -the enum construct which appeared only in that version.

-

Libvirt-java bindings development occurs on the same mailing-list as -the normal libvirt work see the associated contact -page

-

GIT repository mirror

- The CVS source repository is also mirrored using GIT, and is available - for anonymous access via: + It can also be browsed at

-
 
-  git clone git://git.et.redhat.com/libvirt-java
+        
+
+  http://gitorious.org/libvirt/libvirt-java
+
+

+

CVS repository access (Deprecated)

+

The old source repository uses CVS and anonymous access +is provided. Prior to accessing the server is it necessary to authenticate +using the password anoncvs. This can be accomplished with +the cvs login command: +

+
+  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs login
 

- It can also be browsed at + Once authenticated, a checkout can be obtained using

+  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs co libvirt-java
+
+

+

Building

+

The code is built using ant, and assumes that you have the jna jar installed. Once you have downloaded +the code you can build the code with

+
 
-  http://git.et.redhat.com/?p=libvirt-java.git;a=summary
+% cd libvirt-java
+% ant build
 

Content

The bindings are articulated around a few -classes in the org/libvirt namespace, notably the +classes in the org/libvirt package, notably the Connect, Domain and Network ones. Functions in the C API taking virConnectPtr, virDomainPtr or @@ -192,13 +193,13 @@ lower case, for example the C functions:

become

- virConn::numOfDomains() + virConn.numOfDomains()

- virDomain::setMaxMemory(long memory) + virDomain.setMaxMemory(long memory)

There is of course some functions where the mapping is less direct -and using extra classes to map complex arguments. The Javadoc is available online or as +and using extra classes to map complex arguments. The Javadoc is available online or as part of a separate libvirt-java-javadoc package.

So let's look at a simple example inspired from the test.java test found in src in the source tree:

@@ -226,7 +227,7 @@ public class minitest {

There is not much to comment about it, it really is a straight mapping from the C API, the only points to notice are:

- -

Hourly development snapshots

-

Once an hour, an automated snapshot is made from the latest CVS server - source tree. These snapshots should be usable, but we make no guarantees - about their stability:

+

Maven

+

A maven repository is located at http://www.libvirt.org/maven2/ +which you can use to include this in your maven projects.

- +

GIT source repository

+

The Java bindings code source is now maintained in a git repository available on +libvirt.org: +

+
+git clone git://libvirt.org/libvirt-java.git
+
+

+It can also be browsed at +

+
 
-

CVS repository access

+http://libvirt.org/git/?p=libvirt-java.git;a=summary +
-

The master source repository uses CVS and anonymous access -is provided. Prior to accessing the server is it necessary to authenticate -using the password anoncvs. This can be accomplished with -the cvs login command: +

+

GIT repository mirror

+ +

+ The source code is also mirrored on gitorious + to aid in public development. You clone the repo with

-  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs login
+  git clone git://gitorious.org/libvirt/libvirt-java.git
 

- Once authenticated, a checkout can be obtained using + It can also be browsed at

 
-  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs co libvirt-java
+  http://gitorious.org/libvirt/libvirt-java
 
-

-The libvirt-java build process uses GNU autotools, so after obtaining a checkout -it is necessary to generate the configure script and Makefile.in templates -using the autogen.sh command. As an example, to do a complete -build and install it into your home directory run: +

+

CVS repository access (Deprecated)

+ +

The old source repository uses CVS and anonymous access +is provided. Prior to accessing the server is it necessary to authenticate +using the password anoncvs. This can be accomplished with +the cvs login command:

+
-  ./autogen.sh --prefix=$HOME/usr
-  make
-  make install
+  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs login
 
-

Other build system are not currently available but as usual we take patches -(Eclipse/ant/...) would be welcome !

-

currently libvirt-java requires a version of libvirt >= 0.4.0 to be -installed as well as the associated libvirt development files/package. It -should compile with any java implementation >= 1.5, the bindings uses -the enum construct which appeared only in that version.

-

Libvirt-java bindings development occurs on the same mailing-list as -the normal libvirt work see the associated contact -page

- -

GIT repository mirror

- The CVS source repository is also mirrored using GIT, and is available - for anonymous access via: + Once authenticated, a checkout can be obtained using

-
 
-  git clone git://git.et.redhat.com/libvirt-java
+
+  # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs co libvirt-java
 
-

- It can also be browsed at -

+

+

Building

+

The code is built using ant, and assumes that you have the jna jar installed. Once you have downloaded +the code you can build the code with

 
-  http://git.et.redhat.com/?p=libvirt-java.git;a=summary
+% cd libvirt-java
+% ant build
 
+

Content

The bindings are articulated around a few -classes in the org/libvirt namespace, notably the +classes in the org/libvirt package, notably the Connect, Domain and Network ones. Functions in the C API taking virConnectPtr, virDomainPtr or @@ -112,13 +113,13 @@ lower case, for example the C functions:

become

- virConn::numOfDomains() + virConn.numOfDomains()

- virDomain::setMaxMemory(long memory) + virDomain.setMaxMemory(long memory)

There is of course some functions where the mapping is less direct -and using extra classes to map complex arguments. The Javadoc is available online or as +and using extra classes to map complex arguments. The Javadoc is available online or as part of a separate libvirt-java-javadoc package.

So let's look at a simple example inspired from the test.java test found in src in the source tree:

@@ -147,7 +148,7 @@ public class minitest {

There is not much to comment about it, it really is a straight mapping from the C API, the only points to notice are:

    -
  • the import of the modules in the org.libvirt namespace
  • +
  • the import of the modules in the org.libvirt package
  • getting a connection to the hypervisor, in that case using the readonly access to the default test hypervisor.
  • getting an object representing the test domain using lookupByName