+/** @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.migration;\r
\r
import java.io.*;\r
import java.util.*;\r
\r
-public class Database {\r
- Database() throws Exception {\r
- if (System.getenv("WORKSPACE") == null) {\r
- DatabasePath = "C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration";\r
- } else {\r
- DatabasePath = System.getenv("WORKSPACE") + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration";\r
- }\r
+public final class Database {\r
+ Database(String path) throws Exception {\r
+ DatabasePath = path;\r
\r
importDBLib("Library.csv");\r
importDBGuid("Guid.csv", "Guid");\r
Func lf;\r
\r
if (rd.ready()) {\r
- System.out.println("Found " + filename + " , Importing Library Database");\r
+ System.out.println("Found " + filename + ", Importing Library Database.");\r
while ((line = rd.readLine()) != null) {\r
if (line.length() != 0) {\r
linecontext = line.split(",");\r
Guid gu;\r
\r
if (rd.ready()) {\r
- System.out.println("Found " + filename + " , Importing " + type + " Database");\r
+ System.out.println("Found " + filename + ", Importing " + type + " Database.");\r
while ((line = rd.readLine()) != null) {\r
if (line.length() != 0) {\r
linecontext = line.split(",");\r
Macro mc;\r
\r
if (rd.ready()) {\r
- System.out.println("Found " + filename + " , Importing Macro Database");\r
+ System.out.println("Found " + filename + ", Importing Macro Database.");\r
while ((line = rd.readLine()) != null) {\r
if (line.length() != 0) {\r
linecontext = line.split(",");\r
public String getR9Macro(String r8macro) {\r
return hashmacro.get(r8macro).r9name; // the verification job of if the macro exists in the database is done when registering it\r
}\r
- \r
+\r
public String getR9Guidname(String r8Guid) {\r
String temp = null;\r
try {\r
}\r
return temp;\r
}\r
- \r
+\r
public String getGuidType(String r8Guid) {\r
String temp = null;\r
try {\r
}\r
return temp;\r
}\r
+\r
+ public static Database init() throws Exception {\r
+ if (System.getenv("WORKSPACE") == null) {\r
+ return new Database("C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");\r
+ } else {\r
+ return new Database(System.getenv("WORKSPACE") + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");\r
+ }\r
+ }\r
}\r