]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java
moved exception and logger classes to org.tianocore.common package
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / global / SurfaceAreaQuery.java
index 956033993d523ad95abc7978508404b28166efae..93727dbfc432c0e1b64d8cfd9ee85c89b93dec2e 100644 (file)
@@ -23,17 +23,16 @@ import java.util.Stack;
 import java.util.regex.Matcher;\r
 import java.util.regex.Pattern;\r
 \r
-import org.apache.xmlbeans.XmlNormalizedString;\r
+import org.w3c.dom.Node;\r
+\r
 import org.apache.xmlbeans.XmlObject;\r
 import org.apache.xmlbeans.XmlString;\r
+\r
 import org.tianocore.BuildOptionsDocument;\r
 import org.tianocore.CNameType;\r
-import org.tianocore.DataIdDocument;\r
 import org.tianocore.ExternsDocument;\r
 import org.tianocore.FileNameConvention;\r
-import org.tianocore.FvAttributeDocument;\r
 import org.tianocore.FvImagesDocument;\r
-import org.tianocore.FvOptionDocument;\r
 import org.tianocore.GuidDeclarationsDocument;\r
 import org.tianocore.GuidsDocument;\r
 import org.tianocore.LibrariesDocument;\r
@@ -51,29 +50,30 @@ import org.tianocore.PackageDependenciesDocument;
 import org.tianocore.PackageHeadersDocument;\r
 import org.tianocore.PcdCodedDocument;\r
 import org.tianocore.PlatformDefinitionsDocument;\r
+import org.tianocore.PlatformHeaderDocument;\r
 import org.tianocore.PpiDeclarationsDocument;\r
 import org.tianocore.ProtocolDeclarationsDocument;\r
 import org.tianocore.Sentence;\r
 import org.tianocore.SpdHeaderDocument;\r
-import org.tianocore.SupportedArchitectures;\r
+import org.tianocore.UserExtensionsDocument;\r
 import org.tianocore.FilenameDocument.Filename;\r
 import org.tianocore.MsaHeaderDocument.MsaHeader;\r
 import org.tianocore.ProtocolsDocument.Protocols.Protocol;\r
 import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;\r
-import org.tianocore.PlatformHeaderDocument;\r
+\r
+import org.tianocore.common.logger.EdkLog;\r
 import org.tianocore.build.id.FpdModuleIdentification;\r
 import org.tianocore.build.id.ModuleIdentification;\r
 import org.tianocore.build.id.PackageIdentification;\r
 import org.tianocore.build.id.PlatformIdentification;\r
 import org.tianocore.build.toolchain.ToolChainInfo;\r
-import org.tianocore.logger.EdkLog;\r
 \r
 /**\r
  * SurfaceAreaQuery class is used to query Surface Area information from msa,\r
  * mbd, spd and fpd files.\r
- * \r
+ *\r
  * This class should not instantiated. All the public interfaces is static.\r
- * \r
+ *\r
  * @since GenBuild 1.0\r
  */\r
 public class SurfaceAreaQuery {\r
@@ -108,7 +108,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Set a Surface Area document for query later\r
-     * \r
+     *\r
      * @param map\r
      *            A Surface Area document in TopLevelElementName/XmlObject\r
      *            format.\r
@@ -123,7 +123,7 @@ public class SurfaceAreaQuery {
      * Push current used Surface Area document into query stack. The given new\r
      * document will be used for any immediately followed getXXX() callings,\r
      * untill pop() is called.\r
-     * \r
+     *\r
      * @param newMap\r
      *            The TopLevelElementName/XmlObject format of a Surface Area\r
      *            document.\r
@@ -183,7 +183,7 @@ public class SurfaceAreaQuery {
     /**\r
      * Search all XML documents stored in "map" for the specified xPath, using\r
      * relative path (starting with '$this')\r
-     * \r
+     *\r
      * @param xPath\r
      *            xpath query string array\r
      * @returns An array of XmlObject if elements are found at the specified\r
@@ -222,7 +222,7 @@ public class SurfaceAreaQuery {
     /**\r
      * Search XML documents named by "rootName" for the given xPath, using\r
      * relative path (starting with '$this')\r
-     * \r
+     *\r
      * @param rootName\r
      *            The top level element name\r
      * @param xPath\r
@@ -258,7 +258,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve SourceFiles/Filename for specified ARCH type\r
-     * \r
+     *\r
      * @param arch\r
      *            architecture name\r
      * @returns An 2 dimension string array if elements are found at the known\r
@@ -269,12 +269,7 @@ public class SurfaceAreaQuery {
         String[] xPath;\r
         Object[] returns;\r
 \r
-        if (arch == null || arch.equals("")) {\r
-            xPath = new String[] { "/Filename" };\r
-        } else {\r
-            xPath = new String[] { "/Filename[not(@SupArchList) or @SupArchList='"\r
-                    + arch + "']" };\r
-        }\r
+        xPath = new String[] { "/Filename" };\r
 \r
         returns = get("SourceFiles", xPath);\r
 \r
@@ -283,17 +278,25 @@ public class SurfaceAreaQuery {
         }\r
 \r
         Filename[] sourceFileNames = (Filename[]) returns;\r
-        String[][] outputString = new String[sourceFileNames.length][2];\r
+        List<String[]> outputList = new ArrayList<String[]>();\r
         for (int i = 0; i < sourceFileNames.length; i++) {\r
-            outputString[i][0] = sourceFileNames[i].getToolCode();\r
-            outputString[i][1] = sourceFileNames[i].getStringValue();\r
+            List archList = sourceFileNames[i].getSupArchList();\r
+            if (arch == null || arch.equalsIgnoreCase("") || archList == null || contains(archList, arch)) {\r
+                outputList.add(new String[] {sourceFileNames[i].getToolCode(),sourceFileNames[i].getStringValue()});\r
+            }\r
+        }\r
+\r
+        String[][] outputString = new String[outputList.size()][2];\r
+        for (int index = 0; index < outputList.size(); index++) {\r
+            outputString[index][0] = outputList.get(index)[0];\r
+            outputString[index][1] = outputList.get(index)[1];\r
         }\r
         return outputString;\r
     }\r
 \r
     /**\r
      * Retrieve /PlatformDefinitions/OutputDirectory from FPD\r
-     * \r
+     *\r
      * @returns Directory names array if elements are found at the known xpath\r
      * @returns Empty if nothing is found at the known xpath\r
      */\r
@@ -317,7 +320,7 @@ public class SurfaceAreaQuery {
         }\r
         PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];\r
         if(item.getIntermediateDirectories() == null) {\r
-            return null;     \r
+            return null;\r
         }\r
         else {\r
             return item.getIntermediateDirectories().toString();\r
@@ -334,7 +337,7 @@ public class SurfaceAreaQuery {
         ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];\r
         return item.getFfsFormatKey();\r
     }\r
-    \r
+\r
     public static String getModuleFvBindingKeyword() {\r
         String[] xPath = new String[] { "/" };\r
 \r
@@ -345,7 +348,7 @@ public class SurfaceAreaQuery {
         ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];\r
         return item.getFvBinding();\r
     }\r
-    \r
+\r
     public static List getModuleSupportedArchs() {\r
         String[] xPath = new String[] { "/" };\r
 \r
@@ -356,17 +359,17 @@ public class SurfaceAreaQuery {
         ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];\r
         return item.getSupportedArchitectures();\r
     }\r
-    \r
+\r
     public static BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() {\r
         String[] xPath = new String[] {"/Ffs"};\r
-        \r
+\r
         Object[] returns = get("BuildOptions", xPath);\r
         if (returns == null || returns.length == 0) {\r
             return new BuildOptionsDocument.BuildOptions.Ffs[0];\r
         }\r
         return (BuildOptionsDocument.BuildOptions.Ffs[])returns;\r
     }\r
-    \r
+\r
     public static String getModuleOutputFileBasename() {\r
         String[] xPath = new String[] { "/" };\r
 \r
@@ -377,18 +380,18 @@ public class SurfaceAreaQuery {
         ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];\r
         return item.getOutputFileBasename();\r
     }\r
-    \r
+\r
     /**\r
      * Retrieve BuildOptions/Option or Arch/Option\r
-     * \r
+     *\r
      * @param toolChainFamilyFlag\r
      *            if true, retrieve options for toolchain family; otherwise for\r
      *            toolchain\r
-     * \r
+     *\r
      * @returns String[][5] name, target, toolchain, arch, coommand of options\r
      *          if elements are found at the known xpath. String[0][] if dont\r
      *          find element.\r
-     * \r
+     *\r
      * @returns Empty array if nothing is there\r
      */\r
     public static String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) {\r
@@ -397,7 +400,6 @@ public class SurfaceAreaQuery {
         String toolchainFamily = null;\r
         List<String> archList = null;\r
         String cmd = null;\r
-        String targetName = null;\r
         String optionName = null;\r
 \r
         Object[] returns = get(from, xPath);\r
@@ -442,19 +444,16 @@ public class SurfaceAreaQuery {
             }\r
 \r
             archList = new ArrayList<String>();\r
-            List<String> archEnumList = option.getSupArchList();            \r
+            List archEnumList = option.getSupArchList();\r
             if (archEnumList == null) {\r
                 archList.add(null);\r
             } else {\r
-                archList.addAll(archEnumList);\r
-                /*\r
+                //archList.addAll(archEnumList);\r
                 Iterator it = archEnumList.iterator();\r
                 while (it.hasNext()) {\r
-                    System.out.println(it.next().getClass().getName());\r
-                    SupportedArchitectures.Enum archType = it.next();\r
-                    archList.add(archType.toString());\r
+                    String archType = (String)it.next();\r
+                    archList.add(archType);\r
                 }\r
-                */\r
             }\r
 \r
             cmd = option.getToolCode();\r
@@ -481,7 +480,7 @@ public class SurfaceAreaQuery {
 \r
     public static String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) {\r
         String[] xPath;\r
-        \r
+\r
         if (toolChainFamilyFlag == true) {\r
             xPath = new String[] {\r
                     "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",\r
@@ -492,8 +491,8 @@ public class SurfaceAreaQuery {
                     "/Options/Option[@TagName]", };\r
         }\r
         return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag);\r
-    }   \r
-    \r
+    }\r
+\r
     public static String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) {\r
         String[] xPath;\r
 \r
@@ -517,7 +516,7 @@ public class SurfaceAreaQuery {
         if (returns == null || returns.length == 0) {\r
             return null;\r
         }\r
-        \r
+\r
         PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];\r
         ToolChainInfo toolChainInfo = new ToolChainInfo();\r
         toolChainInfo.addTargets(item.getBuildTargets().toString());\r
@@ -528,7 +527,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve <xxxHeader>/ModuleType\r
-     * \r
+     *\r
      * @returns The module type name if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -546,10 +545,10 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve PackageDependencies/Package\r
-     * \r
+     *\r
      * @param arch\r
      *            Architecture name\r
-     * \r
+     *\r
      * @returns package name list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -558,41 +557,51 @@ public class SurfaceAreaQuery {
         String packageGuid = null;\r
         String packageVersion = null;\r
 \r
-        if (arch == null || arch.equals("")) {\r
-            xPath = new String[] { "/Package" };\r
-        } else {\r
-            xPath = new String[] { "/Package[not(@SupArchList) or @SupArchList='"\r
-                    + arch + "']" };\r
-        }\r
+\r
+        xPath = new String[] { "/Package" };\r
 \r
         Object[] returns = get("PackageDependencies", xPath);\r
         if (returns == null) {\r
             return new PackageIdentification[0];\r
         }\r
-        PackageIdentification[] packageIdList = new PackageIdentification[returns.length];\r
+\r
+        //\r
+        //  Get packageIdentification\r
+        //\r
+        List<PackageIdentification> packageIdList = new ArrayList<PackageIdentification>();\r
         for (int i = 0; i < returns.length; i++) {\r
             PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];\r
-            packageGuid = item.getPackageGuid();\r
-            packageVersion = item.getPackageVersion();\r
-            packageIdList[i] = (new PackageIdentification(null, packageGuid,\r
+            List archList = item.getSupArchList();\r
+            if (arch == null || archList == null || contains(archList, arch)) {\r
+                packageGuid = item.getPackageGuid();\r
+                packageVersion = item.getPackageVersion();\r
+                packageIdList.add(new PackageIdentification(null, packageGuid,\r
                     packageVersion));\r
+            }\r
+        }\r
+\r
+        //\r
+        //  transfer packageIdentification list to array.\r
+        //\r
+        PackageIdentification[] packageIdArray = new PackageIdentification[packageIdList.size()];\r
+        for (int i = 0; i < packageIdList.size(); i++) {\r
+            packageIdArray[i] = new PackageIdentification(null, packageIdList.get(i).getGuid(),packageIdList.get(i).getVersion());\r
         }\r
-        return packageIdList;\r
+        return packageIdArray;\r
     }\r
 \r
     /**\r
      * Retrieve LibraryClassDefinitions/LibraryClass for specified usage\r
-     * \r
+     *\r
      * @param usage\r
      *            Library class usage\r
-     * \r
+     *\r
      * @returns LibraryClass objects list if elements are found at the known\r
      *          xpath\r
      * @returns null if nothing is there\r
      */\r
-    public static String[] getLibraryClasses(String usage) {\r
+    public static String[] getLibraryClasses(String usage, String arch) {\r
         String[] xPath;\r
-\r
         if (usage == null || usage.equals("")) {\r
             xPath = new String[] { "/LibraryClass" };\r
         } else {\r
@@ -605,16 +614,24 @@ public class SurfaceAreaQuery {
         }\r
 \r
         LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns;\r
-        String[] libraryClassName = new String[libraryClassList.length];\r
+        List<String> libraryClassName = new ArrayList<String>();\r
         for (int i = 0; i < libraryClassList.length; i++) {\r
-            libraryClassName[i] = libraryClassList[i].getKeyword();\r
+                       List archList = libraryClassList[i].getSupArchList();\r
+\r
+                       if (arch == null || contains(archList, arch)) {\r
+                libraryClassName.add(libraryClassList[i].getKeyword());\r
+                       }\r
         }\r
-        return libraryClassName;\r
+               String[] libraryArray = new String[libraryClassName.size()];\r
+               for (int i = 0; i < libraryClassName.size(); i++) {\r
+                       libraryArray[i] = libraryClassName.get(i);\r
+               }\r
+        return libraryArray;\r
     }\r
 \r
     /**\r
      * Retrieve ModuleEntryPoint names\r
-     * \r
+     *\r
      * @returns ModuleEntryPoint name list if elements are found at the known\r
      *          xpath\r
      * @returns null if nothing is there\r
@@ -639,10 +656,10 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * retrieve Protocol for specified usage\r
-     * \r
+     *\r
      * @param usage\r
      *            Protocol usage arch Architecture\r
-     * \r
+     *\r
      * @returns Protocol String list if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -654,7 +671,7 @@ public class SurfaceAreaQuery {
         if (arch == null || arch.equals("")) {\r
             return new String[0];\r
         } else {\r
-            archXpath = "/Protocol[@SupArchList='" + arch + "']";\r
+            archXpath = "/Protocol";\r
             if (usage != null && !usage.equals("")) {\r
                 usageXpath = "/Protocol[@Usage='" + usage + "']";\r
                 xPath = new String[] { usageXpath, archXpath };\r
@@ -679,10 +696,10 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * retrieve Protocol for specified usage\r
-     * \r
+     *\r
      * @param arch\r
      *            Architecture\r
-     * \r
+     *\r
      * @returns Protocol String list if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -699,24 +716,29 @@ public class SurfaceAreaQuery {
         if (returns == null) {\r
             return new String[0];\r
         }\r
-        Protocol[] protocolList = (Protocol[]) returns;\r
+        Protocol[] returnlList = (Protocol[]) returns;\r
+\r
+        List<String> protocolList = new ArrayList<String>();\r
 \r
-        String[] protocolArray = new String[returns.length];\r
         for (int i = 0; i < returns.length; i++) {\r
-            List<String> archList = protocolList[i].getSupArchList();\r
-            if (archList == null || archList.contains(arch)){\r
-                protocolArray[i] = protocolList[i].getProtocolCName(); \r
+            List archList = returnlList[i].getSupArchList();\r
+            if (archList == null || contains(archList, arch)){\r
+                protocolList.add(returnlList[i].getProtocolCName());\r
             }\r
         }\r
+        String[] protocolArray = new String[protocolList.size()];\r
+        for (int i = 0; i < protocolList.size(); i++) {\r
+            protocolArray[i] = protocolList.get(i);\r
+        }\r
         return protocolArray;\r
     }\r
 \r
     /**\r
      * Retrieve ProtocolNotify for specified usage\r
-     * \r
+     *\r
      * @param usage\r
      *            ProtocolNotify usage\r
-     * \r
+     *\r
      * @returns String[] if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -734,24 +756,28 @@ public class SurfaceAreaQuery {
             return new String[0];\r
         }\r
 \r
-        String[] protocolNotifyList = new String[returns.length];\r
+        List<String> protocolNotifyList = new ArrayList<String>();\r
+\r
         for (int i = 0; i < returns.length; i++) {\r
-            List<String> archList = ((ProtocolNotify) returns[i]).getSupArchList();\r
-            if (archList == null || archList.contains(arch)){\r
-                protocolNotifyList[i] = ((ProtocolNotify) returns[i]).getProtocolNotifyCName();\r
+            List archList = ((ProtocolNotify) returns[i]).getSupArchList();\r
+            if (archList == null || contains(archList, arch)){\r
+                protocolNotifyList.add(((ProtocolNotify) returns[i]).getProtocolNotifyCName());\r
             }\r
-            \r
-        }\r
 \r
-        return protocolNotifyList;\r
+        }\r
+        String[] protocolNotifyArray = new String[protocolNotifyList.size()];\r
+        for (int i = 0; i < protocolNotifyList.size(); i++) {\r
+            protocolNotifyArray[i] = protocolNotifyList.get(i);\r
+        }\r
+        return protocolNotifyArray;\r
     }\r
 \r
     /**\r
      * Retrieve ProtocolNotify for specified usage\r
-     * \r
+     *\r
      * @param usage\r
      *            ProtocolNotify usage\r
-     * \r
+     *\r
      * @returns String[] if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -764,7 +790,7 @@ public class SurfaceAreaQuery {
         if (arch == null || arch.equals("")) {\r
             return new String[0];\r
         } else {\r
-            archXpath = "/ProtocolNotify[@SupArchList='" + arch + "']";\r
+            archXpath = "/ProtocolNotify";\r
             if (usage != null && !usage.equals("")) {\r
                 usageXpath = "/ProtocolNotify[@Usage='" + arch + "']";\r
                 xPath = new String[] { archXpath, usageXpath };\r
@@ -788,7 +814,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve ModuleUnloadImage names\r
-     * \r
+     *\r
      * @returns ModuleUnloadImage name list if elements are found at the known\r
      *          xpath\r
      * @returns null if nothing is there\r
@@ -813,7 +839,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve Extern\r
-     * \r
+     *\r
      * @returns Extern objects list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -830,10 +856,10 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve PpiNotify for specified arch\r
-     * \r
+     *\r
      * @param arch\r
      *            PpiNotify arch\r
-     * \r
+     *\r
      * @returns String[] if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -851,25 +877,30 @@ public class SurfaceAreaQuery {
             return new String[0];\r
         }\r
 \r
-        String[] ppiNotifyList = new String[returns.length];\r
+\r
+        List<String> ppiNotifyList = new ArrayList<String>();\r
         for (int i = 0; i < returns.length; i++) {\r
-            List<String> archList = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getSupArchList();\r
-            if (archList == null || archList.contains(arch)){\r
-                ppiNotifyList[i] = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName();    \r
+            List archList = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getSupArchList();\r
+            if (archList == null || contains(archList, arch)){\r
+                ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName());\r
             }\r
-            \r
+\r
+        }\r
+        String[] ppiNotifyArray = new String[ppiNotifyList.size()];\r
+        for (int i = 0; i < ppiNotifyList.size(); i++) {\r
+            ppiNotifyArray[i] = ppiNotifyList.get(i);\r
         }\r
 \r
-        return ppiNotifyList;\r
+        return ppiNotifyArray;\r
     }\r
 \r
     /**\r
      * Retrieve PpiNotify for specified usage and arch\r
-     * \r
+     *\r
      * @param arch\r
      *            PpiNotify arch usage PpiNotify usage\r
-     * \r
-     * \r
+     *\r
+     *\r
      * @returns String[] if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -906,10 +937,10 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve Ppi for specified arch\r
-     * \r
+     *\r
      * @param arch\r
      *            Ppi arch\r
-     * \r
+     *\r
      * @returns String[] if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -927,24 +958,28 @@ public class SurfaceAreaQuery {
             return new String[0];\r
         }\r
 \r
-        String[] ppiList = new String[returns.length];\r
+        List<String> ppiList = new ArrayList<String>();\r
         for (int i = 0; i < returns.length; i++) {\r
-            List<String> archList = ((PPIsDocument.PPIs.Ppi) returns[i]).getSupArchList();\r
-            if (archList == null || archList.contains(arch)){\r
-                ppiList[i] = ((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName();    \r
+            List archList = ((PPIsDocument.PPIs.Ppi) returns[i]).getSupArchList();\r
+            if (archList == null || contains(archList, arch)){\r
+                ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName());\r
             }\r
-            \r
+\r
         }\r
-        return ppiList;\r
+        String[] ppiArray = new String[ppiList.size()];\r
+        for (int i = 0; i < ppiList.size(); i++) {\r
+            ppiArray[i] = ppiList.get(i);\r
+        }\r
+        return ppiArray;\r
     }\r
 \r
     /**\r
      * Retrieve PpiNotify for specified usage and arch\r
-     * \r
+     *\r
      * @param arch\r
      *            PpiNotify arch usage PpiNotify usage\r
-     * \r
-     * \r
+     *\r
+     *\r
      * @returns String[] if elements are found at the known xpath\r
      * @returns String[0] if nothing is there\r
      */\r
@@ -981,10 +1016,10 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve GuidEntry information for specified usage\r
-     * \r
+     *\r
      * @param arch\r
      *            GuidEntry arch\r
-     * \r
+     *\r
      * @returns GuidEntry objects list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1001,24 +1036,29 @@ public class SurfaceAreaQuery {
         if (returns == null) {\r
             return new String[0];\r
         }\r
-        String[] guidList = new String[returns.length];\r
+\r
+        List<String> guidList = new ArrayList<String>();\r
         for (int i = 0; i < returns.length; i++) {\r
-            List<String> archList = ((GuidsDocument.Guids.GuidCNames) returns[i]).getSupArchList();\r
-            if (archList == null || archList.contains(arch)){\r
-                guidList[i] = ((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName();    \r
+            List archList = ((GuidsDocument.Guids.GuidCNames) returns[i]).getSupArchList();\r
+            if (archList == null || contains(archList, arch)){\r
+                guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName());\r
             }\r
-            \r
+\r
         }\r
-        return guidList;\r
+        String[] guidArray = new String[guidList.size()];\r
+        for (int i = 0; i < guidList.size(); i++) {\r
+            guidArray[i] = guidList.get(i);\r
+        }\r
+        return guidArray;\r
 \r
     }\r
 \r
     /**\r
      * Retrieve GuidEntry information for specified usage\r
-     * \r
+     *\r
      * @param arch\r
      *            GuidEntry arch usage GuidEntry usage\r
-     * \r
+     *\r
      * @returns GuidEntry objects list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1054,12 +1094,12 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve Library instance information\r
-     * \r
+     *\r
      * @param arch\r
      *            Architecture name\r
      * @param usage\r
      *            Library instance usage\r
-     * \r
+     *\r
      * @returns library instance name list if elements are found at the known\r
      *          xpath\r
      * @returns null if nothing is there\r
@@ -1074,6 +1114,11 @@ public class SurfaceAreaQuery {
         if (arch == null || arch.equalsIgnoreCase("")) {\r
             xPath = new String[] { "/Instance" };\r
         } else {\r
+            //\r
+            // Since Schema don't have SupArchList now, so the follow Xpath is\r
+            // equal to "/Instance" and [not(@SupArchList) or @SupArchList= arch]\r
+            // don't have effect.\r
+            //\r
             xPath = new String[] { "/Instance[not(@SupArchList) or @SupArchList='"\r
                     + arch + "']" };\r
         }\r
@@ -1125,7 +1170,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive library's constructor name\r
-     * \r
+     *\r
      * @returns constructor name list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1143,7 +1188,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive library's destructor name\r
-     * \r
+     *\r
      * @returns destructor name list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1164,7 +1209,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive DriverBinding names\r
-     * \r
+     *\r
      * @returns DriverBinding name list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1175,7 +1220,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive ComponentName names\r
-     * \r
+     *\r
      * @returns ComponentName name list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1186,7 +1231,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive DriverConfig names\r
-     * \r
+     *\r
      * @returns DriverConfig name list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1197,7 +1242,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive DriverDiag names\r
-     * \r
+     *\r
      * @returns DriverDiag name list if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1208,7 +1253,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive SetVirtualAddressMapCallBack names\r
-     * \r
+     *\r
      * @returns SetVirtualAddressMapCallBack name list if elements are found at\r
      *          the known xpath\r
      * @returns null if nothing is there\r
@@ -1220,7 +1265,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrive ExitBootServicesCallBack names\r
-     * \r
+     *\r
      * @returns ExitBootServicesCallBack name list if elements are found at the\r
      *          known xpath\r
      * @returns null if nothing is there\r
@@ -1232,7 +1277,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve module surface area file information\r
-     * \r
+     *\r
      * @returns ModuleSA objects list if elements are found at the known xpath\r
      * @returns Empty ModuleSA list if nothing is there\r
      */\r
@@ -1262,24 +1307,24 @@ public class SurfaceAreaQuery {
                 ObjectMap.put("Libraries", moduleSA.getLibraries());\r
             }\r
             if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) {\r
-                ObjectMap.put("PcdBuildDefinition", moduleSA\r
-                        .getPcdBuildDefinition());\r
+                ObjectMap.put("PcdBuildDefinition", moduleSA.getPcdBuildDefinition());\r
             }\r
-            if (((ModuleSADocument.ModuleSA) result[i])\r
-                    .getModuleSaBuildOptions() != null) {\r
-                ObjectMap.put("ModuleSaBuildOptions", moduleSA\r
-                        .getModuleSaBuildOptions());\r
+            if (((ModuleSADocument.ModuleSA) result[i]).getModuleSaBuildOptions() != null) {\r
+                ObjectMap.put("ModuleSaBuildOptions", moduleSA.getModuleSaBuildOptions());\r
             }\r
 \r
             //\r
             // Get Fpd SA Module attribute and create FpdMoudleIdentification.\r
             //\r
-            arch = moduleSA.getSupArchList().toString();\r
+            if (moduleSA.isSetSupArchList()) {\r
+                arch = moduleSA.getSupArchList().toString();\r
+            } else {\r
+                arch = null;\r
+            }\r
 \r
             // TBD\r
             fvBinding = null;\r
-            saVersion = ((ModuleSADocument.ModuleSA) result[i])\r
-                    .getModuleVersion();\r
+            saVersion = ((ModuleSADocument.ModuleSA) result[i]).getModuleVersion();\r
 \r
             saGuid = moduleSA.getModuleGuid();\r
             pkgGuid = moduleSA.getPackageGuid();\r
@@ -1289,10 +1334,8 @@ public class SurfaceAreaQuery {
             // Create Module Identification which have class member of package\r
             // identification.\r
             //\r
-            PackageIdentification pkgId = new PackageIdentification(null,\r
-                    pkgGuid, pkgVersion);\r
-            ModuleIdentification saId = new ModuleIdentification(null, saGuid,\r
-                    saVersion);\r
+            PackageIdentification pkgId = new PackageIdentification(null, pkgGuid, pkgVersion);\r
+            ModuleIdentification saId = new ModuleIdentification(null, saGuid, saVersion);\r
 \r
             saId.setPackage(pkgId);\r
 \r
@@ -1300,21 +1343,24 @@ public class SurfaceAreaQuery {
             // Create FpdModule Identification which have class member of module\r
             // identification\r
             //\r
-            if (arch != null) {\r
-                String[] archList = arch.split(" ");\r
-                for (int j = 0; j < archList.length; j++) {\r
-                    FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId,    archList[j]);\r
-        \r
-                    if (fvBinding != null) {\r
-                        fpdSaId.setFvBinding(fvBinding);\r
-                    }\r
-        \r
-                    //\r
-                    // Put element to Map<FpdModuleIdentification, Map<String,\r
-                    // Object>>.\r
-                    //\r
-                    fpdModuleMap.put(fpdSaId, ObjectMap);\r
+            String[] archList = new String[0];\r
+            if (arch == null || arch.trim().length() == 0) {\r
+                archList = GlobalData.getToolChainInfo().getArchs();\r
+            } else {\r
+                archList = arch.split(" ");\r
+            }\r
+            for (int j = 0; j < archList.length; j++) {\r
+                FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, archList[j]);\r
+\r
+                if (fvBinding != null) {\r
+                    fpdSaId.setFvBinding(fvBinding);\r
                 }\r
+\r
+                //\r
+                // Put element to Map<FpdModuleIdentification, Map<String,\r
+                // Object>>.\r
+                //\r
+                fpdModuleMap.put(fpdSaId, ObjectMap);\r
             }\r
         }\r
         return fpdModuleMap;\r
@@ -1322,7 +1368,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve valid image names\r
-     * \r
+     *\r
      * @returns valid iamges name list if elements are found at the known xpath\r
      * @returns empty list if nothing is there\r
      */\r
@@ -1341,29 +1387,43 @@ public class SurfaceAreaQuery {
 \r
         return result;\r
     }\r
-    \r
-    public static XmlObject getFpdUserExtension() {\r
-        String[] xPath = new String[] { "" };\r
+\r
+    public static Node getFpdUserExtensionPreBuild() {\r
+        String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };\r
 \r
         Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
-        if (queryResult == null) {\r
+        if (queryResult == null || queryResult.length == 0) {\r
             return null;\r
         }\r
-        return null;\r
+        UserExtensionsDocument.UserExtensions a =  (UserExtensionsDocument.UserExtensions)queryResult[0];\r
+\r
+        return a.getDomNode();\r
+    }\r
+\r
+    public static Node getFpdUserExtensionPostBuild() {\r
+        String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };\r
+\r
+        Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
+        if (queryResult == null || queryResult.length == 0) {\r
+            return null;\r
+        }\r
+        UserExtensionsDocument.UserExtensions a =  (UserExtensionsDocument.UserExtensions)queryResult[0];\r
+\r
+        return a.getDomNode();\r
     }\r
 \r
     /**\r
      * Retrieve FV image option information\r
-     * \r
+     *\r
      * @param fvName\r
      *            FV image name\r
-     * \r
+     *\r
      * @returns option name/value list if elements are found at the known xpath\r
      * @returns empty list if nothing is there\r
      */\r
     public static String[][] getFpdOptions(String fvName) {\r
            String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='"\r
-                      + fvName.toUpperCase() + "']/FvImageOptions" };\r
+                      + fvName + "']/FvImageOptions" };\r
            Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
            if (queryResult == null) {\r
                  return new String[0][];\r
@@ -1421,24 +1481,24 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve FV image attributes information\r
-     * \r
+     *\r
      * @param fvName\r
      *            FV image name\r
-     * \r
+     *\r
      * @returns attribute name/value list if elements are found at the known\r
      *          xpath\r
      * @returns empty list if nothing is there\r
      */\r
     public static String[][] getFpdAttributes(String fvName) {\r
         String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='"\r
-                         + fvName.toUpperCase() + "']/FvImageOptions" };\r
+                         + fvName + "']/FvImageOptions" };\r
         Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
         if (queryResult == null) {\r
              return new String[0][];\r
         }\r
         ArrayList<String[]> list = new ArrayList<String[]>();\r
         for (int i = 0; i < queryResult.length; i++) {\r
-            \r
+\r
             FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];\r
             List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item.getNameValueList();\r
             Iterator iter = namevalues.iterator();\r
@@ -1458,7 +1518,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve flash definition file name\r
-     * \r
+     *\r
      * @returns file name if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1482,26 +1542,26 @@ public class SurfaceAreaQuery {
         }\r
 \r
         String[][] result = new String[queryResult.length][2];\r
-        \r
+\r
         for (int i = 0; i < queryResult.length; i++) {\r
             FvImagesDocument.FvImages.NameValue item = (FvImagesDocument.FvImages.NameValue)queryResult[i];\r
             result[i][0] = item.getName();\r
             result[i][1] = item.getValue();\r
         }\r
-        return result;   \r
+        return result;\r
     }\r
-    \r
+\r
     /**\r
      * Retrieve FV image component options\r
-     * \r
+     *\r
      * @param fvName\r
      *            FV image name\r
-     * \r
+     *\r
      * @returns name/value pairs list if elements are found at the known xpath\r
      * @returns empty list if nothing is there\r
      */\r
     public static String[][] getFpdComponents(String fvName) {\r
-        String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName.toUpperCase() + "']/FvImageOptions" };\r
+        String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName + "']/FvImageOptions" };\r
         Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
         if (queryResult == null) {\r
             return new String[0][];\r
@@ -1523,12 +1583,12 @@ public class SurfaceAreaQuery {
                result[i][0] = list.get(i)[0];\r
              result[i][1] = list.get(i)[1];\r
         }\r
-            return result;  \r
+            return result;\r
     }\r
 \r
     /**\r
      * Retrieve PCD tokens\r
-     * \r
+     *\r
      * @returns CName/ItemType pairs list if elements are found at the known\r
      *          xpath\r
      * @returns null if nothing is there\r
@@ -1541,86 +1601,12 @@ public class SurfaceAreaQuery {
             return null;\r
         }\r
 \r
-        // PcdCoded.PcdData[] pcds = (PcdCoded.PcdData[]) returns;\r
-        // String[][] result = new String[pcds.length][2];\r
-        // for (int i = 0; i < returns.length; ++i) {\r
-        // if (pcds[i].getItemType() != null) {\r
-        // result[i][1] = pcds[i].getItemType().toString();\r
-        // } else {\r
-        // result[i][1] = null;\r
-        // }\r
-        // result[i][0] = pcds[i].getCName();\r
-        // }\r
-\r
         return null;\r
     }\r
 \r
-    /**\r
-     * Get the PcdToken array from module's surface area document. The array\r
-     * should contains following data:\r
-     * <p>\r
-     * -------------------------------------------------------------------\r
-     * </p>\r
-     * <p>\r
-     * CName | ItemType | TokenspaceName | DefaultValue | Usage | HelpText\r
-     * </p>\r
-     * <p>\r
-     * -------------------------------------------------------------------\r
-     * </p>\r
-     * <p>\r
-     * Note: Until new schema applying, now we can only get CName, ItemType,\r
-     * </p>\r
-     * \r
-     * @return 2-array table contains all information of PCD token retrieved\r
-     *         from MSA.\r
-     */\r
-    public static Object[][] etModulePCDTokenArray() {\r
-        return null;\r
-        // int index;\r
-        // Object[][] result;\r
-        // PCDs.PcdData[] pcds;\r
-        // String[] xPath = new String[] { "/PcdData" };\r
-        // Object[] returns = get("PCDs", xPath);\r
-        //\r
-        // if ((returns == null) || (returns.length == 0)) {\r
-        // return null;\r
-        // }\r
-        //\r
-        // pcds = (PCDs.PcdData[]) returns;\r
-        // result = new Object[pcds.length][6];\r
-        // for (index = 0; index < pcds.length; index++) {\r
-        // //\r
-        // // Get CName\r
-        // //\r
-        // result[index][0] = pcds[index].getCName();\r
-        // //\r
-        // // Get ItemType: FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODLE,\r
-        // // DYNAMIC, DYNAMIC_EX\r
-        // //\r
-        // if (pcds[index].getItemType() != null) {\r
-        // result[index][1] = pcds[index].getItemType().toString();\r
-        // } else {\r
-        // result[index][1] = null;\r
-        // }\r
-        //\r
-        // //\r
-        // // BUGBUG: following field can *not* be got from current MSA until\r
-        // // schema changed.\r
-        // //\r
-        // // result [index][2] = pcds[index].getTokenSpaceName();\r
-        // result[index][2] = null;\r
-        // result[index][3] = pcds[index].getDefaultValue();\r
-        // // result [index][4] = pcds[index].getUsage ();\r
-        // result[index][4] = null;\r
-        // // result [index][5] = pcds[index].getHelpText ();\r
-        // result[index][5] = null;\r
-        // }\r
-        // return result;\r
-    }\r
-\r
     /**\r
      * Retrieve MAS header\r
-     * \r
+     *\r
      * @return\r
      * @return\r
      */\r
@@ -1652,12 +1638,12 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retrieve Extern Specification\r
-     * \r
+     *\r
      * @param\r
-     * \r
+     *\r
      * @return String[] If have specification element in the <extern> String[0]\r
      *         If no specification element in the <extern>\r
-     * \r
+     *\r
      */\r
 \r
     public static String[] getExternSpecificaiton() {\r
@@ -1678,7 +1664,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * Retreive MsaFile which in SPD\r
-     * \r
+     *\r
      * @param\r
      * @return String[][3] The string sequence is ModuleName, ModuleGuid,\r
      *         ModuleVersion, MsaFile String[0][] If no msafile in SPD\r
@@ -1737,7 +1723,7 @@ public class SurfaceAreaQuery {
         if (returns == null) {\r
             return packageIncludeMap;\r
         }\r
-//        GlobalData.log.info("" + returns[0].getClass().getName());\r
+\r
         for (int i = 0; i < returns.length; i++) {\r
             PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i];\r
             packageIncludeMap.put(includeHeader.getModuleType().toString(),\r
@@ -1787,7 +1773,7 @@ public class SurfaceAreaQuery {
             String[] guidPair = new String[2];\r
             guidPair[0] = entry.getCName();\r
             guidPair[1] = entry.getGuidValue();\r
-            guidDeclMap.put(entry.getName(), guidPair);\r
+            guidDeclMap.put(entry.getCName(), guidPair);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r
             EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[0]);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[1]);\r
@@ -1818,7 +1804,7 @@ public class SurfaceAreaQuery {
 \r
             protocolPair[0] = entry.getCName();\r
             protocolPair[1] = entry.getGuidValue();\r
-            protoclMap.put(entry.getName(), protocolPair);\r
+            protoclMap.put(entry.getCName(), protocolPair);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r
             EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[0]);\r
             EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[1]);\r
@@ -1828,7 +1814,7 @@ public class SurfaceAreaQuery {
 \r
     /**\r
      * getSpdPpi() Retrieve the SPD PPI Entry\r
-     * \r
+     *\r
      * @param\r
      * @return Map<String, String[2]> if get the PPI entry from SPD. Key - PPI\r
      *         Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI\r
@@ -1853,39 +1839,14 @@ public class SurfaceAreaQuery {
             String[] ppiPair = new String[2];\r
             ppiPair[0] = entry.getCName();\r
             ppiPair[1] = entry.getGuidValue();\r
-            ppiMap.put(entry.getName(), ppiPair);\r
+            ppiMap.put(entry.getCName(), ppiPair);\r
         }\r
         return ppiMap;\r
     }\r
 \r
-    /**\r
-     * getToolChainFamily\r
-     * \r
-     * This function is to retrieve ToolChainFamily attribute of FPD\r
-     * <BuildOptions>\r
-     * \r
-     * @param\r
-     * @return toolChainFamily If find toolChainFamily attribute in\r
-     *         <BuildOptions> Null If don't have toolChainFamily in\r
-     *         <BuildOptions>.\r
-     */\r
-    public String getToolChainFamily() {\r
-        String toolChainFamily;\r
-        String[] xPath = new String[] { "/BuildOptions" };\r
-\r
-        Object[] result = get("PlatformSurfaceArea", xPath);\r
-        if (result == null) {\r
-            return null;\r
-        }\r
-        // toolChainFamily =\r
-        // ((BuildOptionsDocument.BuildOptions)result[0]).getToolChainFamilies();\r
-        // return toolChainFamily;\r
-        return null;\r
-    }\r
-\r
     /**\r
      * Retrieve module Guid string\r
-     * \r
+     *\r
      * @returns GUILD string if elements are found at the known xpath\r
      * @returns null if nothing is there\r
      */\r
@@ -1917,26 +1878,63 @@ public class SurfaceAreaQuery {
     /**\r
     Get name array of PCD in a module. In one module, token space\r
     is same, and token name should not be conflicted.\r
-    \r
+\r
     @return String[]\r
- **/\r
- public static String[] getModulePcdEntryNameArray() {\r
-     PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries  = null;\r
-     String[]            results;\r
-     int                 index;\r
-     String[]            xPath       = new String[] {"/PcdEntry"};\r
-     Object[]         returns     = get ("PcdCoded", xPath);\r
-     \r
-     if (returns == null) {\r
-         return new String[0];\r
-     }\r
-     \r
-     pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns;\r
-     results    = new String[pcdEntries.length];\r
-     \r
-     for (index = 0; index < pcdEntries.length; index ++) {\r
-         results[index] = pcdEntries[index].getCName();\r
-     }\r
-     return results;\r
- }\r
+    **/\r
+    public static String[] getModulePcdEntryNameArray() {\r
+        PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries  = null;\r
+        String[]            results;\r
+        int                 index;\r
+        String[]            xPath       = new String[] {"/PcdEntry"};\r
+        Object[]         returns     = get ("PcdCoded", xPath);\r
+\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns;\r
+        results    = new String[pcdEntries.length];\r
+\r
+        for (index = 0; index < pcdEntries.length; index ++) {\r
+            results[index] = pcdEntries[index].getCName();\r
+        }\r
+        return results;\r
+    }\r
+\r
+    /**\r
+     Search in a List for a given string\r
+\r
+     @return boolean\r
+     **/\r
+    public static boolean contains(List list, String str) {\r
+               if (list == null || list.size()== 0) {\r
+                       return true;\r
+               }\r
+        Iterator it = list.iterator();\r
+        while (it.hasNext()) {\r
+            String s = (String)it.next();\r
+            if (s.equalsIgnoreCase(str)) {\r
+                return true;\r
+            }\r
+        }\r
+\r
+        return false;\r
+    }\r
+\r
+       public static boolean isHaveTianoR8FlashMap(){\r
+        String[]            xPath       = new String[] {"/"};\r
+        Object[]         returns     = get ("Externs", xPath);\r
+\r
+        if (returns == null) {\r
+            return false;\r
+        }\r
+\r
+               ExternsDocument.Externs ext = (ExternsDocument.Externs)returns[0];\r
+\r
+               if (ext.getTianoR8FlashMapH()){\r
+                       return true;\r
+           }else {\r
+                       return false;\r
+               }\r
+       }\r
 }\r