]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpenFile.java
Update FrameworkWizard.msa to add newly added file in <SourceFiles> section
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / Identifications / 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
15package org.tianocore.frameworkwizard.common.Identifications;\r
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
30import org.tianocore.frameworkwizard.common.Log;\r
31\r
32public class OpenFile {\r
33 /**\r
34 \r
35 @param args\r
36 \r
37 **/\r
38 public static void main(String[] args) {\r
39 // TODO Auto-generated method stub\r
40\r
41 }\r
42\r
43 /**\r
44 Open specificed Msa file and read its content\r
45 \r
46 @param strMsaFilePath The input data of Msa File Path\r
47 \r
48 **/\r
49 public static ModuleSurfaceArea openMsaFile(String strMsaFilePath) throws IOException, XmlException, Exception {\r
50 Log.log("Open Msa", strMsaFilePath);\r
51 File msaFile = new File(strMsaFilePath);\r
52 ModuleSurfaceAreaDocument xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);\r
53 return xmlMsaDoc.getModuleSurfaceArea();\r
54 }\r
55\r
56 /**\r
57 Open specificed Spd file and read its content\r
58 \r
59 @param strSpdFilePath The input data of Spd File Path\r
60 \r
61 **/\r
62 public static PackageSurfaceArea openSpdFile(String strSpdFilePath) throws IOException, XmlException, Exception {\r
63 Log.log("Open Spd", strSpdFilePath);\r
64 File spdFile = new File(strSpdFilePath);\r
65 PackageSurfaceAreaDocument xmlSpdDoc = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdFile);\r
66 return xmlSpdDoc.getPackageSurfaceArea();\r
67 }\r
68\r
69 /**\r
70 Open specificed Fpd file and read its content\r
71 \r
72 @param strFpdFilePath The input data of Fpd File Path\r
73 \r
74 **/\r
75 public static PlatformSurfaceArea openFpdFile(String strFpdFilePath) throws IOException, XmlException,\r
76 Exception {\r
77 Log.log("Open Fpd", strFpdFilePath);\r
78 File fpdFile = new File(strFpdFilePath);\r
79 PlatformSurfaceAreaDocument xmlFpdDoc = null;\r
80 xmlFpdDoc = (PlatformSurfaceAreaDocument) XmlObject.Factory.parse(fpdFile);\r
81 return xmlFpdDoc.getPlatformSurfaceArea();\r
82 }\r
83\r
84 /**\r
85 \r
86 Open specificed Framework Database file and read its content\r
87 \r
88 */\r
89 public static FrameworkDatabase openFrameworkDb(String strDbFilePath) throws IOException, XmlException, Exception {\r
90 Log.log("Open Framework Database", strDbFilePath);\r
91 File db = new File(strDbFilePath);\r
92 FrameworkDatabaseDocument xmlDb = null;\r
93 xmlDb = (FrameworkDatabaseDocument) XmlObject.Factory.parse(db);\r
94 return xmlDb.getFrameworkDatabase();\r
95 }\r
96}\r