[libvirt PATCH 0/2] docs: Link to java.libvirt.org

That's the new canonical location for information on libvirt-java. A server-side redirect will have to be created in order to keep existing external links working. Andrea Bolognani (2): docs: Link to java.libvirt.org docs: Drop java.rst docs/bindings.rst | 3 +- docs/docs.rst | 2 +- docs/java.rst | 127 ---------------------------------------------- docs/meson.build | 1 - 4 files changed, 3 insertions(+), 130 deletions(-) delete mode 100644 docs/java.rst -- 2.40.0

All the information from docs/java.rst have been transferred to the subproject's own website. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/bindings.rst | 3 ++- docs/docs.rst | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/bindings.rst b/docs/bindings.rst index 42006a9c3f..9991012bf9 100644 --- a/docs/bindings.rst +++ b/docs/bindings.rst @@ -12,7 +12,8 @@ other languages: - **Go**: Daniel Berrange develops `Go bindings <https://pkg.go.dev/libvirt.org/go/libvirt>`__. -- **Java**: Daniel Veillard develops `Java bindings <java.html>`__. +- **Java**: Daniel Veillard develops `Java bindings + <https://java.libvirt.org/>`__. - **OCaml**: Richard Jones develops `OCaml bindings <https://ocaml.libvirt.org/>`__. diff --git a/docs/docs.rst b/docs/docs.rst index 6e0a7f842b..f57164b9e3 100644 --- a/docs/docs.rst +++ b/docs/docs.rst @@ -80,7 +80,7 @@ Application development Bindings of the libvirt API for `c# <csharp.html>`__, `go <https://pkg.go.dev/libvirt.org/go/libvirt>`__ (`all go modules <golang.html>`__), - `java <java.html>`__, + `java <https://java.libvirt.org/>`__, `ocaml <https://ocaml.libvirt.org/>`__, `perl <https://search.cpan.org/dist/Sys-Virt/>`__, `python <python.html>`__, -- 2.40.0

We no longer link to it from anywhere. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/java.rst | 127 ----------------------------------------------- docs/meson.build | 1 - 2 files changed, 128 deletions(-) delete mode 100644 docs/java.rst diff --git a/docs/java.rst b/docs/java.rst deleted file mode 100644 index c817601079..0000000000 --- a/docs/java.rst +++ /dev/null @@ -1,127 +0,0 @@ -================= -Java API bindings -================= - -.. contents:: - -Presentation ------------- - -The Java bindings make use of `JNA <https://jna.dev.java.net/>`__ to expose the -C API in a Java friendly way. The bindings are based on work initiated by Toth -Istvan. - -Getting it ----------- - -The latest versions of the libvirt Java bindings can be downloaded from: - -- `libvirt.org HTTP server <https://download.libvirt.org/java/>`__ - -A maven repository is located at https://download.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 <https://git-scm.com/>`__ repository available on -`gitlab.com <https://gitlab.com/libvirt/libvirt-java/>`__: - -:: - - git clone https://gitlab.com/libvirt/libvirt-java.git - -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 - -:: - - - % cd libvirt-java - % ant build - -Content -------- - -The bindings are articulated around a few classes in the ``org/libvirt`` -package, notably the ``Connect``, ``Domain`` and ``Network`` ones. Functions in -the `C API <html/index.html>`__ taking ``virConnectPtr``, ``virDomainPtr`` or -``virNetworkPtr`` as their first argument usually become methods for the -classes, their name is just stripped from the virConnect or virDomain(Get) -prefix and the first letter gets converted to lower case, for example the C -functions: - -``int virConnectNumOfDomains (virConnectPtr conn);`` - -``int virDomainSetMaxMemory (virDomainPtr domain, unsigned long memory);`` - -become - -``virConn.numOfDomains()`` - -``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 <https://java.libvirt.org/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: - -:: - - import org.libvirt.*; - public class minitest { - public static void main(String[] args) { - Connect conn=null; - try{ - conn = new Connect("test:///default", true); - } catch (LibvirtException e) { - System.out.println("exception caught:"+e); - System.out.println(e.getError()); - } - try{ - Domain testDomain=conn.domainLookupByName("test"); - System.out.println("Domain:" + testDomain.getName() + " id " + - testDomain.getID() + " running " + - testDomain.getOSType()); - } catch (LibvirtException e) { - System.out.println("exception caught:"+e); - System.out.println(e.getError()); - } - } - } - -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`` 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`` -- if the domain is not found a LibvirtError exception will be raised -- extracting and printing some information about the domain using various - methods associated to the Domain class. - -Maven ------ - -Up until version 0.4.7 the Java bindings were available from the central maven -repository. - -If you want to use 0.4.8 or higher, please add the following repository to your -pom.xml - -:: - - <repositories> - <repository> - <id>libvirt-org</id> - <url>https://download.libvirt.org/maven2</url> - </repository> - </repositories> diff --git a/docs/meson.build b/docs/meson.build index 4945340a1e..68359be0b4 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -85,7 +85,6 @@ docs_rst_files = [ 'hacking', 'hooks', 'issue-handling', - 'java', 'libvirt-go', 'libvirt-go-xml', 'logging', -- 2.40.0

On Thu, Apr 27, 2023 at 09:51:21 +0200, Andrea Bolognani wrote:
That's the new canonical location for information on libvirt-java.
A server-side redirect will have to be created in order to keep existing external links working.
Once this is done: Reviewed-by: Peter Krempa <pkrempa@redhat.com>

On Thu, Apr 27, 2023 at 09:56:06AM +0200, Peter Krempa wrote:
On Thu, Apr 27, 2023 at 09:51:21 +0200, Andrea Bolognani wrote:
That's the new canonical location for information on libvirt-java.
A server-side redirect will have to be created in order to keep existing external links working.
Once this is done:
It is done. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Thu, Apr 27, 2023 at 09:12:22AM +0100, Daniel P. Berrangé wrote:
On Thu, Apr 27, 2023 at 09:56:06AM +0200, Peter Krempa wrote:
On Thu, Apr 27, 2023 at 09:51:21 +0200, Andrea Bolognani wrote:
That's the new canonical location for information on libvirt-java.
A server-side redirect will have to be created in order to keep existing external links working.
Once this is done:
It is done.
Thanks to both of you. Pushed now. -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Daniel P. Berrangé
-
Peter Krempa