AW: [libvirt] AW: beta libvirt-java port uploaded

Daniel Schwager Daniel.Schwager at dtnet.de
Thu Jul 3 18:34:30 UTC 2008


>   What are the diffs which should be applied to the cirrent 0.1.2
> code base ? and what specifically should be added in libvirt-java
> CVS. The Beans support seems one of them (but i have no idea how
> it's supposed to be used).
>   A bit of explanations would go a long way ;-)
> 
> Daniel


Hi Daniel,

some (maybe) useful things could be

a) integration of apache-commons 'ivy' for dependencymanagement
	depends on log4j and apache-xmlbeans
   maybe maven-repos could also be a way ..

b) build (compile) the native libraries remote on a targetsystems
(32bit, 64bit)
	libvirt_jni-32bit.so
	libvirt_jni-64bit.so
   using ant build (target compile.native-library) and
http://staf.sf.net - maybe ant-based ssh-execution of makefile
   would maybe better (we use STAF in our company)


c) integration of apache-xmlbeans for getting rid of the java
XML-hacking:
	- using an XSD-File (descriptors/libvirt.xsd*) for defining the
libvirt-XML language
	  AND autocreating all the java beans mapped to the XML
		- refer to build.xml, target: create-xmlbeans

	- using Xml helper class LibvirtXmlUtil
		- for e.g. verifing the incoming libvirt-XML
				LibvirtXmlUtil p = new LibvirtXmlUtil();
				DomainDocumentXmlBean doc = p.read(new
File("domain.xml");
				System.out.println(p.toString(doc));	

	- creating a object-trees of the libvirt-XML-code (e.g.
TestXml.java) easily 
			// Define a new Domain
			DomainDocumentXmlBean doc =
DomainDocumentXmlBean.Factory.newInstance();
			DomainXmlBean domain = doc.addNewDomain();
		
			domain.setName("domainName");
			domain.setType(DomainTypeXmlBean.XEN);
			domain.setMemory(256 * 1024);
			domain.setVcpu(1);
	
domain.setOnReboot(LifeCycleActionXmlBean.RESTART);
	
domain.setOnPoweroff(LifeCycleActionXmlBean.DESTROY);
	
domain.setOnCrash(LifeCycleActionXmlBean.DESTROY);
			domain.addNewFeatures().addNewPae();

			// and showing the XML output like
			System.output(new
LibvirtXmlUtil().toString(doc));

			
	- for easy accessing all elements in the XML-structur - bean
like
		DomainDocumentXmlBean doc = new
LibvirtXmlUtil().read("domain1.xml");
	
System.out(doc.getDomain().getDevices().getDiskList().get(0).getSource()
.getFile());


Regards

Danny




More information about the libvir-list mailing list