summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/libvirt/libosinfo/os/Os.java
blob: 37a0a2ea871c81a4eb52d59f66dbdcf23b869778 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package org.openslx.libvirt.libosinfo.os;

import org.openslx.libvirt.xml.LibvirtXmlNode;
import org.openslx.virtualization.Version;

/**
 * A operating system node in a libosinfo XML document.
 * 
 * @author Manuel Bentele
 * @version 1.0
 */
public class Os extends LibvirtXmlNode
{
	/**
	 * Creates an empty operating system.
	 */
	public Os()
	{
		super();
	}

	/**
	 * Creates a operating system representing an existing libosinfo XML operating system element.
	 * 
	 * @param xmlNode existing libosinfo XML operating system element.
	 */
	public Os( LibvirtXmlNode xmlNode )
	{
		super( xmlNode );
	}

	/**
	 * Returns the identifier of the operating system.
	 * 
	 * @return identifier of the operating system.
	 */
	public String getId()
	{
		return this.getXmlElementAttributeValue( "id" );
	}

	/**
	 * Returns the name of the operating system.
	 * 
	 * @return name of the operating system.
	 */
	public String getName()
	{
		return this.getXmlElementValue( "name" );
	}

	/**
	 * Returns the version of the operating system.
	 * 
	 * @return version of the operating system.
	 */
	public Version getVersion()
	{
		final String version = this.getXmlElementValue( "version" );
		return Version.valueOf( version );
	}

	/**
	 * Returns the system family of the operating system.
	 * 
	 * @return system family of the operating system.
	 */
	public String getFamily()
	{
		return this.getXmlElementValue( "family" );
	}

	/**
	 * Returns the distribution name of the operating system.
	 * 
	 * @return distribution name of the operating system.
	 */
	public String getDistro()
	{
		return this.getXmlElementValue( "distro" );
	}

	/**
	 * Creates a operating system representing an existing libosinfo XML operating system element.
	 * 
	 * @param xmlNode existing libosinfo XML operating system element.
	 * @return libosinfo XML operating system instance.
	 */
	public static Os newInstance( LibvirtXmlNode node )
	{
		return new Os( node );
	}
}