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