2 This file is for surface area information retrieval.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 package org
.tianocore
.build
.global
;
16 import java
.util
.ArrayList
;
17 import java
.util
.HashMap
;
18 import java
.util
.Iterator
;
19 import java
.util
.LinkedHashMap
;
20 import java
.util
.List
;
22 import java
.util
.Stack
;
23 import java
.util
.regex
.Matcher
;
24 import java
.util
.regex
.Pattern
;
26 import org
.apache
.xmlbeans
.XmlObject
;
27 import org
.apache
.xmlbeans
.XmlString
;
28 import org
.tianocore
.*;
29 import org
.tianocore
.ExternsDocument
.Externs
.Extern
;
30 import org
.tianocore
.FilenameDocument
.Filename
;
31 import org
.tianocore
.ModuleDefinitionsDocument
.ModuleDefinitions
;
32 import org
.tianocore
.MsaHeaderDocument
.MsaHeader
;
33 import org
.tianocore
.ProtocolsDocument
.Protocols
.Protocol
;
34 import org
.tianocore
.ProtocolsDocument
.Protocols
.ProtocolNotify
;
35 import org
.tianocore
.build
.autogen
.CommonDefinition
;
36 import org
.tianocore
.build
.id
.FpdModuleIdentification
;
37 import org
.tianocore
.build
.id
.ModuleIdentification
;
38 import org
.tianocore
.build
.id
.PackageIdentification
;
39 import org
.tianocore
.build
.id
.PlatformIdentification
;
40 import org
.tianocore
.build
.toolchain
.ToolChainInfo
;
41 import org
.tianocore
.common
.definitions
.EdkDefinitions
;
42 import org
.tianocore
.common
.exception
.EdkException
;
43 import org
.w3c
.dom
.Node
;
46 * SurfaceAreaQuery class is used to query Surface Area information from msa,
47 * mbd, spd and fpd files.
49 * This class should not instantiated. All the public interfaces is static.
53 public class SurfaceAreaQuery
{
55 public String prefix
= "http://www.TianoCore.org/2006/Edk2.0";
58 // Contains name/value pairs of Surface Area document object. The name is
59 // always the top level element name.
61 private Map
<String
, XmlObject
> map
= null;
64 // mapStack is used to do nested query
66 private Stack
<Map
<String
, XmlObject
>> mapStack
= new Stack
<Map
<String
, XmlObject
>>();
69 // prefix of name space
71 private String nsPrefix
= "sans";
74 // xmlbeans needs a name space for each Xpath element
76 private String ns
= null;
79 // keep the namep declaration for xmlbeans Xpath query
81 private String queryDeclaration
= null;
82 private StringBuffer normQueryString
= new StringBuffer(4096);
83 private Pattern xPathPattern
= Pattern
.compile("([^/]*)(/|//)([^/]+)");
86 * Set a Surface Area document for query later
89 * A Surface Area document in TopLevelElementName/XmlObject
92 public SurfaceAreaQuery(Map
<String
, XmlObject
> map
) {
94 queryDeclaration
= "declare namespace " + nsPrefix
+ "='" + ns
+ "'; ";
99 * Push current used Surface Area document into query stack. The given new
100 * document will be used for any immediately followed getXXX() callings,
101 * untill pop() is called.
104 * The TopLevelElementName/XmlObject format of a Surface Area
107 public void push(Map
<String
, XmlObject
> newMap
) {
108 mapStack
.push(this.map
);
113 * Discard current used Surface Area document and use the top document in
117 this.map
= mapStack
.pop();
121 // / Convert xPath to be namespace qualified, which is necessary for
123 // / selectPath(). For example, converting /MsaHeader/ModuleType to
124 // / /ns:MsaHeader/ns:ModuleType
126 private String
normalizeQueryString(String
[] exp
, String from
) {
127 normQueryString
.setLength(0);
130 while (i
< exp
.length
) {
131 String newExp
= from
+ exp
[i
];
132 Matcher matcher
= xPathPattern
.matcher(newExp
);
134 while (matcher
.find()) {
135 String starter
= newExp
.substring(matcher
.start(1), matcher
137 String seperator
= newExp
.substring(matcher
.start(2), matcher
139 String token
= newExp
.substring(matcher
.start(3), matcher
142 normQueryString
.append(starter
);
143 normQueryString
.append(seperator
);
144 normQueryString
.append(nsPrefix
);
145 normQueryString
.append(":");
146 normQueryString
.append(token
);
150 if (i
< exp
.length
) {
151 normQueryString
.append(" | ");
155 return normQueryString
.toString();
159 * Search all XML documents stored in "map" for the specified xPath, using
160 * relative path (starting with '$this')
163 * xpath query string array
164 * @returns An array of XmlObject if elements are found at the specified
166 * @returns NULL if nothing is at the specified xpath
168 public Object
[] get(String
[] xPath
) {
173 String
[] keys
= (String
[]) map
.keySet().toArray(new String
[map
.size()]);
174 List
<Object
> result
= new ArrayList
<Object
>();
175 for (int i
= 0; i
< keys
.length
; ++i
) {
176 XmlObject rootNode
= (XmlObject
) map
.get(keys
[i
]);
177 if (rootNode
== null) {
181 String query
= queryDeclaration
182 + normalizeQueryString(xPath
, "$this/" + keys
[i
]);
183 XmlObject
[] tmp
= rootNode
.selectPath(query
);
184 for (int j
= 0; j
< tmp
.length
; ++j
) {
185 result
.add((Object
)tmp
[j
]);
189 int size
= result
.size();
194 return (Object
[]) result
.toArray(new Object
[size
]);
198 * Search XML documents named by "rootName" for the given xPath, using
199 * relative path (starting with '$this')
202 * The top level element name
204 * The xpath query string array
205 * @returns An array of XmlObject if elements are found at the given xpath
206 * @returns NULL if nothing is found at the given xpath
208 public Object
[] get(String rootName
, String
[] xPath
) {
213 XmlObject root
= (XmlObject
) map
.get(rootName
);
218 String query
= queryDeclaration
219 + normalizeQueryString(xPath
, "$this/" + rootName
);
220 XmlObject
[] result
= root
.selectPath(query
);
221 if (result
.length
> 0) {
222 return (Object
[])result
;
225 query
= queryDeclaration
+ normalizeQueryString(xPath
, "/" + rootName
);
226 result
= root
.selectPath(query
);
227 if (result
.length
> 0) {
228 return (Object
[])result
;
235 * Retrieve SourceFiles/Filename for specified ARCH type
239 * @returns An 2 dimension string array if elements are found at the known
241 * @returns NULL if nothing is found at the known xpath
243 public String
[][] getSourceFiles(String arch
) {
247 xPath
= new String
[] { "/Filename" };
249 returns
= get("SourceFiles", xPath
);
251 if (returns
== null || returns
.length
== 0) {
252 return new String
[0][3];
255 Filename
[] sourceFileNames
= (Filename
[]) returns
;
256 List
<String
[]> outputList
= new ArrayList
<String
[]>();
257 for (int i
= 0; i
< sourceFileNames
.length
; i
++) {
258 List archList
= sourceFileNames
[i
].getSupArchList();
259 if (arch
== null || arch
.trim().equalsIgnoreCase("") || archList
== null || contains(archList
, arch
)) {
260 outputList
.add(new String
[] {sourceFileNames
[i
].getToolCode(), sourceFileNames
[i
].getStringValue(), sourceFileNames
[i
].getToolChainFamily()});
264 String
[][] outputString
= new String
[outputList
.size()][3];
265 for (int index
= 0; index
< outputList
.size(); index
++) {
267 // ToolCode (FileType)
269 outputString
[index
][0] = outputList
.get(index
)[0];
271 // File name (relative to MODULE_DIR)
273 outputString
[index
][1] = outputList
.get(index
)[1];
277 outputString
[index
][2] = outputList
.get(index
)[2];
283 * Retrieve /PlatformDefinitions/OutputDirectory from FPD
285 * @returns Directory names array if elements are found at the known xpath
286 * @returns Empty if nothing is found at the known xpath
288 public String
getFpdOutputDirectory() {
289 String
[] xPath
= new String
[] { "/PlatformDefinitions" };
291 Object
[] returns
= get("PlatformSurfaceArea", xPath
);
292 if (returns
== null || returns
.length
== 0) {
295 PlatformDefinitionsDocument
.PlatformDefinitions item
= (PlatformDefinitionsDocument
.PlatformDefinitions
)returns
[0];
296 return item
.getOutputDirectory();
299 public String
getFpdIntermediateDirectories() {
300 String
[] xPath
= new String
[] { "/PlatformDefinitions" };
302 Object
[] returns
= get("PlatformSurfaceArea", xPath
);
303 if (returns
== null || returns
.length
== 0) {
306 PlatformDefinitionsDocument
.PlatformDefinitions item
= (PlatformDefinitionsDocument
.PlatformDefinitions
)returns
[0];
307 if(item
.getIntermediateDirectories() == null) {
311 return item
.getIntermediateDirectories().toString();
315 public String
getModuleFfsKeyword() {
316 String
[] xPath
= new String
[] { "/" };
318 Object
[] returns
= get("ModuleSaBuildOptions", xPath
);
319 if (returns
== null || returns
.length
== 0) {
322 ModuleSaBuildOptionsDocument
.ModuleSaBuildOptions item
= (ModuleSaBuildOptionsDocument
.ModuleSaBuildOptions
)returns
[0];
323 return item
.getFfsFormatKey();
326 public String
getModuleFvBindingKeyword() {
327 String
[] xPath
= new String
[] { "/" };
329 Object
[] returns
= get("ModuleSaBuildOptions", xPath
);
330 if (returns
== null || returns
.length
== 0) {
333 ModuleSaBuildOptionsDocument
.ModuleSaBuildOptions item
= (ModuleSaBuildOptionsDocument
.ModuleSaBuildOptions
)returns
[0];
334 return item
.getFvBinding();
337 public List
getModuleSupportedArchs() {
338 String
[] xPath
= new String
[] { "/" };
340 Object
[] returns
= get("ModuleDefinitions", xPath
);
341 if (returns
== null || returns
.length
== 0) {
344 ModuleDefinitionsDocument
.ModuleDefinitions item
= (ModuleDefinitionsDocument
.ModuleDefinitions
)returns
[0];
345 return item
.getSupportedArchitectures();
348 public BuildOptionsDocument
.BuildOptions
.Ffs
[] getFpdFfs() {
349 String
[] xPath
= new String
[] {"/Ffs"};
351 Object
[] returns
= get("BuildOptions", xPath
);
352 if (returns
== null || returns
.length
== 0) {
353 return new BuildOptionsDocument
.BuildOptions
.Ffs
[0];
355 return (BuildOptionsDocument
.BuildOptions
.Ffs
[])returns
;
358 public String
getModuleOutputFileBasename() {
359 String
[] xPath
= new String
[] { "/" };
361 Object
[] returns
= get("ModuleDefinitions", xPath
);
362 if (returns
== null || returns
.length
== 0) {
365 ModuleDefinitionsDocument
.ModuleDefinitions item
= (ModuleDefinitionsDocument
.ModuleDefinitions
)returns
[0];
366 return item
.getOutputFileBasename();
370 * Retrieve BuildOptions/Option or Arch/Option
372 * @param toolChainFamilyFlag
373 * if true, retrieve options for toolchain family; otherwise for
376 * @returns String[][5] name, target, toolchain, arch, coommand of options
377 * if elements are found at the known xpath. String[0][] if dont
380 * @returns Empty array if nothing is there
382 public String
[][] getOptions(String from
, String
[] xPath
, boolean toolChainFamilyFlag
) {
383 String target
= null;
384 String toolchain
= null;
385 String toolchainFamily
= null;
386 List
<String
> archList
= null;
388 String optionName
= null;
390 Object
[] returns
= get(from
, xPath
);
391 if (returns
== null) {
392 return new String
[0][5];
395 List
<String
[]> optionList
= new ArrayList
<String
[]>();
396 OptionDocument
.Option option
;
398 for (int i
= 0; i
< returns
.length
; i
++) {
399 option
= (OptionDocument
.Option
) returns
[i
];
402 // Get Target, ToolChain(Family), Arch, Cmd, and Option from Option,
404 // put to result[][5] array in above order.
407 if (option
.getBuildTargets() == null) {
411 target
= option
.getBuildTargets().toString();
413 if (target
!= null) {
414 targetList
= target
.split(" ");
416 targetList
= new String
[1];
417 targetList
[0] = null;
420 if (toolChainFamilyFlag
) {
421 toolchainFamily
= option
.getToolChainFamily();
422 if (toolchainFamily
!= null) {
423 toolchain
= toolchainFamily
.toString();
428 toolchain
= option
.getTagName();
431 archList
= new ArrayList
<String
>();
432 List archEnumList
= option
.getSupArchList();
433 if (archEnumList
== null) {
436 //archList.addAll(archEnumList);
437 Iterator it
= archEnumList
.iterator();
438 while (it
.hasNext()) {
439 String archType
= (String
)it
.next();
440 archList
.add(archType
);
444 cmd
= option
.getToolCode();
446 optionName
= option
.getStringValue();
447 for (int t
= 0; t
< targetList
.length
; t
++) {
448 for (int j
= 0; j
< archList
.size(); j
++) {
449 optionList
.add(new String
[] { targetList
[t
],
450 toolchain
, archList
.get(j
), cmd
, optionName
});
455 String
[][] result
= new String
[optionList
.size()][5];
456 for (int i
= 0; i
< optionList
.size(); i
++) {
457 result
[i
][0] = optionList
.get(i
)[0];
458 result
[i
][1] = optionList
.get(i
)[1];
459 result
[i
][2] = optionList
.get(i
)[2];
460 result
[i
][3] = optionList
.get(i
)[3];
461 result
[i
][4] = optionList
.get(i
)[4];
466 public String
[][] getModuleBuildOptions(boolean toolChainFamilyFlag
) {
469 if (toolChainFamilyFlag
== true) {
470 xPath
= new String
[] {
471 "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
472 "/Options/Option[@ToolChainFamily]", };
474 xPath
= new String
[] {
475 "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
476 "/Options/Option[@TagName]", };
478 return getOptions("ModuleSaBuildOptions", xPath
, toolChainFamilyFlag
);
481 public String
[][] getPlatformBuildOptions(boolean toolChainFamilyFlag
) {
484 if (toolChainFamilyFlag
== true) {
485 xPath
= new String
[] {
486 "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
487 "/BuildOptions/Options/Option[@ToolChainFamily]", };
489 xPath
= new String
[] {
490 "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
491 "/BuildOptions/Options/Option[@TagName]", };
494 return getOptions("PlatformSurfaceArea", xPath
, toolChainFamilyFlag
);
497 public String
[][] getMsaBuildOptions(boolean toolChainFamilyFlag
) {
500 if (toolChainFamilyFlag
== true) {
501 xPath
= new String
[] {
502 "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
503 "/Options/Option[@ToolChainFamily]", };
505 xPath
= new String
[] {
506 "/Options/Option[not(@ToolChainFamily) and not(@TagName)]",
507 "/Options/Option[@TagName]", };
510 return getOptions("ModuleBuildOptions", xPath
, toolChainFamilyFlag
);
513 public ToolChainInfo
getFpdToolChainInfo() {
514 String
[] xPath
= new String
[] { "/PlatformDefinitions" };
516 Object
[] returns
= get("PlatformSurfaceArea", xPath
);
517 if (returns
== null || returns
.length
== 0) {
521 PlatformDefinitionsDocument
.PlatformDefinitions item
= (PlatformDefinitionsDocument
.PlatformDefinitions
)returns
[0];
522 ToolChainInfo toolChainInfo
= new ToolChainInfo();
523 toolChainInfo
.addTargets(item
.getBuildTargets().toString());
524 toolChainInfo
.addArchs(item
.getSupportedArchitectures().toString());
525 toolChainInfo
.addTagnames((String
)null);
526 return toolChainInfo
;
530 * Retrieve <xxxHeader>/ModuleType
532 * @returns The module type name if elements are found at the known xpath
533 * @returns null if nothing is there
535 public String
getModuleType() {
536 String
[] xPath
= new String
[] { "/ModuleType" };
538 Object
[] returns
= get(xPath
);
539 if (returns
!= null && returns
.length
> 0) {
540 ModuleTypeDef type
= (ModuleTypeDef
) returns
[0];
541 return type
.enumValue().toString();
548 * Retrieve <ModuleDefinitions>/<BinaryModule>
550 * @returns The module type name if elements are found at the known xpath
551 * @returns null if nothing is there
553 public boolean getBinaryModule() {
554 String
[] xPath
= new String
[] { "/" };
556 Object
[] returns
= get("ModuleDefinitions", xPath
);
557 if (returns
!= null && returns
.length
> 0) {
558 ModuleDefinitionsDocument
.ModuleDefinitions def
= (ModuleDefinitionsDocument
.ModuleDefinitions
)returns
[0];
559 return def
.getBinaryModule();
566 * Retrieve PackageDependencies/Package
571 * @returns package name list if elements are found at the known xpath
572 * @returns null if nothing is there
574 public PackageIdentification
[] getDependencePkg(String arch
) throws EdkException
{
576 String packageGuid
= null;
577 String packageVersion
= null;
580 xPath
= new String
[] { "/Package" };
582 Object
[] returns
= get("PackageDependencies", xPath
);
583 if (returns
== null) {
584 return new PackageIdentification
[0];
588 // Get packageIdentification
590 List
<PackageIdentification
> packageIdList
= new ArrayList
<PackageIdentification
>();
591 for (int i
= 0; i
< returns
.length
; i
++) {
592 PackageDependenciesDocument
.PackageDependencies
.Package item
= (PackageDependenciesDocument
.PackageDependencies
.Package
) returns
[i
];
593 List archList
= item
.getSupArchList();
594 if (arch
== null || archList
== null || contains(archList
, arch
)) {
595 packageGuid
= item
.getPackageGuid();
596 packageVersion
= item
.getPackageVersion();
597 PackageIdentification pkgId
= new PackageIdentification(null, packageGuid
, packageVersion
);
598 GlobalData
.refreshPackageIdentification(pkgId
);
599 packageIdList
.add(pkgId
);
603 return packageIdList
.toArray(new PackageIdentification
[packageIdList
.size()]);
607 * Retrieve LibraryClassDefinitions/LibraryClass for specified usage
610 * Library class usage
612 * @returns LibraryClass objects list if elements are found at the known
614 * @returns null if nothing is there
616 public String
[] getLibraryClasses(String usage
, String arch
, String moduleType
) {
618 if (usage
== null || usage
.equals("")) {
619 xPath
= new String
[] { "/LibraryClass" };
621 xPath
= new String
[] { "/LibraryClass[@Usage='" + usage
+ "']" };
624 Object
[] returns
= get("LibraryClassDefinitions", xPath
);
625 if (returns
== null || returns
.length
== 0) {
626 return new String
[0];
629 LibraryClassDocument
.LibraryClass
[] libraryClassList
= (LibraryClassDocument
.LibraryClass
[]) returns
;
630 List
<String
> libraryClassName
= new ArrayList
<String
>();
631 for (int i
= 0; i
< libraryClassList
.length
; i
++) {
632 List archList
= libraryClassList
[i
].getSupArchList();
633 List moduleTypeList
= libraryClassList
[i
].getSupModuleList();
634 if ((arch
== null || contains(archList
, arch
))
635 && (moduleType
== null || contains(moduleTypeList
, moduleType
))) {
636 libraryClassName
.add(libraryClassList
[i
].getKeyword());
640 String
[] libraryArray
= new String
[libraryClassName
.size()];
641 libraryClassName
.toArray(libraryArray
);
646 * Retrieve ModuleEntryPoint names
648 * @returns ModuleEntryPoint name list if elements are found at the known
650 * @returns null if nothing is there
652 public String
[] getModuleEntryPointArray() {
653 String
[] xPath
= new String
[] { "/Extern/ModuleEntryPoint" };
655 Object
[] returns
= get("Externs", xPath
);
657 if (returns
!= null && returns
.length
> 0) {
658 String
[] entryPoints
= new String
[returns
.length
];
660 for (int i
= 0; i
< returns
.length
; ++i
) {
661 entryPoints
[i
] = ((CNameType
) returns
[i
]).getStringValue();
671 * retrieve Protocol for specified usage
674 * Protocol usage arch Architecture
676 * @returns Protocol String list if elements are found at the known xpath
677 * @returns String[0] if nothing is there
679 public String
[] getProtocolArray(String arch
, String usage
) {
681 String usageXpath
= "";
682 String archXpath
= "";
684 if (arch
== null || arch
.equals("")) {
685 return new String
[0];
687 archXpath
= "/Protocol";
688 if (usage
!= null && !usage
.equals("")) {
689 usageXpath
= "/Protocol[@Usage='" + usage
+ "']";
690 xPath
= new String
[] { usageXpath
, archXpath
};
692 return getProtocolArray(arch
);
697 Object
[] returns
= get("Protocols", xPath
);
698 if (returns
== null) {
699 return new String
[0];
701 Protocol
[] protocolList
= (Protocol
[]) returns
;
703 String
[] protocolArray
= new String
[returns
.length
];
704 for (int i
= 0; i
< returns
.length
; i
++) {
705 protocolArray
[i
] = protocolList
[i
].getProtocolCName();
707 return protocolArray
;
711 * retrieve Protocol for specified usage
716 * @returns Protocol String list if elements are found at the known xpath
717 * @returns String[0] if nothing is there
719 public String
[] getProtocolArray(String arch
) {
722 if (arch
== null || arch
.equals("")) {
723 return new String
[0];
725 xPath
= new String
[] { "/Protocol" };
728 Object
[] returns
= get("Protocols", xPath
);
729 if (returns
== null) {
730 return new String
[0];
732 Protocol
[] returnlList
= (Protocol
[]) returns
;
734 List
<String
> protocolList
= new ArrayList
<String
>();
736 for (int i
= 0; i
< returns
.length
; i
++) {
737 List archList
= returnlList
[i
].getSupArchList();
738 if (archList
== null || contains(archList
, arch
)){
739 protocolList
.add(returnlList
[i
].getProtocolCName());
742 String
[] protocolArray
= new String
[protocolList
.size()];
743 for (int i
= 0; i
< protocolList
.size(); i
++) {
744 protocolArray
[i
] = protocolList
.get(i
);
746 return protocolArray
;
750 * Retrieve ProtocolNotify for specified usage
753 * ProtocolNotify usage
755 * @returns String[] if elements are found at the known xpath
756 * @returns String[0] if nothing is there
758 public String
[] getProtocolNotifyArray(String arch
) {
761 if (arch
== null || arch
.equals("")) {
762 return new String
[0];
764 xPath
= new String
[] { "/ProtocolNotify" };
767 Object
[] returns
= get("Protocols", xPath
);
768 if (returns
== null) {
769 return new String
[0];
772 List
<String
> protocolNotifyList
= new ArrayList
<String
>();
774 for (int i
= 0; i
< returns
.length
; i
++) {
775 List archList
= ((ProtocolNotify
) returns
[i
]).getSupArchList();
776 if (archList
== null || contains(archList
, arch
)){
777 protocolNotifyList
.add(((ProtocolNotify
) returns
[i
]).getProtocolNotifyCName());
781 String
[] protocolNotifyArray
= new String
[protocolNotifyList
.size()];
782 for (int i
= 0; i
< protocolNotifyList
.size(); i
++) {
783 protocolNotifyArray
[i
] = protocolNotifyList
.get(i
);
785 return protocolNotifyArray
;
789 * Retrieve ProtocolNotify for specified usage
792 * ProtocolNotify usage
794 * @returns String[] if elements are found at the known xpath
795 * @returns String[0] if nothing is there
797 public String
[] getProtocolNotifyArray(String arch
, String usage
) {
803 if (arch
== null || arch
.equals("")) {
804 return new String
[0];
806 archXpath
= "/ProtocolNotify";
807 if (usage
!= null && !usage
.equals("")) {
808 usageXpath
= "/ProtocolNotify[@Usage='" + arch
+ "']";
809 xPath
= new String
[] { archXpath
, usageXpath
};
811 return getProtocolNotifyArray(arch
);
815 Object
[] returns
= get("Protocols", xPath
);
816 if (returns
== null) {
817 return new String
[0];
820 String
[] protocolNotifyList
= new String
[returns
.length
];
822 for (int i
= 0; i
< returns
.length
; i
++) {
823 protocolNotifyList
[i
] = ((ProtocolNotify
) returns
[i
]).getProtocolNotifyCName();
825 return protocolNotifyList
;
829 * Retrieve ModuleUnloadImage names
831 * @returns ModuleUnloadImage name list if elements are found at the known
833 * @returns null if nothing is there
835 public String
[] getModuleUnloadImageArray() {
836 String
[] xPath
= new String
[] { "/Extern/ModuleUnloadImage" };
838 Object
[] returns
= get("Externs", xPath
);
839 if (returns
!= null && returns
.length
> 0) {
840 String
[] stringArray
= new String
[returns
.length
];
841 CNameType
[] doc
= (CNameType
[]) returns
;
843 for (int i
= 0; i
< returns
.length
; ++i
) {
844 stringArray
[i
] = doc
[i
].getStringValue();
856 * @returns Extern objects list if elements are found at the known xpath
857 * @returns null if nothing is there
859 public ExternsDocument
.Externs
.Extern
[] getExternArray() {
860 String
[] xPath
= new String
[] { "/Extern" };
862 Object
[] returns
= get("Externs", xPath
);
863 if (returns
!= null && returns
.length
> 0) {
864 return (ExternsDocument
.Externs
.Extern
[]) returns
;
871 * Retrieve PpiNotify for specified arch
876 * @returns String[] if elements are found at the known xpath
877 * @returns String[0] if nothing is there
879 public String
[] getPpiNotifyArray(String arch
) {
882 if (arch
== null || arch
.equals("")) {
883 return new String
[0];
885 xPath
= new String
[] { "/PpiNotify" };
888 Object
[] returns
= get("PPIs", xPath
);
889 if (returns
== null) {
890 return new String
[0];
894 List
<String
> ppiNotifyList
= new ArrayList
<String
>();
895 for (int i
= 0; i
< returns
.length
; i
++) {
896 List archList
= ((PPIsDocument
.PPIs
.PpiNotify
) returns
[i
]).getSupArchList();
897 if (archList
== null || contains(archList
, arch
)){
898 ppiNotifyList
.add(((PPIsDocument
.PPIs
.PpiNotify
) returns
[i
]).getPpiNotifyCName());
902 String
[] ppiNotifyArray
= new String
[ppiNotifyList
.size()];
903 for (int i
= 0; i
< ppiNotifyList
.size(); i
++) {
904 ppiNotifyArray
[i
] = ppiNotifyList
.get(i
);
907 return ppiNotifyArray
;
911 * Retrieve PpiNotify for specified usage and arch
914 * PpiNotify arch usage PpiNotify usage
917 * @returns String[] if elements are found at the known xpath
918 * @returns String[0] if nothing is there
920 public String
[] getPpiNotifyArray(String arch
, String usage
) {
926 if (arch
== null || arch
.equals("")) {
927 return new String
[0];
929 archXpath
= "/PpiNotify";
930 if (usage
!= null && !usage
.equals("")) {
931 usageXpath
= "/PpiNotify[@Usage='" + arch
+ "']";
932 xPath
= new String
[] { archXpath
, usageXpath
};
934 return getProtocolNotifyArray(arch
);
938 Object
[] returns
= get("PPIs", xPath
);
939 if (returns
== null) {
940 return new String
[0];
943 String
[] ppiNotifyList
= new String
[returns
.length
];
945 for (int i
= 0; i
< returns
.length
; i
++) {
946 ppiNotifyList
[i
] = ((PPIsDocument
.PPIs
.PpiNotify
) returns
[i
]).getPpiNotifyCName();
948 return ppiNotifyList
;
952 * Retrieve Ppi for specified arch
957 * @returns String[] if elements are found at the known xpath
958 * @returns String[0] if nothing is there
960 public String
[] getPpiArray(String arch
) {
963 if (arch
== null || arch
.equals("")) {
964 return new String
[0];
966 xPath
= new String
[] { "/Ppi" };
969 Object
[] returns
= get("PPIs", xPath
);
970 if (returns
== null) {
971 return new String
[0];
974 List
<String
> ppiList
= new ArrayList
<String
>();
975 for (int i
= 0; i
< returns
.length
; i
++) {
976 List archList
= ((PPIsDocument
.PPIs
.Ppi
) returns
[i
]).getSupArchList();
977 if (archList
== null || contains(archList
, arch
)){
978 ppiList
.add(((PPIsDocument
.PPIs
.Ppi
) returns
[i
]).getPpiCName());
982 String
[] ppiArray
= new String
[ppiList
.size()];
983 for (int i
= 0; i
< ppiList
.size(); i
++) {
984 ppiArray
[i
] = ppiList
.get(i
);
990 * Retrieve PpiNotify for specified usage and arch
993 * PpiNotify arch usage PpiNotify usage
996 * @returns String[] if elements are found at the known xpath
997 * @returns String[0] if nothing is there
999 public String
[] getPpiArray(String arch
, String usage
) {
1005 if (arch
== null || arch
.equals("")) {
1006 return new String
[0];
1009 if (usage
!= null && !usage
.equals("")) {
1010 usageXpath
= "/Ppi[@Usage='" + arch
+ "']";
1011 xPath
= new String
[] { archXpath
, usageXpath
};
1013 return getProtocolNotifyArray(arch
);
1017 Object
[] returns
= get("PPIs", xPath
);
1018 if (returns
== null) {
1019 return new String
[0];
1022 String
[] ppiList
= new String
[returns
.length
];
1024 for (int i
= 0; i
< returns
.length
; i
++) {
1025 ppiList
[i
] = ((PPIsDocument
.PPIs
.Ppi
) returns
[i
]).getPpiCName();
1031 * Retrieve GuidEntry information for specified usage
1036 * @returns GuidEntry objects list if elements are found at the known xpath
1037 * @returns null if nothing is there
1039 public String
[] getGuidEntryArray(String arch
) {
1042 if (arch
== null || arch
.equals("")) {
1043 xPath
= new String
[] { "/GuidCNames" };
1045 xPath
= new String
[] { "/GuidCNames" };
1048 Object
[] returns
= get("Guids", xPath
);
1049 if (returns
== null) {
1050 return new String
[0];
1053 List
<String
> guidList
= new ArrayList
<String
>();
1054 for (int i
= 0; i
< returns
.length
; i
++) {
1055 List archList
= ((GuidsDocument
.Guids
.GuidCNames
) returns
[i
]).getSupArchList();
1056 if (archList
== null || contains(archList
, arch
)){
1057 guidList
.add(((GuidsDocument
.Guids
.GuidCNames
) returns
[i
]).getGuidCName());
1061 String
[] guidArray
= new String
[guidList
.size()];
1062 for (int i
= 0; i
< guidList
.size(); i
++) {
1063 guidArray
[i
] = guidList
.get(i
);
1070 * Retrieve GuidEntry information for specified usage
1073 * GuidEntry arch usage GuidEntry usage
1075 * @returns GuidEntry objects list if elements are found at the known xpath
1076 * @returns null if nothing is there
1078 public String
[] getGuidEntryArray(String arch
, String usage
) {
1083 if (arch
== null || arch
.equals("")) {
1084 return new String
[0];
1086 archXpath
= "/GuidEntry";
1087 if (usage
!= null && !usage
.equals("")) {
1088 usageXpath
= "/GuidEntry[@Usage='" + arch
+ "']";
1089 xPath
= new String
[] { archXpath
, usageXpath
};
1091 return getGuidEntryArray(arch
);
1095 Object
[] returns
= get("Guids", xPath
);
1096 if (returns
== null) {
1097 return new String
[0];
1100 String
[] guidList
= new String
[returns
.length
];
1102 for (int i
= 0; i
< returns
.length
; i
++) {
1103 guidList
[i
] = ((GuidsDocument
.Guids
.GuidCNames
) returns
[i
]).getGuidCName();
1108 public String
[] getEventCNameArray(String arch
) {
1109 String
[] xPath
= null;
1111 if (arch
== null || arch
.equals("")) {
1112 xPath
= new String
[]{
1113 "/CreateEvents/EventTypes[@EventGuidCName]",
1114 "/SignalEvents/EventTypes[@EventGuidCName]",
1117 xPath
= new String
[]{
1118 "/CreateEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",
1119 "/SignalEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",
1120 "/CreateEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch
+ "')]",
1121 "/SignalEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch
+ "')]",
1125 Object
[] returns
= get("Events", xPath
);
1126 if (returns
== null) {
1127 return new String
[0];
1130 String
[] cnameList
= new String
[returns
.length
];
1131 for (int i
= 0; i
< returns
.length
; i
++) {
1132 if (returns
[i
] instanceof EventsDocument
.Events
.CreateEvents
.EventTypes
) {
1133 cnameList
[i
] = ((EventsDocument
.Events
.CreateEvents
.EventTypes
) returns
[i
]).getEventGuidCName();
1135 cnameList
[i
] = ((EventsDocument
.Events
.SignalEvents
.EventTypes
) returns
[i
]).getEventGuidCName();
1141 public String
[] getHobCNameArray(String arch
) {
1142 String
[] xPath
= null;
1144 if (arch
== null || arch
.equals("")) {
1145 xPath
= new String
[]{"/HobTypes[@HobGuidCName]"};
1147 xPath
= new String
[]{
1148 "/HobTypes[@HobGuidCName and not(@SupArchList)]",
1149 "/HobTypes[@HobGuidCName and contains(@SupArchList,'" + arch
+ "')]",
1153 Object
[] returns
= get("Hobs", xPath
);
1154 if (returns
== null) {
1155 return new String
[0];
1158 String
[] cnameList
= new String
[returns
.length
];
1159 for (int i
= 0; i
< returns
.length
; i
++) {
1160 cnameList
[i
] = ((HobsDocument
.Hobs
.HobTypes
) returns
[i
]).getHobGuidCName();
1165 public String
[] getVariableCNameArray(String arch
) {
1166 String
[] xPath
= null;
1168 if (arch
== null || arch
.equals("")) {
1169 xPath
= new String
[]{"/Variable"};
1171 xPath
= new String
[]{"/Variable[not(@SupArchList) or contains(@SupArchList,'" + arch
+ "')]"};
1174 Object
[] returns
= get("Variables", xPath
);
1175 if (returns
== null) {
1176 return new String
[0];
1179 String
[] cnameList
= new String
[returns
.length
];
1180 for (int i
= 0; i
< returns
.length
; i
++) {
1181 cnameList
[i
] = ((VariablesDocument
.Variables
.Variable
) returns
[i
]).getGuidCName();
1186 public String
[] getSystemTableCNameArray(String arch
) {
1187 String
[] xPath
= null;
1189 if (arch
== null || arch
.equals("")) {
1190 xPath
= new String
[]{"/SystemTableCNames"};
1192 xPath
= new String
[]{
1193 "/SystemTableCNames[not(@SupArchList) or contains(@SupArchList,'" + arch
+ "')]"
1197 Object
[] returns
= get("SystemTables", xPath
);
1198 if (returns
== null) {
1199 return new String
[0];
1202 String
[] cnameList
= new String
[returns
.length
];
1203 for (int i
= 0; i
< returns
.length
; i
++) {
1204 cnameList
[i
] = ((SystemTablesDocument
.SystemTables
.SystemTableCNames
) returns
[i
]).getSystemTableCName();
1209 public String
[] getDataHubCNameArray(String arch
) {
1210 String
[] xPath
= null;
1212 if (arch
== null || arch
.equals("")) {
1213 xPath
= new String
[]{"/DataHubRecord"};
1215 xPath
= new String
[]{"/DataHubRecord[not(@SupArchList) or contains(@SupArchList,'" + arch
+ "')]"};
1218 Object
[] returns
= get("DataHubs", xPath
);
1219 if (returns
== null) {
1220 return new String
[0];
1223 String
[] cnameList
= new String
[returns
.length
];
1224 for (int i
= 0; i
< returns
.length
; i
++) {
1225 cnameList
[i
] = ((DataHubsDocument
.DataHubs
.DataHubRecord
) returns
[i
]).getDataHubCName();
1230 public String
[] getHiiPackageCNameArray(String arch
) {
1231 String
[] xPath
= null;
1233 if (arch
== null || arch
.equals("")) {
1234 xPath
= new String
[]{"/HiiPackage"};
1236 xPath
= new String
[]{"/HiiPackage[not(@SupArchList) or contains(@SupArchList,'" + arch
+ "')]"};
1239 Object
[] returns
= get("HiiPackages", xPath
);
1240 if (returns
== null) {
1241 return new String
[0];
1244 String
[] cnameList
= new String
[returns
.length
];
1245 for (int i
= 0; i
< returns
.length
; i
++) {
1246 cnameList
[i
] = ((HiiPackagesDocument
.HiiPackages
.HiiPackage
) returns
[i
]).getHiiCName();
1251 public String
[] getCNameArray(String arch
) {
1252 List
<String
> cnameList
= new ArrayList
<String
>(100);
1253 String
[] result
= null;
1255 // "/Guids/GuidCNames/GuidCName",
1257 result
= getGuidEntryArray(arch
);
1258 for (int i
= 0; i
< result
.length
; ++i
) {
1259 cnameList
.add(result
[i
]);
1262 // "/Protocols/Protocol/ProtocolCName",
1264 result
= getProtocolArray(arch
);
1265 for (int i
= 0; i
< result
.length
; ++i
) {
1266 cnameList
.add(result
[i
]);
1269 // "/Protocols/ProtocolNotify/ProtocolNotifyCName",
1271 result
= getProtocolNotifyArray(arch
);
1272 for (int i
= 0; i
< result
.length
; ++i
) {
1273 cnameList
.add(result
[i
]);
1276 // "/Events/CreateEvents/EventTypes[@EventGuidCName]",
1277 // "/Events/SignalEvents/EventTypes[@EventGuidCName]",
1279 result
= getEventCNameArray(arch
);
1280 for (int i
= 0; i
< result
.length
; ++i
) {
1281 cnameList
.add(result
[i
]);
1284 // "/Hobs/HobTypes[@HobGuidCName]",
1286 result
= getHobCNameArray(arch
);
1287 for (int i
= 0; i
< result
.length
; ++i
) {
1288 cnameList
.add(result
[i
]);
1291 // "/PPIs/Ppi/PpiCName",
1293 result
= getPpiArray(arch
);
1294 for (int i
= 0; i
< result
.length
; ++i
) {
1295 cnameList
.add(result
[i
]);
1298 // "/PPIs/PpiNotify/PpiNotifyCName",
1300 result
= getPpiNotifyArray(arch
);
1301 for (int i
= 0; i
< result
.length
; ++i
) {
1302 cnameList
.add(result
[i
]);
1305 // "/Variables/Variable/GuidC_Name",
1307 result
= getVariableCNameArray(arch
);
1308 for (int i
= 0; i
< result
.length
; ++i
) {
1309 cnameList
.add(result
[i
]);
1312 // "/SystemTables/SystemTableCNames/SystemTableCName",
1314 result
= getSystemTableCNameArray(arch
);
1315 for (int i
= 0; i
< result
.length
; ++i
) {
1316 cnameList
.add(result
[i
]);
1319 // "/DataHubs/DataHubRecord/DataHubCName",
1321 result
= getDataHubCNameArray(arch
);
1322 for (int i
= 0; i
< result
.length
; ++i
) {
1323 cnameList
.add(result
[i
]);
1326 // "/HiiPackages/HiiPackage/HiiCName",
1328 result
= getHiiPackageCNameArray(arch
);
1329 for (int i
= 0; i
< result
.length
; ++i
) {
1330 cnameList
.add(result
[i
]);
1333 return cnameList
.toArray(new String
[cnameList
.size()]);
1337 * Retrieve Library instance information
1342 * Library instance usage
1344 * @returns library instance name list if elements are found at the known
1346 * @returns null if nothing is there
1348 public ModuleIdentification
[] getLibraryInstance(String arch
) throws EdkException
{
1350 String saGuid
= null;
1351 String saVersion
= null;
1352 String pkgGuid
= null;
1353 String pkgVersion
= null;
1355 if (arch
== null || arch
.equalsIgnoreCase("")) {
1356 xPath
= new String
[] { "/Instance" };
1359 // Since Schema don't have SupArchList now, so the follow Xpath is
1360 // equal to "/Instance" and [not(@SupArchList) or @SupArchList= arch]
1361 // don't have effect.
1363 xPath
= new String
[] { "/Instance[not(@SupArchList) or @SupArchList='"
1367 Object
[] returns
= get("Libraries", xPath
);
1368 if (returns
== null || returns
.length
== 0) {
1369 return new ModuleIdentification
[0];
1372 ModuleIdentification
[] saIdList
= new ModuleIdentification
[returns
.length
];
1373 for (int i
= 0; i
< returns
.length
; i
++) {
1374 LibrariesDocument
.Libraries
.Instance library
= (LibrariesDocument
.Libraries
.Instance
) returns
[i
];
1375 saGuid
= library
.getModuleGuid();
1376 saVersion
= library
.getModuleVersion();
1378 pkgGuid
= library
.getPackageGuid();
1379 pkgVersion
= library
.getPackageVersion();
1381 ModuleIdentification saId
= new ModuleIdentification(null, saGuid
,
1383 PackageIdentification pkgId
= new PackageIdentification(null,
1384 pkgGuid
, pkgVersion
);
1385 GlobalData
.refreshPackageIdentification(pkgId
);
1386 saId
.setPackage(pkgId
);
1387 GlobalData
.refreshModuleIdentification(saId
);
1396 // / This method is used for retrieving the elements information which has
1397 // / CName sub-element
1399 private String
[] getCNames(String from
, String xPath
[]) {
1400 Object
[] returns
= get(from
, xPath
);
1401 if (returns
== null || returns
.length
== 0) {
1405 String
[] strings
= new String
[returns
.length
];
1406 for (int i
= 0; i
< returns
.length
; ++i
) {
1408 strings
[i
] = ((CNameType
) returns
[i
]).getStringValue();
1415 * Retrive library's constructor name
1417 * @returns constructor name list if elements are found at the known xpath
1418 * @returns null if nothing is there
1420 public String
getLibConstructorName() {
1421 String
[] xPath
= new String
[] { "/Extern/Constructor" };
1423 Object
[] returns
= get("Externs", xPath
);
1424 if (returns
!= null && returns
.length
> 0) {
1425 CNameType constructor
= ((CNameType
) returns
[0]);
1426 return constructor
.getStringValue();
1433 * Retrive library's destructor name
1435 * @returns destructor name list if elements are found at the known xpath
1436 * @returns null if nothing is there
1438 public String
getLibDestructorName() {
1439 String
[] xPath
= new String
[] { "/Extern/Destructor" };
1441 Object
[] returns
= get("Externs", xPath
);
1442 if (returns
!= null && returns
.length
> 0) {
1444 // Only support one Destructor function.
1446 CNameType destructor
= (CNameType
) returns
[0];
1447 return destructor
.getStringValue();
1454 * Retrive DriverBinding names
1456 * @returns DriverBinding name list if elements are found at the known xpath
1457 * @returns null if nothing is there
1459 public String
[] getDriverBindingArray() {
1460 String
[] xPath
= new String
[] { "/Extern/DriverBinding" };
1461 return getCNames("Externs", xPath
);
1465 * Retrive ComponentName names
1467 * @returns ComponentName name list if elements are found at the known xpath
1468 * @returns null if nothing is there
1470 public String
[] getComponentNameArray() {
1471 String
[] xPath
= new String
[] { "/Extern/ComponentName" };
1472 return getCNames("Externs", xPath
);
1476 * Retrive DriverConfig names
1478 * @returns DriverConfig name list if elements are found at the known xpath
1479 * @returns null if nothing is there
1481 public String
[] getDriverConfigArray() {
1482 String
[] xPath
= new String
[] { "/Extern/DriverConfig" };
1483 return getCNames("Externs", xPath
);
1487 * Retrive DriverDiag names
1489 * @returns DriverDiag name list if elements are found at the known xpath
1490 * @returns null if nothing is there
1492 public String
[] getDriverDiagArray() {
1493 String
[] xPath
= new String
[] { "/Extern/DriverDiag" };
1494 return getCNames("Externs", xPath
);
1498 * Retrive DriverBinding, ComponentName, DriverConfig,
1499 * DriverDiag group array
1501 * @returns DriverBinding group name list if elements are found
1502 * at the known xpath
1503 * @returns null if nothing is there
1505 public String
[][] getExternProtocolGroup() {
1506 String
[] xPath
= new String
[] {"/Extern"};
1507 Object
[] returns
= get("Externs",xPath
);
1509 if (returns
== null) {
1510 return new String
[0][4];
1512 List
<Extern
> externList
= new ArrayList
<Extern
>();
1513 for (int i
= 0; i
< returns
.length
; i
++) {
1514 org
.tianocore
.ExternsDocument
.Externs
.Extern extern
= (org
.tianocore
.ExternsDocument
.Externs
.Extern
)returns
[i
];
1515 if (extern
.getDriverBinding() != null) {
1516 externList
.add(extern
);
1520 String
[][] externGroup
= new String
[externList
.size()][4];
1521 for (int i
= 0; i
< externList
.size(); i
++) {
1522 String driverBindingStr
= externList
.get(i
).getDriverBinding();
1523 if ( driverBindingStr
!= null){
1524 externGroup
[i
][0] = driverBindingStr
;
1526 externGroup
[i
][0] = null;
1529 String componentNameStr
= externList
.get(i
).getComponentName();
1530 if (componentNameStr
!= null) {
1531 externGroup
[i
][1] = componentNameStr
;
1533 externGroup
[i
][1] = null;
1536 String driverConfigStr
= externList
.get(i
).getDriverConfig();
1537 if (driverConfigStr
!= null) {
1538 externGroup
[i
][2] = driverConfigStr
;
1540 externGroup
[i
][2] = null;
1543 String driverDiagStr
= externList
.get(i
).getDriverDiag();
1544 if (driverDiagStr
!= null) {
1545 externGroup
[i
][3] = driverDiagStr
;
1547 externGroup
[i
][3] = null;
1554 * Retrive SetVirtualAddressMapCallBack names
1556 * @returns SetVirtualAddressMapCallBack name list if elements are found at
1558 * @returns null if nothing is there
1560 public String
[] getSetVirtualAddressMapCallBackArray() {
1561 String
[] xPath
= new String
[] { "/Extern/SetVirtualAddressMapCallBack" };
1562 return getCNames("Externs", xPath
);
1566 * Retrive ExitBootServicesCallBack names
1568 * @returns ExitBootServicesCallBack name list if elements are found at the
1570 * @returns null if nothing is there
1572 public String
[] getExitBootServicesCallBackArray() {
1573 String
[] xPath
= new String
[] { "/Extern/ExitBootServicesCallBack" };
1574 return getCNames("Externs", xPath
);
1578 Judge whether current driver is PEI_PCD_DRIVER or DXE_PCD_DRIVER or
1581 @return CommonDefinition.PCD_DRIVER_TYPE the type of current driver
1583 public CommonDefinition
.PCD_DRIVER_TYPE
getPcdDriverType() {
1584 String
[] xPath
= new String
[] {"/PcdIsDriver"};
1585 Object
[] results
= get ("Externs", xPath
);
1587 if (results
!= null && results
.length
!= 0) {
1588 PcdDriverTypes type
= (PcdDriverTypes
) results
[0];
1589 String typeStr
= type
.enumValue().toString();
1590 if (typeStr
.equals(CommonDefinition
.PCD_DRIVER_TYPE
.PEI_PCD_DRIVER
.toString())) {
1591 return CommonDefinition
.PCD_DRIVER_TYPE
.PEI_PCD_DRIVER
;
1592 } else if (typeStr
.equals(CommonDefinition
.PCD_DRIVER_TYPE
.DXE_PCD_DRIVER
.toString())) {
1593 return CommonDefinition
.PCD_DRIVER_TYPE
.DXE_PCD_DRIVER
;
1595 return CommonDefinition
.PCD_DRIVER_TYPE
.UNKNOWN_PCD_DRIVER
;
1598 return CommonDefinition
.PCD_DRIVER_TYPE
.NOT_PCD_DRIVER
;
1602 * Retrieve module surface area file information
1604 * @returns ModuleSA objects list if elements are found at the known xpath
1605 * @returns Empty ModuleSA list if nothing is there
1607 public Map
<FpdModuleIdentification
, Map
<String
, XmlObject
>> getFpdModules() throws EdkException
{
1608 String
[] xPath
= new String
[] { "/FrameworkModules/ModuleSA" };
1609 Object
[] result
= get("PlatformSurfaceArea", xPath
);
1611 String fvBinding
= null;
1612 String saGuid
= null;
1613 String saVersion
= null;
1614 String pkgGuid
= null;
1615 String pkgVersion
= null;
1617 Map
<FpdModuleIdentification
, Map
<String
, XmlObject
>> fpdModuleMap
= new LinkedHashMap
<FpdModuleIdentification
, Map
<String
, XmlObject
>>();
1619 if (result
== null) {
1620 return fpdModuleMap
;
1623 for (int i
= 0; i
< result
.length
; i
++) {
1625 // Get Fpd SA Module element node and add to ObjectMap.
1627 Map
<String
, XmlObject
> ObjectMap
= new HashMap
<String
, XmlObject
>();
1628 ModuleSADocument
.ModuleSA moduleSA
= (ModuleSADocument
.ModuleSA
) result
[i
];
1629 if (((ModuleSADocument
.ModuleSA
) result
[i
]).getLibraries() != null) {
1630 ObjectMap
.put("Libraries", moduleSA
.getLibraries());
1632 if (((ModuleSADocument
.ModuleSA
) result
[i
]).getPcdBuildDefinition() != null) {
1633 ObjectMap
.put("PcdBuildDefinition", moduleSA
.getPcdBuildDefinition());
1635 if (((ModuleSADocument
.ModuleSA
) result
[i
]).getModuleSaBuildOptions() != null) {
1636 ObjectMap
.put("ModuleSaBuildOptions", moduleSA
.getModuleSaBuildOptions());
1640 // Get Fpd SA Module attribute and create FpdMoudleIdentification.
1642 if (moduleSA
.isSetSupArchList()) {
1643 arch
= moduleSA
.getSupArchList().toString();
1650 saVersion
= ((ModuleSADocument
.ModuleSA
) result
[i
]).getModuleVersion();
1652 saGuid
= moduleSA
.getModuleGuid();
1653 pkgGuid
= moduleSA
.getPackageGuid();
1654 pkgVersion
= moduleSA
.getPackageVersion();
1657 // Create Module Identification which have class member of package
1660 PackageIdentification pkgId
= new PackageIdentification(null, pkgGuid
, pkgVersion
);
1661 GlobalData
.refreshPackageIdentification(pkgId
);
1663 ModuleIdentification saId
= new ModuleIdentification(null, saGuid
, saVersion
);
1664 saId
.setPackage(pkgId
);
1665 GlobalData
.refreshModuleIdentification(saId
);
1670 // Create FpdModule Identification which have class member of module
1673 String
[] archList
= new String
[0];
1674 if (arch
== null || arch
.trim().length() == 0) {
1675 archList
= GlobalData
.getToolChainInfo().getArchs();
1677 archList
= arch
.split(" ");
1679 for (int j
= 0; j
< archList
.length
; j
++) {
1680 FpdModuleIdentification fpdSaId
= new FpdModuleIdentification(saId
, archList
[j
]);
1682 if (fvBinding
!= null) {
1683 fpdSaId
.setFvBinding(fvBinding
);
1687 // Put element to Map<FpdModuleIdentification, Map<String,
1690 fpdModuleMap
.put(fpdSaId
, ObjectMap
);
1693 return fpdModuleMap
;
1697 * Retrieve valid image names
1699 * @returns valid iamges name list if elements are found at the known xpath
1700 * @returns empty list if nothing is there
1702 public String
[] getFpdValidImageNames() {
1703 String
[] xPath
= new String
[] { "/Flash/FvImages/FvImage[@Type='ImageName']/FvImageNames" };
1705 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1706 if (queryResult
== null) {
1707 return new String
[0];
1710 String
[] result
= new String
[queryResult
.length
];
1711 for (int i
= 0; i
< queryResult
.length
; i
++) {
1712 result
[i
] = ((XmlString
) queryResult
[i
]).getStringValue();
1718 public Node
getFpdUserExtensionPreBuild() {
1719 String
[] xPath
= new String
[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };
1721 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1722 if (queryResult
== null || queryResult
.length
== 0) {
1725 UserExtensionsDocument
.UserExtensions a
= (UserExtensionsDocument
.UserExtensions
)queryResult
[0];
1727 return a
.getDomNode();
1730 public Node
getFpdUserExtensionPostBuild() {
1731 String
[] xPath
= new String
[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };
1733 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1734 if (queryResult
== null || queryResult
.length
== 0) {
1737 UserExtensionsDocument
.UserExtensions a
= (UserExtensionsDocument
.UserExtensions
)queryResult
[0];
1739 return a
.getDomNode();
1742 public Node
[] getFpdUserExtensions() {
1743 String
[] xPath
= new String
[] { "/UserExtensions[@UserID='TianoCore' and not(@Identifier='1') and not(@Identifier='0')]" };
1745 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1746 if (queryResult
== null || queryResult
.length
== 0) {
1750 Node
[] nodeList
= new Node
[queryResult
.length
];
1751 for (int i
= 0; i
< queryResult
.length
; ++i
) {
1752 UserExtensionsDocument
.UserExtensions a
= (UserExtensionsDocument
.UserExtensions
)queryResult
[i
];
1753 nodeList
[i
] = a
.getDomNode();
1759 * Retrieve FV image option information
1764 * @returns option name/value list if elements are found at the known xpath
1765 * @returns empty list if nothing is there
1767 public String
[][] getFpdOptions(String fvName
) {
1768 String
[] xPath
= new String
[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='"
1769 + fvName
+ "']/FvImageOptions" };
1770 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1771 if (queryResult
== null) {
1772 return new String
[0][];
1774 ArrayList
<String
[]> list
= new ArrayList
<String
[]>();
1775 for (int i
= 0; i
< queryResult
.length
; i
++) {
1776 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions item
= (FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
) queryResult
[i
];
1777 List
<FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue
> namevalues
= item
1778 .getNameValueList();
1779 Iterator iter
= namevalues
.iterator();
1780 while (iter
.hasNext()) {
1781 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue nvItem
= (FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue
) iter
1783 list
.add(new String
[] { nvItem
.getName(), nvItem
.getValue() });
1786 String
[][] result
= new String
[list
.size()][2];
1787 for (int i
= 0; i
< list
.size(); i
++) {
1788 result
[i
][0] = list
.get(i
)[0];
1789 result
[i
][1] = list
.get(i
)[1];
1795 public XmlObject
getFpdBuildOptions() {
1796 String
[] xPath
= new String
[] { "/BuildOptions" };
1798 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1800 if (queryResult
== null || queryResult
.length
== 0) {
1803 return (XmlObject
)queryResult
[0];
1806 public PlatformIdentification
getFpdHeader() {
1807 String
[] xPath
= new String
[] { "/PlatformHeader" };
1809 Object
[] returns
= get("PlatformSurfaceArea", xPath
);
1811 if (returns
== null || returns
.length
== 0) {
1814 PlatformHeaderDocument
.PlatformHeader header
= (PlatformHeaderDocument
.PlatformHeader
) returns
[0];
1816 String name
= header
.getPlatformName();
1818 String guid
= header
.getGuidValue();
1820 String version
= header
.getVersion();
1822 return new PlatformIdentification(name
, guid
, version
);
1826 * Retrieve FV image attributes information
1831 * @returns attribute name/value list if elements are found at the known
1833 * @returns empty list if nothing is there
1835 public String
[][] getFpdAttributes(String fvName
) {
1836 String
[] xPath
= new String
[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='"
1837 + fvName
+ "']/FvImageOptions" };
1838 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1839 if (queryResult
== null) {
1840 return new String
[0][];
1842 ArrayList
<String
[]> list
= new ArrayList
<String
[]>();
1843 for (int i
= 0; i
< queryResult
.length
; i
++) {
1845 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions item
= (FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
) queryResult
[i
];
1846 List
<FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue
> namevalues
= item
.getNameValueList();
1847 Iterator iter
= namevalues
.iterator();
1848 while (iter
.hasNext()) {
1849 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue nvItem
= (FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue
) iter
1851 list
.add(new String
[] { nvItem
.getName(), nvItem
.getValue() });
1854 String
[][] result
= new String
[list
.size()][2];
1855 for (int i
= 0; i
< list
.size(); i
++) {
1856 result
[i
][0] = list
.get(i
)[0];
1857 result
[i
][1] = list
.get(i
)[1];
1863 * Retrieve flash definition file name
1865 * @returns file name if elements are found at the known xpath
1866 * @returns null if nothing is there
1868 public String
getFlashDefinitionFile() {
1869 String
[] xPath
= new String
[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" };
1871 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1872 if (queryResult
== null || queryResult
.length
== 0) {
1876 FileNameConvention filename
= (FileNameConvention
) queryResult
[queryResult
.length
- 1];
1877 return filename
.getStringValue();
1880 public String
[][] getFpdGlobalVariable() {
1881 String
[] xPath
= new String
[] { "/Flash/FvImages/NameValue" };
1882 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1883 if (queryResult
== null) {
1884 return new String
[0][];
1887 String
[][] result
= new String
[queryResult
.length
][2];
1889 for (int i
= 0; i
< queryResult
.length
; i
++) {
1890 FvImagesDocument
.FvImages
.NameValue item
= (FvImagesDocument
.FvImages
.NameValue
)queryResult
[i
];
1891 result
[i
][0] = item
.getName();
1892 result
[i
][1] = item
.getValue();
1898 * Retrieve FV image component options
1903 * @returns name/value pairs list if elements are found at the known xpath
1904 * @returns empty list if nothing is there
1906 public String
[][] getFpdComponents(String fvName
) {
1907 String
[] xPath
= new String
[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName
+ "']/FvImageOptions" };
1908 Object
[] queryResult
= get("PlatformSurfaceArea", xPath
);
1909 if (queryResult
== null) {
1910 return new String
[0][];
1913 ArrayList
<String
[]> list
= new ArrayList
<String
[]>();
1914 for (int i
= 0; i
< queryResult
.length
; i
++) {
1915 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions item
= (FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
) queryResult
[i
];
1916 List
<FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue
> namevalues
= item
.getNameValueList();
1917 Iterator iter
= namevalues
.iterator();
1918 while (iter
.hasNext()) {
1919 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue nvItem
= (FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue
) iter
1921 list
.add(new String
[] { nvItem
.getName(), nvItem
.getValue() });
1924 String
[][] result
= new String
[list
.size()][2];
1925 for (int i
= 0; i
< list
.size(); i
++) {
1926 result
[i
][0] = list
.get(i
)[0];
1927 result
[i
][1] = list
.get(i
)[1];
1933 * Retrieve PCD tokens
1935 * @returns CName/ItemType pairs list if elements are found at the known
1937 * @returns null if nothing is there
1939 public String
[][] getPcdTokenArray() {
1940 String
[] xPath
= new String
[] { "/PcdData" };
1942 Object
[] returns
= get("PCDs", xPath
);
1943 if (returns
== null || returns
.length
== 0) {
1951 * Retrieve MAS header
1956 public ModuleIdentification
getMsaHeader() {
1957 String
[] xPath
= new String
[] { "/" };
1958 Object
[] returns
= get("MsaHeader", xPath
);
1960 if (returns
== null || returns
.length
== 0) {
1964 MsaHeader msaHeader
= (MsaHeader
) returns
[0];
1966 // Get BaseName, ModuleType, GuidValue, Version
1967 // which in MsaHeader.
1969 String name
= msaHeader
.getModuleName();
1970 String moduleType
= msaHeader
.getModuleType().toString();
1971 String guid
= msaHeader
.getGuidValue();
1972 String version
= msaHeader
.getVersion();
1974 ModuleIdentification moduleId
= new ModuleIdentification(name
, guid
,
1977 moduleId
.setModuleType(moduleType
);
1983 * Retrieve Extern Specification
1987 * @return String[] If have specification element in the <extern> String[0]
1988 * If no specification element in the <extern>
1992 public String
[] getExternSpecificaiton() {
1993 String
[] xPath
= new String
[] { "/Specification" };
1995 Object
[] queryResult
= get("Externs", xPath
);
1996 if (queryResult
== null) {
1997 return new String
[0];
2000 String
[] specificationList
= new String
[queryResult
.length
];
2001 for (int i
= 0; i
< queryResult
.length
; i
++) {
2002 specificationList
[i
] = ((Sentence
)queryResult
[i
])
2005 return specificationList
;
2009 * Retreive MsaFile which in SPD
2012 * @return String[][3] The string sequence is ModuleName, ModuleGuid,
2013 * ModuleVersion, MsaFile String[0][] If no msafile in SPD
2015 public String
[] getSpdMsaFile() {
2016 String
[] xPath
= new String
[] { "/MsaFiles" };
2018 Object
[] returns
= get("PackageSurfaceArea", xPath
);
2019 if (returns
== null) {
2020 return new String
[0];
2023 List
<String
> filenameList
= ((MsaFilesDocument
.MsaFiles
) returns
[0])
2025 return filenameList
.toArray(new String
[filenameList
.size()]);
2031 public Map
<String
, String
[]> getSpdLibraryClasses() {
2032 String
[] xPath
= new String
[] { "/LibraryClassDeclarations/LibraryClass" };
2034 Object
[] returns
= get("PackageSurfaceArea", xPath
);
2037 // Create Map, Key - LibraryClass, String[] - LibraryClass Header file.
2039 Map
<String
, String
[]> libClassHeaderMap
= new HashMap
<String
, String
[]>();
2041 if (returns
== null) {
2042 return libClassHeaderMap
;
2045 for (int i
= 0; i
< returns
.length
; i
++) {
2046 LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass library
= (LibraryClassDeclarationsDocument
.LibraryClassDeclarations
.LibraryClass
) returns
[i
];
2047 libClassHeaderMap
.put(library
.getName(), new String
[] { library
2048 .getIncludeHeader() });
2050 return libClassHeaderMap
;
2056 public Map
<String
, String
> getSpdPackageHeaderFiles() {
2057 String
[] xPath
= new String
[] { "/PackageHeaders/IncludePkgHeader" };
2059 Object
[] returns
= get("PackageSurfaceArea", xPath
);
2062 // Create Map, Key - ModuleType, String - PackageInclude Header file.
2064 Map
<String
, String
> packageIncludeMap
= new HashMap
<String
, String
>();
2066 if (returns
== null) {
2067 return packageIncludeMap
;
2070 for (int i
= 0; i
< returns
.length
; i
++) {
2071 PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader includeHeader
= (PackageHeadersDocument
.PackageHeaders
.IncludePkgHeader
) returns
[i
];
2072 packageIncludeMap
.put(includeHeader
.getModuleType().toString(),
2073 includeHeader
.getStringValue());
2075 return packageIncludeMap
;
2078 public PackageIdentification
getSpdHeader() {
2079 String
[] xPath
= new String
[] { "/SpdHeader" };
2081 Object
[] returns
= get("PackageSurfaceArea", xPath
);
2083 if (returns
== null || returns
.length
== 0) {
2087 SpdHeaderDocument
.SpdHeader header
= (SpdHeaderDocument
.SpdHeader
) returns
[0];
2089 String name
= header
.getPackageName();
2091 String guid
= header
.getGuidValue();
2093 String version
= header
.getVersion();
2095 return new PackageIdentification(name
, guid
, version
);
2101 public Map
<String
, String
[]> getSpdGuid() {
2102 String
[] xPath
= new String
[] { "/GuidDeclarations/Entry" };
2104 Object
[] returns
= get("PackageSurfaceArea", xPath
);
2107 // Create Map, Key - GuidName, String[] - C_NAME & GUID value.
2109 Map
<String
, String
[]> guidDeclMap
= new HashMap
<String
, String
[]>();
2110 if (returns
== null) {
2114 for (int i
= 0; i
< returns
.length
; i
++) {
2115 GuidDeclarationsDocument
.GuidDeclarations
.Entry entry
= (GuidDeclarationsDocument
.GuidDeclarations
.Entry
) returns
[i
];
2116 String
[] guidPair
= new String
[2];
2117 guidPair
[0] = entry
.getCName();
2118 guidPair
[1] = entry
.getGuidValue();
2119 guidDeclMap
.put(entry
.getCName(), guidPair
);
2127 public Map
<String
, String
[]> getSpdProtocol() {
2128 String
[] xPath
= new String
[] { "/ProtocolDeclarations/Entry" };
2130 Object
[] returns
= get("PackageSurfaceArea", xPath
);
2133 // Create Map, Key - protocolName, String[] - C_NAME & GUID value.
2135 Map
<String
, String
[]> protoclMap
= new HashMap
<String
, String
[]>();
2137 if (returns
== null) {
2141 for (int i
= 0; i
< returns
.length
; i
++) {
2142 ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry entry
= (ProtocolDeclarationsDocument
.ProtocolDeclarations
.Entry
) returns
[i
];
2143 String
[] protocolPair
= new String
[2];
2145 protocolPair
[0] = entry
.getCName();
2146 protocolPair
[1] = entry
.getGuidValue();
2147 protoclMap
.put(entry
.getCName(), protocolPair
);
2153 * getSpdPpi() Retrieve the SPD PPI Entry
2156 * @return Map<String, String[2]> if get the PPI entry from SPD. Key - PPI
2157 * Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI
2160 public Map
<String
, String
[]> getSpdPpi() {
2161 String
[] xPath
= new String
[] { "/PpiDeclarations/Entry" };
2163 Object
[] returns
= get("PackageSurfaceArea", xPath
);
2166 // Create Map, Key - protocolName, String[] - C_NAME & GUID value.
2168 Map
<String
, String
[]> ppiMap
= new HashMap
<String
, String
[]>();
2170 if (returns
== null) {
2174 for (int i
= 0; i
< returns
.length
; i
++) {
2175 PpiDeclarationsDocument
.PpiDeclarations
.Entry entry
= (PpiDeclarationsDocument
.PpiDeclarations
.Entry
) returns
[i
];
2176 String
[] ppiPair
= new String
[2];
2177 ppiPair
[0] = entry
.getCName();
2178 ppiPair
[1] = entry
.getGuidValue();
2179 ppiMap
.put(entry
.getCName(), ppiPair
);
2185 * Retrieve module Guid string
2187 * @returns GUILD string if elements are found at the known xpath
2188 * @returns null if nothing is there
2190 public String
getModuleGuid() {
2191 String
[] xPath
= new String
[] { "" };
2193 Object
[] returns
= get("MsaHeader", xPath
);
2194 if (returns
!= null && returns
.length
> 0) {
2195 String guid
= ((MsaHeaderDocument
.MsaHeader
) returns
[0])
2206 public ModuleSADocument
.ModuleSA
[] getFpdModuleSAs() {
2207 String
[] xPath
= new String
[] { "/FrameworkModules/ModuleSA" };
2208 Object
[] result
= get("PlatformSurfaceArea", xPath
);
2209 if (result
!= null) {
2210 return (ModuleSADocument
.ModuleSA
[]) result
;
2212 return new ModuleSADocument
.ModuleSA
[0];
2217 Get name array who contains all PCDs in a module according to specified arch.
2219 @param arch The specified architecture type.
2221 @return String[] return all PCDs name into array, if no any PCD used by
2222 this module, a String[0] array is returned.
2224 public String
[] getModulePcdEntryNameArray(String arch
) {
2225 PcdCodedDocument
.PcdCoded
.PcdEntry
[] pcdEntries
= null;
2226 java
.util
.List archList
= null;
2227 java
.util
.List
<String
> results
= new java
.util
.ArrayList
<String
> ();
2229 String
[] xPath
= new String
[] {"/PcdEntry"};
2230 Object
[] returns
= get ("PcdCoded", xPath
);
2232 if (returns
== null) {
2233 return new String
[0];
2236 pcdEntries
= (PcdCodedDocument
.PcdCoded
.PcdEntry
[])returns
;
2238 for (index
= 0; index
< pcdEntries
.length
; index
++) {
2239 archList
= pcdEntries
[index
].getSupArchList();
2241 // If the ArchList is specified in MSA for this PCD, need check
2242 // current arch whether can support by this PCD.
2244 if (archList
!= null) {
2245 if (archList
.contains(arch
)) {
2246 results
.add(new String(pcdEntries
[index
].getCName()));
2250 // If no ArchList is specificied in MSA for this PCD, that means
2251 // this PCD support all architectures.
2253 results
.add(new String(pcdEntries
[index
].getCName()));
2257 if (results
.size() == 0) {
2258 return new String
[0];
2261 String
[] retArray
= new String
[results
.size()];
2262 results
.toArray(retArray
);
2268 Search in a List for a given string
2272 public boolean contains(List list
, String str
) {
2273 if (list
== null || list
.size()== 0) {
2277 return list
.contains(str
);
2280 public boolean isHaveTianoR8FlashMap(){
2281 String
[] xPath
= new String
[] {"/"};
2282 Object
[] returns
= get ("Externs", xPath
);
2284 if (returns
== null) {
2288 ExternsDocument
.Externs ext
= (ExternsDocument
.Externs
)returns
[0];
2290 if (ext
.getTianoR8FlashMapH()){
2297 public Node
getPeiApriori(String fvName
) {
2298 String
[] xPath
= new String
[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='0' and ./FvName='" + fvName
+ "']" };
2299 Object
[] result
= get("PlatformSurfaceArea", xPath
);
2301 if (result
== null || result
.length
== 0) {
2305 UserExtensionsDocument
.UserExtensions a
= (UserExtensionsDocument
.UserExtensions
)result
[0];
2307 return a
.getDomNode();
2310 public Node
getDxeApriori(String fvName
) {
2311 String
[] xPath
= new String
[] { "/BuildOptions/UserExtensions[@UserID='APRIORI' and @Identifier='1' and ./FvName='" + fvName
+ "']" };
2312 Object
[] result
= get("PlatformSurfaceArea", xPath
);
2314 if (result
== null || result
.length
== 0) {
2318 UserExtensionsDocument
.UserExtensions a
= (UserExtensionsDocument
.UserExtensions
)result
[0];
2320 return a
.getDomNode();
2323 public Node
getFpdModuleSequence(String fvName
) {
2324 String
[] xPath
= new String
[] { "/BuildOptions/UserExtensions[@UserID='IMAGES' and @Identifier='1' and ./FvName='" + fvName
+ "']" };
2325 Object
[] result
= get("PlatformSurfaceArea", xPath
);
2327 if (result
== null || result
.length
== 0) {
2331 UserExtensionsDocument
.UserExtensions a
= (UserExtensionsDocument
.UserExtensions
)result
[0];
2333 return a
.getDomNode();
2337 Get the value of PCD by PCD cName
2339 @return PcdValue String of PcdComponentName
2340 null If don't find ComponentName Pcd
2342 public String
getPcdValueBycName(String cName
){
2343 String
[] xPath
= new String
[] { "/PcdData" };
2344 Object
[] returns
= get("PcdBuildDefinition", xPath
);
2345 if (returns
== null || returns
.length
== 0) {
2348 for (int i
= 0; i
< returns
.length
; i
++) {
2349 PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData pcdData
= (PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData
)returns
[i
];
2350 if (pcdData
.getCName().equalsIgnoreCase(cName
)){
2351 return pcdData
.getValue();