clienttest.java revision f5e435b10a89c4311d503faa10e79e736dfcc976
/*
* 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-2009 Sun Microsystems, Inc.
*
* The following license applies to this file only:
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/* Somewhat ugly way to support versioning */
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();
}
}
}