public class IConsole extends IUnknown
IMachine.lockMachine(org.virtualbox_6_1.ISession,org.virtualbox_6_1.LockType)
orIMachine.launchVMProcess(org.virtualbox_6_1.ISession,String,List)
. The console object can
then be found in the session'sISession.getConsole()
attribute.
Methods of the IConsole interface allow the caller to query the current
virtual machine execution state, pause the machine or power it down, save
the machine state or take a snapshot, attach and detach removable media
and so on.Constructor and Description |
---|
IConsole(java.lang.String wrapped,
org.virtualbox_6_1.ObjectRefManager objMgr,
org.virtualbox_6_1.jaxws.VboxPortType port) |
Modifier and Type | Method and Description |
---|---|
void |
addDiskEncryptionPassword(java.lang.String id,
java.lang.String password,
java.lang.Boolean clearOnSuspend)
Adds a password used for hard disk encryption/decryption.
|
void |
addDiskEncryptionPasswords(java.util.List<java.lang.String> ids,
java.util.List<java.lang.String> passwords,
java.lang.Boolean clearOnSuspend)
Adds a password used for hard disk encryption/decryption.
|
void |
attachUSBDevice(java.lang.String id,
java.lang.String captureFilename)
Attaches a host USB device with the given UUID to the
USB controller of the virtual machine.
|
void |
clearAllDiskEncryptionPasswords()
Clears all provided supplied disk encryption passwords.
|
void |
createSharedFolder(java.lang.String name,
java.lang.String hostPath,
java.lang.Boolean writable,
java.lang.Boolean automount,
java.lang.String autoMountPoint)
Creates a transient new shared folder by associating the given logical
name with the given host path, adds it to the collection of shared
folders and starts sharing it.
|
IUSBDevice |
detachUSBDevice(java.lang.String id)
Detaches an USB device with the given UUID from the USB controller
of the virtual machine.
|
IUSBDevice |
findUSBDeviceByAddress(java.lang.String name)
Searches for a USB device with the given host address.
|
IUSBDevice |
findUSBDeviceById(java.lang.String id)
Searches for a USB device with the given UUID.
|
java.util.List<IPCIDeviceAttachment> |
getAttachedPCIDevices()
Array of PCI devices attached to this machine.
|
IMachineDebugger |
getDebugger()
Debugging interface.
|
java.util.List<DeviceActivity> |
getDeviceActivity(java.util.List<DeviceType> type)
Gets the current activity type of given devices or device groups.
|
IDisplay |
getDisplay()
Virtual display object.
|
IEmulatedUSB |
getEmulatedUSB()
Interface that manages emulated USB devices.
|
IEventSource |
getEventSource()
Event source for console events.
|
IGuest |
getGuest()
Guest object.
|
java.lang.Boolean |
getGuestEnteredACPIMode()
Checks if the guest entered the ACPI mode G0 (working) or
G1 (sleeping).
|
IKeyboard |
getKeyboard()
Virtual keyboard object.
|
IMachine |
getMachine()
Machine object for this console session.
|
IMouse |
getMouse()
Virtual mouse object.
|
java.lang.Boolean |
getPowerButtonHandled()
Checks if the last power button event was handled by guest.
|
java.util.List<IHostUSBDevice> |
getRemoteUSBDevices()
List of USB devices currently attached to the remote VRDE client.
|
java.util.List<ISharedFolder> |
getSharedFolders()
Collection of shared folders for the current session.
|
MachineState |
getState()
Current execution state of the machine.
|
java.util.List<IUSBDevice> |
getUSBDevices()
Collection of USB devices currently attached to the virtual
USB controller.
|
java.lang.Boolean |
getUseHostClipboard()
Whether the guest clipboard should be connected to the host one or
whether it should only be allowed access to the VRDE clipboard.
|
IVRDEServerInfo |
getVRDEServerInfo()
Interface that provides information on Remote Desktop Extension (VRDE) connection.
|
void |
pause()
Pauses the virtual machine execution.
|
void |
powerButton()
Sends the ACPI power button event to the guest.
|
IProgress |
powerDown()
Initiates the power down procedure to stop the virtual machine
execution.
|
IProgress |
powerUp()
Starts the virtual machine execution using the current machine
state (that is, its current execution state, current settings and
current storage devices).If the machine is powered off or aborted, the execution will
start from the beginning (as if the real hardware were just
powered on).
|
IProgress |
powerUpPaused()
Identical to powerUp except that the VM will enter the
MachineState.Paused state, instead ofMachineState.Running . |
static IConsole |
queryInterface(IUnknown obj) |
void |
removeDiskEncryptionPassword(java.lang.String id)
Removes a password used for hard disk encryption/decryption from
the running VM.
|
void |
removeSharedFolder(java.lang.String name)
Removes a transient shared folder with the given name previously
created by
createSharedFolder(String,String,Boolean,Boolean,String) from the collection of
shared folders and stops sharing it. |
void |
reset()
Resets the virtual machine.
|
void |
resume()
Resumes the virtual machine execution.
|
void |
setUseHostClipboard(java.lang.Boolean value)
Whether the guest clipboard should be connected to the host one or
whether it should only be allowed access to the VRDE clipboard.
|
void |
sleepButton()
Sends the ACPI sleep button event to the guest.
|
IProgress |
teleport(java.lang.String hostname,
java.lang.Long tcpport,
java.lang.String password,
java.lang.Long maxDowntime)
Teleport the VM to a different host machine or process.
|
getObjMgr, getRemoteWSPort, getWrapped, releaseRemote
public IConsole(java.lang.String wrapped, org.virtualbox_6_1.ObjectRefManager objMgr, org.virtualbox_6_1.jaxws.VboxPortType port)
public IMachine getMachine()
ISession.getMachine()
of the corresponding session
object.public MachineState getState()
public IGuest getGuest()
public IKeyboard getKeyboard()
public IMouse getMouse()
public IDisplay getDisplay()
public IMachineDebugger getDebugger()
public java.util.List<IUSBDevice> getUSBDevices()
public java.util.List<IHostUSBDevice> getRemoteUSBDevices()
public java.util.List<ISharedFolder> getSharedFolders()
IMachine.getSharedFolders()
which represent permanent shared
folders). When the session is closed (e.g. the machine is powered down),
these folders are automatically discarded.
New shared folders are added to the collection usingcreateSharedFolder(String,String,Boolean,Boolean,String)
. Existing shared folders can be
removed usingremoveSharedFolder(String)
.public IVRDEServerInfo getVRDEServerInfo()
public IEventSource getEventSource()
public java.util.List<IPCIDeviceAttachment> getAttachedPCIDevices()
public java.lang.Boolean getUseHostClipboard()
public void setUseHostClipboard(java.lang.Boolean value)
value
- Booleanpublic IEmulatedUSB getEmulatedUSB()
public IProgress powerUp()
MachineState.Saved
state,
it will continue its execution the point where the state has
been saved.
If the machineIMachine.getTeleporterEnabled()
property is
enabled on the machine being powered up, the machine will wait for an
incoming teleportation in theMachineState.TeleportingIn
state. The returned progress object will have at least three
operations where the last three are defined as: (1) powering up and
starting TCP server, (2) waiting for incoming teleportations, and
(3) perform teleportation. These operations will be reflected as the
last three operations of the progress objected returned byIMachine.launchVMProcess(org.virtualbox_6_1.ISession,String,List)
as well.VBOX_E_INVALID_VM_STATE | Virtual machine already running. |
VBOX_E_HOST_ERROR | Host interface does not exist or name not set. |
VBOX_E_FILE_ERROR | Invalid saved state file. |
IMachine.launchVMProcess(org.virtualbox_6_1.ISession,String,List)
instead; these
front-ends will power up the machine automatically for you.IMachine.saveState()
public IProgress powerUpPaused()
MachineState.Paused
state, instead ofMachineState.Running
.VBOX_E_INVALID_VM_STATE | Virtual machine already running. |
VBOX_E_HOST_ERROR | Host interface does not exist or name not set. |
VBOX_E_FILE_ERROR | Invalid saved state file. |
powerUp()
public IProgress powerDown()
VBOX_E_INVALID_VM_STATE | Virtual machine must be Running, Paused or Stuck to be powered down. |
public void reset()
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_VM_ERROR | Virtual machine error in reset operation. |
public void pause()
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_VM_ERROR | Virtual machine error in suspend operation. |
public void resume()
VBOX_E_INVALID_VM_STATE | Virtual machine not in Paused state. |
VBOX_E_VM_ERROR | Virtual machine error in resume operation. |
public void powerButton()
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_PDM_ERROR | Controlled power off failed. |
public void sleepButton()
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
VBOX_E_PDM_ERROR | Sending sleep button event failed. |
public java.lang.Boolean getPowerButtonHandled()
VBOX_E_PDM_ERROR | Checking if the event was handled by the guest OS failed. |
public java.lang.Boolean getGuestEnteredACPIMode()
VBOX_E_INVALID_VM_STATE | Virtual machine not in Running state. |
public java.util.List<DeviceActivity> getDeviceActivity(java.util.List<DeviceType> type)
E_INVALIDARG | Invalid device type. |
public void attachUSBDevice(java.lang.String id, java.lang.String captureFilename)
USBDeviceState.Busy
,USBDeviceState.Available
orUSBDeviceState.Held
,
otherwise an error is immediately returned.
When the device state isUSBDeviceState.Busy
, an error may also
be returned if the host computer refuses to release it for some reason.id
- UUID of the host USB device to attach.captureFilename
- Filename to capture the USB traffic to.
Expected result codes:
VBOX_E_INVALID_VM_STATE | Virtual machine state neither Running nor Paused. |
VBOX_E_PDM_ERROR | Virtual machine does not have a USB controller. |
IUSBDeviceFilters.getDeviceFilters()
,
USBDeviceState
public IUSBDevice detachUSBDevice(java.lang.String id)
id
- UUID of the USB device to detach.VBOX_E_PDM_ERROR | Virtual machine does not have a USB controller. |
E_INVALIDARG | USB device not attached to this virtual machine. |
IUSBDeviceFilters.getDeviceFilters()
,
USBDeviceState
public IUSBDevice findUSBDeviceByAddress(java.lang.String name)
name
- Address of the USB device (as assigned by the host) to
search for.VBOX_E_OBJECT_NOT_FOUND | Given name does not correspond to any USB device. |
IUSBDevice.getAddress()
public IUSBDevice findUSBDeviceById(java.lang.String id)
id
- UUID of the USB device to search for.VBOX_E_OBJECT_NOT_FOUND | Given id does not correspond to any USB device. |
IUSBDevice.getId()
public void createSharedFolder(java.lang.String name, java.lang.String hostPath, java.lang.Boolean writable, java.lang.Boolean automount, java.lang.String autoMountPoint)
ISharedFolder
to read more about logical names.name
- Unique logical name of the shared folder.hostPath
- Full path to the shared folder in the host file system.writable
- Whether the share is writable or readonlyautomount
- Whether the share gets automatically mounted by the guest
or not.autoMountPoint
- Where the guest should automatically mount the folder, if possible.
For Windows and OS/2 guests this should be a drive letter, while other
guests it should be a absolute directory.
Expected result codes:
VBOX_E_INVALID_VM_STATE | Virtual machine in Saved state or currently changing state. |
VBOX_E_FILE_ERROR | Shared folder already exists or not accessible. |
public void removeSharedFolder(java.lang.String name)
createSharedFolder(String,String,Boolean,Boolean,String)
from the collection of
shared folders and stops sharing it.name
- Logical name of the shared folder to remove.
Expected result codes:
VBOX_E_INVALID_VM_STATE | Virtual machine in Saved state or currently changing state. |
VBOX_E_FILE_ERROR | Shared folder does not exists. |
public IProgress teleport(java.lang.String hostname, java.lang.Long tcpport, java.lang.String password, java.lang.Long maxDowntime)
hostname
- The name or IP of the host to teleport to.tcpport
- The TCP port to connect to (1..65535).password
- The password.maxDowntime
- The maximum allowed downtime given as milliseconds. 0 is not a valid
value. Recommended value: 250 ms.
The higher the value is, the greater the chance for a successful
teleportation. A small value may easily result in the teleportation
process taking hours and eventually fail.VBOX_E_INVALID_VM_STATE | Virtual machine not running or paused. |
public void addDiskEncryptionPassword(java.lang.String id, java.lang.String password, java.lang.Boolean clearOnSuspend)
id
- The identifier used for the password. Must match the identifier
used when the encrypted medium was created.password
- The password.clearOnSuspend
- Flag whether to clear the password on VM suspend (due to a suspending host
for example). The password must be supplied again before the VM can resume.
Expected result codes:
VBOX_E_PASSWORD_INCORRECT | The password provided wasn't correct for at least one disk using the provided ID. |
public void addDiskEncryptionPasswords(java.util.List<java.lang.String> ids, java.util.List<java.lang.String> passwords, java.lang.Boolean clearOnSuspend)
ids
- List of identifiers for the passwords. Must match the identifier
used when the encrypted medium was created.passwords
- List of passwords.clearOnSuspend
- Flag whether to clear the given passwords on VM suspend (due to a suspending host
for example). The passwords must be supplied again before the VM can resume.
Expected result codes:
VBOX_E_PASSWORD_INCORRECT | The password provided wasn't correct for at least one disk using the provided ID. |
public void removeDiskEncryptionPassword(java.lang.String id)
id
- The identifier used for the password. Must match the identifier
used when the encrypted medium was created.public void clearAllDiskEncryptionPasswords()