org.virtualbox_5_1
Class ISession

java.lang.Object
  extended by org.virtualbox_5_1.IUnknown
      extended by org.virtualbox_5_1.ISession

public class ISession
extends IUnknown

The ISession interface represents a client process and allows for locking virtual machines (represented by IMachine objects) to prevent conflicting changes to the machine. Any caller wishing to manipulate a virtual machine needs to create a session object first, which lives in its own process space. Such session objects are then associated withIMachineobjects living in the VirtualBox server process to coordinate such changes. There are two typical scenarios in which sessions are used:

How sessions objects are created in a client process depends on whether you use the Main API via COM or via the webservice: Interface ID: {7844AA05-B02E-4CDD-A04F-ADE4A762E6B7}


Field Summary
 
Fields inherited from class org.virtualbox_5_1.IUnknown
obj, objMgr, port
 
Constructor Summary
ISession(java.lang.String wrapped, org.virtualbox_5_1.ObjectRefManager objMgr, org.virtualbox_5_1.jaxws.VboxPortType port)
           
 
Method Summary
 IConsole getConsole()
          Console object associated with this session.
 IMachine getMachine()
          Machine object associated with this session.
 java.lang.String getName()
          Name of this session.
 SessionState getState()
          Current state of this session.
 SessionType getType()
          Type of this session.
static ISession queryInterface(IUnknown obj)
           
 void setName(java.lang.String value)
          Name of this session.
 void unlockMachine()
          Unlocks a machine that was previously locked for the current session.
 
Methods inherited from class org.virtualbox_5_1.IUnknown
getObjMgr, getRemoteWSPort, getWrapped, releaseRemote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISession

public ISession(java.lang.String wrapped,
                org.virtualbox_5_1.ObjectRefManager objMgr,
                org.virtualbox_5_1.jaxws.VboxPortType port)
Method Detail

getState

public SessionState getState()
Current state of this session.

Returns:
org.virtualbox_5_1.SessionState

getType

public SessionType getType()
Type of this session. The value of this attribute is valid only if the session currently has a machine locked (i.e. itsgetState()is Locked), otherwise an error will be returned.

Returns:
org.virtualbox_5_1.SessionType

getName

public java.lang.String getName()
Name of this session. Important only for VM sessions, otherwise it it will be remembered, but not used for anything significant (and can be left at the empty string which is the default). The value can only be changed when the session state is SessionState_Unlocked. Make sure that you use a descriptive name which does not conflict with the VM process session names: "GUI/Qt", "GUI/SDL" and "headless".

Returns:
String

setName

public void setName(java.lang.String value)
Name of this session. Important only for VM sessions, otherwise it it will be remembered, but not used for anything significant (and can be left at the empty string which is the default). The value can only be changed when the session state is SessionState_Unlocked. Make sure that you use a descriptive name which does not conflict with the VM process session names: "GUI/Qt", "GUI/SDL" and "headless".

Parameters:
value - String

getMachine

public IMachine getMachine()
Machine object associated with this session.

Returns:
org.virtualbox_5_1.IMachine

getConsole

public IConsole getConsole()
Console object associated with this session. Only sessions which locked the machine for a VM process have a non-null console.

Returns:
org.virtualbox_5_1.IConsole

queryInterface

public static ISession queryInterface(IUnknown obj)

unlockMachine

public void unlockMachine()
Unlocks a machine that was previously locked for the current session. Calling this method is required every time a machine has been locked for a particular session using theIMachine.launchVMProcess(org.virtualbox_5_1.ISession,String,String)orIMachine.lockMachine(org.virtualbox_5_1.ISession,org.virtualbox_5_1.LockType)calls. Otherwise the state of the machine will be set toMachineState.Abortedon the server, and changes made to the machine settings will be lost. Generally, it is recommended to unlock all machines explicitly before terminating the application (regardless of the reason for the termination). Expected result codes:
E_UNEXPECTEDSession is not locked.
NOTE: Do not expect the session state (getState()to return to "Unlocked" immediately after you invoke this method, particularly if you have started a new VM process. The session state will automatically return to "Unlocked" once the VM is no longer executing, which can of course take a very long time.