|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.ntnu.item.jt.VMware.GuestOS
public class GuestOS
Represents a Guest OS/Virtual Machine instance. Instances of GuestOS can only be gotten through a relevant VMwareServer, as a virtual machine always must be directly associated with a VMware server. The GuestOS is aware of its VMware server, but not vice versa. There is state associated with the virtual machine (GuestOS), but this is not reflected in the GuestOS class, as the underlying VIX API will return appropriate errors (which will be represented by exceptions here) if the state is wrong for a given call. Most functionality offered in this class utilizes in turn the VixInterface class and the C VIX API offered by VMWare.
Field Summary | |
---|---|
static String |
VIX_CONSOLE_USER_NAME
|
static int |
VIX_E_FILE_ALREADY_EXISTS
|
static long |
VIX_OK
|
static int |
VIX_PROPERTY_JOB_RESULT_HANDLE
|
static int |
VIX_PROPERTY_NONE
|
static int |
VIX_RUNPROGRAM_ACTIVATE_WINDOW
|
static int |
VIX_RUNPROGRAM_RETURN_IMMEDIATELY
|
static int |
VIX_SNAPSHOT_INCLUDE_MEMORY
|
static int |
VIX_VM_POWEROP_NORMAL
|
Constructor Summary | |
---|---|
protected |
GuestOS(int[] vmHandle,
String vmxPath,
String username,
String password,
VMwareServer vmWareServer)
Constructor for the GuestOS class. |
Method Summary | |
---|---|
void |
copyFileFromGuest(String guestPathName,
String hostPathName)
Copy a file from the local machine (client) to the guest OS. |
void |
copyFileToGuest(String localPathName,
String guestPathName)
Copy a file to the guest OS. |
protected void |
finalize()
Releases the vix handle of this guest OS, allowing vix to free up any resources locked by this VM. |
String |
getHost()
Getter for the hostname of the VMware server running this guest OS. |
String |
getPassword()
Getter for the password associated with this virtual machine. |
String |
getUsername()
Getter for the username associated with this virtual machine. |
int |
getVMHandle()
Not currently supported in VIX 1.0 and 1.1. |
String |
getvmxPath()
Getter for the guest OS's VMX path. |
void |
loadSnapshot()
Loads a previously stored snapshot. |
void |
login()
Login to the guest OS. |
void |
logInGuiConsoleUser()
Log in to the Guest OS with a GUI console user. |
void |
powerOff()
Powers off the virtual machine. |
void |
powerOn(boolean waitForTools,
int timeout)
Powers on the virtual machine. |
void |
releaseJobHandle(int jobHandle)
Releases the given job handle in the vix API. |
void |
revertToSnapshot(boolean waitForCompletion)
Revert to the previous snapshot. |
void |
runProgramInGuest(String programPath,
String commandLineArgs)
Run a executable file in the guest OS. |
int |
runProgramInGuest(String programPath,
String commandLineArgs,
Callback callbackProc)
Run a program in the guest OS using a callback procedure. |
void |
runProgramInGuestNonBlocking(String programPath,
String commandLineArgs)
Run a program in the guest OS without blocking call or any callback procedure. |
void |
takeSnapshot(String name,
String description,
boolean includeMemory)
Take a snapshot of the current state in the virtual machine (guest OS). |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VIX_PROPERTY_NONE
public static final long VIX_OK
public static final int VIX_SNAPSHOT_INCLUDE_MEMORY
public static final int VIX_PROPERTY_JOB_RESULT_HANDLE
public static final int VIX_VM_POWEROP_NORMAL
public static final int VIX_E_FILE_ALREADY_EXISTS
public static final int VIX_RUNPROGRAM_RETURN_IMMEDIATELY
public static final int VIX_RUNPROGRAM_ACTIVATE_WINDOW
public static final String VIX_CONSOLE_USER_NAME
Constructor Detail |
---|
protected GuestOS(int[] vmHandle, String vmxPath, String username, String password, VMwareServer vmWareServer)
vmHandle
- the Vix handle of this virtual machine.vmxPath
- the VMX config path of this virtual machine. The VMX path is valid on the VMware Server running this guest OS.vmWareServer
- reference to the VMware server running this guest OS instance.username
- username for logging in to the OS running at the virtual machine.password
- password for logging in to the OS running at the virtual machine. If no password is required, supply null.Method Detail |
---|
public void powerOn(boolean waitForTools, int timeout) throws PowerUpFailureException
waitForTools
- specifies whether or not to wait for tools to run in the guest os.timeout
- specifies the timeout in seconds when waiting for tools. If waitForTools is false, this parameter is ignored.
PowerUpFailureException
- the only exception thrown. Contains a textual description of the error that occured.public void powerOff() throws PowerOffFailureException
PowerOffFailureException
- if an error occured while powering off the virtual machine.public void login() throws LoginFailureException
LoginFailureException
- indicates an error during logging in. Contains a textual description of the error.public void copyFileToGuest(String localPathName, String guestPathName) throws FileCopyException
localPathName
- full path of the local file.guestPathName
- full path of the destination file on the guest OS.
FileCopyException
- thrown if an error occurs during copying of the file. Includes a textual representation of the error.public void copyFileFromGuest(String guestPathName, String hostPathName) throws FileCopyException
guestPathName
- file name of the file in the guest OS.hostPathName
- file name of destination file in the local machine.
FileCopyException
- thrown if an error occurs during copying of the file. Includes a textual representation of the error.public void runProgramInGuest(String programPath, String commandLineArgs) throws FileExecutionException
programPath
- full path of the program to be executed.commandLineArgs
- command line arguments to be supplied to the executable.
FileExecutionException
- thrown if an error occured when executing the file.public void logInGuiConsoleUser() throws LoginFailureException
LoginFailureException
- If the log in operation failspublic void runProgramInGuestNonBlocking(String programPath, String commandLineArgs) throws FileExecutionException
programPath
- Path to the program to be executedcommandLineArgs
- any command line arguments
FileExecutionException
public int runProgramInGuest(String programPath, String commandLineArgs, Callback callbackProc)
programPath
- path to the program to be executed.commandLineArgs
- any command line arguments to be passed to the program.callbackProc
- class containing the callback procedure.
public void takeSnapshot(String name, String description, boolean includeMemory) throws CreateSnapshotException
name
- a name describing the snapshot. Only used for description, so need not be unique.description
- a textual description of the snapshot.includeMemory
- indicates whether the memory state is to be part of the snapshot.
CreateSnapshotException
- an error occured while trying to create the snapshot. See the textual description and/or the exception error code for more information.public void revertToSnapshot(boolean waitForCompletion) throws NoSnapshotLoadedException, RevertToSnapshotFailedException, NoSnapshotAvailableException
NoSnapshotLoadedException
- indicates that no snapshot has been loaded prior to calling the function.
RevertToSnapshotFailedException
- indicates that an error occured while attempting to revert to the loaded snapshot. For information about the error, see the exception's textual description or error code.
NoSnapshotAvailableException
- no snapshot could be loaded, indicating that no snapshot is available.public void loadSnapshot() throws NoSnapshotLoadedException, NoSnapshotAvailableException
NoSnapshotLoadedException
NoSnapshotAvailableException
public void releaseJobHandle(int jobHandle)
jobHandle
- id of the job handle to be released.public int getVMHandle()
public String getvmxPath()
public String getHost()
public String getUsername()
public String getPassword()
protected void finalize()
finalize
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |