summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/libvirt/domain/device/GraphicsSpice.java
blob: f0872960e21968f0808b37f9f4c9b8b269a45bfa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package org.openslx.libvirt.domain.device;

import org.openslx.libvirt.xml.LibvirtXmlNode;

/**
 * A graphics SPICE device node in a Libvirt domain XML document.
 * 
 * @author Manuel Bentele
 * @version 1.0
 */
public class GraphicsSpice extends Graphics
{
	/**
	 * Creates an empty graphics SPICE device.
	 */
	public GraphicsSpice()
	{
		super();
	}

	/**
	 * Creates a graphics SPICE device representing an existing Libvirt XML graphics SPICE device
	 * element.
	 * 
	 * @param xmlNode existing Libvirt XML graphics SPCIE device element.
	 */
	public GraphicsSpice( LibvirtXmlNode xmlNode )
	{
		super( xmlNode );
	}

	/**
	 * Returns the state whether OpenGL hardware acceleration is enabled or not.
	 * 
	 * @return tate whether OpenGL hardware acceleration is enabled or not.
	 */
	public boolean isOpenGlEnabled()
	{
		return this.getXmlElementAttributeValueAsBool( "gl", "enable" );
	}

	/**
	 * Sets the state whether OpenGL hardware acceleration is enabled or not.
	 * 
	 * @param enabled state whether OpenGL hardware acceleration is enabled or not.
	 */
	public void setOpenGl( boolean enabled )
	{
		this.setXmlElementAttributeValue( "gl", "enable", enabled );
	}

	/**
	 * Creates a non-existent graphics SPICE device as Libvirt XML device element.
	 * 
	 * @param xmlNode Libvirt XML node of the Libvirt XML device that is created.
	 * @return created graphics SPICE device instance.
	 */
	public static GraphicsSpice createInstance( LibvirtXmlNode xmlNode )
	{
		return GraphicsSpice.newInstance( xmlNode );
	}

	/**
	 * Creates a graphics SPICE device representing an existing Libvirt XML graphics SPICE device
	 * element.
	 * 
	 * @param xmlNode existing Libvirt XML graphics SPICE device element.
	 * @return graphics SPICE device instance.
	 */
	public static GraphicsSpice newInstance( LibvirtXmlNode xmlNode )
	{
		return new GraphicsSpice( xmlNode );
	}
}