edu.ntnu.item.jt.VMware
Class VMwareServer

java.lang.Object
  extended by edu.ntnu.item.jt.VMware.VMwareServer

public class VMwareServer
extends Object

Representents a VMware server.

Author:
Jøran Vagnby Lillesand

Field Summary
static boolean debug
           
static int VIX_API_VERSION
           
static int VIX_INVALID_HANDLE
           
static long VIX_OK
           
static int VIX_PROPERTY_JOB_RESULT_HANDLE
           
static int VIX_PROPERTY_NONE
           
static int VIX_SERVICEPROVIDER_DEFAULT
           
static int VIX_SERVICEPROVIDER_VMWARE_SERVER
           
static int VIX_SERVICEPROVIDER_VMWARE_WORKSTATION
           
static int VIX_VMPOWEROP_NORMAL
           
(package private)  VixInterface vixLib
           
 
Constructor Summary
VMwareServer(String hostname, int portNumber)
          Create a new VMwareServer instance.
 
Method Summary
 void connect(String serverUsername, String serverPassword)
          Connect to a VMWare Server.
 void disconnect()
          Disconnect from the guest OS and free the resources.
protected  String getHost()
          Getter for the hostname of this VMware server.
protected  int getHostHandle()
          Getter for the host handle of the VMware server (only has meaning for vix (and log files)).
static void main(String[] args)
          Contains code used for testing VMwareServer and GuestOS.
 GuestOS openVM(String vmxFilePathName, String username, String password)
          Load a VM in the VMWare server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIX_API_VERSION

public static final int VIX_API_VERSION
See Also:
Constant Field Values

VIX_SERVICEPROVIDER_DEFAULT

public static final int VIX_SERVICEPROVIDER_DEFAULT
See Also:
Constant Field Values

VIX_SERVICEPROVIDER_VMWARE_SERVER

public static final int VIX_SERVICEPROVIDER_VMWARE_SERVER
See Also:
Constant Field Values

VIX_SERVICEPROVIDER_VMWARE_WORKSTATION

public static final int VIX_SERVICEPROVIDER_VMWARE_WORKSTATION
See Also:
Constant Field Values

VIX_INVALID_HANDLE

public static final int VIX_INVALID_HANDLE
See Also:
Constant Field Values

VIX_PROPERTY_NONE

public static final int VIX_PROPERTY_NONE
See Also:
Constant Field Values

VIX_PROPERTY_JOB_RESULT_HANDLE

public static final int VIX_PROPERTY_JOB_RESULT_HANDLE
See Also:
Constant Field Values

VIX_VMPOWEROP_NORMAL

public static final int VIX_VMPOWEROP_NORMAL
See Also:
Constant Field Values

VIX_OK

public static final long VIX_OK
See Also:
Constant Field Values

debug

public static boolean debug

vixLib

VixInterface vixLib
Constructor Detail

VMwareServer

public VMwareServer(String hostname,
                    int portNumber)
Create a new VMwareServer instance. Initializes the Vix interface.

Parameters:
hostname - host running VMware server.
Method Detail

connect

public void connect(String serverUsername,
                    String serverPassword)
             throws ConnectionFailedException
Connect to a VMWare Server. To connect to server running on local machine as current user, supply null for serverUsername and serverPassword.

Parameters:
serverUsername - user name of the user running VMWare.
serverPassword - password of the user running VMWare.
Throws:
ConnectionFailedException - thrown to indicate a connection failure.

openVM

public GuestOS openVM(String vmxFilePathName,
                      String username,
                      String password)
               throws OpenVMException
Load a VM in the VMWare server. Requires that a connection has already been established to a VMWare server.

Parameters:
vmxFilePathName - Full path name to the .vmx VMWare config file on the VMWare server host.
username - user name for the virtual machine.
password - password for the virtual machine. If none is required, supply null.
Returns:
instance representing the loaded guest OS.
Throws:
OpenVMException - thrown if opening the VM failed.
See Also:
GuestOS

disconnect

public void disconnect()
Disconnect from the guest OS and free the resources.


getHostHandle

protected int getHostHandle()
Getter for the host handle of the VMware server (only has meaning for vix (and log files)).

Returns:
Vix host handle for this VMware server.

getHost

protected String getHost()
Getter for the hostname of this VMware server.

Returns:
hostname of VMware server.

main

public static void main(String[] args)
                 throws Exception
Contains code used for testing VMwareServer and GuestOS.

Parameters:
args -
Throws:
Exception - not handled.