]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | This file is for surface area information retrieval.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | package org.tianocore.build.global;\r | |
15 | \r | |
16 | import java.util.ArrayList;\r | |
a29c47e0 | 17 | import java.util.HashMap;\r |
878ddf1f | 18 | import java.util.Iterator;\r |
a29c47e0 | 19 | import java.util.LinkedHashMap;\r |
878ddf1f | 20 | import java.util.List;\r |
21 | import java.util.Map;\r | |
22 | import java.util.Stack;\r | |
23 | import java.util.regex.Matcher;\r | |
24 | import java.util.regex.Pattern;\r | |
25 | \r | |
878ddf1f | 26 | import org.apache.xmlbeans.XmlObject;\r |
27 | import org.apache.xmlbeans.XmlString;\r | |
de4bb9f6 | 28 | import org.tianocore.BuildOptionsDocument;\r |
29 | import org.tianocore.CNameType;\r | |
de4bb9f6 | 30 | import org.tianocore.ExternsDocument;\r |
31 | import org.tianocore.FileNameConvention;\r | |
de4bb9f6 | 32 | import org.tianocore.FvImagesDocument;\r |
de4bb9f6 | 33 | import org.tianocore.GuidDeclarationsDocument;\r |
34 | import org.tianocore.GuidsDocument;\r | |
35 | import org.tianocore.LibrariesDocument;\r | |
36 | import org.tianocore.LibraryClassDeclarationsDocument;\r | |
37 | import org.tianocore.LibraryClassDocument;\r | |
38 | import org.tianocore.ModuleDefinitionsDocument;\r | |
39 | import org.tianocore.ModuleSADocument;\r | |
40 | import org.tianocore.ModuleSaBuildOptionsDocument;\r | |
41 | import org.tianocore.ModuleTypeDef;\r | |
42 | import org.tianocore.MsaFilesDocument;\r | |
43 | import org.tianocore.MsaHeaderDocument;\r | |
44 | import org.tianocore.OptionDocument;\r | |
45 | import org.tianocore.PPIsDocument;\r | |
46 | import org.tianocore.PackageDependenciesDocument;\r | |
47 | import org.tianocore.PackageHeadersDocument;\r | |
48 | import org.tianocore.PcdCodedDocument;\r | |
49 | import org.tianocore.PlatformDefinitionsDocument;\r | |
50 | import org.tianocore.PlatformHeaderDocument;\r | |
51 | import org.tianocore.PpiDeclarationsDocument;\r | |
52 | import org.tianocore.ProtocolDeclarationsDocument;\r | |
53 | import org.tianocore.Sentence;\r | |
54 | import org.tianocore.SpdHeaderDocument;\r | |
8031d48d | 55 | import org.tianocore.UserExtensionsDocument;\r |
a29c47e0 | 56 | import org.tianocore.FilenameDocument.Filename;\r |
250258de | 57 | import org.tianocore.MsaHeaderDocument.MsaHeader;\r |
a29c47e0 | 58 | import org.tianocore.ProtocolsDocument.Protocols.Protocol;\r |
59 | import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;\r | |
a29c47e0 | 60 | import org.tianocore.build.id.FpdModuleIdentification;\r |
61 | import org.tianocore.build.id.ModuleIdentification;\r | |
62 | import org.tianocore.build.id.PackageIdentification;\r | |
63 | import org.tianocore.build.id.PlatformIdentification;\r | |
64 | import org.tianocore.build.toolchain.ToolChainInfo;\r | |
136adffc | 65 | import org.tianocore.logger.EdkLog;\r |
8031d48d | 66 | import org.w3c.dom.Node;\r |
878ddf1f | 67 | \r |
68 | /**\r | |
a29c47e0 | 69 | * SurfaceAreaQuery class is used to query Surface Area information from msa,\r |
70 | * mbd, spd and fpd files.\r | |
71 | * \r | |
72 | * This class should not instantiated. All the public interfaces is static.\r | |
73 | * \r | |
74 | * @since GenBuild 1.0\r | |
75 | */\r | |
878ddf1f | 76 | public class SurfaceAreaQuery {\r |
a29c47e0 | 77 | \r |
78 | public static String prefix = "http://www.TianoCore.org/2006/Edk2.0";\r | |
79 | \r | |
80 | // /\r | |
81 | // / Contains name/value pairs of Surface Area document object. The name is\r | |
82 | // / always the top level element name.\r | |
83 | // /\r | |
878ddf1f | 84 | private static Map<String, XmlObject> map = null;\r |
a29c47e0 | 85 | \r |
86 | // /\r | |
87 | // / mapStack is used to do nested query\r | |
88 | // /\r | |
89 | private static Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();\r | |
90 | \r | |
91 | // /\r | |
92 | // / prefix of name space\r | |
93 | // /\r | |
878ddf1f | 94 | private static String nsPrefix = "sans";\r |
a29c47e0 | 95 | \r |
96 | // /\r | |
97 | // / xmlbeans needs a name space for each Xpath element\r | |
98 | // /\r | |
878ddf1f | 99 | private static String ns = null;\r |
a29c47e0 | 100 | \r |
101 | // /\r | |
102 | // / keep the namep declaration for xmlbeans Xpath query\r | |
103 | // /\r | |
878ddf1f | 104 | private static String queryDeclaration = null;\r |
105 | \r | |
106 | /**\r | |
a29c47e0 | 107 | * Set a Surface Area document for query later\r |
108 | * \r | |
109 | * @param map\r | |
110 | * A Surface Area document in TopLevelElementName/XmlObject\r | |
111 | * format.\r | |
112 | */\r | |
878ddf1f | 113 | public static void setDoc(Map<String, XmlObject> map) {\r |
a29c47e0 | 114 | ns = prefix;\r |
878ddf1f | 115 | queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; ";\r |
116 | SurfaceAreaQuery.map = map;\r | |
117 | }\r | |
118 | \r | |
119 | /**\r | |
a29c47e0 | 120 | * Push current used Surface Area document into query stack. The given new\r |
121 | * document will be used for any immediately followed getXXX() callings,\r | |
122 | * untill pop() is called.\r | |
123 | * \r | |
124 | * @param newMap\r | |
125 | * The TopLevelElementName/XmlObject format of a Surface Area\r | |
126 | * document.\r | |
127 | */\r | |
878ddf1f | 128 | public static void push(Map<String, XmlObject> newMap) {\r |
129 | mapStack.push(SurfaceAreaQuery.map);\r | |
130 | SurfaceAreaQuery.map = newMap;\r | |
131 | }\r | |
a29c47e0 | 132 | \r |
878ddf1f | 133 | /**\r |
a29c47e0 | 134 | * Discard current used Surface Area document and use the top document in\r |
135 | * stack instead.\r | |
136 | */\r | |
878ddf1f | 137 | public static void pop() {\r |
138 | SurfaceAreaQuery.map = mapStack.pop();\r | |
139 | }\r | |
a29c47e0 | 140 | \r |
141 | // /\r | |
142 | // / Convert xPath to be namespace qualified, which is necessary for\r | |
143 | // XmlBeans\r | |
144 | // / selectPath(). For example, converting /MsaHeader/ModuleType to\r | |
145 | // / /ns:MsaHeader/ns:ModuleType\r | |
146 | // /\r | |
878ddf1f | 147 | private static String normalizeQueryString(String[] exp, String from) {\r |
148 | StringBuffer normQueryString = new StringBuffer(4096);\r | |
149 | \r | |
150 | int i = 0;\r | |
151 | while (i < exp.length) {\r | |
152 | String newExp = from + exp[i];\r | |
153 | Pattern pattern = Pattern.compile("([^/]*)(/|//)([^/]+)");\r | |
154 | Matcher matcher = pattern.matcher(newExp);\r | |
155 | \r | |
156 | while (matcher.find()) {\r | |
a29c47e0 | 157 | String starter = newExp.substring(matcher.start(1), matcher\r |
158 | .end(1));\r | |
159 | String seperator = newExp.substring(matcher.start(2), matcher\r | |
160 | .end(2));\r | |
161 | String token = newExp.substring(matcher.start(3), matcher\r | |
162 | .end(3));\r | |
163 | \r | |
878ddf1f | 164 | normQueryString.append(starter);\r |
165 | normQueryString.append(seperator);\r | |
166 | normQueryString.append(nsPrefix);\r | |
167 | normQueryString.append(":");\r | |
168 | normQueryString.append(token);\r | |
169 | }\r | |
170 | \r | |
171 | ++i;\r | |
172 | if (i < exp.length) {\r | |
173 | normQueryString.append(" | ");\r | |
174 | }\r | |
175 | }\r | |
176 | \r | |
177 | return normQueryString.toString();\r | |
178 | }\r | |
179 | \r | |
180 | /**\r | |
a29c47e0 | 181 | * Search all XML documents stored in "map" for the specified xPath, using\r |
182 | * relative path (starting with '$this')\r | |
183 | * \r | |
184 | * @param xPath\r | |
185 | * xpath query string array\r | |
186 | * @returns An array of XmlObject if elements are found at the specified\r | |
187 | * xpath\r | |
188 | * @returns NULL if nothing is at the specified xpath\r | |
189 | */\r | |
190 | public static Object[] get(String[] xPath) {\r | |
878ddf1f | 191 | if (map == null) {\r |
192 | return null;\r | |
193 | }\r | |
a29c47e0 | 194 | \r |
878ddf1f | 195 | String[] keys = (String[]) map.keySet().toArray(new String[map.size()]);\r |
a29c47e0 | 196 | List<Object> result = new ArrayList<Object>();\r |
878ddf1f | 197 | for (int i = 0; i < keys.length; ++i) {\r |
198 | XmlObject rootNode = (XmlObject) map.get(keys[i]);\r | |
199 | if (rootNode == null) {\r | |
200 | continue;\r | |
201 | }\r | |
a29c47e0 | 202 | \r |
203 | String query = queryDeclaration\r | |
204 | + normalizeQueryString(xPath, "$this/" + keys[i]);\r | |
878ddf1f | 205 | XmlObject[] tmp = rootNode.selectPath(query);\r |
206 | for (int j = 0; j < tmp.length; ++j) {\r | |
a29c47e0 | 207 | result.add((Object)tmp[j]);\r |
878ddf1f | 208 | }\r |
209 | }\r | |
a29c47e0 | 210 | \r |
878ddf1f | 211 | int size = result.size();\r |
212 | if (size <= 0) {\r | |
213 | return null;\r | |
214 | }\r | |
a29c47e0 | 215 | \r |
216 | return (Object[]) result.toArray(new Object[size]);\r | |
878ddf1f | 217 | }\r |
218 | \r | |
219 | /**\r | |
a29c47e0 | 220 | * Search XML documents named by "rootName" for the given xPath, using\r |
221 | * relative path (starting with '$this')\r | |
222 | * \r | |
223 | * @param rootName\r | |
224 | * The top level element name\r | |
225 | * @param xPath\r | |
226 | * The xpath query string array\r | |
227 | * @returns An array of XmlObject if elements are found at the given xpath\r | |
228 | * @returns NULL if nothing is found at the given xpath\r | |
229 | */\r | |
230 | public static Object[] get(String rootName, String[] xPath) {\r | |
878ddf1f | 231 | if (map == null) {\r |
232 | return null;\r | |
233 | }\r | |
a29c47e0 | 234 | \r |
878ddf1f | 235 | XmlObject root = (XmlObject) map.get(rootName);\r |
236 | if (root == null) {\r | |
237 | return null;\r | |
238 | }\r | |
239 | \r | |
a29c47e0 | 240 | String query = queryDeclaration\r |
241 | + normalizeQueryString(xPath, "$this/" + rootName);\r | |
878ddf1f | 242 | XmlObject[] result = root.selectPath(query);\r |
243 | if (result.length > 0) {\r | |
a29c47e0 | 244 | return (Object[])result;\r |
878ddf1f | 245 | }\r |
246 | \r | |
247 | query = queryDeclaration + normalizeQueryString(xPath, "/" + rootName);\r | |
248 | result = root.selectPath(query);\r | |
249 | if (result.length > 0) {\r | |
a29c47e0 | 250 | return (Object[])result;\r |
878ddf1f | 251 | }\r |
252 | \r | |
253 | return null;\r | |
254 | }\r | |
255 | \r | |
256 | /**\r | |
a29c47e0 | 257 | * Retrieve SourceFiles/Filename for specified ARCH type\r |
258 | * \r | |
259 | * @param arch\r | |
260 | * architecture name\r | |
261 | * @returns An 2 dimension string array if elements are found at the known\r | |
262 | * xpath\r | |
263 | * @returns NULL if nothing is found at the known xpath\r | |
264 | */\r | |
265 | public static String[][] getSourceFiles(String arch) {\r | |
878ddf1f | 266 | String[] xPath;\r |
a29c47e0 | 267 | Object[] returns;\r |
878ddf1f | 268 | \r |
25832ed3 | 269 | xPath = new String[] { "/Filename" };\r |
878ddf1f | 270 | \r |
a29c47e0 | 271 | returns = get("SourceFiles", xPath);\r |
878ddf1f | 272 | \r |
a29c47e0 | 273 | if (returns == null || returns.length == 0) {\r |
274 | return new String[0][0];\r | |
878ddf1f | 275 | }\r |
276 | \r | |
a29c47e0 | 277 | Filename[] sourceFileNames = (Filename[]) returns;\r |
25832ed3 | 278 | List<String[]> outputList = new ArrayList<String[]>();\r |
a29c47e0 | 279 | for (int i = 0; i < sourceFileNames.length; i++) {\r |
78d0508a | 280 | @SuppressWarnings("unchecked")\r |
25832ed3 | 281 | List<String> archList = sourceFileNames[i].getSupArchList();\r |
282 | if (arch == null || arch.equalsIgnoreCase("") || archList == null || archList.contains(arch)) {\r | |
283 | outputList.add(new String[] {sourceFileNames[i].getToolCode(),sourceFileNames[i].getStringValue()});\r | |
284 | }\r | |
285 | }\r | |
286 | \r | |
287 | String[][] outputString = new String[outputList.size()][2];\r | |
288 | for (int index = 0; index < outputList.size(); index++) {\r | |
289 | outputString[index][0] = outputList.get(index)[0];\r | |
290 | outputString[index][1] = outputList.get(index)[1];\r | |
a29c47e0 | 291 | }\r |
292 | return outputString;\r | |
878ddf1f | 293 | }\r |
294 | \r | |
295 | /**\r | |
a29c47e0 | 296 | * Retrieve /PlatformDefinitions/OutputDirectory from FPD\r |
297 | * \r | |
298 | * @returns Directory names array if elements are found at the known xpath\r | |
299 | * @returns Empty if nothing is found at the known xpath\r | |
300 | */\r | |
301 | public static String getFpdOutputDirectory() {\r | |
302 | String[] xPath = new String[] { "/PlatformDefinitions" };\r | |
303 | \r | |
304 | Object[] returns = get("PlatformSurfaceArea", xPath);\r | |
305 | if (returns == null || returns.length == 0) {\r | |
306 | return null;\r | |
307 | }\r | |
308 | PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];\r | |
309 | return item.getOutputDirectory();\r | |
310 | }\r | |
878ddf1f | 311 | \r |
a29c47e0 | 312 | public static String getFpdIntermediateDirectories() {\r |
313 | String[] xPath = new String[] { "/PlatformDefinitions" };\r | |
878ddf1f | 314 | \r |
a29c47e0 | 315 | Object[] returns = get("PlatformSurfaceArea", xPath);\r |
316 | if (returns == null || returns.length == 0) {\r | |
317 | return "UNIFIED";\r | |
318 | }\r | |
319 | PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];\r | |
320 | if(item.getIntermediateDirectories() == null) {\r | |
321 | return null; \r | |
322 | }\r | |
323 | else {\r | |
324 | return item.getIntermediateDirectories().toString();\r | |
325 | }\r | |
326 | }\r | |
878ddf1f | 327 | \r |
a29c47e0 | 328 | public static String getModuleFfsKeyword() {\r |
329 | String[] xPath = new String[] { "/" };\r | |
878ddf1f | 330 | \r |
a29c47e0 | 331 | Object[] returns = get("ModuleSaBuildOptions", xPath);\r |
332 | if (returns == null || returns.length == 0) {\r | |
333 | return null;\r | |
878ddf1f | 334 | }\r |
a29c47e0 | 335 | ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];\r |
336 | return item.getFfsFormatKey();\r | |
337 | }\r | |
338 | \r | |
339 | public static String getModuleFvBindingKeyword() {\r | |
340 | String[] xPath = new String[] { "/" };\r | |
878ddf1f | 341 | \r |
a29c47e0 | 342 | Object[] returns = get("ModuleSaBuildOptions", xPath);\r |
343 | if (returns == null || returns.length == 0) {\r | |
344 | return null;\r | |
345 | }\r | |
346 | ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0];\r | |
347 | return item.getFvBinding();\r | |
348 | }\r | |
349 | \r | |
350 | public static List getModuleSupportedArchs() {\r | |
351 | String[] xPath = new String[] { "/" };\r | |
352 | \r | |
353 | Object[] returns = get("ModuleDefinitions", xPath);\r | |
354 | if (returns == null || returns.length == 0) {\r | |
355 | return null;\r | |
356 | }\r | |
357 | ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];\r | |
358 | return item.getSupportedArchitectures();\r | |
359 | }\r | |
360 | \r | |
361 | public static BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() {\r | |
362 | String[] xPath = new String[] {"/Ffs"};\r | |
363 | \r | |
364 | Object[] returns = get("BuildOptions", xPath);\r | |
365 | if (returns == null || returns.length == 0) {\r | |
366 | return new BuildOptionsDocument.BuildOptions.Ffs[0];\r | |
367 | }\r | |
368 | return (BuildOptionsDocument.BuildOptions.Ffs[])returns;\r | |
878ddf1f | 369 | }\r |
a29c47e0 | 370 | \r |
371 | public static String getModuleOutputFileBasename() {\r | |
372 | String[] xPath = new String[] { "/" };\r | |
878ddf1f | 373 | \r |
a29c47e0 | 374 | Object[] returns = get("ModuleDefinitions", xPath);\r |
375 | if (returns == null || returns.length == 0) {\r | |
376 | return null;\r | |
377 | }\r | |
378 | ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];\r | |
379 | return item.getOutputFileBasename();\r | |
380 | }\r | |
381 | \r | |
878ddf1f | 382 | /**\r |
a29c47e0 | 383 | * Retrieve BuildOptions/Option or Arch/Option\r |
384 | * \r | |
385 | * @param toolChainFamilyFlag\r | |
386 | * if true, retrieve options for toolchain family; otherwise for\r | |
387 | * toolchain\r | |
388 | * \r | |
389 | * @returns String[][5] name, target, toolchain, arch, coommand of options\r | |
390 | * if elements are found at the known xpath. String[0][] if dont\r | |
391 | * find element.\r | |
392 | * \r | |
393 | * @returns Empty array if nothing is there\r | |
394 | */\r | |
395 | public static String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) {\r | |
396 | String target = null;\r | |
397 | String toolchain = null;\r | |
398 | String toolchainFamily = null;\r | |
399 | List<String> archList = null;\r | |
400 | String cmd = null;\r | |
401 | String targetName = null;\r | |
402 | String optionName = null;\r | |
403 | \r | |
404 | Object[] returns = get(from, xPath);\r | |
405 | if (returns == null) {\r | |
406 | return new String[0][5];\r | |
407 | }\r | |
878ddf1f | 408 | \r |
a29c47e0 | 409 | List<String[]> optionList = new ArrayList<String[]>();\r |
410 | OptionDocument.Option option;\r | |
878ddf1f | 411 | \r |
a29c47e0 | 412 | for (int i = 0; i < returns.length; i++) {\r |
413 | option = (OptionDocument.Option) returns[i];\r | |
878ddf1f | 414 | \r |
a29c47e0 | 415 | //\r |
416 | // Get Target, ToolChain(Family), Arch, Cmd, and Option from Option,\r | |
417 | // then\r | |
418 | // put to result[][5] array in above order.\r | |
419 | //\r | |
420 | String[] targetList;\r | |
421 | if (option.getBuildTargets() == null) {\r | |
422 | target = null;\r | |
423 | }\r | |
424 | else {\r | |
425 | target = option.getBuildTargets().toString();\r | |
426 | }\r | |
427 | if (target != null) {\r | |
428 | targetList = target.split(" ");\r | |
429 | } else {\r | |
430 | targetList = new String[1];\r | |
431 | targetList[0] = null;\r | |
432 | }\r | |
878ddf1f | 433 | \r |
a29c47e0 | 434 | if (toolChainFamilyFlag) {\r |
435 | toolchainFamily = option.getToolChainFamily();\r | |
436 | if (toolchainFamily != null) {\r | |
437 | toolchain = toolchainFamily.toString();\r | |
438 | } else {\r | |
439 | toolchain = null;\r | |
440 | }\r | |
878ddf1f | 441 | } else {\r |
a29c47e0 | 442 | toolchain = option.getTagName();\r |
878ddf1f | 443 | }\r |
a29c47e0 | 444 | \r |
445 | archList = new ArrayList<String>();\r | |
78d0508a | 446 | @SuppressWarnings("unchecked")\r |
a29c47e0 | 447 | List<String> archEnumList = option.getSupArchList(); \r |
448 | if (archEnumList == null) {\r | |
449 | archList.add(null);\r | |
450 | } else {\r | |
451 | archList.addAll(archEnumList);\r | |
452 | /*\r | |
453 | Iterator it = archEnumList.iterator();\r | |
454 | while (it.hasNext()) {\r | |
455 | System.out.println(it.next().getClass().getName());\r | |
456 | SupportedArchitectures.Enum archType = it.next();\r | |
457 | archList.add(archType.toString());\r | |
458 | }\r | |
459 | */\r | |
460 | }\r | |
461 | \r | |
462 | cmd = option.getToolCode();\r | |
463 | \r | |
464 | optionName = option.getStringValue();\r | |
465 | for (int t = 0; t < targetList.length; t++) {\r | |
466 | for (int j = 0; j < archList.size(); j++) {\r | |
467 | optionList.add(new String[] { targetList[t],\r | |
468 | toolchain, archList.get(j), cmd, optionName});\r | |
878ddf1f | 469 | }\r |
470 | }\r | |
878ddf1f | 471 | }\r |
472 | \r | |
a29c47e0 | 473 | String[][] result = new String[optionList.size()][5];\r |
474 | for (int i = 0; i < optionList.size(); i++) {\r | |
475 | result[i][0] = optionList.get(i)[0];\r | |
476 | result[i][1] = optionList.get(i)[1];\r | |
477 | result[i][2] = optionList.get(i)[2];\r | |
478 | result[i][3] = optionList.get(i)[3];\r | |
479 | result[i][4] = optionList.get(i)[4];\r | |
480 | }\r | |
878ddf1f | 481 | return result;\r |
482 | }\r | |
a29c47e0 | 483 | \r |
484 | public static String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) {\r | |
485 | String[] xPath;\r | |
486 | \r | |
487 | if (toolChainFamilyFlag == true) {\r | |
488 | xPath = new String[] {\r | |
489 | "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",\r | |
490 | "/Options/Option[@ToolChainFamily]", };\r | |
491 | } else {\r | |
492 | xPath = new String[] {\r | |
493 | "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",\r | |
494 | "/Options/Option[@TagName]", };\r | |
495 | }\r | |
496 | return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag);\r | |
497 | } \r | |
878ddf1f | 498 | \r |
a29c47e0 | 499 | public static String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) {\r |
500 | String[] xPath;\r | |
250258de | 501 | \r |
a29c47e0 | 502 | if (toolChainFamilyFlag == true) {\r |
503 | xPath = new String[] {\r | |
504 | "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@TagName)]",\r | |
505 | "/BuildOptions/Options/Option[@ToolChainFamily]", };\r | |
506 | } else {\r | |
507 | xPath = new String[] {\r | |
508 | "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@TagName)]",\r | |
509 | "/BuildOptions/Options/Option[@TagName]", };\r | |
250258de | 510 | }\r |
511 | \r | |
a29c47e0 | 512 | return getOptions("PlatformSurfaceArea", xPath, toolChainFamilyFlag);\r |
250258de | 513 | }\r |
514 | \r | |
a29c47e0 | 515 | public static ToolChainInfo getFpdToolChainInfo() {\r |
516 | String[] xPath = new String[] { "/PlatformDefinitions" };\r | |
878ddf1f | 517 | \r |
a29c47e0 | 518 | Object[] returns = get("PlatformSurfaceArea", xPath);\r |
519 | if (returns == null || returns.length == 0) {\r | |
520 | return null;\r | |
878ddf1f | 521 | }\r |
a29c47e0 | 522 | \r |
523 | PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0];\r | |
524 | ToolChainInfo toolChainInfo = new ToolChainInfo();\r | |
525 | toolChainInfo.addTargets(item.getBuildTargets().toString());\r | |
526 | toolChainInfo.addArchs(item.getSupportedArchitectures().toString());\r | |
527 | toolChainInfo.addTagnames((String)null);\r | |
528 | return toolChainInfo;\r | |
878ddf1f | 529 | }\r |
530 | \r | |
531 | /**\r | |
a29c47e0 | 532 | * Retrieve <xxxHeader>/ModuleType\r |
533 | * \r | |
534 | * @returns The module type name if elements are found at the known xpath\r | |
535 | * @returns null if nothing is there\r | |
536 | */\r | |
537 | public static String getModuleType() {\r | |
538 | String[] xPath = new String[] { "/ModuleType" };\r | |
539 | \r | |
540 | Object[] returns = get(xPath);\r | |
878ddf1f | 541 | if (returns != null && returns.length > 0) {\r |
a29c47e0 | 542 | ModuleTypeDef type = (ModuleTypeDef) returns[0];\r |
878ddf1f | 543 | return type.enumValue().toString();\r |
544 | }\r | |
545 | \r | |
546 | return null;\r | |
547 | }\r | |
548 | \r | |
549 | /**\r | |
a29c47e0 | 550 | * Retrieve PackageDependencies/Package\r |
551 | * \r | |
552 | * @param arch\r | |
553 | * Architecture name\r | |
554 | * \r | |
555 | * @returns package name list if elements are found at the known xpath\r | |
556 | * @returns null if nothing is there\r | |
557 | */\r | |
558 | public static PackageIdentification[] getDependencePkg(String arch) {\r | |
878ddf1f | 559 | String[] xPath;\r |
a29c47e0 | 560 | String packageGuid = null;\r |
561 | String packageVersion = null;\r | |
878ddf1f | 562 | \r |
25832ed3 | 563 | \r |
564 | xPath = new String[] { "/Package" };\r | |
565 | \r | |
a29c47e0 | 566 | Object[] returns = get("PackageDependencies", xPath);\r |
567 | if (returns == null) {\r | |
568 | return new PackageIdentification[0];\r | |
878ddf1f | 569 | }\r |
a29c47e0 | 570 | PackageIdentification[] packageIdList = new PackageIdentification[returns.length];\r |
571 | for (int i = 0; i < returns.length; i++) {\r | |
572 | PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];\r | |
78d0508a | 573 | @SuppressWarnings("unchecked")\r |
25832ed3 | 574 | List<String> archList = item.getSupArchList();\r |
575 | if (arch == null || archList == null || archList.contains(arch)) {\r | |
576 | packageGuid = item.getPackageGuid();\r | |
577 | packageVersion = item.getPackageVersion();\r | |
578 | packageIdList[i] = (new PackageIdentification(null, packageGuid,\r | |
a29c47e0 | 579 | packageVersion));\r |
25832ed3 | 580 | }\r |
a29c47e0 | 581 | }\r |
582 | return packageIdList;\r | |
878ddf1f | 583 | }\r |
584 | \r | |
585 | /**\r | |
a29c47e0 | 586 | * Retrieve LibraryClassDefinitions/LibraryClass for specified usage\r |
587 | * \r | |
588 | * @param usage\r | |
589 | * Library class usage\r | |
590 | * \r | |
591 | * @returns LibraryClass objects list if elements are found at the known\r | |
592 | * xpath\r | |
593 | * @returns null if nothing is there\r | |
594 | */\r | |
595 | public static String[] getLibraryClasses(String usage) {\r | |
878ddf1f | 596 | String[] xPath;\r |
597 | \r | |
598 | if (usage == null || usage.equals("")) {\r | |
a29c47e0 | 599 | xPath = new String[] { "/LibraryClass" };\r |
878ddf1f | 600 | } else {\r |
a29c47e0 | 601 | xPath = new String[] { "/LibraryClass[@Usage='" + usage + "']" };\r |
878ddf1f | 602 | }\r |
603 | \r | |
a29c47e0 | 604 | Object[] returns = get("LibraryClassDefinitions", xPath);\r |
605 | if (returns == null || returns.length == 0) {\r | |
606 | return new String[0];\r | |
878ddf1f | 607 | }\r |
608 | \r | |
a29c47e0 | 609 | LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns;\r |
610 | String[] libraryClassName = new String[libraryClassList.length];\r | |
611 | for (int i = 0; i < libraryClassList.length; i++) {\r | |
612 | libraryClassName[i] = libraryClassList[i].getKeyword();\r | |
613 | }\r | |
614 | return libraryClassName;\r | |
878ddf1f | 615 | }\r |
616 | \r | |
617 | /**\r | |
a29c47e0 | 618 | * Retrieve ModuleEntryPoint names\r |
619 | * \r | |
620 | * @returns ModuleEntryPoint name list if elements are found at the known\r | |
621 | * xpath\r | |
622 | * @returns null if nothing is there\r | |
623 | */\r | |
878ddf1f | 624 | public static String[] getModuleEntryPointArray() {\r |
625 | String[] xPath = new String[] { "/Extern/ModuleEntryPoint" };\r | |
626 | \r | |
a29c47e0 | 627 | Object[] returns = get("Externs", xPath);\r |
878ddf1f | 628 | \r |
629 | if (returns != null && returns.length > 0) {\r | |
630 | String[] entryPoints = new String[returns.length];\r | |
631 | \r | |
632 | for (int i = 0; i < returns.length; ++i) {\r | |
136adffc | 633 | entryPoints[i] = ((CNameType) returns[i]).getStringValue();\r |
878ddf1f | 634 | }\r |
635 | \r | |
636 | return entryPoints;\r | |
637 | }\r | |
638 | \r | |
639 | return null;\r | |
640 | }\r | |
641 | \r | |
642 | /**\r | |
a29c47e0 | 643 | * retrieve Protocol for specified usage\r |
644 | * \r | |
645 | * @param usage\r | |
646 | * Protocol usage arch Architecture\r | |
647 | * \r | |
648 | * @returns Protocol String list if elements are found at the known xpath\r | |
649 | * @returns String[0] if nothing is there\r | |
650 | */\r | |
651 | public static String[] getProtocolArray(String arch, String usage) {\r | |
652 | String[] xPath;\r | |
653 | String usageXpath = "";\r | |
654 | String archXpath = "";\r | |
878ddf1f | 655 | \r |
a29c47e0 | 656 | if (arch == null || arch.equals("")) {\r |
657 | return new String[0];\r | |
658 | } else {\r | |
25832ed3 | 659 | archXpath = "/Protocol";\r |
a29c47e0 | 660 | if (usage != null && !usage.equals("")) {\r |
661 | usageXpath = "/Protocol[@Usage='" + usage + "']";\r | |
662 | xPath = new String[] { usageXpath, archXpath };\r | |
663 | } else {\r | |
664 | return getProtocolArray(arch);\r | |
250258de | 665 | }\r |
a29c47e0 | 666 | \r |
250258de | 667 | }\r |
668 | \r | |
a29c47e0 | 669 | Object[] returns = get("Protocols", xPath);\r |
670 | if (returns == null) {\r | |
671 | return new String[0];\r | |
672 | }\r | |
673 | Protocol[] protocolList = (Protocol[]) returns;\r | |
674 | \r | |
675 | String[] protocolArray = new String[returns.length];\r | |
676 | for (int i = 0; i < returns.length; i++) {\r | |
677 | protocolArray[i] = protocolList[i].getProtocolCName();\r | |
678 | }\r | |
679 | return protocolArray;\r | |
250258de | 680 | }\r |
681 | \r | |
682 | /**\r | |
a29c47e0 | 683 | * retrieve Protocol for specified usage\r |
684 | * \r | |
685 | * @param arch\r | |
686 | * Architecture\r | |
687 | * \r | |
688 | * @returns Protocol String list if elements are found at the known xpath\r | |
689 | * @returns String[0] if nothing is there\r | |
690 | */\r | |
691 | public static String[] getProtocolArray(String arch) {\r | |
692 | String[] xPath;\r | |
693 | \r | |
694 | if (arch == null || arch.equals("")) {\r | |
695 | return new String[0];\r | |
696 | } else {\r | |
136adffc | 697 | xPath = new String[] { "/Protocol" };\r |
a29c47e0 | 698 | }\r |
250258de | 699 | \r |
a29c47e0 | 700 | Object[] returns = get("Protocols", xPath);\r |
701 | if (returns == null) {\r | |
702 | return new String[0];\r | |
878ddf1f | 703 | }\r |
25832ed3 | 704 | Protocol[] returnlList = (Protocol[]) returns;\r |
878ddf1f | 705 | \r |
25832ed3 | 706 | List<String> protocolList = new ArrayList<String>();\r |
707 | \r | |
a29c47e0 | 708 | for (int i = 0; i < returns.length; i++) {\r |
78d0508a | 709 | @SuppressWarnings("unchecked")\r |
25832ed3 | 710 | List<String> archList = returnlList[i].getSupArchList();\r |
136adffc | 711 | if (archList == null || archList.contains(arch)){\r |
25832ed3 | 712 | protocolList.add(returnlList[i].getProtocolCName());\r |
136adffc | 713 | }\r |
a29c47e0 | 714 | }\r |
25832ed3 | 715 | String[] protocolArray = new String[protocolList.size()];\r |
716 | for (int i = 0; i < protocolList.size(); i++) {\r | |
717 | protocolArray[i] = protocolList.get(i);\r | |
718 | }\r | |
a29c47e0 | 719 | return protocolArray;\r |
878ddf1f | 720 | }\r |
721 | \r | |
722 | /**\r | |
a29c47e0 | 723 | * Retrieve ProtocolNotify for specified usage\r |
724 | * \r | |
725 | * @param usage\r | |
726 | * ProtocolNotify usage\r | |
727 | * \r | |
728 | * @returns String[] if elements are found at the known xpath\r | |
729 | * @returns String[0] if nothing is there\r | |
730 | */\r | |
731 | public static String[] getProtocolNotifyArray(String arch) {\r | |
878ddf1f | 732 | String[] xPath;\r |
733 | \r | |
a29c47e0 | 734 | if (arch == null || arch.equals("")) {\r |
735 | return new String[0];\r | |
878ddf1f | 736 | } else {\r |
136adffc | 737 | xPath = new String[] { "/ProtocolNotify" };\r |
878ddf1f | 738 | }\r |
739 | \r | |
a29c47e0 | 740 | Object[] returns = get("Protocols", xPath);\r |
741 | if (returns == null) {\r | |
742 | return new String[0];\r | |
878ddf1f | 743 | }\r |
744 | \r | |
25832ed3 | 745 | List<String> protocolNotifyList = new ArrayList<String>();\r |
746 | \r | |
a29c47e0 | 747 | for (int i = 0; i < returns.length; i++) {\r |
78d0508a | 748 | @SuppressWarnings("unchecked")\r |
136adffc | 749 | List<String> archList = ((ProtocolNotify) returns[i]).getSupArchList();\r |
750 | if (archList == null || archList.contains(arch)){\r | |
25832ed3 | 751 | protocolNotifyList.add(((ProtocolNotify) returns[i]).getProtocolNotifyCName());\r |
136adffc | 752 | }\r |
753 | \r | |
a29c47e0 | 754 | }\r |
25832ed3 | 755 | String[] protocolNotifyArray = new String[protocolNotifyList.size()];\r |
756 | for (int i = 0; i < protocolNotifyList.size(); i++) {\r | |
757 | protocolNotifyArray[i] = protocolNotifyList.get(i);\r | |
758 | }\r | |
759 | return protocolNotifyArray;\r | |
878ddf1f | 760 | }\r |
761 | \r | |
762 | /**\r | |
a29c47e0 | 763 | * Retrieve ProtocolNotify for specified usage\r |
764 | * \r | |
765 | * @param usage\r | |
766 | * ProtocolNotify usage\r | |
767 | * \r | |
768 | * @returns String[] if elements are found at the known xpath\r | |
769 | * @returns String[0] if nothing is there\r | |
770 | */\r | |
771 | public static String[] getProtocolNotifyArray(String arch, String usage) {\r | |
878ddf1f | 772 | \r |
878ddf1f | 773 | String[] xPath;\r |
a29c47e0 | 774 | String usageXpath;\r |
775 | String archXpath;\r | |
878ddf1f | 776 | \r |
a29c47e0 | 777 | if (arch == null || arch.equals("")) {\r |
778 | return new String[0];\r | |
878ddf1f | 779 | } else {\r |
25832ed3 | 780 | archXpath = "/ProtocolNotify";\r |
a29c47e0 | 781 | if (usage != null && !usage.equals("")) {\r |
782 | usageXpath = "/ProtocolNotify[@Usage='" + arch + "']";\r | |
783 | xPath = new String[] { archXpath, usageXpath };\r | |
784 | } else {\r | |
785 | return getProtocolNotifyArray(arch);\r | |
786 | }\r | |
878ddf1f | 787 | }\r |
788 | \r | |
a29c47e0 | 789 | Object[] returns = get("Protocols", xPath);\r |
790 | if (returns == null) {\r | |
791 | return new String[0];\r | |
878ddf1f | 792 | }\r |
793 | \r | |
a29c47e0 | 794 | String[] protocolNotifyList = new String[returns.length];\r |
795 | \r | |
796 | for (int i = 0; i < returns.length; i++) {\r | |
797 | protocolNotifyList[i] = ((ProtocolNotify) returns[i]).getProtocolNotifyCName();\r | |
798 | }\r | |
799 | return protocolNotifyList;\r | |
878ddf1f | 800 | }\r |
801 | \r | |
802 | /**\r | |
a29c47e0 | 803 | * Retrieve ModuleUnloadImage names\r |
804 | * \r | |
805 | * @returns ModuleUnloadImage name list if elements are found at the known\r | |
806 | * xpath\r | |
807 | * @returns null if nothing is there\r | |
808 | */\r | |
878ddf1f | 809 | public static String[] getModuleUnloadImageArray() {\r |
810 | String[] xPath = new String[] { "/Extern/ModuleUnloadImage" };\r | |
811 | \r | |
a29c47e0 | 812 | Object[] returns = get("Externs", xPath);\r |
878ddf1f | 813 | if (returns != null && returns.length > 0) {\r |
814 | String[] stringArray = new String[returns.length];\r | |
136adffc | 815 | CNameType[] doc = (CNameType[]) returns;\r |
878ddf1f | 816 | \r |
817 | for (int i = 0; i < returns.length; ++i) {\r | |
818 | stringArray[i] = doc[i].getStringValue();\r | |
819 | }\r | |
820 | \r | |
821 | return stringArray;\r | |
822 | }\r | |
823 | \r | |
824 | return null;\r | |
825 | }\r | |
826 | \r | |
827 | /**\r | |
a29c47e0 | 828 | * Retrieve Extern\r |
829 | * \r | |
830 | * @returns Extern objects list if elements are found at the known xpath\r | |
831 | * @returns null if nothing is there\r | |
832 | */\r | |
878ddf1f | 833 | public static ExternsDocument.Externs.Extern[] getExternArray() {\r |
834 | String[] xPath = new String[] { "/Extern" };\r | |
835 | \r | |
a29c47e0 | 836 | Object[] returns = get("Externs", xPath);\r |
878ddf1f | 837 | if (returns != null && returns.length > 0) {\r |
838 | return (ExternsDocument.Externs.Extern[]) returns;\r | |
839 | }\r | |
840 | \r | |
841 | return null;\r | |
842 | }\r | |
843 | \r | |
844 | /**\r | |
a29c47e0 | 845 | * Retrieve PpiNotify for specified arch\r |
846 | * \r | |
847 | * @param arch\r | |
848 | * PpiNotify arch\r | |
849 | * \r | |
850 | * @returns String[] if elements are found at the known xpath\r | |
851 | * @returns String[0] if nothing is there\r | |
852 | */\r | |
853 | public static String[] getPpiNotifyArray(String arch) {\r | |
878ddf1f | 854 | String[] xPath;\r |
855 | \r | |
a29c47e0 | 856 | if (arch == null || arch.equals("")) {\r |
857 | return new String[0];\r | |
878ddf1f | 858 | } else {\r |
136adffc | 859 | xPath = new String[] { "/PpiNotify" };\r |
878ddf1f | 860 | }\r |
861 | \r | |
a29c47e0 | 862 | Object[] returns = get("PPIs", xPath);\r |
863 | if (returns == null) {\r | |
864 | return new String[0];\r | |
878ddf1f | 865 | }\r |
866 | \r | |
25832ed3 | 867 | \r |
868 | List<String> ppiNotifyList = new ArrayList<String>();\r | |
a29c47e0 | 869 | for (int i = 0; i < returns.length; i++) {\r |
78d0508a | 870 | @SuppressWarnings("unchecked")\r |
136adffc | 871 | List<String> archList = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getSupArchList();\r |
872 | if (archList == null || archList.contains(arch)){\r | |
25832ed3 | 873 | ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName()); \r |
136adffc | 874 | }\r |
875 | \r | |
a29c47e0 | 876 | }\r |
25832ed3 | 877 | String[] ppiNotifyArray = new String[ppiNotifyList.size()];\r |
878 | for (int i = 0; i < ppiNotifyList.size(); i++) {\r | |
879 | ppiNotifyArray[i] = ppiNotifyList.get(i);\r | |
880 | }\r | |
a29c47e0 | 881 | \r |
25832ed3 | 882 | return ppiNotifyArray;\r |
878ddf1f | 883 | }\r |
884 | \r | |
885 | /**\r | |
a29c47e0 | 886 | * Retrieve PpiNotify for specified usage and arch\r |
887 | * \r | |
888 | * @param arch\r | |
889 | * PpiNotify arch usage PpiNotify usage\r | |
890 | * \r | |
891 | * \r | |
892 | * @returns String[] if elements are found at the known xpath\r | |
893 | * @returns String[0] if nothing is there\r | |
894 | */\r | |
895 | public static String[] getPpiNotifyArray(String arch, String usage) {\r | |
878ddf1f | 896 | \r |
878ddf1f | 897 | String[] xPath;\r |
a29c47e0 | 898 | String usageXpath;\r |
899 | String archXpath;\r | |
878ddf1f | 900 | \r |
a29c47e0 | 901 | if (arch == null || arch.equals("")) {\r |
902 | return new String[0];\r | |
878ddf1f | 903 | } else {\r |
136adffc | 904 | archXpath = "/PpiNotify";\r |
a29c47e0 | 905 | if (usage != null && !usage.equals("")) {\r |
906 | usageXpath = "/PpiNotify[@Usage='" + arch + "']";\r | |
907 | xPath = new String[] { archXpath, usageXpath };\r | |
908 | } else {\r | |
909 | return getProtocolNotifyArray(arch);\r | |
910 | }\r | |
878ddf1f | 911 | }\r |
912 | \r | |
a29c47e0 | 913 | Object[] returns = get("PPIs", xPath);\r |
914 | if (returns == null) {\r | |
915 | return new String[0];\r | |
878ddf1f | 916 | }\r |
917 | \r | |
a29c47e0 | 918 | String[] ppiNotifyList = new String[returns.length];\r |
919 | \r | |
920 | for (int i = 0; i < returns.length; i++) {\r | |
921 | ppiNotifyList[i] = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName();\r | |
922 | }\r | |
923 | return ppiNotifyList;\r | |
878ddf1f | 924 | }\r |
925 | \r | |
926 | /**\r | |
a29c47e0 | 927 | * Retrieve Ppi for specified arch\r |
928 | * \r | |
929 | * @param arch\r | |
930 | * Ppi arch\r | |
931 | * \r | |
932 | * @returns String[] if elements are found at the known xpath\r | |
933 | * @returns String[0] if nothing is there\r | |
934 | */\r | |
935 | public static String[] getPpiArray(String arch) {\r | |
936 | String[] xPath;\r | |
937 | \r | |
938 | if (arch == null || arch.equals("")) {\r | |
939 | return new String[0];\r | |
940 | } else {\r | |
136adffc | 941 | xPath = new String[] { "/Ppi" };\r |
a29c47e0 | 942 | }\r |
943 | \r | |
944 | Object[] returns = get("PPIs", xPath);\r | |
945 | if (returns == null) {\r | |
946 | return new String[0];\r | |
947 | }\r | |
948 | \r | |
25832ed3 | 949 | List<String> ppiList = new ArrayList<String>();\r |
a29c47e0 | 950 | for (int i = 0; i < returns.length; i++) {\r |
78d0508a | 951 | @SuppressWarnings("unchecked")\r |
136adffc | 952 | List<String> archList = ((PPIsDocument.PPIs.Ppi) returns[i]).getSupArchList();\r |
953 | if (archList == null || archList.contains(arch)){\r | |
25832ed3 | 954 | ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName()); \r |
136adffc | 955 | }\r |
956 | \r | |
a29c47e0 | 957 | }\r |
25832ed3 | 958 | String[] ppiArray = new String[ppiList.size()];\r |
959 | for (int i = 0; i < ppiList.size(); i++) {\r | |
960 | ppiArray[i] = ppiList.get(i);\r | |
961 | }\r | |
962 | return ppiArray;\r | |
a29c47e0 | 963 | }\r |
878ddf1f | 964 | \r |
a29c47e0 | 965 | /**\r |
966 | * Retrieve PpiNotify for specified usage and arch\r | |
967 | * \r | |
968 | * @param arch\r | |
969 | * PpiNotify arch usage PpiNotify usage\r | |
970 | * \r | |
971 | * \r | |
972 | * @returns String[] if elements are found at the known xpath\r | |
973 | * @returns String[0] if nothing is there\r | |
974 | */\r | |
975 | public static String[] getPpiArray(String arch, String usage) {\r | |
878ddf1f | 976 | \r |
878ddf1f | 977 | String[] xPath;\r |
a29c47e0 | 978 | String usageXpath;\r |
979 | String archXpath;\r | |
878ddf1f | 980 | \r |
a29c47e0 | 981 | if (arch == null || arch.equals("")) {\r |
982 | return new String[0];\r | |
878ddf1f | 983 | } else {\r |
136adffc | 984 | archXpath = "/Ppi";\r |
a29c47e0 | 985 | if (usage != null && !usage.equals("")) {\r |
986 | usageXpath = "/Ppi[@Usage='" + arch + "']";\r | |
987 | xPath = new String[] { archXpath, usageXpath };\r | |
988 | } else {\r | |
989 | return getProtocolNotifyArray(arch);\r | |
990 | }\r | |
878ddf1f | 991 | }\r |
992 | \r | |
a29c47e0 | 993 | Object[] returns = get("PPIs", xPath);\r |
994 | if (returns == null) {\r | |
995 | return new String[0];\r | |
878ddf1f | 996 | }\r |
997 | \r | |
a29c47e0 | 998 | String[] ppiList = new String[returns.length];\r |
999 | \r | |
1000 | for (int i = 0; i < returns.length; i++) {\r | |
1001 | ppiList[i] = ((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName();\r | |
1002 | }\r | |
1003 | return ppiList;\r | |
878ddf1f | 1004 | }\r |
1005 | \r | |
1006 | /**\r | |
a29c47e0 | 1007 | * Retrieve GuidEntry information for specified usage\r |
1008 | * \r | |
1009 | * @param arch\r | |
1010 | * GuidEntry arch\r | |
1011 | * \r | |
1012 | * @returns GuidEntry objects list if elements are found at the known xpath\r | |
1013 | * @returns null if nothing is there\r | |
1014 | */\r | |
1015 | public static String[] getGuidEntryArray(String arch) {\r | |
1016 | String[] xPath;\r | |
1017 | \r | |
1018 | if (arch == null || arch.equals("")) {\r | |
136adffc | 1019 | xPath = new String[] { "/GuidCNames" };\r |
a29c47e0 | 1020 | } else {\r |
136adffc | 1021 | xPath = new String[] { "/GuidCNames" };\r |
a29c47e0 | 1022 | }\r |
1023 | \r | |
1024 | Object[] returns = get("Guids", xPath);\r | |
1025 | if (returns == null) {\r | |
1026 | return new String[0];\r | |
1027 | }\r | |
25832ed3 | 1028 | \r |
1029 | List<String> guidList = new ArrayList<String>();\r | |
a29c47e0 | 1030 | for (int i = 0; i < returns.length; i++) {\r |
78d0508a | 1031 | @SuppressWarnings("unchecked")\r |
136adffc | 1032 | List<String> archList = ((GuidsDocument.Guids.GuidCNames) returns[i]).getSupArchList();\r |
1033 | if (archList == null || archList.contains(arch)){\r | |
25832ed3 | 1034 | guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName()); \r |
136adffc | 1035 | }\r |
1036 | \r | |
a29c47e0 | 1037 | }\r |
25832ed3 | 1038 | String[] guidArray = new String[guidList.size()];\r |
1039 | for (int i = 0; i < guidList.size(); i++) {\r | |
1040 | guidArray[i] = guidList.get(i);\r | |
1041 | }\r | |
1042 | return guidArray;\r | |
878ddf1f | 1043 | \r |
a29c47e0 | 1044 | }\r |
878ddf1f | 1045 | \r |
a29c47e0 | 1046 | /**\r |
1047 | * Retrieve GuidEntry information for specified usage\r | |
1048 | * \r | |
1049 | * @param arch\r | |
1050 | * GuidEntry arch usage GuidEntry usage\r | |
1051 | * \r | |
1052 | * @returns GuidEntry objects list if elements are found at the known xpath\r | |
1053 | * @returns null if nothing is there\r | |
1054 | */\r | |
1055 | public static String[] getGuidEntryArray(String arch, String usage) {\r | |
878ddf1f | 1056 | String[] xPath;\r |
a29c47e0 | 1057 | String archXpath;\r |
1058 | String usageXpath;\r | |
878ddf1f | 1059 | \r |
a29c47e0 | 1060 | if (arch == null || arch.equals("")) {\r |
1061 | return new String[0];\r | |
1062 | } else {\r | |
136adffc | 1063 | archXpath = "/GuidEntry";\r |
a29c47e0 | 1064 | if (usage != null && !usage.equals("")) {\r |
1065 | usageXpath = "/GuidEntry[@Usage='" + arch + "']";\r | |
1066 | xPath = new String[] { archXpath, usageXpath };\r | |
878ddf1f | 1067 | } else {\r |
a29c47e0 | 1068 | return getProtocolNotifyArray(arch);\r |
878ddf1f | 1069 | }\r |
1070 | }\r | |
878ddf1f | 1071 | \r |
a29c47e0 | 1072 | Object[] returns = get("Guids", xPath);\r |
1073 | if (returns == null) {\r | |
1074 | return new String[0];\r | |
878ddf1f | 1075 | }\r |
a29c47e0 | 1076 | \r |
1077 | String[] guidList = new String[returns.length];\r | |
1078 | \r | |
1079 | for (int i = 0; i < returns.length; i++) {\r | |
1080 | guidList[i] = ((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName();\r | |
1081 | }\r | |
1082 | return guidList;\r | |
1083 | }\r | |
1084 | \r | |
1085 | /**\r | |
1086 | * Retrieve Library instance information\r | |
1087 | * \r | |
1088 | * @param arch\r | |
1089 | * Architecture name\r | |
1090 | * @param usage\r | |
1091 | * Library instance usage\r | |
1092 | * \r | |
1093 | * @returns library instance name list if elements are found at the known\r | |
1094 | * xpath\r | |
1095 | * @returns null if nothing is there\r | |
1096 | */\r | |
1097 | public static ModuleIdentification[] getLibraryInstance(String arch) {\r | |
1098 | String[] xPath;\r | |
1099 | String saGuid = null;\r | |
1100 | String saVersion = null;\r | |
1101 | String pkgGuid = null;\r | |
1102 | String pkgVersion = null;\r | |
1103 | \r | |
1104 | if (arch == null || arch.equalsIgnoreCase("")) {\r | |
1105 | xPath = new String[] { "/Instance" };\r | |
1106 | } else {\r | |
25832ed3 | 1107 | //\r |
1108 | // Since Schema don't have SupArchList now, so the follow Xpath is \r | |
1109 | // equal to "/Instance" and [not(@SupArchList) or @SupArchList= arch]\r | |
1110 | // don't have effect.\r | |
1111 | //\r | |
a29c47e0 | 1112 | xPath = new String[] { "/Instance[not(@SupArchList) or @SupArchList='"\r |
1113 | + arch + "']" };\r | |
878ddf1f | 1114 | }\r |
1115 | \r | |
a29c47e0 | 1116 | Object[] returns = get("Libraries", xPath);\r |
1117 | if (returns == null || returns.length == 0) {\r | |
1118 | return new ModuleIdentification[0];\r | |
1119 | }\r | |
1120 | \r | |
1121 | ModuleIdentification[] saIdList = new ModuleIdentification[returns.length];\r | |
1122 | for (int i = 0; i < returns.length; i++) {\r | |
1123 | LibrariesDocument.Libraries.Instance library = (LibrariesDocument.Libraries.Instance) returns[i];\r | |
1124 | saGuid = library.getModuleGuid();\r | |
1125 | saVersion = library.getModuleVersion();\r | |
1126 | \r | |
1127 | pkgGuid = library.getPackageGuid();\r | |
1128 | pkgVersion = library.getPackageVersion();\r | |
1129 | \r | |
1130 | ModuleIdentification saId = new ModuleIdentification(null, saGuid,\r | |
1131 | saVersion);\r | |
1132 | PackageIdentification pkgId = new PackageIdentification(null,\r | |
1133 | pkgGuid, pkgVersion);\r | |
1134 | saId.setPackage(pkgId);\r | |
1135 | \r | |
1136 | saIdList[i] = saId;\r | |
1137 | \r | |
1138 | }\r | |
1139 | return saIdList;\r | |
878ddf1f | 1140 | }\r |
1141 | \r | |
a29c47e0 | 1142 | // /\r |
1143 | // / This method is used for retrieving the elements information which has\r | |
1144 | // / CName sub-element\r | |
1145 | // /\r | |
878ddf1f | 1146 | private static String[] getCNames(String from, String xPath[]) {\r |
a29c47e0 | 1147 | Object[] returns = get(from, xPath);\r |
878ddf1f | 1148 | if (returns == null || returns.length == 0) {\r |
1149 | return null;\r | |
1150 | }\r | |
a29c47e0 | 1151 | \r |
878ddf1f | 1152 | String[] strings = new String[returns.length];\r |
1153 | for (int i = 0; i < returns.length; ++i) {\r | |
a29c47e0 | 1154 | // TBD\r |
136adffc | 1155 | strings[i] = ((CNameType) returns[i]).getStringValue();\r |
878ddf1f | 1156 | }\r |
a29c47e0 | 1157 | \r |
1158 | return strings;\r | |
878ddf1f | 1159 | }\r |
878ddf1f | 1160 | \r |
a29c47e0 | 1161 | /**\r |
1162 | * Retrive library's constructor name\r | |
1163 | * \r | |
1164 | * @returns constructor name list if elements are found at the known xpath\r | |
1165 | * @returns null if nothing is there\r | |
1166 | */\r | |
878ddf1f | 1167 | public static String getLibConstructorName() {\r |
a29c47e0 | 1168 | String[] xPath = new String[] { "/Extern/Constructor" };\r |
878ddf1f | 1169 | \r |
a29c47e0 | 1170 | Object[] returns = get("Externs", xPath);\r |
878ddf1f | 1171 | if (returns != null && returns.length > 0) {\r |
136adffc | 1172 | CNameType constructor = ((CNameType) returns[0]);\r |
1173 | return constructor.getStringValue();\r | |
878ddf1f | 1174 | }\r |
1175 | \r | |
1176 | return null;\r | |
1177 | }\r | |
1178 | \r | |
1179 | /**\r | |
a29c47e0 | 1180 | * Retrive library's destructor name\r |
1181 | * \r | |
1182 | * @returns destructor name list if elements are found at the known xpath\r | |
1183 | * @returns null if nothing is there\r | |
1184 | */\r | |
878ddf1f | 1185 | public static String getLibDestructorName() {\r |
a29c47e0 | 1186 | String[] xPath = new String[] { "/Extern/Destructor" };\r |
878ddf1f | 1187 | \r |
a29c47e0 | 1188 | Object[] returns = get("Externs", xPath);\r |
878ddf1f | 1189 | if (returns != null && returns.length > 0) {\r |
136adffc | 1190 | //\r |
1191 | // Only support one Destructor function.\r | |
1192 | //\r | |
1193 | CNameType destructor = (CNameType) returns[0];\r | |
1194 | return destructor.getStringValue();\r | |
878ddf1f | 1195 | }\r |
1196 | \r | |
1197 | return null;\r | |
1198 | }\r | |
878ddf1f | 1199 | \r |
a29c47e0 | 1200 | /**\r |
1201 | * Retrive DriverBinding names\r | |
1202 | * \r | |
1203 | * @returns DriverBinding name list if elements are found at the known xpath\r | |
1204 | * @returns null if nothing is there\r | |
1205 | */\r | |
878ddf1f | 1206 | public static String[] getDriverBindingArray() {\r |
a29c47e0 | 1207 | String[] xPath = new String[] { "/Extern/DriverBinding" };\r |
878ddf1f | 1208 | return getCNames("Externs", xPath);\r |
1209 | }\r | |
878ddf1f | 1210 | \r |
a29c47e0 | 1211 | /**\r |
1212 | * Retrive ComponentName names\r | |
1213 | * \r | |
1214 | * @returns ComponentName name list if elements are found at the known xpath\r | |
1215 | * @returns null if nothing is there\r | |
1216 | */\r | |
878ddf1f | 1217 | public static String[] getComponentNameArray() {\r |
a29c47e0 | 1218 | String[] xPath = new String[] { "/Extern/ComponentName" };\r |
878ddf1f | 1219 | return getCNames("Externs", xPath);\r |
1220 | }\r | |
878ddf1f | 1221 | \r |
a29c47e0 | 1222 | /**\r |
1223 | * Retrive DriverConfig names\r | |
1224 | * \r | |
1225 | * @returns DriverConfig name list if elements are found at the known xpath\r | |
1226 | * @returns null if nothing is there\r | |
1227 | */\r | |
878ddf1f | 1228 | public static String[] getDriverConfigArray() {\r |
a29c47e0 | 1229 | String[] xPath = new String[] { "/Extern/DriverConfig" };\r |
878ddf1f | 1230 | return getCNames("Externs", xPath);\r |
1231 | }\r | |
878ddf1f | 1232 | \r |
a29c47e0 | 1233 | /**\r |
1234 | * Retrive DriverDiag names\r | |
1235 | * \r | |
1236 | * @returns DriverDiag name list if elements are found at the known xpath\r | |
1237 | * @returns null if nothing is there\r | |
1238 | */\r | |
878ddf1f | 1239 | public static String[] getDriverDiagArray() {\r |
a29c47e0 | 1240 | String[] xPath = new String[] { "/Extern/DriverDiag" };\r |
878ddf1f | 1241 | return getCNames("Externs", xPath);\r |
1242 | }\r | |
1243 | \r | |
1244 | /**\r | |
a29c47e0 | 1245 | * Retrive SetVirtualAddressMapCallBack names\r |
1246 | * \r | |
1247 | * @returns SetVirtualAddressMapCallBack name list if elements are found at\r | |
1248 | * the known xpath\r | |
1249 | * @returns null if nothing is there\r | |
1250 | */\r | |
878ddf1f | 1251 | public static String[] getSetVirtualAddressMapCallBackArray() {\r |
a29c47e0 | 1252 | String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" };\r |
878ddf1f | 1253 | return getCNames("Externs", xPath);\r |
1254 | }\r | |
878ddf1f | 1255 | \r |
a29c47e0 | 1256 | /**\r |
1257 | * Retrive ExitBootServicesCallBack names\r | |
1258 | * \r | |
1259 | * @returns ExitBootServicesCallBack name list if elements are found at the\r | |
1260 | * known xpath\r | |
1261 | * @returns null if nothing is there\r | |
1262 | */\r | |
878ddf1f | 1263 | public static String[] getExitBootServicesCallBackArray() {\r |
a29c47e0 | 1264 | String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" };\r |
878ddf1f | 1265 | return getCNames("Externs", xPath);\r |
1266 | }\r | |
1267 | \r | |
1268 | /**\r | |
a29c47e0 | 1269 | * Retrieve module surface area file information\r |
1270 | * \r | |
1271 | * @returns ModuleSA objects list if elements are found at the known xpath\r | |
1272 | * @returns Empty ModuleSA list if nothing is there\r | |
1273 | */\r | |
1274 | public static Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() {\r | |
1275 | String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };\r | |
1276 | Object[] result = get("PlatformSurfaceArea", xPath);\r | |
1277 | String arch = null;\r | |
1278 | String fvBinding = null;\r | |
1279 | String saGuid = null;\r | |
1280 | String saVersion = null;\r | |
1281 | String pkgGuid = null;\r | |
1282 | String pkgVersion = null;\r | |
1283 | \r | |
1284 | Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleMap = new LinkedHashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r | |
878ddf1f | 1285 | \r |
878ddf1f | 1286 | if (result == null) {\r |
a29c47e0 | 1287 | return fpdModuleMap;\r |
1288 | }\r | |
1289 | \r | |
1290 | for (int i = 0; i < result.length; i++) {\r | |
1291 | //\r | |
1292 | // Get Fpd SA Module element node and add to ObjectMap.\r | |
1293 | //\r | |
1294 | Map<String, XmlObject> ObjectMap = new HashMap<String, XmlObject>();\r | |
1295 | ModuleSADocument.ModuleSA moduleSA = (ModuleSADocument.ModuleSA) result[i];\r | |
1296 | if (((ModuleSADocument.ModuleSA) result[i]).getLibraries() != null) {\r | |
1297 | ObjectMap.put("Libraries", moduleSA.getLibraries());\r | |
1298 | }\r | |
1299 | if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) {\r | |
1300 | ObjectMap.put("PcdBuildDefinition", moduleSA\r | |
1301 | .getPcdBuildDefinition());\r | |
1302 | }\r | |
1303 | if (((ModuleSADocument.ModuleSA) result[i])\r | |
1304 | .getModuleSaBuildOptions() != null) {\r | |
1305 | ObjectMap.put("ModuleSaBuildOptions", moduleSA\r | |
1306 | .getModuleSaBuildOptions());\r | |
1307 | }\r | |
1308 | \r | |
1309 | //\r | |
1310 | // Get Fpd SA Module attribute and create FpdMoudleIdentification.\r | |
1311 | //\r | |
1312 | arch = moduleSA.getSupArchList().toString();\r | |
1313 | \r | |
1314 | // TBD\r | |
1315 | fvBinding = null;\r | |
1316 | saVersion = ((ModuleSADocument.ModuleSA) result[i])\r | |
1317 | .getModuleVersion();\r | |
1318 | \r | |
1319 | saGuid = moduleSA.getModuleGuid();\r | |
1320 | pkgGuid = moduleSA.getPackageGuid();\r | |
1321 | pkgVersion = moduleSA.getPackageVersion();\r | |
1322 | \r | |
1323 | //\r | |
1324 | // Create Module Identification which have class member of package\r | |
1325 | // identification.\r | |
1326 | //\r | |
1327 | PackageIdentification pkgId = new PackageIdentification(null,\r | |
1328 | pkgGuid, pkgVersion);\r | |
1329 | ModuleIdentification saId = new ModuleIdentification(null, saGuid,\r | |
1330 | saVersion);\r | |
1331 | \r | |
1332 | saId.setPackage(pkgId);\r | |
1333 | \r | |
1334 | //\r | |
1335 | // Create FpdModule Identification which have class member of module\r | |
1336 | // identification\r | |
1337 | //\r | |
1338 | if (arch != null) {\r | |
1339 | String[] archList = arch.split(" ");\r | |
1340 | for (int j = 0; j < archList.length; j++) {\r | |
1341 | FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, archList[j]);\r | |
1342 | \r | |
1343 | if (fvBinding != null) {\r | |
1344 | fpdSaId.setFvBinding(fvBinding);\r | |
1345 | }\r | |
1346 | \r | |
1347 | //\r | |
1348 | // Put element to Map<FpdModuleIdentification, Map<String,\r | |
1349 | // Object>>.\r | |
1350 | //\r | |
1351 | fpdModuleMap.put(fpdSaId, ObjectMap);\r | |
1352 | }\r | |
250258de | 1353 | }\r |
878ddf1f | 1354 | }\r |
a29c47e0 | 1355 | return fpdModuleMap;\r |
1356 | }\r | |
878ddf1f | 1357 | \r |
a29c47e0 | 1358 | /**\r |
1359 | * Retrieve valid image names\r | |
1360 | * \r | |
1361 | * @returns valid iamges name list if elements are found at the known xpath\r | |
1362 | * @returns empty list if nothing is there\r | |
1363 | */\r | |
1364 | public static String[] getFpdValidImageNames() {\r | |
1365 | String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='ImageName']/FvImageNames" };\r | |
1366 | \r | |
1367 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r | |
1368 | if (queryResult == null) {\r | |
1369 | return new String[0];\r | |
1370 | }\r | |
1371 | \r | |
1372 | String[] result = new String[queryResult.length];\r | |
1373 | for (int i = 0; i < queryResult.length; i++) {\r | |
1374 | result[i] = ((XmlString) queryResult[i]).getStringValue();\r | |
1375 | }\r | |
1376 | \r | |
1377 | return result;\r | |
1378 | }\r | |
1379 | \r | |
8031d48d | 1380 | public static Node getFpdUserExtension() {\r |
e0f8d087 | 1381 | String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore']" }; \r |
a29c47e0 | 1382 | \r |
1383 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r | |
80785fd5 | 1384 | if (queryResult == null || queryResult.length == 0) {\r |
a29c47e0 | 1385 | return null;\r |
1386 | }\r | |
8031d48d | 1387 | UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];\r |
1388 | \r | |
1389 | return a.getDomNode();\r | |
878ddf1f | 1390 | }\r |
1391 | \r | |
03b1a72d | 1392 | /**\r |
a29c47e0 | 1393 | * Retrieve FV image option information\r |
1394 | * \r | |
1395 | * @param fvName\r | |
1396 | * FV image name\r | |
1397 | * \r | |
1398 | * @returns option name/value list if elements are found at the known xpath\r | |
1399 | * @returns empty list if nothing is there\r | |
1400 | */\r | |
1401 | public static String[][] getFpdOptions(String fvName) {\r | |
1402 | String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='"\r | |
1403 | + fvName.toUpperCase() + "']/FvImageOptions" };\r | |
1404 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r | |
1405 | if (queryResult == null) {\r | |
1406 | return new String[0][];\r | |
1407 | }\r | |
1408 | ArrayList<String[]> list = new ArrayList<String[]>();\r | |
1409 | for (int i = 0; i < queryResult.length; i++) {\r | |
1410 | FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];\r | |
1411 | List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item\r | |
1412 | .getNameValueList();\r | |
1413 | Iterator iter = namevalues.iterator();\r | |
1414 | while (iter.hasNext()) {\r | |
1415 | FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nvItem = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue) iter\r | |
1416 | .next();\r | |
1417 | list.add(new String[] { nvItem.getName(), nvItem.getValue() });\r | |
1418 | }\r | |
1419 | }\r | |
1420 | String[][] result = new String[list.size()][2];\r | |
1421 | for (int i = 0; i < list.size(); i++) {\r | |
1422 | result[i][0] = list.get(i)[0];\r | |
1423 | result[i][1] = list.get(i)[1];\r | |
1424 | }\r | |
1425 | return result;\r | |
03b1a72d | 1426 | \r |
a29c47e0 | 1427 | }\r |
03b1a72d | 1428 | \r |
a29c47e0 | 1429 | public static XmlObject getFpdBuildOptions() {\r |
1430 | String[] xPath = new String[] { "/BuildOptions" };\r | |
1431 | \r | |
1432 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r | |
1433 | \r | |
1434 | if (queryResult == null || queryResult.length == 0) {\r | |
1435 | return null;\r | |
03b1a72d | 1436 | }\r |
a29c47e0 | 1437 | return (XmlObject)queryResult[0];\r |
1438 | }\r | |
1439 | \r | |
1440 | public static PlatformIdentification getFpdHeader() {\r | |
1441 | String[] xPath = new String[] { "/PlatformHeader" };\r | |
1442 | \r | |
1443 | Object[] returns = get("PlatformSurfaceArea", xPath);\r | |
1444 | \r | |
1445 | if (returns == null || returns.length == 0) {\r | |
1446 | return null;\r | |
1447 | }\r | |
1448 | PlatformHeaderDocument.PlatformHeader header = (PlatformHeaderDocument.PlatformHeader) returns[0];\r | |
1449 | \r | |
1450 | String name = header.getPlatformName();\r | |
1451 | \r | |
1452 | String guid = header.getGuidValue();\r | |
1453 | \r | |
1454 | String version = header.getVersion();\r | |
1455 | \r | |
1456 | return new PlatformIdentification(name, guid, version);\r | |
03b1a72d | 1457 | }\r |
1458 | \r | |
878ddf1f | 1459 | /**\r |
a29c47e0 | 1460 | * Retrieve FV image attributes information\r |
1461 | * \r | |
1462 | * @param fvName\r | |
1463 | * FV image name\r | |
1464 | * \r | |
1465 | * @returns attribute name/value list if elements are found at the known\r | |
1466 | * xpath\r | |
1467 | * @returns empty list if nothing is there\r | |
1468 | */\r | |
1469 | public static String[][] getFpdAttributes(String fvName) {\r | |
1470 | String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='"\r | |
1471 | + fvName.toUpperCase() + "']/FvImageOptions" };\r | |
1472 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r | |
1473 | if (queryResult == null) {\r | |
1474 | return new String[0][];\r | |
1475 | }\r | |
1476 | ArrayList<String[]> list = new ArrayList<String[]>();\r | |
1477 | for (int i = 0; i < queryResult.length; i++) {\r | |
1478 | \r | |
1479 | FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];\r | |
1480 | List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item.getNameValueList();\r | |
1481 | Iterator iter = namevalues.iterator();\r | |
1482 | while (iter.hasNext()) {\r | |
1483 | FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nvItem = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue) iter\r | |
1484 | .next();\r | |
1485 | list.add(new String[] { nvItem.getName(), nvItem.getValue() });\r | |
1486 | }\r | |
1487 | }\r | |
1488 | String[][] result = new String[list.size()][2];\r | |
1489 | for (int i = 0; i < list.size(); i++) {\r | |
1490 | result[i][0] = list.get(i)[0];\r | |
1491 | result[i][1] = list.get(i)[1];\r | |
1492 | }\r | |
1493 | return result;\r | |
1494 | }\r | |
1495 | \r | |
1496 | /**\r | |
1497 | * Retrieve flash definition file name\r | |
1498 | * \r | |
1499 | * @returns file name if elements are found at the known xpath\r | |
1500 | * @returns null if nothing is there\r | |
1501 | */\r | |
1502 | public static String getFlashDefinitionFile() {\r | |
1503 | String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" };\r | |
1504 | \r | |
1505 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r | |
1506 | if (queryResult == null || queryResult.length == 0) {\r | |
1507 | return null;\r | |
1508 | }\r | |
1509 | \r | |
1510 | FileNameConvention filename = (FileNameConvention) queryResult[queryResult.length - 1];\r | |
1511 | return filename.getStringValue();\r | |
1512 | }\r | |
878ddf1f | 1513 | \r |
878ddf1f | 1514 | public static String[][] getFpdGlobalVariable() {\r |
1515 | String[] xPath = new String[] { "/Flash/FvImages/NameValue" };\r | |
a29c47e0 | 1516 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r |
878ddf1f | 1517 | if (queryResult == null) {\r |
1518 | return new String[0][];\r | |
1519 | }\r | |
1520 | \r | |
1521 | String[][] result = new String[queryResult.length][2];\r | |
a29c47e0 | 1522 | \r |
1523 | for (int i = 0; i < queryResult.length; i++) {\r | |
1524 | FvImagesDocument.FvImages.NameValue item = (FvImagesDocument.FvImages.NameValue)queryResult[i];\r | |
1525 | result[i][0] = item.getName();\r | |
1526 | result[i][1] = item.getValue();\r | |
878ddf1f | 1527 | }\r |
a29c47e0 | 1528 | return result; \r |
878ddf1f | 1529 | }\r |
1530 | \r | |
1531 | /**\r | |
a29c47e0 | 1532 | * Retrieve FV image component options\r |
1533 | * \r | |
1534 | * @param fvName\r | |
1535 | * FV image name\r | |
1536 | * \r | |
1537 | * @returns name/value pairs list if elements are found at the known xpath\r | |
1538 | * @returns empty list if nothing is there\r | |
1539 | */\r | |
1540 | public static String[][] getFpdComponents(String fvName) {\r | |
1541 | String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName.toUpperCase() + "']/FvImageOptions" };\r | |
1542 | Object[] queryResult = get("PlatformSurfaceArea", xPath);\r | |
878ddf1f | 1543 | if (queryResult == null) {\r |
a29c47e0 | 1544 | return new String[0][];\r |
878ddf1f | 1545 | }\r |
1546 | \r | |
a29c47e0 | 1547 | ArrayList<String[]> list = new ArrayList<String[]>();\r |
1548 | for (int i = 0; i < queryResult.length; i++) {\r | |
1549 | FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i];\r | |
1550 | List<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> namevalues = item.getNameValueList();\r | |
1551 | Iterator iter = namevalues.iterator();\r | |
1552 | while (iter.hasNext()) {\r | |
1553 | FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nvItem = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue) iter\r | |
1554 | .next();\r | |
1555 | list.add(new String[] { nvItem.getName(), nvItem.getValue() });\r | |
1556 | }\r | |
1557 | }\r | |
1558 | String[][] result = new String[list.size()][2];\r | |
1559 | for (int i = 0; i < list.size(); i++) {\r | |
1560 | result[i][0] = list.get(i)[0];\r | |
1561 | result[i][1] = list.get(i)[1];\r | |
878ddf1f | 1562 | }\r |
a29c47e0 | 1563 | return result; \r |
1564 | }\r | |
878ddf1f | 1565 | \r |
a29c47e0 | 1566 | /**\r |
1567 | * Retrieve PCD tokens\r | |
1568 | * \r | |
1569 | * @returns CName/ItemType pairs list if elements are found at the known\r | |
1570 | * xpath\r | |
1571 | * @returns null if nothing is there\r | |
1572 | */\r | |
1573 | public static String[][] getPcdTokenArray() {\r | |
1574 | String[] xPath = new String[] { "/PcdData" };\r | |
1575 | \r | |
1576 | Object[] returns = get("PCDs", xPath);\r | |
1577 | if (returns == null || returns.length == 0) {\r | |
1578 | return null;\r | |
1579 | }\r | |
1580 | \r | |
1581 | // PcdCoded.PcdData[] pcds = (PcdCoded.PcdData[]) returns;\r | |
1582 | // String[][] result = new String[pcds.length][2];\r | |
1583 | // for (int i = 0; i < returns.length; ++i) {\r | |
1584 | // if (pcds[i].getItemType() != null) {\r | |
1585 | // result[i][1] = pcds[i].getItemType().toString();\r | |
1586 | // } else {\r | |
1587 | // result[i][1] = null;\r | |
1588 | // }\r | |
1589 | // result[i][0] = pcds[i].getCName();\r | |
1590 | // }\r | |
1591 | \r | |
1592 | return null;\r | |
878ddf1f | 1593 | }\r |
1594 | \r | |
1595 | /**\r | |
a29c47e0 | 1596 | * Get the PcdToken array from module's surface area document. The array\r |
1597 | * should contains following data:\r | |
1598 | * <p>\r | |
1599 | * -------------------------------------------------------------------\r | |
1600 | * </p>\r | |
1601 | * <p>\r | |
1602 | * CName | ItemType | TokenspaceName | DefaultValue | Usage | HelpText\r | |
1603 | * </p>\r | |
1604 | * <p>\r | |
1605 | * -------------------------------------------------------------------\r | |
1606 | * </p>\r | |
1607 | * <p>\r | |
1608 | * Note: Until new schema applying, now we can only get CName, ItemType,\r | |
1609 | * </p>\r | |
1610 | * \r | |
1611 | * @return 2-array table contains all information of PCD token retrieved\r | |
1612 | * from MSA.\r | |
1613 | */\r | |
1614 | public static Object[][] etModulePCDTokenArray() {\r | |
1615 | return null;\r | |
1616 | // int index;\r | |
1617 | // Object[][] result;\r | |
1618 | // PCDs.PcdData[] pcds;\r | |
1619 | // String[] xPath = new String[] { "/PcdData" };\r | |
1620 | // Object[] returns = get("PCDs", xPath);\r | |
1621 | //\r | |
1622 | // if ((returns == null) || (returns.length == 0)) {\r | |
1623 | // return null;\r | |
1624 | // }\r | |
1625 | //\r | |
1626 | // pcds = (PCDs.PcdData[]) returns;\r | |
1627 | // result = new Object[pcds.length][6];\r | |
1628 | // for (index = 0; index < pcds.length; index++) {\r | |
1629 | // //\r | |
1630 | // // Get CName\r | |
1631 | // //\r | |
1632 | // result[index][0] = pcds[index].getCName();\r | |
1633 | // //\r | |
1634 | // // Get ItemType: FEATURE_FLAG, FIXED_AT_BUILD, PATCHABLE_IN_MODLE,\r | |
1635 | // // DYNAMIC, DYNAMIC_EX\r | |
1636 | // //\r | |
1637 | // if (pcds[index].getItemType() != null) {\r | |
1638 | // result[index][1] = pcds[index].getItemType().toString();\r | |
1639 | // } else {\r | |
1640 | // result[index][1] = null;\r | |
1641 | // }\r | |
1642 | //\r | |
1643 | // //\r | |
1644 | // // BUGBUG: following field can *not* be got from current MSA until\r | |
1645 | // // schema changed.\r | |
1646 | // //\r | |
1647 | // // result [index][2] = pcds[index].getTokenSpaceName();\r | |
1648 | // result[index][2] = null;\r | |
1649 | // result[index][3] = pcds[index].getDefaultValue();\r | |
1650 | // // result [index][4] = pcds[index].getUsage ();\r | |
1651 | // result[index][4] = null;\r | |
1652 | // // result [index][5] = pcds[index].getHelpText ();\r | |
1653 | // result[index][5] = null;\r | |
1654 | // }\r | |
1655 | // return result;\r | |
1656 | }\r | |
1657 | \r | |
1658 | /**\r | |
1659 | * Retrieve MAS header\r | |
1660 | * \r | |
1661 | * @return\r | |
1662 | * @return\r | |
1663 | */\r | |
1664 | public static ModuleIdentification getMsaHeader() {\r | |
1665 | String[] xPath = new String[] { "/" };\r | |
1666 | Object[] returns = get("MsaHeader", xPath);\r | |
1667 | \r | |
1668 | if (returns == null || returns.length == 0) {\r | |
1669 | return null;\r | |
1670 | }\r | |
1671 | \r | |
1672 | MsaHeader msaHeader = (MsaHeader) returns[0];\r | |
1673 | //\r | |
1674 | // Get BaseName, ModuleType, GuidValue, Version\r | |
1675 | // which in MsaHeader.\r | |
1676 | //\r | |
1677 | String name = msaHeader.getModuleName();\r | |
1678 | String moduleType = msaHeader.getModuleType().toString();\r | |
1679 | String guid = msaHeader.getGuidValue();\r | |
1680 | String version = msaHeader.getVersion();\r | |
878ddf1f | 1681 | \r |
a29c47e0 | 1682 | ModuleIdentification moduleId = new ModuleIdentification(name, guid,\r |
1683 | version);\r | |
878ddf1f | 1684 | \r |
a29c47e0 | 1685 | moduleId.setModuleType(moduleType);\r |
1686 | \r | |
1687 | return moduleId;\r | |
1688 | }\r | |
878ddf1f | 1689 | \r |
a29c47e0 | 1690 | /**\r |
1691 | * Retrieve Extern Specification\r | |
1692 | * \r | |
1693 | * @param\r | |
1694 | * \r | |
1695 | * @return String[] If have specification element in the <extern> String[0]\r | |
1696 | * If no specification element in the <extern>\r | |
1697 | * \r | |
1698 | */\r | |
1699 | \r | |
1700 | public static String[] getExternSpecificaiton() {\r | |
1701 | String[] xPath = new String[] { "/Specification" };\r | |
1702 | \r | |
1703 | Object[] queryResult = get("Externs", xPath);\r | |
878ddf1f | 1704 | if (queryResult == null) {\r |
a29c47e0 | 1705 | return new String[0];\r |
878ddf1f | 1706 | }\r |
1707 | \r | |
a29c47e0 | 1708 | String[] specificationList = new String[queryResult.length];\r |
1709 | for (int i = 0; i < queryResult.length; i++) {\r | |
136adffc | 1710 | specificationList[i] = ((Sentence)queryResult[i])\r |
1711 | .getStringValue();\r | |
878ddf1f | 1712 | }\r |
a29c47e0 | 1713 | return specificationList;\r |
1714 | }\r | |
878ddf1f | 1715 | \r |
a29c47e0 | 1716 | /**\r |
1717 | * Retreive MsaFile which in SPD\r | |
1718 | * \r | |
1719 | * @param\r | |
1720 | * @return String[][3] The string sequence is ModuleName, ModuleGuid,\r | |
1721 | * ModuleVersion, MsaFile String[0][] If no msafile in SPD\r | |
1722 | */\r | |
1723 | public static String[] getSpdMsaFile() {\r | |
1724 | String[] xPath = new String[] { "/MsaFiles" };\r | |
1725 | \r | |
1726 | Object[] returns = get("PackageSurfaceArea", xPath);\r | |
1727 | if (returns == null) {\r | |
1728 | return new String[0];\r | |
1729 | }\r | |
1730 | \r | |
1731 | List<String> filenameList = ((MsaFilesDocument.MsaFiles) returns[0])\r | |
1732 | .getFilenameList();\r | |
1733 | return filenameList.toArray(new String[filenameList.size()]);\r | |
878ddf1f | 1734 | }\r |
a29c47e0 | 1735 | \r |
878ddf1f | 1736 | /**\r |
a29c47e0 | 1737 | * Reteive\r |
1738 | */\r | |
1739 | public static Map<String, String[]> getSpdLibraryClasses() {\r | |
1740 | String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" };\r | |
878ddf1f | 1741 | \r |
a29c47e0 | 1742 | Object[] returns = get("PackageSurfaceArea", xPath);\r |
878ddf1f | 1743 | \r |
a29c47e0 | 1744 | //\r |
1745 | // Create Map, Key - LibraryClass, String[] - LibraryClass Header file.\r | |
1746 | //\r | |
1747 | Map<String, String[]> libClassHeaderMap = new HashMap<String, String[]>();\r | |
878ddf1f | 1748 | \r |
a29c47e0 | 1749 | if (returns == null) {\r |
1750 | return libClassHeaderMap;\r | |
878ddf1f | 1751 | }\r |
1752 | \r | |
a29c47e0 | 1753 | for (int i = 0; i < returns.length; i++) {\r |
1754 | LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass library = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) returns[i];\r | |
1755 | libClassHeaderMap.put(library.getName(), new String[] { library\r | |
1756 | .getIncludeHeader() });\r | |
1757 | }\r | |
1758 | return libClassHeaderMap;\r | |
1759 | }\r | |
878ddf1f | 1760 | \r |
a29c47e0 | 1761 | /**\r |
1762 | * Reteive\r | |
1763 | */\r | |
1764 | public static Map<String, String> getSpdPackageHeaderFiles() {\r | |
1765 | String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" };\r | |
878ddf1f | 1766 | \r |
a29c47e0 | 1767 | Object[] returns = get("PackageSurfaceArea", xPath);\r |
878ddf1f | 1768 | \r |
a29c47e0 | 1769 | //\r |
1770 | // Create Map, Key - ModuleType, String - PackageInclude Header file.\r | |
1771 | //\r | |
1772 | Map<String, String> packageIncludeMap = new HashMap<String, String>();\r | |
1773 | \r | |
1774 | if (returns == null) {\r | |
1775 | return packageIncludeMap;\r | |
878ddf1f | 1776 | }\r |
a29c47e0 | 1777 | // GlobalData.log.info("" + returns[0].getClass().getName());\r |
1778 | for (int i = 0; i < returns.length; i++) {\r | |
1779 | PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i];\r | |
1780 | packageIncludeMap.put(includeHeader.getModuleType().toString(),\r | |
1781 | includeHeader.getStringValue());\r | |
1782 | }\r | |
1783 | return packageIncludeMap;\r | |
1784 | }\r | |
878ddf1f | 1785 | \r |
a29c47e0 | 1786 | public static PackageIdentification getSpdHeader() {\r |
1787 | String[] xPath = new String[] { "/SpdHeader" };\r | |
1788 | \r | |
1789 | Object[] returns = get("PackageSurfaceArea", xPath);\r | |
1790 | \r | |
1791 | if (returns == null || returns.length == 0) {\r | |
1792 | return null;\r | |
878ddf1f | 1793 | }\r |
1794 | \r | |
a29c47e0 | 1795 | SpdHeaderDocument.SpdHeader header = (SpdHeaderDocument.SpdHeader) returns[0];\r |
1796 | \r | |
1797 | String name = header.getPackageName();\r | |
1798 | \r | |
1799 | String guid = header.getGuidValue();\r | |
1800 | \r | |
1801 | String version = header.getVersion();\r | |
1802 | \r | |
1803 | return new PackageIdentification(name, guid, version);\r | |
878ddf1f | 1804 | }\r |
a29c47e0 | 1805 | \r |
878ddf1f | 1806 | /**\r |
a29c47e0 | 1807 | * Reteive\r |
1808 | */\r | |
1809 | public static Map<String, String[]> getSpdGuid() {\r | |
1810 | String[] xPath = new String[] { "/GuidDeclarations/Entry" };\r | |
878ddf1f | 1811 | \r |
a29c47e0 | 1812 | Object[] returns = get("PackageSurfaceArea", xPath);\r |
878ddf1f | 1813 | \r |
a29c47e0 | 1814 | //\r |
1815 | // Create Map, Key - GuidName, String[] - C_NAME & GUID value.\r | |
1816 | //\r | |
1817 | Map<String, String[]> guidDeclMap = new HashMap<String, String[]>();\r | |
1818 | if (returns == null) {\r | |
1819 | return guidDeclMap;\r | |
878ddf1f | 1820 | }\r |
1821 | \r | |
a29c47e0 | 1822 | for (int i = 0; i < returns.length; i++) {\r |
1823 | GuidDeclarationsDocument.GuidDeclarations.Entry entry = (GuidDeclarationsDocument.GuidDeclarations.Entry) returns[i];\r | |
1824 | String[] guidPair = new String[2];\r | |
1825 | guidPair[0] = entry.getCName();\r | |
1826 | guidPair[1] = entry.getGuidValue();\r | |
1827 | guidDeclMap.put(entry.getName(), guidPair);\r | |
136adffc | 1828 | EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r |
1829 | EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[0]);\r | |
1830 | EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[1]);\r | |
a29c47e0 | 1831 | }\r |
1832 | return guidDeclMap;\r | |
878ddf1f | 1833 | }\r |
a29c47e0 | 1834 | \r |
878ddf1f | 1835 | /**\r |
a29c47e0 | 1836 | * Reteive\r |
1837 | */\r | |
1838 | public static Map<String, String[]> getSpdProtocol() {\r | |
1839 | String[] xPath = new String[] { "/ProtocolDeclarations/Entry" };\r | |
878ddf1f | 1840 | \r |
a29c47e0 | 1841 | Object[] returns = get("PackageSurfaceArea", xPath);\r |
878ddf1f | 1842 | \r |
a29c47e0 | 1843 | //\r |
1844 | // Create Map, Key - protocolName, String[] - C_NAME & GUID value.\r | |
1845 | //\r | |
1846 | Map<String, String[]> protoclMap = new HashMap<String, String[]>();\r | |
878ddf1f | 1847 | \r |
a29c47e0 | 1848 | if (returns == null) {\r |
1849 | return protoclMap;\r | |
878ddf1f | 1850 | }\r |
1851 | \r | |
a29c47e0 | 1852 | for (int i = 0; i < returns.length; i++) {\r |
1853 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry entry = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) returns[i];\r | |
1854 | String[] protocolPair = new String[2];\r | |
878ddf1f | 1855 | \r |
a29c47e0 | 1856 | protocolPair[0] = entry.getCName();\r |
1857 | protocolPair[1] = entry.getGuidValue();\r | |
1858 | protoclMap.put(entry.getName(), protocolPair);\r | |
136adffc | 1859 | EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r |
1860 | EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[0]);\r | |
1861 | EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[1]);\r | |
a29c47e0 | 1862 | }\r |
1863 | return protoclMap;\r | |
1864 | }\r | |
878ddf1f | 1865 | \r |
a29c47e0 | 1866 | /**\r |
1867 | * getSpdPpi() Retrieve the SPD PPI Entry\r | |
1868 | * \r | |
1869 | * @param\r | |
1870 | * @return Map<String, String[2]> if get the PPI entry from SPD. Key - PPI\r | |
1871 | * Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI\r | |
1872 | * entry in SPD.\r | |
1873 | */\r | |
1874 | public static Map<String, String[]> getSpdPpi() {\r | |
1875 | String[] xPath = new String[] { "/PpiDeclarations/Entry" };\r | |
1876 | \r | |
1877 | Object[] returns = get("PackageSurfaceArea", xPath);\r | |
1878 | \r | |
1879 | //\r | |
1880 | // Create Map, Key - protocolName, String[] - C_NAME & GUID value.\r | |
1881 | //\r | |
1882 | Map<String, String[]> ppiMap = new HashMap<String, String[]>();\r | |
878ddf1f | 1883 | \r |
a29c47e0 | 1884 | if (returns == null) {\r |
1885 | return ppiMap;\r | |
878ddf1f | 1886 | }\r |
1887 | \r | |
a29c47e0 | 1888 | for (int i = 0; i < returns.length; i++) {\r |
1889 | PpiDeclarationsDocument.PpiDeclarations.Entry entry = (PpiDeclarationsDocument.PpiDeclarations.Entry) returns[i];\r | |
1890 | String[] ppiPair = new String[2];\r | |
1891 | ppiPair[0] = entry.getCName();\r | |
1892 | ppiPair[1] = entry.getGuidValue();\r | |
1893 | ppiMap.put(entry.getName(), ppiPair);\r | |
878ddf1f | 1894 | }\r |
a29c47e0 | 1895 | return ppiMap;\r |
878ddf1f | 1896 | }\r |
a29c47e0 | 1897 | \r |
878ddf1f | 1898 | /**\r |
a29c47e0 | 1899 | * getToolChainFamily\r |
1900 | * \r | |
1901 | * This function is to retrieve ToolChainFamily attribute of FPD\r | |
1902 | * <BuildOptions>\r | |
1903 | * \r | |
1904 | * @param\r | |
1905 | * @return toolChainFamily If find toolChainFamily attribute in\r | |
1906 | * <BuildOptions> Null If don't have toolChainFamily in\r | |
1907 | * <BuildOptions>.\r | |
1908 | */\r | |
1909 | public String getToolChainFamily() {\r | |
1910 | String toolChainFamily;\r | |
1911 | String[] xPath = new String[] { "/BuildOptions" };\r | |
1912 | \r | |
1913 | Object[] result = get("PlatformSurfaceArea", xPath);\r | |
1914 | if (result == null) {\r | |
878ddf1f | 1915 | return null;\r |
1916 | }\r | |
a29c47e0 | 1917 | // toolChainFamily =\r |
1918 | // ((BuildOptionsDocument.BuildOptions)result[0]).getToolChainFamilies();\r | |
1919 | // return toolChainFamily;\r | |
1920 | return null;\r | |
1921 | }\r | |
878ddf1f | 1922 | \r |
a29c47e0 | 1923 | /**\r |
1924 | * Retrieve module Guid string\r | |
1925 | * \r | |
1926 | * @returns GUILD string if elements are found at the known xpath\r | |
1927 | * @returns null if nothing is there\r | |
1928 | */\r | |
1929 | public static String getModuleGuid() {\r | |
1930 | String[] xPath = new String[] { "" };\r | |
1931 | \r | |
1932 | Object[] returns = get("MsaHeader", xPath);\r | |
1933 | if (returns != null && returns.length > 0) {\r | |
1934 | String guid = ((MsaHeaderDocument.MsaHeader) returns[0])\r | |
1935 | .getGuidValue();\r | |
1936 | return guid;\r | |
ad82307c | 1937 | }\r |
a29c47e0 | 1938 | \r |
1939 | return null;\r | |
1940 | }\r | |
1941 | \r | |
1942 | //\r | |
1943 | // For new Pcd\r | |
1944 | //\r | |
1945 | public static ModuleSADocument.ModuleSA[] getFpdModuleSAs() {\r | |
1946 | String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };\r | |
1947 | Object[] result = get("PlatformSurfaceArea", xPath);\r | |
1948 | if (result != null) {\r | |
1949 | return (ModuleSADocument.ModuleSA[]) result;\r | |
1950 | }\r | |
1951 | return new ModuleSADocument.ModuleSA[0];\r | |
1952 | \r | |
878ddf1f | 1953 | }\r |
136adffc | 1954 | /**\r |
1955 | Get name array of PCD in a module. In one module, token space\r | |
1956 | is same, and token name should not be conflicted.\r | |
1957 | \r | |
1958 | @return String[]\r | |
1959 | **/\r | |
1960 | public static String[] getModulePcdEntryNameArray() {\r | |
1961 | PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null;\r | |
1962 | String[] results;\r | |
1963 | int index;\r | |
1964 | String[] xPath = new String[] {"/PcdEntry"};\r | |
1965 | Object[] returns = get ("PcdCoded", xPath);\r | |
1966 | \r | |
1967 | if (returns == null) {\r | |
1968 | return new String[0];\r | |
1969 | }\r | |
1970 | \r | |
1971 | pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns;\r | |
1972 | results = new String[pcdEntries.length];\r | |
1973 | \r | |
1974 | for (index = 0; index < pcdEntries.length; index ++) {\r | |
1975 | results[index] = pcdEntries[index].getCName();\r | |
1976 | }\r | |
1977 | return results;\r | |
1978 | }\r | |
878ddf1f | 1979 | }\r |