]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / OpenFile.java
CommitLineData
79cb6fdb 1/** @file\r
2 \r
3 The file provides interface to open xml file.\r
4 \r
5 Copyright (c) 2006, Intel Corporation\r
6 All rights reserved. This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13 \r
14 **/\r
f9d0ab92 15package org.tianocore.frameworkwizard.common;\r
79cb6fdb 16\r
17import java.io.File;\r
18import java.io.IOException;\r
19\r
20import org.apache.xmlbeans.XmlException;\r
21import org.apache.xmlbeans.XmlObject;\r
22import org.tianocore.FrameworkDatabaseDocument;\r
23import org.tianocore.ModuleSurfaceAreaDocument;\r
24import org.tianocore.PackageSurfaceAreaDocument;\r
25import org.tianocore.PlatformSurfaceAreaDocument;\r
26import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;\r
27import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
28import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
29import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
79cb6fdb 30\r
31public class OpenFile {\r
32 /**\r
33 \r
34 @param args\r
35 \r
36 **/\r
37 public static void main(String[] args) {\r
38 // TODO Auto-generated method stub\r
39\r
40 }\r
41\r
42 /**\r
43 Open specificed Msa file and read its content\r
44 \r
45 @param strMsaFilePath The input data of Msa File Path\r
46 \r
47 **/\r
48 public static ModuleSurfaceArea openMsaFile(String strMsaFilePath) throws IOException, XmlException, Exception {\r
49 Log.log("Open Msa", strMsaFilePath);\r
50 File msaFile = new File(strMsaFilePath);\r
51 ModuleSurfaceAreaDocument xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);\r
52 return xmlMsaDoc.getModuleSurfaceArea();\r
53 }\r
54\r
55 /**\r
56 Open specificed Spd file and read its content\r
57 \r
58 @param strSpdFilePath The input data of Spd File Path\r
59 \r
60 **/\r
61 public static PackageSurfaceArea openSpdFile(String strSpdFilePath) throws IOException, XmlException, Exception {\r
62 Log.log("Open Spd", strSpdFilePath);\r
63 File spdFile = new File(strSpdFilePath);\r
64 PackageSurfaceAreaDocument xmlSpdDoc = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdFile);\r
65 return xmlSpdDoc.getPackageSurfaceArea();\r
66 }\r
67\r
68 /**\r
69 Open specificed Fpd file and read its content\r
70 \r
71 @param strFpdFilePath The input data of Fpd File Path\r
72 \r
73 **/\r
74 public static PlatformSurfaceArea openFpdFile(String strFpdFilePath) throws IOException, XmlException,\r
75 Exception {\r
76 Log.log("Open Fpd", strFpdFilePath);\r
77 File fpdFile = new File(strFpdFilePath);\r
78 PlatformSurfaceAreaDocument xmlFpdDoc = null;\r
79 xmlFpdDoc = (PlatformSurfaceAreaDocument) XmlObject.Factory.parse(fpdFile);\r
80 return xmlFpdDoc.getPlatformSurfaceArea();\r
81 }\r
82\r
83 /**\r
84 \r
85 Open specificed Framework Database file and read its content\r
86 \r
87 */\r
88 public static FrameworkDatabase openFrameworkDb(String strDbFilePath) throws IOException, XmlException, Exception {\r
89 Log.log("Open Framework Database", strDbFilePath);\r
90 File db = new File(strDbFilePath);\r
91 FrameworkDatabaseDocument xmlDb = null;\r
92 xmlDb = (FrameworkDatabaseDocument) XmlObject.Factory.parse(db);\r
93 return xmlDb.getFrameworkDatabase();\r
94 }\r
95}\r