]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PackageEditor/src/org/tianocore/packaging/ManifestContents.java
Initial import.
[mirror_edk2.git] / Tools / Source / PackageEditor / src / org / tianocore / packaging / ManifestContents.java
1 /** @file
2 Java class ManifestContents is used to deal with FDPManifest.xml file related
3 operations.
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 **/
14 package org.tianocore.packaging;
15
16 import org.apache.xmlbeans.XmlException;
17
18 import org.tianocore.*;
19 import java.io.*;
20
21 /**
22 This class operates on FDPManifest.xml file
23
24 @since PackageEditor 1.0
25 **/
26 public class ManifestContents {
27
28 ///
29 /// it is more convenient to get input stream from Jar entry of to-be-installed package file.
30 /// so i use InputStream instead of File
31 ///
32 private InputStream manIs = null;
33
34 FrameworkDevPkgManifestDocument manDoc = null;
35
36 HeaderDocument hdr = null;
37
38 FrameworkDevPkgManifestDocument.FrameworkDevPkgManifest manRoot = null;
39
40 public ManifestContents(InputStream fis) throws XmlException, IOException {
41
42 manIs = fis;
43 manDoc = FrameworkDevPkgManifestDocument.Factory.parse(manIs);
44 manRoot = manDoc.getFrameworkDevPkgManifest();
45
46 }
47
48 /**
49 Get package name from manifest file header.
50
51 @return String
52 **/
53 public String getBaseName() {
54 return manRoot.getHeader().getPackageName().getStringValue();
55 }
56
57 /**
58 Get package version from manifest file header.
59
60 @return String
61 **/
62 public String getVersion() {
63 return manRoot.getHeader().getVersion();
64 }
65
66 /**
67 Get package GUID from manifest file header.
68
69 @return String
70 **/
71 public String getGuid() {
72 return manRoot.getHeader().getGuid().getStringValue();
73 }
74 }