On Sat, Jul 25, 2009 at 08:02:09AM -0400, Bryan Kearney wrote: > --- > README | 12 ++-- > src/org/libvirt/Connect.java | 102 ++++++++++++++++++++++++++++---------- > src/org/libvirt/Network.java | 65 +++++++++++------------- > src/org/libvirt/jna/Libvirt.java | 23 ++++++++- > src/test.java | 58 +++++++++++---------- > 5 files changed, 164 insertions(+), 96 deletions(-) > > diff --git a/README b/README > index 4fd68be..655090f 100644 > --- a/README > +++ b/README > @@ -4,7 +4,7 @@ To use it, your program needs to access both the java library (.jar file), > and the JNI library (.so file) > > 1. You must have the libvirt.jar file in your classpath. > -By default the installs it to /usr/share/java/libvirt-0.2.1.jar > +By default the installs it to /usr/local/share/java/libvirt-0.2.1.jar > > 2. You must have the libvirt_jni.so accessible by the dynamic linker. > By default the RPM installs it to /usr/lib or /usr/lib64, so the linker will > @@ -13,16 +13,16 @@ the LD_LIBRARY_PATH variable to the directory containing the libvirt_jni.so > file. > > There is a rudimentary functional test program that the libvirt-java-devel > -installs put it into /usr/share/doc/libvirt-java-devel-0.2.1/test.java > +installs put it into /usr/local/share/doc/libvirt-java-devel-0.2.1/test.java > > To run it, first copy the test.java file to writeable directory > -cp /usr/share/doc/libvirt-java-devel-0.2.1/test.java ~ > +cp /usr/local/share/doc/libvirt-java-devel-0.2.1/test.java ~ > > Compile the java file to a class: > -javac -classpath /usr/share/java/libvirt-0.2.1.jar test.java > +javac -classpath /usr/local/share/java/libvirt-0.2.1.jar test.java > > Then run the program: > -java -classpath .:/usr/share/java/libvirt-0.2.1.jar test > +java -classpath .:/usr/local/share/java/libvirt-0.2.1.jar test > > -There is full javadoc for the API in /usr/share/javadoc/libvirt-java-0.2.1/ > +There is full javadoc for the API in /usr/local/share/javadoc/libvirt-java-0.2.1/ Hum, I disagree, someone with the package installed by rpm should have this in /usr not /usr/local , I would prefer to not change the doc, as this should be the default. > diff --git a/src/org/libvirt/Connect.java b/src/org/libvirt/Connect.java > index bc560d0..b559b52 100644 > --- a/src/org/libvirt/Connect.java > +++ b/src/org/libvirt/Connect.java looks rather simple. Maybe we should have dropped looking by UUID in array form and stick only to UUID strings for Java APIs, but it's done now. > diff --git a/src/org/libvirt/Network.java b/src/org/libvirt/Network.java > index a194ca7..063345c 100644 > --- a/src/org/libvirt/Network.java > +++ b/src/org/libvirt/Network.java > @@ -3,6 +3,8 @@ package org.libvirt; > import org.libvirt.jna.Libvirt; > + return autoStart.getValue() != 0 ? true : false ; is that that much better than C code ;-) ? Can we parenthesize this ? but overall the code is fine > diff --git a/src/org/libvirt/jna/Libvirt.java b/src/org/libvirt/jna/Libvirt.java > index 1874d3e..30ab49d 100644 > --- a/src/org/libvirt/jna/Libvirt.java > +++ b/src/org/libvirt/jna/Libvirt.java > @@ -6,6 +6,7 @@ import com.sun.jna.Library ; > import com.sun.jna.Native; > import com.sun.jna.Pointer; > import com.sun.jna.Structure.ByReference; > +import com.sun.jna.ptr.IntByReference; > import com.sun.jna.ptr.LongByReference; > import com.sun.jna.ptr.PointerByReference; > > @@ -13,6 +14,10 @@ public interface Libvirt extends Library > { > Libvirt INSTANCE = (Libvirt) Native.loadLibrary("libvirt", Libvirt.class) ; > > + // Constants we need > + public static int VIR_UUID_BUFLEN = 16 ; > + public static int VIR_UUID_STRING_BUFLEN = (36+1) ; > + > //Callbacks > interface virErrorFunc extends Callback { > void handleError(Pointer userData, virError error) throws Exception ; > @@ -50,17 +55,31 @@ public interface Libvirt extends Library > public int virNodeGetInfo(Pointer virConnectPtr, virNodeInfo virNodeInfo) ; > > // Network functions > + public int virNetworkCreate(Pointer virConnectPtr) ; > public Pointer virNetworkCreateXML(Pointer virConnectPtr, String xmlDesc) ; > public Pointer virNetworkDefineXML(Pointer virConnectPtr, String xmlDesc) ; > - public String virNetworkGetName(Pointer virNetorkPtr) ; > + public int virNetworkDestroy(Pointer virConnectPtr) ; > + public int virNetworkFree(Pointer virConnectPtr) ; > + public int virNetworkGetAutostart(Pointer virNetworkPtr, IntByReference value) ; > + public String virNetworkGetBridgeName(Pointer virNetworkPtr) ; > + public String virNetworkGetName(Pointer virNetworkPtr) ; > + public int virNetworkGetUUID(Pointer virNetworkPtr, byte[] uuidString) ; > + public int virNetworkGetUUIDString(Pointer virNetworkPtr, byte[] uuidString) ; > + public String virNetworkGetXMLDesc(Pointer virNetworkPtr, int flags) ; > public Pointer virNetworkLookupByName(Pointer virConnectPtr, String name) ; > public Pointer virNetworkLookupByUUIDString(Pointer virConnectPtr, String uuidstr) ; > - public Pointer virNetworkLookupByUUID(Pointer virConnectPtr, String uuidstr) ; > + public Pointer virNetworkLookupByUUID(Pointer virConnectPtr, String uuidstr) ; > + public int virNetworkSetAutostart(Pointer virConnectPtr, int autoStart) ; > + public int virNetworkUndefine(Pointer virConnectPtr) ; > > // Domain functions > public Pointer virDomainCreateLinux(Pointer virConnectPtr, String xmlDesc, int flags) ; > public Pointer virDomainCreateXML(Pointer virConnectPtr, String xmlDesc, int flags) ; > public Pointer virDomainDefineXML(Pointer virConnectPtr, String xmlDesc) ; > + public Pointer virDomainLookupByID(Pointer virConnectPtr, int id) ; > + public Pointer virDomainLookupByName(Pointer virConnectPtr, String name) ; > + public Pointer virDomainLookupByUUID(Pointer virConnectPtr, String uuidstr) ; > public Pointer virDomainLookupByUUIDString(Pointer virConnectPtr, String uuidstr) ; > + > > } nice ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list