clienttest.java revision fa833d3a9203f26e4cd8c944223706f90b06d8a9
/*
* Sample client for the VirtualBox webservice, written in Java.
*
* Don't forget to run VBOX webserver
* with 'vboxwebsrv -t 1000' command, to calm down watchdog thread.
*
* Copyright (C) 2008 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
import org.virtualbox.*;
public class clienttest
{
public clienttest()
{
}
public void disconnect()
{
}
class Desktop
{
Desktop(int n)
{
name = "Mach"+n;
}
{
return name;
}
{
return uuid;
}
}
public void test()
{
for (int i=0; i<100; i++)
{
"linux",
mgr.cleanupUnused();
}
}
public void test2()
{
bios.setIOAPICEnabled(true);
mach.saveSettings();
}
public void test3()
{
}
public void showVMs()
{
try
{
int i = 0;
{
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void listHostInfo()
{
try
{
for (long i=0; i<uProcCount; i++)
{
}
for (IPerformanceMetric m : aMetrics)
{
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
{
try
{
// first assume we were given a UUID
try
{
}
catch (Exception e)
{
try
{
}
{
}
}
{
}
else
{
uuid,
env);
if (rc != 0)
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
{
}
}
}
public void cleanup()
{
try
{
{
disconnect();
}
mgr.cleanupUnused();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void printArgs()
{
"\nwith <mode> being:" +
"\n show vms list installed virtual machines" +
"\n list hostinfo list host info" +
"\n startvm <vmname|uuid> start the given virtual machine");
}
{
{
printArgs();
}
else
{
clienttest c = new clienttest();
{
{
c.showVMs();
else
}
else
}
{
{
c.listHostInfo();
else
}
else
}
{
{
}
else
}
{
c.test3();
}
else
c.cleanup();
}
}
}