All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.ws.commons.virtualbox.ISnapshot Maven / Gradle / Ivy


package com.sun.xml.ws.commons.virtualbox;

import java.util.List;
import java.util.UUID;
import javax.xml.ws.WebServiceException;


/**
 * The ISnapshot interface represents a snapshot of the virtual
 *       machine.
 * 
 *       Thesnapshotstores all the information about a virtual
 *       machine necessary to bring it to exactly the same state as it was at
 *       the time of taking the snapshot. The snapshot includes:
  • all settings of the virtual machine (i.e. its hardware * configuration: RAM size, attached hard disks, etc.)
  • the execution state of the virtual machine (memory contents, * CPU state, etc.).
Snapshots can beoffline(taken when the VM is powered off) * oronline(taken when the VM is running). The execution * state of the offline snapshot is called azero execution state(it doesn't actually contain any information about memory contents * or the CPU state, assuming that all hardware is just powered off).

Snapshot branches

Snapshots can be chained. Chained snapshots form a branch where * every next snapshot is based on the previous one. This chaining is * mostly related to hard disk branching (see {@link IHardDisk} description). This means that every time a new snapshot is created, * a new differencing hard disk is implicitly created for all normal * hard disks attached to the given virtual machine. This allows to * fully restore hard disk contents when the machine is later reverted * to a particular snapshot. * * In the current implementation, multiple snapshot branches within one * virtual machine are not allowed. Every machine has a single branch, * and {@link IConsole#takeSnapshot} operation adds a new * snapshot to the top of that branch. * * Existing snapshots can be discarded using {@link IConsole#discardSnapshot}.

Current snapshot

Every virtual machine has a current snapshot, identified by {@link IMachine#currentSnapshot}. This snapshot is used as * a base for thecurrent machine state(see below), to the effect * that all normal hard disks of the machine and its execution * state are based on this snapshot. * * In the current implementation, the current snapshot is always the * last taken snapshot (i.e. the head snapshot on the branch) and it * cannot be changed. * * The current snapshot isnullif the machine doesn't have * snapshots at all; in this case the current machine state is just * current settings of this machine plus its current execution state.

Current machine state

The current machine state is what represented by IMachine instances got * directly from IVirtualBox * using {@link IVirtualBox#getMachine}, {@link IVirtualBox#findMachine}, etc. (as opposed * to instances returned by {@link ISnapshot#machine}). This state * is always used when the machine is {@link IConsole#powerUp}. * * The current machine state also includes the current execution state. * If the machine is being currently executed * ({@link IMachine#state} is {@link MachineState_Running} and above), its execution state is just what's happening now. * If it is powered off ({@link MachineState_PoweredOff} or {@link MachineState_Aborted}), it has a zero execution state. * If the machine is saved ({@link MachineState_Saved}), its * execution state is what saved in the execution state file * ({@link IMachine#stateFilePath}). * * If the machine is in the saved state, then, next time it is powered * on, its execution state will be fully restored from the saved state * file and the execution will continue from the point where the state * was saved. * * Similarly to snapshots, the current machine state can be discarded * using {@link IConsole#discardCurrentState}.

Taking and discarding snapshots

The table below briefly explains the meaning of every snapshot * operation:
OperationMeaningRemarks
{@link IConsole#takeSnapshot}Save the current state of the virtual machine, including all * settings, contents of normal hard disks and the current modifications * to immutable hard disks (for online snapshots)The current state is not changed (the machine will continue * execution if it is being executed when the snapshot is * taken)
{@link IConsole#discardSnapshot}Forget the state of the virtual machine stored in the snapshot: * dismiss all saved settings and delete the saved execution state (for * online snapshots)Other snapshots (including child snapshots, if any) and the * current state are not directly affected
{@link IConsole#discardCurrentState}Restore the current state of the virtual machine from the state * stored in the current snapshot, including all settings and hard disk * contentsThe current state of the machine existed prior to this operation * is lost
{@link IConsole#discardCurrentSnapshotAndState}Completely revert the virtual machine to the state it was in * before the current snapshot has been takenThe current state, as well as the current snapshot, are * lost
* */ public class ISnapshot extends VBoxObject { public ISnapshot(String _this, VboxPortType port) { super(_this,port); } /** * UUID of the snapshot. * */ public UUID getId() { try { String retVal = port.iSnapshotGetId(_this); return UUID.fromString(retVal); } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Short name of the snapshot. * */ public String getName() { try { String retVal = port.iSnapshotGetName(_this); return retVal; } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Short name of the snapshot. * */ public void setName(String value) { try { port.iSnapshotSetName(_this, value); } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Optional description of the snapshot. * */ public String getDescription() { try { String retVal = port.iSnapshotGetDescription(_this); return retVal; } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Optional description of the snapshot. * */ public void setDescription(String value) { try { port.iSnapshotSetDescription(_this, value); } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Time stamp of the snapshot, in milliseconds since 1970-01-01 UTC. * */ public long getTimeStamp() { try { long retVal = port.iSnapshotGetTimeStamp(_this); return retVal; } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * trueif this snapshot is an online snapshot andfalseotherwise.
When this attribute istrue, the {@link IMachine#stateFilePath} attribute of the {@link #machine} object associated with this snapshot * will point to the saved state file. Otherwise, it will benull.
* */ public boolean getOnline() { try { boolean retVal = port.iSnapshotGetOnline(_this); return retVal; } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Virtual machine this snapshot is taken on. This object * stores all settings the machine had when taking this snapshot.
The returned machine object is immutable, i.e. no * any settings can be changed.
* */ public IMachine getMachine() { try { String retVal = port.iSnapshotGetMachine(_this); return new IMachine(retVal, port); } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Parent snapshot (a snapshot this one is based on).
It's not an error to read this attribute on a snapshot * that doesn't have a parent -- a null object will be * returned to indicate this.
* */ public ISnapshot getParent() { try { String retVal = port.iSnapshotGetParent(_this); return new ISnapshot(retVal, port); } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } /** * Child snapshots (all snapshots having this one as a parent).
In the current implementation, there can be only one * child snapshot, or no children at all, meaning this is the * last (head) snapshot.
* */ public List getChildren() { try { List retVal = port.iSnapshotGetChildren(_this); return Helper.wrap(ISnapshot.class, port, retVal); } catch (com.sun.xml.ws.commons.virtualbox.InvalidObjectFaultMsg e) { throw new WebServiceException(e); } catch (com.sun.xml.ws.commons.virtualbox.RuntimeFaultMsg e) { throw new WebServiceException(e); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy