-/** @file\r
- \r
- The file provides interface to open xml file.\r
- \r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
- \r
- **/\r
-package org.tianocore.frameworkwizard.common;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-\r
-import org.apache.xmlbeans.XmlException;\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.tianocore.FrameworkDatabaseDocument;\r
-import org.tianocore.ModuleSurfaceAreaDocument;\r
-import org.tianocore.PackageSurfaceAreaDocument;\r
-import org.tianocore.PlatformSurfaceAreaDocument;\r
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;\r
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
-\r
-public class OpenFile {\r
- /**\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- Open specificed Msa file and read its content\r
- \r
- @param strMsaFilePath The input data of Msa File Path\r
- \r
- **/\r
- public static ModuleSurfaceArea openMsaFile(String strMsaFilePath) throws IOException, XmlException, Exception {\r
- Log.log("Open Msa", strMsaFilePath);\r
- File msaFile = new File(strMsaFilePath);\r
- ModuleSurfaceAreaDocument xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);\r
- return xmlMsaDoc.getModuleSurfaceArea();\r
- }\r
-\r
- /**\r
- Open specificed Spd file and read its content\r
- \r
- @param strSpdFilePath The input data of Spd File Path\r
- \r
- **/\r
- public static PackageSurfaceArea openSpdFile(String strSpdFilePath) throws IOException, XmlException, Exception {\r
- Log.log("Open Spd", strSpdFilePath);\r
- File spdFile = new File(strSpdFilePath);\r
- PackageSurfaceAreaDocument xmlSpdDoc = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdFile);\r
- return xmlSpdDoc.getPackageSurfaceArea();\r
- }\r
-\r
- /**\r
- Open specificed Fpd file and read its content\r
- \r
- @param strFpdFilePath The input data of Fpd File Path\r
- \r
- **/\r
- public static PlatformSurfaceArea openFpdFile(String strFpdFilePath) throws IOException, XmlException,\r
- Exception {\r
- Log.log("Open Fpd", strFpdFilePath);\r
- File fpdFile = new File(strFpdFilePath);\r
- PlatformSurfaceAreaDocument xmlFpdDoc = null;\r
- xmlFpdDoc = (PlatformSurfaceAreaDocument) XmlObject.Factory.parse(fpdFile);\r
- return xmlFpdDoc.getPlatformSurfaceArea();\r
- }\r
-\r
- /**\r
- \r
- Open specificed Framework Database file and read its content\r
- \r
- */\r
- public static FrameworkDatabase openFrameworkDb(String strDbFilePath) throws IOException, XmlException, Exception {\r
- Log.log("Open Framework Database", strDbFilePath);\r
- File db = new File(strDbFilePath);\r
- FrameworkDatabaseDocument xmlDb = null;\r
- xmlDb = (FrameworkDatabaseDocument) XmlObject.Factory.parse(db);\r
- return xmlDb.getFrameworkDatabase();\r
- }\r
-}\r