import org.tianocore.PPIsDocument;\r
import org.tianocore.PackageNameDocument;\r
import org.tianocore.ProtocolsDocument;\r
-import org.tianocore.PCDsDocument.PCDs;\r
+import org.tianocore.PcdCodedDocument.PcdCoded;\r
+import org.tianocore.MsaHeaderDocument;\r
+import org.tianocore.MsaHeaderDocument.MsaHeader;\r
\r
/**\r
SurfaceAreaQuery class is used to query Surface Area information from msa, mbd,\r
};\r
} else {\r
xPath = new String[] {\r
- "/Filename[not(@ArchType) or @ArchType='ALL' or @ArchType='" + arch + "']",\r
+ "/Filename[not(@SupArchList) and not(@ArchType) or @SupArchList='ALL' or @SupArchList='" + arch + "' or @ArchType='ALL' or @ArchType='" + arch + "']",\r
+ "/Filename[not(@SupArchList) and not(@ArchType) or @ArchType='ALL' or @ArchType='" + arch + "']",\r
"/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/Filename"\r
};\r
}\r
} else {\r
xPath = new String[] {\r
"/Option",\r
+ "/Option[@SupArchList='ALL' or @SupArchList='" + arch + "']",\r
"/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/Option"\r
};\r
}\r
return result;\r
}\r
\r
+ public static String getModuleName() {\r
+ String[] xPath = new String[] { "/ModuleName", "/BaseName" };\r
+\r
+ XmlObject[] returns = get(xPath);\r
+ if (returns != null && returns.length > 0) {\r
+ return returns[0].toString();\r
+ }\r
+\r
+ return null;\r
+ }\r
+\r
/**\r
Retrieve <xxxHeader>/ModuleType\r
\r
} else {\r
xPath = new String[] {\r
"/PackageName",\r
+ "/PackageName[@SupArchList='ALL' or @SupArchList='" + arch + "']",\r
+ "/PackageName[@Arch='ALL' or @Arch='" + arch + "']",\r
"/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/PackageName"\r
};\r
}\r
\r
XmlObject[] returns = get("Includes", xPath);\r
if (returns == null || returns.length == 0) {\r
- return null;\r
+ returns = get("PackageDependencies", xPath);\r
+ if (returns == null || returns.length == 0) {\r
+ return null;\r
+ }\r
}\r
\r
List<String> packageNames = new ArrayList<String>();\r
@returns null if nothing is there\r
**/\r
public static String getModuleGuid() {\r
- String[] xPath = new String[] { "/Guid" };\r
+ String[] xPath = new String[] { "" };\r
\r
- XmlObject[] returns = get(xPath);\r
+ XmlObject[] returns = get("MsaHeader", xPath);\r
if (returns != null && returns.length > 0) {\r
- GuidDocument.Guid guid = (GuidDocument.Guid) returns[0];\r
- return guid.getStringValue();\r
+ MsaHeaderDocument.MsaHeader moduleHeader = (MsaHeaderDocument.MsaHeader) returns[0];\r
+ if (moduleHeader.isSetGuid()) {\r
+ return moduleHeader.getGuid().getStringValue();\r
+ } else if (moduleHeader.isSetGuidValue()) {\r
+ return moduleHeader.getGuidValue();\r
+ }\r
+ }\r
+\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ Retrieve module Guid string\r
+ \r
+ @returns GUILD string if elements are found at the known xpath\r
+ @returns null if nothing is there\r
+ **/\r
+ public static String getModuleGuidValue() {\r
+ String[] xPath = new String[] { "" };\r
+\r
+ XmlObject[] returns = get("MsaHeader", xPath);\r
+ if (returns != null && returns.length > 0) { \r
+ MsaHeaderDocument.MsaHeader moduleHeader = (MsaHeaderDocument.MsaHeader) returns[0];\r
+ return moduleHeader.getGuidValue();\r
}\r
\r
return null;\r
}\r
\r
xPath = new String[] {\r
- "/Library" + usageAttribute,\r
+ "/Library" + archAttribute, //usageAttribute,\r
+ "/Library[not(@SupArchList) or @SupArchList='" + arch + "']",\r
"/Arch" + archAttribute + "/Library" + usageAttribute\r
};\r
\r
\r
XmlObject[] result = get("FrameworkPlatformDescription", xPath);\r
if (result == null) {\r
+ xPath = new String[] { "/FrameworkModules/*/ModuleSA" };\r
+ result = get("FrameworkPlatformDescription", xPath);\r
+ if (result != null) {\r
+ return (ModuleSADocument.ModuleSA[]) result;\r
+ }\r
return new ModuleSADocument.ModuleSA[0];\r
}\r
\r
}\r
\r
/**\r
- Retrieve PCD tokens\r
-\r
- @returns CName/ItemType pairs list if elements are found at the known xpath\r
- @returns null if nothing is there\r
- **/\r
- public static String[][] getPcdTokenArray() {\r
- String[] xPath = new String[] {"/PcdData"};\r
- \r
- XmlObject[] returns = get("PCDs", xPath);\r
- if (returns == null || returns.length == 0) {\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
+ @return String[]\r
+ **/\r
+ public static String[] getModulePcdEntryNameArray() {\r
+ PcdCoded.PcdEntry[] pcdEntries = null;\r
+ String[] results;\r
+ int index;\r
+ String[] xPath = new String[] {"/PcdEntry"};\r
+ XmlObject[] returns = get ("PcdCoded", xPath);\r
+ if (returns == null) {\r
return null;\r
}\r
- \r
- PCDs.PcdData[] pcds = (PCDs.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 result;\r
- }\r
\r
- /**\r
- Get the PcdToken array from module's surface area document.\r
- The array should contains following data:\r
- <p>-------------------------------------------------------------------</p>\r
- <p>CName | ItemType | TokenspaceName | DefaultValue | Usage | HelpText</p>\r
- <p>-------------------------------------------------------------------</p>\r
- <p>Note: Until new schema applying, now we can only get CName, ItemType,</p>\r
- \r
- @return 2-array table contains all information of PCD token retrieved from MSA.\r
- **/\r
- public static Object[][] getModulePCDTokenArray () {\r
- int index;\r
- Object[][] result;\r
- PCDs.PcdData[] pcds;\r
- String[] xPath = new String[] {"/PcdData"};\r
- XmlObject[] 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, 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
+ pcdEntries = (PcdCoded.PcdEntry[])returns;\r
+ results = new String[pcdEntries.length];\r
\r
- //\r
- // BUGBUG: following field can *not* be got from current MSA until 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
+ for (index = 0; index < pcdEntries.length; index ++) {\r
+ results[index] = pcdEntries[index].getCName();\r
+ }\r
+ return results;\r
}\r
}\r