blob: 5aa3a5b3ad68d22a9cd066b738987989d0c89baf (
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
94
95
96
97
98
99
100
101
102
103
104
105
|
package org.openslx.libvirt.xml;
import java.io.InputStream;
import org.openslx.util.Resources;
/**
* Collection of resource utils for a Libvirt XML document.
*
* @author Manuel Bentele
* @version 1.0
*/
public final class LibvirtXmlResources
{
/**
* File path prefix of the absolute path to the libvirt resource folder in a *.jar file.
*/
private static final String LIBVIRT_PREFIX_PATH = Resources.PATH_SEPARATOR + "libvirt";
/**
* File path prefix of the absolute path to the libosinfo resource folder in a *.jar file.
*/
private static final String LIBOSINFO_PREFIX_PATH = Resources.PATH_SEPARATOR + "libvirt" + Resources.PATH_SEPARATOR
+ "libosinfo";
/**
* File path prefix of the absolute path to the libvirt XSL resource folder in a *.jar file.
*/
private static final String LIBVIRT_PREFIX_PATH_XSL = LIBVIRT_PREFIX_PATH + Resources.PATH_SEPARATOR + "xsl";
/**
* File path prefix of the absolute path to the libvirt RNG resource folder in a *.jar file.
*/
private static final String LIBVIRT_PREFIX_PATH_RNG = LIBVIRT_PREFIX_PATH + Resources.PATH_SEPARATOR + "rng";
/**
* File path prefix of the absolute path to the libosinfo RNG resource folder in a *.jar file.
*/
private static final String LIBOSINFO_PREFIX_PATH_RNG = LIBOSINFO_PREFIX_PATH + Resources.PATH_SEPARATOR + "rng";
/**
* File path prefix of the absolute path to the libosinfo XML resource folder in a *.jar file.
*/
private static final String LIBOSINFO_PREFIX_PATH_XML = LIBOSINFO_PREFIX_PATH + Resources.PATH_SEPARATOR + "xml";
/**
* Returns a Libvirt resource as stream.
*
* @param prefix file path of the Libvirt resource in the resources *.jar folder.
* @param fileName file name of the Libvirt resource in the resources *.jar folder.
* @return Libvirt resource as stream.
*/
private static InputStream getLibvirtResource( String prefix, String fileName )
{
final String path = prefix + Resources.PATH_SEPARATOR + fileName;
return LibvirtXmlResources.class.getResourceAsStream( path );
}
/**
* Returns a Libvirt XSL resource as stream.
*
* @param libvirtXslFileName file name of the XSL resource in the resources *.jar folder.
* @return Libvirt XSL resource as stream.
*/
public static InputStream getLibvirtXsl( String libvirtXslFileName )
{
return LibvirtXmlResources.getLibvirtResource( LibvirtXmlResources.LIBVIRT_PREFIX_PATH_XSL, libvirtXslFileName );
}
/**
* Returns a Libvirt RNG schema resource as stream.
*
* @param libvirtRngFileName file name of the RNG schema resource in the resources *.jar folder.
* @return Libvirt RNG schema resource as stream.
*/
public static InputStream getLibvirtRng( String libvirtRngFileName )
{
return LibvirtXmlResources.getLibvirtResource( LibvirtXmlResources.LIBVIRT_PREFIX_PATH_RNG, libvirtRngFileName );
}
/**
* Returns a libosinfo RNG schema resource as stream.
*
* @param libosInfoRngFileName file name of the RNG schema resource in the resources *.jar
* folder.
* @return libosinfo RNG schema resource as stream.
*/
public static InputStream getLibOsInfoRng( String libosInfoRngFileName )
{
return LibvirtXmlResources.getLibvirtResource( LibvirtXmlResources.LIBOSINFO_PREFIX_PATH_RNG,
libosInfoRngFileName );
}
/**
* Returns a libosinfo XML resource as stream.
*
* @param libosInfoXmlFileName file name of the XML resource in the resources *.jar folder.
* @return libosinfo XML resource as stream.
*/
public static InputStream getLibOsInfoXml( String libosInfoXmlFileName )
{
return LibvirtXmlResources.getLibvirtResource( LibvirtXmlResources.LIBOSINFO_PREFIX_PATH_XML,
libosInfoXmlFileName );
}
}
|