[libvirt] [PATCH] Initial work on the JNA port, still a work in progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/org/libvirt/Connect.java         |  336 +++++++++++++++++++---------------
 src/org/libvirt/Domain.java          |  183 +++++++++++--------
 src/org/libvirt/Error.java           |   21 ++
 src/org/libvirt/ErrorHandler.java    |   22 +++
 src/org/libvirt/Network.java         |   74 +++++---
 src/org/libvirt/NodeInfo.java        |   16 ++
 src/org/libvirt/jna/Libvirt.java     |   66 +++++++
 src/org/libvirt/jna/virError.java    |   19 ++
 src/org/libvirt/jna/virNodeInfo.java |   19 ++
 src/test.java                        |  237 ++++++++++++------------
 10 files changed, 630 insertions(+), 363 deletions(-)
 create mode 100644 src/org/libvirt/ErrorHandler.java
 create mode 100644 src/org/libvirt/jna/Libvirt.java
 create mode 100644 src/org/libvirt/jna/virError.java
 create mode 100644 src/org/libvirt/jna/virNodeInfo.java

diff --git a/src/org/libvirt/Connect.java b/src/org/libvirt/Connect.java
index 4271937..bc560d0 100644
--- a/src/org/libvirt/Connect.java
+++ b/src/org/libvirt/Connect.java
@@ -3,6 +3,14 @@ package org.libvirt;
 import org.libvirt.LibvirtException;
 import org.libvirt.StoragePool;
 import org.libvirt.StorageVol;
+import org.libvirt.jna.Libvirt;
+import org.libvirt.jna.virError;
+import org.libvirt.jna.virNodeInfo;
+
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+import com.sun.jna.ptr.ByReference;
+import com.sun.jna.ptr.LongByReference;
 
 /**
  * The Connect object represents a connection to a local or remote hypervisor/driver.
@@ -14,17 +22,20 @@ public class Connect {
 
 	// Load the native part
 	static {
-		System.loadLibrary("virt_jni");
-		_virInitialize();
+		Libvirt.INSTANCE.virInitialize() ;
+		Libvirt.INSTANCE.virSetErrorFunc(0, ErrorHandler.INSTANCE) ;
 	}
 
-
 	/**
 	 * the native virConnectPtr.
 	 */
-	long VCP;
+	protected Pointer VCP;
 
-	private static native int _virInitialize();
+
+	/**
+	 * The libvirt library
+	 */
+	Libvirt libvirt = Libvirt.INSTANCE ;
 
 	/**
 	 * Construct a Connect object from a known native virConnectPtr
@@ -32,8 +43,9 @@ public class Connect {
 	 *
 	 * @param VCP	the virConnectPtr pointing to an existing native virConnect structure
 	 */
+	@Deprecated
 	Connect(long VCP) {
-		this.VCP = VCP;
+	    throw new RuntimeException("No longer supported") ;
 	}
 
 	/**
@@ -46,10 +58,13 @@ public class Connect {
 	 */
 	public Connect(String uri, boolean readOnly) throws LibvirtException {
 		if (readOnly) {
-			VCP = _openReadOnly(uri);
+			VCP = libvirt.virConnectOpenReadOnly(uri) ;
 		} else {
-			VCP = _open(uri);
+            VCP = libvirt.virConnectOpen(uri) ;
 		}
+		// Check for an error		
+//        processError(libvirt.virGetLastError()) ;
+        libvirt.virConnSetErrorFunc(VCP,0,ErrorHandler.INSTANCE) ;		
 	}
 
 	/**
@@ -63,7 +78,8 @@ public class Connect {
 	 * @see <a href="http://libvirt.org/uri.html";>The URI documentation</a>
 	 */
 	public Connect(String uri, ConnectAuth auth, int flags) throws LibvirtException {
-		VCP = _openAuth(uri, auth, flags);
+        throw new RuntimeException("Not Implemented") ;      
+//		VCP = _openAuth(uri, auth, flags);
 	}
 
 	/**
@@ -74,7 +90,7 @@ public class Connect {
 	 * @see <a href="http://libvirt.org/uri.html";>The URI documentation</a>
 	 */
 	public Connect(String uri) throws LibvirtException {
-		VCP = _open(uri);
+        VCP = libvirt.virConnectOpen(uri) ;
 	}
 
 	public void finalize() throws LibvirtException {
@@ -88,15 +104,13 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public void close() throws LibvirtException {
-		_close(VCP);
+	    libvirt.virConnectClose(VCP) ;
 		// If leave an invalid pointer dangling around JVM crashes and burns if
 		// someone tries to call a method on us
 		// We rely on the underlying libvirt error handling to detect that it's called with a null virConnectPointer
-		VCP = 0;
+		VCP = null;
 	}
 
-	private native int _close(long VCP) throws LibvirtException;
-
 
 	/**
 	 * Provides capabilities of the hypervisor / driver.
@@ -107,11 +121,9 @@ public class Connect {
 	 *
 	 */
 	public String getCapabilities() throws LibvirtException {
-		return _getCapabilities(VCP);
+	    return libvirt.virConnectGetCapabilities(VCP) ;
 	}
 
-	private native String _getCapabilities(long VCP) throws LibvirtException;
-
 
 	/**
 	 * Returns the system hostname on which the hypervisor is running.
@@ -122,11 +134,11 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String getHostName() throws LibvirtException {
-		return _getHostName(VCP);
+		String returnValue = libvirt.virConnectGetHostname(VCP) ;
+        return returnValue ;
+		
 	}
 
-	private native String _getHostName(long VCP) throws LibvirtException;
-
 
 	/**
 	 * Provides the maximum number of virtual CPUs supported for a guest VM of a specific type.
@@ -137,12 +149,9 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int getMaxVcpus(String type) throws LibvirtException {
-		return _getMaxVcpus(VCP, type);
+		return libvirt.virConnectGetMaxVcpus(VCP, type) ;
 	}
 
-	private native int _getMaxVcpus(long VCP, String type)
-	throws LibvirtException;
-
 
 	/**
 	 * Gets the name of the Hypervisor software used.
@@ -151,11 +160,10 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String getType() throws LibvirtException {
-		return _getType(VCP);
+		return libvirt.virConnectGetType(VCP) ;
 	}
 
-	private native String _getType(long VCP) throws LibvirtException;
-
+	
 
 	/**
 	 * Returns the URI (name) of the hypervisor connection.
@@ -166,10 +174,9 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String getURI() throws LibvirtException {
-		return _getURI(VCP);
+		return libvirt.virConnectGetURI(VCP) ;
 	}
 
-	private native String _getURI(long VCP) throws LibvirtException;
 
 
 	/**
@@ -181,24 +188,25 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public long getVersion() throws LibvirtException {
-		return _getVersion(VCP);
+	    LongByReference hvVer = new LongByReference() ;
+		libvirt.virConnectGetVersion(VCP, hvVer) ;
+		return hvVer.getValue();
 	}
 
-	private native long _getVersion(long VCP) throws LibvirtException;
-
 
 	/**
 	 * Gets the version of the native libvirt library that the JNI part is linked to.
 	 *
-//	 * @return major * 1,000,000 + minor * 1,000 + release
+	 * @return major * 1,000,000 + minor * 1,000 + release
 	 * @throws LibvirtException
 	 */
 	public long getLibVirVersion() throws LibvirtException {
-		return _virGetLibVirVersion();
+        LongByReference libVer = new LongByReference() ;
+        LongByReference typeVer = new LongByReference() ;        
+        libvirt.virGetVersion(libVer, null, typeVer) ;
+        return libVer.getValue();	    
 	}
 
-	private native long _virGetLibVirVersion() throws LibvirtException;
-
 
 	/**
 	 * Returns the version of the hypervisor against which the library was compiled.
@@ -209,12 +217,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public long GetHypervisorVersion(String type) throws LibvirtException {
-		return _virGetHypervisorVersion(type);
+        LongByReference libVer = new LongByReference() ;
+        LongByReference typeVer = new LongByReference() ;        
+        libvirt.virGetVersion(libVer, type, typeVer) ;
+        return libVer.getValue();       
 	}
 
-	private native long _virGetHypervisorVersion(String type)
-	throws LibvirtException;
-
 
 	/**
 	 * Lists the names of the defined but inactive domains
@@ -223,12 +231,14 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String[] listDefinedDomains() throws LibvirtException {
-		return _listDefinedDomains(VCP);
+	    int maxnames = this.numOfDefinedDomains() ;
+	    String[] names = new String[maxnames] ;
+        if (maxnames > 0) {	    
+            libvirt.virConnectListDefinedDomains(VCP, names, maxnames) ;
+        }
+	    return names ;
 	}
 
-	private native String[] _listDefinedDomains(long VCP)
-	throws LibvirtException;
-
 
 	/**
 	 * Lists the inactive networks
@@ -237,12 +247,15 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String[] listDefinedNetworks() throws LibvirtException {
-		return _listDefinedNetworks(VCP);
+        int maxnames = this.numOfDefinedNetworks() ;
+        String[] names = new String[maxnames] ;
+        
+        if (maxnames > 0) {
+            libvirt.virConnectListDefinedNetworks(VCP, names, maxnames) ;
+        }
+        return names ;
 	}
 
-	private native String[] _listDefinedNetworks(long VCP)
-	throws LibvirtException;
-
 
 	/**
 	 * Lists the active domains.
@@ -251,10 +264,15 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int[] listDomains() throws LibvirtException {
-		return _listDomains(VCP);
+        int maxids = this.numOfDomains() ;
+        int[] ids = new int[maxids] ;
+        
+        if (maxids > 0) {
+            libvirt.virConnectListDomains(VCP, ids, maxids) ;
+        }
+        return ids ;
 	}
 
-	private native int[] _listDomains(long VCP) throws LibvirtException;
 
 	/**
 	 * Lists the active networks.
@@ -263,11 +281,15 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String[] listNetworks() throws LibvirtException {
-		return _listNetworks(VCP);
+        int maxnames = this.numOfNetworks() ;
+        String[] names = new String[maxnames] ;
+        
+        if (maxnames > 0) {
+            libvirt.virConnectListNetworks(VCP, names, maxnames) ;
+        }
+        return names ;
 	}
 
-	private native String[] _listNetworks(long VCP) throws LibvirtException;
-
 
 	/**
 	 * Provides the number of inactive domains.
@@ -276,10 +298,9 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int numOfDefinedDomains() throws LibvirtException {
-		return _numOfDefinedDomains(VCP);
+	    return libvirt.virConnectNumOfDefinedDomains(VCP) ;
 	}
 
-	private native int _numOfDefinedDomains(long VCP) throws LibvirtException;
 
 
 	/**
@@ -289,11 +310,10 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int numOfDefinedNetworks() throws LibvirtException {
-		return _numOfDefinedNetworks(VCP);
+        return libvirt.virConnectNumOfDefinedNetworks(VCP) ;
 	}
 
-	private native int _numOfDefinedNetworks(long VCP) throws LibvirtException;
-
+	
 	/**
 	 * Provides the number of active domains.
 	 *
@@ -301,11 +321,9 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int numOfDomains() throws LibvirtException {
-		return _numOfDomains(VCP);
+        return libvirt.virConnectNumOfDomains(VCP) ;
 	}
 
-	private native int _numOfDomains(long VCP) throws LibvirtException;
-
 
 	/**
 	 * Provides the number of active networks.
@@ -314,19 +332,9 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int numOfNetworks() throws LibvirtException {
-		return _numOfNetworks(VCP);
+        return libvirt.virConnectNumOfNetworks(VCP) ;
 	}
 
-	private native int _numOfNetworks(long VCP) throws LibvirtException;
-
-	// open
-	private native long _open(String uri) throws LibvirtException;
-
-	// openReadOnly
-	private native long _openReadOnly(String uri) throws LibvirtException;
-
-	// openAuth
-	private native long _openAuth(String uri, ConnectAuth auth, int flags) throws LibvirtException;
 
 	// virNetwork stuff
 
@@ -339,12 +347,9 @@ public class Connect {
 	 */
 	public Network networkLookupByName(String name)
 	throws LibvirtException {
-		return new Network(this, _virNetworkLookupByName(VCP, name));
+		return new Network(this, libvirt.virNetworkLookupByName(VCP, name));
 	}
 
-	private native long _virNetworkLookupByName(long VCP, String name)
-	throws LibvirtException;
-
 
 	/**
 	 * Looks up a network based on its UUID represented as an int array.
@@ -356,11 +361,14 @@ public class Connect {
 	 */
 	public Network networkLookupByUUID(int[] UUID)
 	throws LibvirtException {
-		return new Network(this, _virNetworkLookupByUUID(VCP, UUID));
+	    StringBuilder uuidString = new StringBuilder() ;
+	    for (int i : UUID) {
+	        uuidString.append(i) ;
+	    }
+		return new Network(this, libvirt.virNetworkLookupByUUID(VCP, uuidString.toString()));
 	}
 
-	private native long _virNetworkLookupByUUID(long VCP, int[] UUID);
-
+	
 	/**
 	 * Looks up a network based on its UUID represented as a String.
 	 *
@@ -370,11 +378,11 @@ public class Connect {
 	 */
 	public Network networkLookupByUUIDString(String UUID)
 	throws LibvirtException {
-		return new Network(this, _virNetworkLookupByUUIDString(VCP, UUID));
+        return new Network(this, libvirt.virNetworkLookupByUUIDString(VCP, UUID));
 	}
 
-	private native long _virNetworkLookupByUUIDString(long VCP, String UUID)
-	throws LibvirtException;
+//	private native long _virNetworkLookupByUUIDString(long VCP, String UUID)
+//	throws LibvirtException;
 
 
 	/**
@@ -388,12 +396,9 @@ public class Connect {
 	 */
 	public Network networkCreateXML(String xmlDesc)
 	throws LibvirtException {
-		return new Network(this, _virNetworkCreateXML(VCP, xmlDesc));
+		return new Network(this, libvirt.virNetworkCreateXML(VCP, xmlDesc));
 	}
 
-	private native long _virNetworkCreateXML(long VCP, String xmlDesc)
-	throws LibvirtException;
-
 
 	/**
 	 * Defines a network, but does not create it.
@@ -406,12 +411,10 @@ public class Connect {
 	 */
 	public Network networkDefineXML(String xmlDesc)
 	throws LibvirtException {
-		return new Network(this, _virNetworkDefineXML(VCP, xmlDesc));
+        return new Network(this, libvirt.virNetworkDefineXML(VCP, xmlDesc));
 	}
 
-	private native long _virNetworkDefineXML(long VCP, String xmlDesc)
-	throws LibvirtException;
-
+	
 	/**
 	 * Finds a domain based on the hypervisor ID number.
 	 *
@@ -420,11 +423,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public Domain domainLookupByID(int id) throws LibvirtException {
-		return new Domain(this, _virDomainLookupByID(VCP, id));
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new Domain(this, _virDomainLookupByID(VCP, id));
 	}
 
-	private native long _virDomainLookupByID(long VCP, int id)
-	throws LibvirtException;
+//	private native long _virDomainLookupByID(long VCP, int id)
+//	throws LibvirtException;
 
 	/**
 	 * Looks up a domain based on its name.
@@ -434,11 +438,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public Domain domainLookupByName(String name) throws LibvirtException {
-		return new Domain(this, _virDomainLookupByName(VCP, name));
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new Domain(this, _virDomainLookupByName(VCP, name));
 	}
 
-	private native long _virDomainLookupByName(long VCP, String name)
-	throws LibvirtException;
+//	private native long _virDomainLookupByName(long VCP, String name)
+//	throws LibvirtException;
 
 
 	/**
@@ -450,11 +455,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public Domain domainLookupByUUID(int[] UUID) throws LibvirtException {
-		return new Domain(this, _virDomainLookupByUUID(VCP, UUID));
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new Domain(this, _virDomainLookupByUUID(VCP, UUID));
 	}
 
-	private native long _virDomainLookupByUUID(long VCP, int[] UUID)
-	throws LibvirtException;
+//	private native long _virDomainLookupByUUID(long VCP, int[] UUID)
+//	throws LibvirtException;
 
 	/**
 	 * Looks up a domain  based on its UUID in String form.
@@ -465,11 +471,9 @@ public class Connect {
 	 */
 	public Domain domainLookupByUUIDString(String UUID)
 	throws LibvirtException {
-		return new Domain(this, _virDomainLookupByUUIDString(VCP, UUID));
+		return new Domain(this, libvirt.virDomainLookupByUUIDString(VCP, UUID));
 	}
 
-	private native long _virDomainLookupByUUIDString(long VCP, String UUID)
-	throws LibvirtException;
 
 	/**
 	 * Launches a new Linux guest domain.
@@ -484,11 +488,9 @@ public class Connect {
 	 */
 	public Domain domainCreateLinux(String xmlDesc, int flags)
 	throws LibvirtException {
-		return new Domain(this, _virDomainCreateLinux(VCP, xmlDesc, flags));
+        return new Domain(this, libvirt.virDomainCreateLinux(VCP, xmlDesc, flags));
 	}
 
-	private native long _virDomainCreateLinux(long VCP, String xmlDesc,
-			int flags) throws LibvirtException;
 
 	/**
 	 * Defines a domain, but does not start it
@@ -499,11 +501,21 @@ public class Connect {
 	 * @see <a href="http://libvirt.org/format.html#Normal1"; > The XML format description </a>
 	 */
 	public Domain domainDefineXML(String xmlDesc) throws LibvirtException {
-		return new Domain(this, _virDomainDefineXML(VCP, xmlDesc));
+        return new Domain(this, libvirt.virDomainDefineXML(VCP, xmlDesc));
 	}
-
-	private native long _virDomainDefineXML(long VCP, String xmlDesc)
-	throws LibvirtException;
+	
+	
+    /**
+     * Launch a new guest domain, based on an XML description
+     *
+     * @param xmlDesc
+     * @return the Domain object
+     * @throws LibvirtException
+     * @see <a href="http://libvirt.org/format.html#Normal1"; > The XML format description </a>
+     */
+    public Domain domainCreateXML(String xmlDesc, int flags) throws LibvirtException {
+        return new Domain(this, libvirt.virDomainCreateXML(VCP, xmlDesc, flags));
+    }	
 
 
 	/**
@@ -513,11 +525,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public void restore(String from) throws LibvirtException {
-		_virDomainRestore(VCP, from);
+	    throw new RuntimeException("Not Implemented") ;
+//		_virDomainRestore(VCP, from);
 	}
 
-	private native int _virDomainRestore(long VCP, String from)
-	throws LibvirtException;
+//	private native int _virDomainRestore(long VCP, String from)
+//	throws LibvirtException;
 
 	/**
 	 * Returns a NodeInfo object describing the hardware configuration of the node.
@@ -526,11 +539,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public NodeInfo nodeInfo() throws LibvirtException {
-		return _virNodeInfo(VCP);
+	    virNodeInfo vInfo = new virNodeInfo();
+	    libvirt.virNodeGetInfo(VCP,vInfo) ;
+	    return new NodeInfo(vInfo) ;
 	}
 
-	private native NodeInfo _virNodeInfo(long VCP) throws LibvirtException;
-
+	
 	/**
 	 * change the amount of memory reserved to Domain0.
 	 * Domain0 is the domain where the application runs.
@@ -540,10 +554,11 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public void setDom0Memory(long memory) throws LibvirtException {
-		_setDom0Memory(memory);
+	    throw new RuntimeException("Not Implemented") ;
+//		_setDom0Memory(memory);
 	}
 
-	private native int _setDom0Memory(long memory) throws LibvirtException;
+//	private native int _setDom0Memory(long memory) throws LibvirtException;
 
 	/**
 	 * Provides the number of inactive storage pools
@@ -552,10 +567,11 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int numOfDefinedStoragePools() throws LibvirtException {
-		return _numOfDefinedStoragePools(VCP);
+	    throw new RuntimeException("Not Implemented") ;
+//		return _numOfDefinedStoragePools(VCP);
 	}
 
-	private native int _numOfDefinedStoragePools(long VCP) throws LibvirtException;
+//	private native int _numOfDefinedStoragePools(long VCP) throws LibvirtException;
 
 	/**
 	 * Provides the number of active storage pools
@@ -564,10 +580,11 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public int numOfStoragePools() throws LibvirtException {
-		return _numOfStoragePools(VCP);
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return _numOfStoragePools(VCP);
 	}
 
-	private native int _numOfStoragePools(long VCP) throws LibvirtException;
+//	private native int _numOfStoragePools(long VCP) throws LibvirtException;
 
 	/**
 	 * Provides the list of names of inactive storage pools.
@@ -576,11 +593,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String[] listDefinedStoragePools() throws LibvirtException {
-		return _listDefinedStoragePools(VCP);
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return _listDefinedStoragePools(VCP);
 	}
 
-	private native String[] _listDefinedStoragePools(long VCP)
-	throws LibvirtException;
+//	private native String[] _listDefinedStoragePools(long VCP)
+//	throws LibvirtException;
 
 	/**
 	 * Provides the list of names of active storage pools.
@@ -589,11 +607,12 @@ public class Connect {
 	 * @throws LibvirtException
 	 */
 	public String[] listStoragePools() throws LibvirtException {
-		return _listStoragePools(VCP);
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return _listStoragePools(VCP);
 	}
 
-	private native String[] _listStoragePools(long VCP)
-	throws LibvirtException;
+//	private native String[] _listStoragePools(long VCP)
+//	throws LibvirtException;
 
 	/**
 	 * Create a new storage based on its XML description.
@@ -606,11 +625,12 @@ public class Connect {
 	 */
 	public StoragePool storagePoolCreateXML(String xmlDesc, int flags)
 	throws LibvirtException {
-		return new StoragePool(this, _virStoragePoolCreateXML(VCP, xmlDesc, flags));
+	    throw new RuntimeException("Not Implemented") ;
+//		return new StoragePool(this, _virStoragePoolCreateXML(VCP, xmlDesc, flags));
 	}
 
-	private native long _virStoragePoolCreateXML(long VCP, String xmlDesc, int flags)
-	throws LibvirtException;
+//	private native long _virStoragePoolCreateXML(long VCP, String xmlDesc, int flags)
+//	throws LibvirtException;
 
 	/**
 	 * Define a new inactive storage pool based on its XML description.
@@ -623,11 +643,12 @@ public class Connect {
 	 */
 	public StoragePool storagePoolDefineXML(String xml, int flags)
 	throws LibvirtException {
-		return new StoragePool(this, _virStoragePoolDefineXML(VCP, xml, flags));
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new StoragePool(this, _virStoragePoolDefineXML(VCP, xml, flags));
 	}
 
-	private native long _virStoragePoolDefineXML(long VCP, String xml, int flags)
-	throws LibvirtException;
+//	private native long _virStoragePoolDefineXML(long VCP, String xml, int flags)
+//	throws LibvirtException;
 
 	/**
 	 * Fetch a storage pool based on its unique name
@@ -638,11 +659,12 @@ public class Connect {
 	 */
 	public StoragePool storagePoolLookupByName(String name)
 	throws LibvirtException {
-		return new StoragePool(this, _virStoragePoolLookupByName(VCP, name));
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new StoragePool(this, _virStoragePoolLookupByName(VCP, name));
 	}
 
-	private native long _virStoragePoolLookupByName(long VCP, String name)
-	throws LibvirtException;
+//	private native long _virStoragePoolLookupByName(long VCP, String name)
+//	throws LibvirtException;
 
 	/**
 	 * Fetch a storage pool based on its globally unique id
@@ -653,10 +675,11 @@ public class Connect {
 	 */
 	public StoragePool storagePoolLookupByUUID(int[] UUID)
 	throws LibvirtException {
-		return new StoragePool(this, _virStoragePoolLookupByUUID(VCP, UUID));
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new StoragePool(this, _virStoragePoolLookupByUUID(VCP, UUID));
 	}
 
-	private native long _virStoragePoolLookupByUUID(long VCP, int[] UUID);
+//	private native long _virStoragePoolLookupByUUID(long VCP, int[] UUID);
 
 	/**
 	 * Fetch a storage pool based on its globally unique id
@@ -667,11 +690,12 @@ public class Connect {
 	 */
 	public StoragePool storagePoolLookupByUUIDString(String UUID)
 	throws LibvirtException {
-		return new StoragePool(this, _virStoragePoolLookupByUUIDString(VCP, UUID));
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new StoragePool(this, _virStoragePoolLookupByUUIDString(VCP, UUID));
 	}
 
-	private native long _virStoragePoolLookupByUUIDString(long VCP, String UUID)
-	throws LibvirtException;
+//	private native long _virStoragePoolLookupByUUIDString(long VCP, String UUID)
+//	throws LibvirtException;
 
 	/**
 	 * Fetch a a storage volume based on its globally unique key
@@ -680,10 +704,11 @@ public class Connect {
 	 * @return a storage volume
 	 */
 	public StorageVol storageVolLookupByKey(String key){
-		return new StorageVol(this, _virStorageVolLookupByKey(VCP, key));
+	    throw new RuntimeException("Not Implemented") ;
+//		return new StorageVol(this, _virStorageVolLookupByKey(VCP, key));
 	}
 
-	private native long _virStorageVolLookupByKey(long VCP, String key);
+//	private native long _virStorageVolLookupByKey(long VCP, String key);
 
 	/**
 	 * Fetch a storage volume based on its locally (host) unique path
@@ -692,10 +717,23 @@ public class Connect {
 	 * @return	a storage volume
 	 */
 	public StorageVol storageVolLookupByPath(String path){
-		return new StorageVol(this, _virStorageVolLookupByPath(VCP, path));
-	}
-
-	private native long _virStorageVolLookupByPath(long VCP, String path);
-
-
+	    throw new RuntimeException("Not Implemented") ;	    
+//		return new StorageVol(this, _virStorageVolLookupByPath(VCP, path));
+	}
+
+//	private native long _virStorageVolLookupByPath(long VCP, String path);
+
+//    @Override
+//    public void handleError(Pointer userData, virError error) throws LibvirtException {
+//        System.out.println("Hello") ;        
+//        this.processError(error) ;
+//    }
+//
+//    protected void processError(virError vError) throws LibvirtException {
+//        System.out.println("Hello") ;
+//        if (vError != null) {
+//            Error error = new Error(vError) ;
+//            throw new LibvirtException(error) ;
+//        }
+//    }
 }
diff --git a/src/org/libvirt/Domain.java b/src/org/libvirt/Domain.java
index 8e7fa74..e9b5d57 100644
--- a/src/org/libvirt/Domain.java
+++ b/src/org/libvirt/Domain.java
@@ -1,5 +1,7 @@
 package org.libvirt;
 
+import com.sun.jna.Pointer;
+
 public class Domain {
 
 	static final class CreateFlags{
@@ -27,7 +29,7 @@ public class Domain {
 	/**
 	 * the native virDomainPtr.
 	 */
-	private long  VDP;
+	private Pointer  VDP;
 
 	/**
 	 * The Connect Object that represents the Hypervisor of this Domain
@@ -42,7 +44,7 @@ public class Domain {
 	 * @param virConnect the Domain's hypervisor
 	 * @param VDP the native virDomainPtr
 	 */
-	Domain(Connect virConnect, long VDP){
+	Domain(Connect virConnect, Pointer VDP){
 		this.virConnect = virConnect;
 		this.VDP = VDP;
 	}
@@ -57,10 +59,11 @@ public class Domain {
 	 * @see <a href="http://libvirt.org/format.html#Normal1"; >The XML Description format </a>
 	 */
 	public String getXMLDesc(int flags) throws LibvirtException{
-		return _getXMLDesc(VDP, flags);
+//		return _getXMLDesc(VDP, flags);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native String _getXMLDesc(long VDP, int flags) throws LibvirtException;
+//	private native String _getXMLDesc(long VDP, int flags) throws LibvirtException;
 
 	/**
 	 * Provides a boolean value indicating whether the network is configured to be automatically started when the host machine boots.
@@ -69,11 +72,12 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public boolean getAutostart() throws LibvirtException{
-		return _getAutostart(VDP);
+//		return _getAutostart(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
 
-	private native boolean _getAutostart(long VDP) throws LibvirtException;
+//	private native boolean _getAutostart(long VDP) throws LibvirtException;
 
 	/**
 	 * Configures the network to be automatically started when the host machine boots.
@@ -82,10 +86,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setAutostart(boolean autostart) throws LibvirtException{
-			_setAutostart(VDP, autostart);
+//			_setAutostart(VDP, autostart);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _setAutostart(long VDP, boolean autostart) throws LibvirtException;
+//	private native int _setAutostart(long VDP, boolean autostart) throws LibvirtException;
 
 	/**
 	 * Provides the connection object associated with a domain.
@@ -103,10 +108,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public int getID() throws LibvirtException{
-		return _getID(VDP);
+//		return _getID(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _getID(long VDP) throws LibvirtException;
+//	private native int _getID(long VDP) throws LibvirtException;
 
 
 	/**
@@ -117,10 +123,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public DomainInfo getInfo() throws LibvirtException{
-		return _getInfo(VDP);
+//		return _getInfo(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native DomainInfo _getInfo(long VDP) throws LibvirtException;
+//	private native DomainInfo _getInfo(long VDP) throws LibvirtException;
 
 	/**
 	 * Retrieve the maximum amount of physical memory allocated to a domain.
@@ -129,10 +136,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public long getMaxMemory() throws LibvirtException{
-		return _getMaxMemory(VDP);
+//		return _getMaxMemory(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native long _getMaxMemory(long VDP) throws LibvirtException;
+//	private native long _getMaxMemory(long VDP) throws LibvirtException;
 
 	/**
 	 * * Dynamically change the maximum amount of physical memory allocated to a domain.
@@ -142,10 +150,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setMaxMemory(long memory) throws LibvirtException{
-		 _setMaxMemory(VDP, memory);
+//		 _setMaxMemory(VDP, memory);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native long _setMaxMemory(long VDP,  long memory) throws LibvirtException;
+//	private native long _setMaxMemory(long VDP,  long memory) throws LibvirtException;
 
 
 	/**
@@ -157,10 +166,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public int getMaxVcpus() throws LibvirtException{
-		return _getMaxVcpus(VDP);
+//		return _getMaxVcpus(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _getMaxVcpus(long VDP) throws LibvirtException;
+//	private native int _getMaxVcpus(long VDP) throws LibvirtException;
 
 
 	/**
@@ -170,10 +180,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public String getName() throws LibvirtException{
-		return _getName(VDP);
+//		return _getName(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native String _getName(long VDP) throws LibvirtException;
+//	private native String _getName(long VDP) throws LibvirtException;
 
 	/**
 	 * Gets the type of domain operation system.
@@ -182,10 +193,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public String getOSType() throws LibvirtException{
-		return _getOSType(VDP);
+//		return _getOSType(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native String _getOSType(long VDP) throws LibvirtException;
+//	private native String _getOSType(long VDP) throws LibvirtException;
 
 
 	/**
@@ -195,10 +207,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public SchedParameter[] getSchedulerParameters() throws LibvirtException{
-		return _getSchedulerParameters(VDP);
+//		return _getSchedulerParameters(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native SchedParameter[] _getSchedulerParameters (long VDP) throws LibvirtException;
+//	private native SchedParameter[] _getSchedulerParameters (long VDP) throws LibvirtException;
 
 	/**
 	 * Changes the scheduler parameters
@@ -207,10 +220,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setSchedulerParameters(SchedParameter[] params) throws LibvirtException{
-		_setSchedulerParameters(VDP, params);
+//		_setSchedulerParameters(VDP, params);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _setSchedulerParameters(long VDP, SchedParameter[] params) throws LibvirtException;
+//	private native int _setSchedulerParameters(long VDP, SchedParameter[] params) throws LibvirtException;
 
 	//getSchedulerType
 	//We don't expose the nparams return value, it's only needed for the SchedulerParameters allocations,
@@ -222,10 +236,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public String[] getSchedulerType() throws LibvirtException{
-		return _getSchedulerType(VDP);
+//		return _getSchedulerType(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native String[] _getSchedulerType(long VDP) throws LibvirtException;
+//	private native String[] _getSchedulerType(long VDP) throws LibvirtException;
 
 	/**
 	 * Get the UUID for this domain.
@@ -235,10 +250,11 @@ public class Domain {
 	 * @see <a href="http://www.ietf.org/rfc/rfc4122.txt";>rfc4122</a>
 	 */
 	public int[] getUUID() throws LibvirtException{
-		return _getUUID(VDP);
+//		return _getUUID(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int[] _getUUID(long VDP) throws LibvirtException;
+//	private native int[] _getUUID(long VDP) throws LibvirtException;
 
 	/**
 	 * Gets the UUID for this domain as string.
@@ -248,10 +264,11 @@ public class Domain {
 	 * @see <a href="http://www.ietf.org/rfc/rfc4122.txt";>rfc4122</a>
 	 */
 	public String getUUIDString() throws LibvirtException{
-		return _getUUIDString(VDP);
+//		return _getUUIDString(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native String _getUUIDString(long VDP) throws LibvirtException;
+//	private native String _getUUIDString(long VDP) throws LibvirtException;
 
 	/**
 	 * Extracts information about virtual CPUs of this domain
@@ -260,10 +277,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public VcpuInfo[] getVcpusInfo() throws LibvirtException{
-		return _getVcpusInfo(VDP);
+//		return _getVcpusInfo(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native VcpuInfo[] _getVcpusInfo(long VDP) throws LibvirtException;
+//	private native VcpuInfo[] _getVcpusInfo(long VDP) throws LibvirtException;
 
 	/**
 	 * Returns the cpumaps for this domain
@@ -273,10 +291,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public int[] getVcpusCpuMaps() throws LibvirtException{
-		return _getVcpusCpuMaps(VDP);
+//		return _getVcpusCpuMaps(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int[] _getVcpusCpuMaps(long VDP) throws LibvirtException;
+//	private native int[] _getVcpusCpuMaps(long VDP) throws LibvirtException;
 
 
 	/**
@@ -288,10 +307,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void pinVcpu(int vcpu, int[] cpumap) throws LibvirtException{
-		_pinVcpu(VDP, vcpu, cpumap);
+//		_pinVcpu(VDP, vcpu, cpumap);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _pinVcpu(long VDP, int vcpu, int[]cpumap) throws LibvirtException;
+//	private native int _pinVcpu(long VDP, int vcpu, int[]cpumap) throws LibvirtException;
 
 	/**
 	 * Dynamically changes the number of virtual CPUs used by this domain.
@@ -302,10 +322,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setVcpus(int nvcpus) throws LibvirtException{
-		_setVcpus(VDP, nvcpus);
+//		_setVcpus(VDP, nvcpus);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _setVcpus(long VDP, int nvcpus) throws LibvirtException;
+//	private native int _setVcpus(long VDP, int nvcpus) throws LibvirtException;
 
 	/**
 	 * Creates a virtual device attachment to backend.
@@ -314,10 +335,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void attachDevice(String xmlDesc) throws LibvirtException{
-		_attachDevice(VDP, xmlDesc);
+//		_attachDevice(VDP, xmlDesc);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _attachDevice(long VDP, String xmlDesc) throws LibvirtException;
+//	private native int _attachDevice(long VDP, String xmlDesc) throws LibvirtException;
 
 	/**
 	 * Destroys a virtual device attachment to backend.
@@ -326,10 +348,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void detachDevice(String xmlDesc) throws LibvirtException{
-		_detachDevice(VDP, xmlDesc);
+//		_detachDevice(VDP, xmlDesc);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _detachDevice(long VDP, String xmlDesc) throws LibvirtException;
+//	private native int _detachDevice(long VDP, String xmlDesc) throws LibvirtException;
 
 
 	/**
@@ -345,10 +368,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public DomainBlockStats blockStats(String path) throws LibvirtException{
-		return _blockStats(VDP, path);
+//		return _blockStats(VDP, path);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native DomainBlockStats _blockStats(long VDP, String path) throws LibvirtException;
+//	private native DomainBlockStats _blockStats(long VDP, String path) throws LibvirtException;
 
 	/**
 	 * Returns network interface stats for interfaces attached to this domain.
@@ -362,10 +386,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public DomainInterfaceStats interfaceStats(String path) throws LibvirtException{
-		return _interfaceStats(VDP, path);
+//		return _interfaceStats(VDP, path);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native DomainInterfaceStats _interfaceStats(long VDP, String path) throws LibvirtException;
+//	private native DomainInterfaceStats _interfaceStats(long VDP, String path) throws LibvirtException;
 
 	/**
 	 * Dumps the core of this domain on a given file for analysis.
@@ -376,10 +401,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void coreDump(String to, int flags) throws LibvirtException{
-		_coreDump(VDP, to, flags);
+//		_coreDump(VDP, to, flags);
+        throw new RuntimeException("Not Implemented") ;		
 	}
 
-	private native int _coreDump(long VDP, String to, int flags) throws LibvirtException;
+//	private native int _coreDump(long VDP, String to, int flags) throws LibvirtException;
 
 	/**
 	 * Launches this defined domain.
@@ -388,10 +414,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void create() throws LibvirtException{
-		_create(VDP);
+//		_create(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _create(long VDP) throws LibvirtException;
+//	private native int _create(long VDP) throws LibvirtException;
 
 	/**
 	 * Destroys this domain object.
@@ -402,10 +429,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void destroy() throws LibvirtException{
-		_destroy(VDP);
+//		_destroy(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _destroy(long VDP) throws LibvirtException;
+//	private native int _destroy(long VDP) throws LibvirtException;
 
 	/**
 	 * Frees this domain object.
@@ -415,11 +443,12 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void free() throws LibvirtException{
-		_free(VDP);
-		VDP=0;
+//		_free(VDP);
+//		VDP=0;
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _free(long VDP) throws LibvirtException;
+//	private native int _free(long VDP) throws LibvirtException;
 
 
 	/**
@@ -449,10 +478,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public Domain migrate(Connect dconn, long flags, String dname, String uri, long bandwidth) throws LibvirtException{
-		return new Domain(dconn, _migrate(VDP, dconn, flags, dname, uri, bandwidth));
+//		return new Domain(dconn, _migrate(VDP, dconn, flags, dname, uri, bandwidth));
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native long _migrate(long VDP, Connect dconn, long flags, String dname, String uri, long bandwidth) throws LibvirtException;
+//	private native long _migrate(long VDP, Connect dconn, long flags, String dname, String uri, long bandwidth) throws LibvirtException;
 
 	/**
 	 * Reboot this domain, the domain object is still usable there after but the domain OS is being stopped for a restart.
@@ -462,10 +492,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void reboot(int flags) throws LibvirtException{
-		_reboot(VDP, flags);
+//		_reboot(VDP, flags);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _reboot(long VDP, int flags) throws LibvirtException;
+//	private native int _reboot(long VDP, int flags) throws LibvirtException;
 
 	/**
 	 * Suspends this active domain, the process is frozen without further access to CPU resources and I/O but the memory used by the domain at the hypervisor level will stay allocated.
@@ -474,10 +505,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void suspend() throws LibvirtException{
-		_suspend(VDP);
+//		_suspend(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _suspend(long VDP) throws LibvirtException;
+//	private native int _suspend(long VDP) throws LibvirtException;
 
 	/**
 	 * Resume this suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain().
@@ -486,10 +518,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void resume() throws LibvirtException{
-		_resume(VDP);
+//		_resume(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _resume(long VDP) throws LibvirtException;
+//	private native int _resume(long VDP) throws LibvirtException;
 
 	/**
 	 * Suspends this domain and saves its memory contents to a file on disk.
@@ -500,10 +533,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void save(String to) throws LibvirtException{
-		_save(VDP, to);
+//		_save(VDP, to);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _save(long VDP, String to) throws LibvirtException;
+//	private native int _save(long VDP, String to) throws LibvirtException;
 
 	/**
 	 * Shuts down this domain, the domain object is still usable there after but the domain OS is being stopped.
@@ -513,10 +547,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void shutdown() throws LibvirtException{
-		_shutdown(VDP);
+//		_shutdown(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int _shutdown(long VDP) throws LibvirtException;
+//	private native int _shutdown(long VDP) throws LibvirtException;
 
 	/**
 	 * undefines this domain but does not stop it if it is running
@@ -524,10 +559,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void undefine() throws LibvirtException{
-		_undefine(VDP);
+        throw new RuntimeException("Not Implemented") ;	    
+//		_undefine(VDP);
 	}
 
-	private native int _undefine(long VDP) throws LibvirtException;
+//	private native int _undefine(long VDP) throws LibvirtException;
 
 	/**
 	 * Dynamically changes the target amount of physical memory allocated to this domain.
@@ -537,10 +573,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setMemory(long memory) throws LibvirtException{
-		_setMemory(VDP, memory);
+	    throw new RuntimeException("Not Implemented") ;
+//		_setMemory(VDP, memory);
 	}
 
-	private native int _setMemory(long VDP, long memory) throws LibvirtException;
+//	private native int _setMemory(long VDP, long memory) throws LibvirtException;
 
 
 }
diff --git a/src/org/libvirt/Error.java b/src/org/libvirt/Error.java
index ef05702..ada7be8 100644
--- a/src/org/libvirt/Error.java
+++ b/src/org/libvirt/Error.java
@@ -2,6 +2,8 @@ package org.libvirt;
 
 import java.io.Serializable;
 
+import org.libvirt.jna.virError;
+
 public class Error implements Serializable {
 
 	public static enum ErrorDomain {
@@ -308,6 +310,25 @@ public class Error implements Serializable {
 	int int1;
 	int int2;
 	long VNP; /* Deprecated */
+	
+    public Error() {
+        
+    }
+    
+    public Error(virError vError) {
+        code = ErrorNumber.values()[vError.code] ;
+        domain = ErrorDomain.values()[vError.domain] ;
+        level = ErrorLevel.values()[vError.level] ;        
+        message = vError.message ;
+        str1 = vError.str1 ;
+        str2 = vError.str2 ;
+        str3 = vError.str3 ;   
+        int1 = vError.int1 ;
+        int2 = vError.int2 ; 
+        VCP = vError.conn ;
+        VDP = vError.dom ;
+        VNP = vError.net ;
+    }	
 
 	/**
 	 * Gets he error code
diff --git a/src/org/libvirt/ErrorHandler.java b/src/org/libvirt/ErrorHandler.java
new file mode 100644
index 0000000..dca47a5
--- /dev/null
+++ b/src/org/libvirt/ErrorHandler.java
@@ -0,0 +1,22 @@
+package org.libvirt;
+
+import org.libvirt.jna.Libvirt;
+import org.libvirt.jna.virError;
+
+import com.sun.jna.Pointer;
+
+public class ErrorHandler implements Libvirt.virErrorFunc
+{
+    public static ErrorHandler INSTANCE = new ErrorHandler() ;
+
+    @Override
+    public void handleError(Pointer userData, virError vError) throws LibvirtException
+    {
+        System.out.println("Hello") ;
+        if (vError != null) {
+            Error error = new Error(vError) ;
+            throw new LibvirtException(error) ;
+        }
+        
+    }
+}
diff --git a/src/org/libvirt/Network.java b/src/org/libvirt/Network.java
index 6fda985..a194ca7 100644
--- a/src/org/libvirt/Network.java
+++ b/src/org/libvirt/Network.java
@@ -1,15 +1,25 @@
 package org.libvirt;
 
+import org.libvirt.jna.Libvirt;
+
+import com.sun.jna.Pointer;
+
 public class Network {
 
 	/**
 	 * The native virNetworkPtr
 	 */
-	private long VNP;
+	protected Pointer VNP;
+	
 	/**
 	 * The Connect Object that represents the Hypervisor of this Network
 	 */
-	private Connect virConnect;
+	protected Connect virConnect;
+	
+	/**
+	 * The libvirt connection from the hypervisor
+	 */
+	protected Libvirt libvirt ;
 
 	/**
 	 * Constructs a Network object from a known native virNetworkPtr, and a Connect object.
@@ -18,9 +28,10 @@ public class Network {
 	 * @param virConnect
 	 * @param VNP
 	 */
-	Network(Connect virConnect, long VNP){
+	Network(Connect virConnect, Pointer VNP){	
 		this.virConnect = virConnect;
 		this.VNP = VNP;
+		this.libvirt = virConnect.libvirt ;
 	}
 
 	public void finalize() throws LibvirtException{
@@ -36,10 +47,11 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public String getXMLDesc(int flags) throws LibvirtException{
-		return _getXMLDesc(VNP, flags);
+//		return _getXMLDesc(VNP, flags);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native String _getXMLDesc(long VNP, int flags) throws LibvirtException;
+//	private native String _getXMLDesc(long VNP, int flags) throws LibvirtException;
 
 	/**
 	 * Provides a boolean value indicating whether this network is configured to be automatically started when the host machine boots.
@@ -48,10 +60,11 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public boolean getAutostart() throws LibvirtException{
-		return _getAutostart(VNP);
+//		return _getAutostart(VNP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native boolean _getAutostart(long VNP) throws LibvirtException;
+//	private native boolean _getAutostart(long VNP) throws LibvirtException;
 
 
 	/**
@@ -61,10 +74,11 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public void setAutostart(boolean autostart) throws LibvirtException{
-		_setAutostart(VNP, autostart);
+//		_setAutostart(VNP, autostart);
+        throw new RuntimeException("Not Implemented") ;		
 	}
 
-	private native int _setAutostart(long VNP, boolean autostart) throws LibvirtException;
+//	private native int _setAutostart(long VNP, boolean autostart) throws LibvirtException;
 
 	/**
 	 * Provides a bridge interface name to which a domain may connect a network interface in order to join this network.
@@ -73,10 +87,12 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public String getBridgeName() throws LibvirtException{
-		return _getBridgeName(VNP);
+//		return _getBridgeName(VNP);
+        throw new RuntimeException("Not Implemented") ;		
 	}
 
-	private native String _getBridgeName(long VNP) throws LibvirtException;
+//	private native String _getBridgeName(long VNP) throws LibvirtException;
+	
 
 
 	/**
@@ -96,10 +112,10 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public String getName() throws LibvirtException{
-		return _getName(VNP);
+		return libvirt.virNetworkGetName(VNP);   
 	}
 
-	private native String _getName(long VNP) throws LibvirtException;
+//	private native String _getName(long VNP) throws LibvirtException;
 
 	/**
 	 * Gets the UUID for this network
@@ -109,10 +125,11 @@ public class Network {
 	 * @see <a href="http://www.ietf.org/rfc/rfc4122.txt";>rfc4122</a>
 	 */
 	public int[] getUUID() throws LibvirtException{
-		return _getUUID(VNP);
+//		return _getUUID(VNP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native int[] _getUUID(long VNP) throws LibvirtException;
+//	private native int[] _getUUID(long VNP) throws LibvirtException;
 
 	/**
 	 * Gets the UUID for a network as string.
@@ -122,10 +139,11 @@ public class Network {
 	 * @see <a href="http://www.ietf.org/rfc/rfc4122.txt";>rfc4122</a>
 	 */
 	public String getUUIDString() throws LibvirtException{
-		return _getUUIDString(VNP);
+//		return _getUUIDString(VNP);
+        throw new RuntimeException("Not Implemented") ;	    
 	}
 
-	private native String _getUUIDString(long VNP) throws LibvirtException;
+//	private native String _getUUIDString(long VNP) throws LibvirtException;
 
 	/**
 	 * Creates and starts this defined network.
@@ -134,10 +152,11 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public void create() throws LibvirtException{
-		_create(VNP);
+//		_create(VNP);
+	       throw new RuntimeException("Not Implemented") ;
 	}
 
-	private native int _create(long VNP) throws LibvirtException;
+//	private native int _create(long VNP) throws LibvirtException;
 
 	/**
 	 * Destroy this network object.
@@ -148,10 +167,11 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public void destroy() throws LibvirtException{
-		_destroy(VNP);
+//		_destroy(VNP);
+	       throw new RuntimeException("Not Implemented") ;
 	}
 
-	private native int _destroy(long VNP) throws LibvirtException;
+//	private native int _destroy(long VNP) throws LibvirtException;
 
 	/**
 	 * Frees this network object.
@@ -161,11 +181,12 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public void free() throws LibvirtException{
-		_free(VNP);
-		VNP=0;
+        throw new RuntimeException("Not Implemented") ;	    
+//		_free(VNP);
+//		VNP=0;
 	}
 
-	private native int _free(long VNP) throws LibvirtException;
+//	private native int _free(long VNP) throws LibvirtException;
 
 	/**
 	 * Undefines this network but does not stop it if it is running
@@ -173,9 +194,10 @@ public class Network {
 	 * @throws LibvirtException
 	 */
 	public void undefine() throws LibvirtException{
-		_undefine(VNP);
+        throw new RuntimeException("Not Implemented") ;	    
+//		_undefine(VNP);
 	}
 
-	private native int _undefine(long VNP) throws LibvirtException;
+//	private native int _undefine(long VNP) throws LibvirtException;
 
 }
diff --git a/src/org/libvirt/NodeInfo.java b/src/org/libvirt/NodeInfo.java
index b7e2840..16855ca 100644
--- a/src/org/libvirt/NodeInfo.java
+++ b/src/org/libvirt/NodeInfo.java
@@ -1,5 +1,7 @@
 package org.libvirt;
 
+import org.libvirt.jna.virNodeInfo;
+
 public class NodeInfo {
 	/**
 	 * string indicating the CPU model
@@ -34,6 +36,20 @@ public class NodeInfo {
 	 */
 	public int threads;
 
+	
+	public NodeInfo() {
+	}
+	
+	public NodeInfo(virNodeInfo vInfo) {
+//	    this.model = new String(vInfo.model) ;
+        this.memory = vInfo.memory.longValue() ;
+        this.cpus = vInfo.cpus ;
+        this.mhz = vInfo.mhz ;        
+        this.nodes = vInfo.nodes ;    
+        this.sockets = vInfo.sockets ;    
+        this.cores = vInfo.cores ;        
+        this.threads = vInfo.threads ;
+	}
 	/**
 	 * @return the total number of CPUs supported but not neccessarily active in the host.
 	 */
diff --git a/src/org/libvirt/jna/Libvirt.java b/src/org/libvirt/jna/Libvirt.java
new file mode 100644
index 0000000..1874d3e
--- /dev/null
+++ b/src/org/libvirt/jna/Libvirt.java
@@ -0,0 +1,66 @@
+package org.libvirt.jna;
+
+
+import com.sun.jna.Callback;
+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.LongByReference;
+import com.sun.jna.ptr.PointerByReference;
+
+public interface Libvirt extends Library
+{
+    Libvirt INSTANCE = (Libvirt) Native.loadLibrary("libvirt", Libvirt.class) ;
+    
+    //Callbacks 
+    interface virErrorFunc extends Callback {
+        void handleError(Pointer userData, virError error) throws Exception ;
+    }    
+    
+    // Global functions
+    public virError virGetLastError() ;    
+    public int virGetVersion(LongByReference libVer, String type, LongByReference typeVer) ;
+    public int virInitialize() ;    
+    public void virSetErrorFunc(long userData, virErrorFunc handler) ;
+    
+    //Connection Functions
+    public int virConnCopyLastError(Pointer virConnectPtr) ;        
+    public int virConnectClose(Pointer virConnectPtr) ;    
+    public String virConnectGetCapabilities(Pointer virConnectPtr) ;
+    public String virConnectGetHostname(Pointer virConnectPtr) ;    
+    public virError virConnGetLastError(Pointer virConnectPtr)  ;    
+    public int virConnectGetMaxVcpus(Pointer virConnectPtr, String type) ;
+    public String virConnectGetType(Pointer virConnectPtr) ;
+    public String virConnectGetURI(Pointer virConnectPtr) ; 
+    public int virConnectGetVersion(Pointer virConnectPtr, LongByReference hvVer) ;  
+    public int virConnectListDomains(Pointer virConnectPtr, int[] ids, int maxnames) ;
+    public int virConnectListNetworks(Pointer virConnectPtr, String[] name, int maxnames) ;       
+    public int virConnectListDefinedDomains(Pointer virConnectPtr, String[] name, int maxnames) ;
+    public int virConnectListDefinedNetworks(Pointer virConnectPtr, String[] name, int maxnames) ;    
+    public int virConnectNumOfDomains(Pointer virConnectPtr) ;
+    public int virConnectNumOfDefinedDomains(Pointer virConnectPtr) ;    
+    public int virConnectNumOfDefinedNetworks(Pointer virConnectPtr) ;
+    public int virConnectNumOfNetworks(Pointer virConnectPtr) ;    
+    public Pointer virConnectOpen(String name) ;
+    public Pointer virConnectOpenReadOnly(String name) ;
+    public void virConnSetErrorFunc(Pointer virConnectPtr, long userData, virErrorFunc handler) ;
+    
+    // Node functions
+    public int virNodeGetInfo(Pointer virConnectPtr, virNodeInfo virNodeInfo) ;
+    
+    // Network functions
+    public Pointer virNetworkCreateXML(Pointer virConnectPtr, String xmlDesc) ;
+    public Pointer virNetworkDefineXML(Pointer virConnectPtr, String xmlDesc) ;  
+    public String virNetworkGetName(Pointer virNetorkPtr) ;
+    public Pointer virNetworkLookupByName(Pointer virConnectPtr, String name) ;
+    public Pointer virNetworkLookupByUUIDString(Pointer virConnectPtr, String uuidstr) ;    
+    public Pointer virNetworkLookupByUUID(Pointer virConnectPtr, String uuidstr) ;        
+    
+    // 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 virDomainLookupByUUIDString(Pointer virConnectPtr, String uuidstr) ;
+
+}
diff --git a/src/org/libvirt/jna/virError.java b/src/org/libvirt/jna/virError.java
new file mode 100644
index 0000000..db462fa
--- /dev/null
+++ b/src/org/libvirt/jna/virError.java
@@ -0,0 +1,19 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Structure ;
+
+public class virError extends Structure
+{
+    public int code ;
+    public int domain ;
+    public String message ;
+    public int level ;
+    public long conn ;
+    public long dom ;
+    public String str1 ;
+    public String str2 ;
+    public String str3 ;   
+    public int int1 ;
+    public int int2 ;    
+    public long net  ;    
+}
diff --git a/src/org/libvirt/jna/virNodeInfo.java b/src/org/libvirt/jna/virNodeInfo.java
new file mode 100644
index 0000000..5a6449e
--- /dev/null
+++ b/src/org/libvirt/jna/virNodeInfo.java
@@ -0,0 +1,19 @@
+package org.libvirt.jna;
+
+import com.sun.jna.NativeLong;
+import com.sun.jna.Structure;
+
+public class virNodeInfo extends Structure 
+{
+    public class ByValue extends virNodeInfo implements Structure.ByValue {};
+    public class ByReference extends virNodeInfo implements Structure.ByReference {};    
+    
+    public byte model[] = new byte[32];
+    public NativeLong memory ;
+    public int cpus ;
+    public int mhz ;
+    public int nodes ;
+    public int sockets ;
+    public int cores ;
+    public int threads ;    
+}
\ No newline at end of file
diff --git a/src/test.java b/src/test.java
index 73f4eb7..2ca6a92 100644
--- a/src/test.java
+++ b/src/test.java
@@ -18,20 +18,21 @@ public class test {
 				Integer.decode("0xf0"), Integer.decode("0x3c"), Integer.decode("0x87"), Integer.decode("0xd2"), Integer.decode("0x1e"), Integer.decode("0x69")} ;
 
 		//For testing the authentication
-		ConnectAuth defaultAuth = new ConnectAuthDefault(); 
+//		ConnectAuth defaultAuth = new ConnectAuthDefault(); 
 		
 		//You need to configure your libvirtd for remote/authenticated connections, and adjust the URL below 
 		//for this to work. Otherwise, you'll get an error
-		try{
-			conn = new Connect("test+tcp://localhost/default", defaultAuth, 0);
-			System.out.println("Encrypted connection successful!");
-		} catch (LibvirtException e){
-			System.out.println("exception caught:"+e);
-			System.out.println(e.getError());
-		}
+//		try{
+//			conn = new Connect("test+tcp://localhost/default", defaultAuth, 0);
+//			System.out.println("Encrypted connection successful!");
+//		} catch (LibvirtException e){
+//			System.out.println("exception caught:"+e);
+//			System.out.println(e.getError());
+//		}
 		
 		try{
 			conn = new Connect("test:///default", false);
+		    //conn = new Connect("qemu:///system", false) ;
 		} catch (LibvirtException e){
 			System.out.println("exception caught:"+e);
 			System.out.println(e.getError());
@@ -54,11 +55,12 @@ public class test {
 			System.out.println("getType:" + conn.getType());
 			System.out.println("getURI:" + conn.getURI());
 			System.out.println("getVersion:" + conn.getVersion());
+            System.out.println("getLibVirVersion:" + conn.getLibVirVersion());			
 			
 			//By default, there are 1 created and 0 defined networks
 			
 			//Create a new network to test the create method
-			System.out.println("conn.networkCreateXML:"+conn.networkCreateXML("<network>" +
+			System.out.println("conn.networkCreateXML: "+conn.networkCreateXML("<network>" +
 					"  <name>createst</name>"+
 					"  <uuid>004b96e1-2d78-c30f-5aa5-f03c87d21e68</uuid>"+
 					"  <bridge name='createst'/>"+
@@ -71,7 +73,7 @@ public class test {
 					"</network>"));
 					
 			//Same for the define method
-			System.out.println("conn.networkDefineXML:"+conn.networkDefineXML("<network>" +
+			System.out.println("conn.networkDefineXML: "+conn.networkDefineXML("<network>" +
 					"  <name>deftest</name>"+
 					"  <uuid>004b96e1-2d78-c30f-5aa5-f03c87d21e67</uuid>"+
 					"  <bridge name='deftest'/>"+
@@ -87,11 +89,11 @@ public class test {
 			System.out.println("numOfDefinedNetworks:" + conn.numOfDefinedNetworks());
 			System.out.println("listDefinedNetworks:" + conn.listDefinedNetworks());
 			for(String c: conn.listDefinedNetworks())
-				System.out.println("	"+c);
+				System.out.println("	-> "+c);
 			System.out.println("numOfNetworks:" + conn.numOfNetworks());
 			System.out.println("listNetworks:" + conn.listNetworks());
 			for(String c: conn.listNetworks())
-				System.out.println("	"+c);
+				System.out.println("	-> "+c);
 	
 			//Define a new Domain
 			System.out.println("conn.domainDefineXML:"+conn.domainDefineXML("<domain type='test' id='2'>"+
@@ -99,6 +101,7 @@ public class test {
 					"  <uuid>004b96e1-2d78-c30f-5aa5-f03c87d21e70</uuid>"+
 					"  <memory>8388608</memory>"+
 					"  <vcpu>2</vcpu>"+
+					"  <os><type arch='i686'>hvm</type></os>" +
 					"  <on_reboot>restart</on_reboot>"+
 					"  <on_poweroff>destroy</on_poweroff>"+
 					"  <on_crash>restart</on_crash>"+
@@ -109,6 +112,7 @@ public class test {
 					"  <uuid>004b96e1-2d78-c30f-5aa5-f03c87d21e71</uuid>"+
 					"  <memory>8388608</memory>"+
 					"  <vcpu>2</vcpu>"+
+                    "  <os><type arch='i686'>hvm</type></os>" +					
 					"  <on_reboot>restart</on_reboot>"+
 					"  <on_poweroff>destroy</on_poweroff>"+
 					"  <on_crash>restart</on_crash>"+
@@ -122,7 +126,7 @@ public class test {
 			System.out.println("numOfDomains:" + conn.numOfDomains());
 			System.out.println("listDomains:" + conn.listDomains());
 			for(int c: conn.listDomains())
-				System.out.println("	"+c);
+				System.out.println("	-> "+c);
 
 			
 		} catch (LibvirtException e){
@@ -133,116 +137,119 @@ public class test {
 		//Network Object
 		
 		try{	
-			//Choose one, they should have the exact same effect
-			//Network testNetwork=conn.networkLookupByName("default");
-			//Network testNetwork=conn.networkLookupByUUIDString("004b96e1-2d78-c30f-5aa5-f03c87d21e69");
-			System.out.println("about to call networkLookupByUUID");
+     		//Choose one, they should have the exact same effect
+		    testNetwork = conn.networkLookupByName("deftest") ;
+		    System.out.println("networkLookupByName: " + testNetwork.getName()) ;
+		    
+            testNetwork = conn.networkLookupByUUIDString("004b96e1-2d78-c30f-5aa5-f03c87d21e67");
+            System.out.println("networkLookupByUUIDString: " + testNetwork.getName()) ;            
 			testNetwork=conn.networkLookupByUUID(UUID);
-			
-			//Exercise the getter methods on the default network
-			System.out.println("virNetworkGetXMLDesc:" + testNetwork.getXMLDesc(0));
-			System.out.println("virNetworkLookupByName:" + testNetwork);
-			System.out.println("virNetworkGetAutostart:" + testNetwork.getAutostart());
-			System.out.println("virNetworkGetBridgeName:" + testNetwork.getBridgeName());
-			System.out.println("virNetworkGetName:" + testNetwork.getName());
-			System.out.println("virNetworkGetUUID:" + testNetwork.getUUID() + " ");
-			for(int c: testNetwork.getUUID())
-				System.out.print(Integer.toHexString(c));
-			System.out.println();
-			System.out.println("virNetworkGetName:" + testNetwork.getUUIDString());
-			
-			//Destroy and create the network
-			System.out.println("virNetworkDestroy:"); testNetwork.destroy();
-			System.out.println("virNetworkCreate:"); testNetwork.create();
-		} catch (LibvirtException e){
-			System.out.println("exception caught:"+e);
-			System.out.println(e.getError());
-		}
-		//This should raise an excpetion
-		try{
-			System.out.println("virNetworkCreate:");  testNetwork.create();
+            System.out.println("networkLookupByUUID: " + testNetwork.getName()) ;                     
+//			
+//			//Exercise the getter methods on the default network
+//			System.out.println("virNetworkGetXMLDesc:" + testNetwork.getXMLDesc(0));
+//			System.out.println("virNetworkLookupByName:" + testNetwork);
+//			System.out.println("virNetworkGetAutostart:" + testNetwork.getAutostart());
+//			System.out.println("virNetworkGetBridgeName:" + testNetwork.getBridgeName());
+//			System.out.println("virNetworkGetName:" + testNetwork.getName());
+//			System.out.println("virNetworkGetUUID:" + testNetwork.getUUID() + " ");
+//			for(int c: testNetwork.getUUID())
+//				System.out.print(Integer.toHexString(c));
+//			System.out.println();
+//			System.out.println("virNetworkGetName:" + testNetwork.getUUIDString());
+//			
+//			//Destroy and create the network
+//			System.out.println("virNetworkDestroy:"); testNetwork.destroy();
+//			System.out.println("virNetworkCreate:"); testNetwork.create();
 		} catch (LibvirtException e){
 			System.out.println("exception caught:"+e);
 			System.out.println(e.getError());
 		}
+//		//This should raise an excpetion
+//		try{
+//			System.out.println("virNetworkCreate:");  testNetwork.create();
+//		} catch (LibvirtException e){
+//			System.out.println("exception caught:"+e);
+//			System.out.println(e.getError());
+//		}
 		
 		//Domain stuff
 		
-		try{
-
-			
-			//Domain lookup
-			//Domain testDomain=conn.domainLookupByID(1);
-			//Domain testDomain=conn.domainLookupByName("test");
-			//Domain testDomain=conn.domainLookupByUUIDString("004b96e1-2d78-c30f-5aa5-f03c87d21e69");
-			Domain testDomain=conn.domainLookupByUUID(UUID);
-			
-			//Exercise the getter methods on the default domain
-			System.out.println("virDomainGetXMLDesc:" + testDomain.getXMLDesc(0));
-			System.out.println("virDomainGetAutostart:" + testDomain.getAutostart());
-			System.out.println("virDomainGetConnect:" + testDomain.getConnect());
-			System.out.println("virDomainGetIDt:" + testDomain.getID());
-			System.out.println("virDomainGetInfo:" + testDomain.getInfo());
-			System.out.println("virDomainGetMaxMemory:" + testDomain.getMaxMemory());
-			//Should fail, test driver does not support it
-			//System.out.println("virDomainGetMaxVcpus:" + testDomain.getMaxVcpus());
-			System.out.println("virDomainGetName:" + testDomain.getName());
-			System.out.println("virDomainGetOSType:" + testDomain.getOSType());
-			System.out.println("virDomainGetSchedulerType:" + testDomain.getSchedulerType());
-			System.out.println("virDomainGetSchedulerParameters:" + testDomain.getSchedulerParameters());
-			//Iterate over the parameters the painful way
-			for(SchedParameter c: testDomain.getSchedulerParameters()){
-				if (c instanceof SchedIntParameter)
-					System.out.println("Int:" + ((SchedIntParameter)c).field +":"+ ((SchedIntParameter)c).value);
-				if (c instanceof SchedUintParameter)
-					System.out.println("Uint:" + ((SchedUintParameter)c).field  +":"+  ((SchedUintParameter)c).value);
-				if (c instanceof SchedLongParameter)
-					System.out.println("Long:" + ((SchedLongParameter)c).field  +":"+  ((SchedLongParameter)c).value);
-				if (c instanceof SchedUlongParameter)
-					System.out.println("Ulong:" + ((SchedUlongParameter)c).field  +":"+  ((SchedUlongParameter)c).value);
-				if (c instanceof SchedDoubleParameter)
-					System.out.println("Double:" + ((SchedDoubleParameter)c).field  +":"+  ((SchedDoubleParameter)c).value);
-				if (c instanceof SchedBooleanParameter)
-					System.out.println("Boolean:" + ((SchedBooleanParameter)c).field  +":"+  ((SchedBooleanParameter)c).value);
-			}
-			//Iterate over the parameters the easy way
-			for(SchedParameter c: testDomain.getSchedulerParameters()){
-				System.out.println(c.getTypeAsString() +":"+ c.field +":"+  c.getValueAsString());
-			}
-			System.out.println("virDomainGetUUID:" + testDomain.getUUID());
-			for(int c: testDomain.getUUID())
-				System.out.print(Integer.toHexString(c));
-			System.out.println();
-			System.out.println("virDomainGetUUIDString:" + testDomain.getUUIDString());
-			//Should fail, unimplemented in test driver		
-			//System.out.println("virDomainGetVcpusInfo:" + testDomain.getVcpusInfo());
-			//Same as above
-			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
-			//Should test pinVcpu, when we test with real xen
-			//Here
-			//Attach default network to test domain
-			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
-			
-			//Should test interfacestats and blockstats with real xen
-			
-			//Close the connection
-			
-			conn.close();
-		} catch (LibvirtException e){
-			System.out.println("exception caught:"+e);
-			System.out.println(e.getError());
-		}
-		
-		
-		
-		try{
-			//We should get an exception, not a crash
-			System.out.println(conn.getHostName());
-		}catch (LibvirtException e){
-			System.out.println("exception caught:"+e);
-			System.out.println(e.getError());
-		}
-		System.out.println();
+//		try{
+//
+//			
+//			//Domain lookup
+//			//Domain testDomain=conn.domainLookupByID(1);
+//			//Domain testDomain=conn.domainLookupByName("test");
+//			//Domain testDomain=conn.domainLookupByUUIDString("004b96e1-2d78-c30f-5aa5-f03c87d21e69");
+//			Domain testDomain=conn.domainLookupByUUID(UUID);
+//			
+//			//Exercise the getter methods on the default domain
+//			System.out.println("virDomainGetXMLDesc:" + testDomain.getXMLDesc(0));
+//			System.out.println("virDomainGetAutostart:" + testDomain.getAutostart());
+//			System.out.println("virDomainGetConnect:" + testDomain.getConnect());
+//			System.out.println("virDomainGetIDt:" + testDomain.getID());
+//			System.out.println("virDomainGetInfo:" + testDomain.getInfo());
+//			System.out.println("virDomainGetMaxMemory:" + testDomain.getMaxMemory());
+//			//Should fail, test driver does not support it
+//			//System.out.println("virDomainGetMaxVcpus:" + testDomain.getMaxVcpus());
+//			System.out.println("virDomainGetName:" + testDomain.getName());
+//			System.out.println("virDomainGetOSType:" + testDomain.getOSType());
+//			System.out.println("virDomainGetSchedulerType:" + testDomain.getSchedulerType());
+//			System.out.println("virDomainGetSchedulerParameters:" + testDomain.getSchedulerParameters());
+//			//Iterate over the parameters the painful way
+//			for(SchedParameter c: testDomain.getSchedulerParameters()){
+//				if (c instanceof SchedIntParameter)
+//					System.out.println("Int:" + ((SchedIntParameter)c).field +":"+ ((SchedIntParameter)c).value);
+//				if (c instanceof SchedUintParameter)
+//					System.out.println("Uint:" + ((SchedUintParameter)c).field  +":"+  ((SchedUintParameter)c).value);
+//				if (c instanceof SchedLongParameter)
+//					System.out.println("Long:" + ((SchedLongParameter)c).field  +":"+  ((SchedLongParameter)c).value);
+//				if (c instanceof SchedUlongParameter)
+//					System.out.println("Ulong:" + ((SchedUlongParameter)c).field  +":"+  ((SchedUlongParameter)c).value);
+//				if (c instanceof SchedDoubleParameter)
+//					System.out.println("Double:" + ((SchedDoubleParameter)c).field  +":"+  ((SchedDoubleParameter)c).value);
+//				if (c instanceof SchedBooleanParameter)
+//					System.out.println("Boolean:" + ((SchedBooleanParameter)c).field  +":"+  ((SchedBooleanParameter)c).value);
+//			}
+//			//Iterate over the parameters the easy way
+//			for(SchedParameter c: testDomain.getSchedulerParameters()){
+//				System.out.println(c.getTypeAsString() +":"+ c.field +":"+  c.getValueAsString());
+//			}
+//			System.out.println("virDomainGetUUID:" + testDomain.getUUID());
+//			for(int c: testDomain.getUUID())
+//				System.out.print(Integer.toHexString(c));
+//			System.out.println();
+//			System.out.println("virDomainGetUUIDString:" + testDomain.getUUIDString());
+//			//Should fail, unimplemented in test driver		
+//			//System.out.println("virDomainGetVcpusInfo:" + testDomain.getVcpusInfo());
+//			//Same as above
+//			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
+//			//Should test pinVcpu, when we test with real xen
+//			//Here
+//			//Attach default network to test domain
+//			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
+//			
+//			//Should test interfacestats and blockstats with real xen
+//			
+//			//Close the connection
+//			
+//			conn.close();
+//		} catch (LibvirtException e){
+//			System.out.println("exception caught:"+e);
+//			System.out.println(e.getError());
+//		}
+//		
+//		
+//		
+//		try{
+//			//We should get an exception, not a crash
+//			System.out.println(conn.getHostName());
+//		}catch (LibvirtException e){
+//			System.out.println("exception caught:"+e);
+//			System.out.println(e.getError());
+//		}
+//		System.out.println();
 	}
 
 }
-- 
1.6.0.6

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]