*/\r
public class SurfaceAreaQuery {\r
\r
- public static String prefix = "http://www.TianoCore.org/2006/Edk2.0";\r
+ public String prefix = "http://www.TianoCore.org/2006/Edk2.0";\r
\r
//\r
// Contains name/value pairs of Surface Area document object. The name is\r
// always the top level element name.\r
//\r
- private static Map<String, XmlObject> map = null;\r
+ private Map<String, XmlObject> map = null;\r
\r
//\r
// mapStack is used to do nested query\r
//\r
- private static Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();\r
+ private Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();\r
\r
//\r
// prefix of name space\r
//\r
- private static String nsPrefix = "sans";\r
+ private String nsPrefix = "sans";\r
\r
//\r
// xmlbeans needs a name space for each Xpath element\r
//\r
- private static String ns = null;\r
+ private String ns = null;\r
\r
//\r
// keep the namep declaration for xmlbeans Xpath query\r
//\r
- private static String queryDeclaration = null;\r
+ private String queryDeclaration = null;\r
\r
- private static StringBuffer normQueryString = new StringBuffer(4096);\r
- private static Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)");\r
+ private StringBuffer normQueryString = new StringBuffer(4096);\r
+ private Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)");\r
\r
/**\r
* Set a Surface Area document for query later\r
* A Surface Area document in TopLevelElementName/XmlObject\r
* format.\r
*/\r
- public static void setDoc(Map<String, XmlObject> map) {\r
+ public SurfaceAreaQuery(Map<String, XmlObject> map) {\r
ns = prefix;\r
queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; ";\r
- SurfaceAreaQuery.map = map;\r
+ this.map = map;\r
}\r
\r
/**\r
* The TopLevelElementName/XmlObject format of a Surface Area\r
* document.\r
*/\r
- public static void push(Map<String, XmlObject> newMap) {\r
- mapStack.push(SurfaceAreaQuery.map);\r
- SurfaceAreaQuery.map = newMap;\r
+ public void push(Map<String, XmlObject> newMap) {\r
+ mapStack.push(this.map);\r
+ this.map = newMap;\r
}\r
\r
/**\r
* Discard current used Surface Area document and use the top document in\r
* stack instead.\r
*/\r
- public static void pop() {\r
- SurfaceAreaQuery.map = mapStack.pop();\r
+ public void pop() {\r
+ this.map = mapStack.pop();\r
}\r
\r
// /\r
// / selectPath(). For example, converting /MsaHeader/ModuleType to\r
// / /ns:MsaHeader/ns:ModuleType\r
// /\r
- private static String normalizeQueryString(String[] exp, String from) {\r
+ private String normalizeQueryString(String[] exp, String from) {\r
normQueryString.setLength(0);\r
\r
int i = 0;\r
* xpath\r
* @returns NULL if nothing is at the specified xpath\r
*/\r
- public static Object[] get(String[] xPath) {\r
+ public Object[] get(String[] xPath) {\r
if (map == null) {\r
return null;\r
}\r
* @returns An array of XmlObject if elements are found at the given xpath\r
* @returns NULL if nothing is found at the given xpath\r
*/\r
- public static Object[] get(String rootName, String[] xPath) {\r
+ public Object[] get(String rootName, String[] xPath) {\r
if (map == null) {\r
return null;\r
}\r
* xpath\r
* @returns NULL if nothing is found at the known xpath\r
*/\r
- public static String[][] getSourceFiles(String arch) {\r
+ public String[][] getSourceFiles(String arch) {\r
String[] xPath;\r
Object[] returns;\r
\r
* @returns Directory names array if elements are found at the known xpath\r
* @returns Empty if nothing is found at the known xpath\r
*/\r
- public static String getFpdOutputDirectory() {\r
+ public String getFpdOutputDirectory() {\r
String[] xPath = new String[] { "/PlatformDefinitions" };\r
\r
Object[] returns = get("PlatformSurfaceArea", xPath);\r
return item.getOutputDirectory();\r
}\r
\r
- public static String getFpdIntermediateDirectories() {\r
+ public String getFpdIntermediateDirectories() {\r
String[] xPath = new String[] { "/PlatformDefinitions" };\r
\r
Object[] returns = get("PlatformSurfaceArea", xPath);\r
}\r
}\r
\r
- public static String getModuleFfsKeyword() {\r
+ public String getModuleFfsKeyword() {\r
String[] xPath = new String[] { "/" };\r
\r
Object[] returns = get("ModuleSaBuildOptions", xPath);\r
return item.getFfsFormatKey();\r
}\r
\r
- public static String getModuleFvBindingKeyword() {\r
+ public String getModuleFvBindingKeyword() {\r
String[] xPath = new String[] { "/" };\r
\r
Object[] returns = get("ModuleSaBuildOptions", xPath);\r
return item.getFvBinding();\r
}\r
\r
- public static List getModuleSupportedArchs() {\r
+ public List getModuleSupportedArchs() {\r
String[] xPath = new String[] { "/" };\r
\r
Object[] returns = get("ModuleDefinitions", xPath);\r
return item.getSupportedArchitectures();\r
}\r
\r
- public static BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() {\r
+ public BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() {\r
String[] xPath = new String[] {"/Ffs"};\r
\r
Object[] returns = get("BuildOptions", xPath);\r
return (BuildOptionsDocument.BuildOptions.Ffs[])returns;\r
}\r
\r
- public static String getModuleOutputFileBasename() {\r
+ public String getModuleOutputFileBasename() {\r
String[] xPath = new String[] { "/" };\r
\r
Object[] returns = get("ModuleDefinitions", xPath);\r
*\r
* @returns Empty array if nothing is there\r
*/\r
- public static String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) {\r
+ public String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) {\r
String target = null;\r
String toolchain = null;\r
String toolchainFamily = null;\r
return result;\r
}\r
\r
- public static String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) {\r
+ public String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) {\r
String[] xPath;\r
\r
if (toolChainFamilyFlag == true) {\r
return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag);\r
}\r
\r
- public static String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) {\r
+ public String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) {\r
String[] xPath;\r
\r
if (toolChainFamilyFlag == true) {\r
return getOptions("PlatformSurfaceArea", xPath, toolChainFamilyFlag);\r
}\r
\r
- public static ToolChainInfo getFpdToolChainInfo() {\r
+ public ToolChainInfo getFpdToolChainInfo() {\r
String[] xPath = new String[] { "/PlatformDefinitions" };\r
\r
Object[] returns = get("PlatformSurfaceArea", xPath);\r
* @returns The module type name if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String getModuleType() {\r
+ public String getModuleType() {\r
String[] xPath = new String[] { "/ModuleType" };\r
\r
Object[] returns = get(xPath);\r
* @returns package name list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static PackageIdentification[] getDependencePkg(String arch) {\r
+ public PackageIdentification[] getDependencePkg(String arch) {\r
String[] xPath;\r
String packageGuid = null;\r
String packageVersion = null;\r
* xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getLibraryClasses(String usage, String arch) {\r
+ public String[] getLibraryClasses(String usage, String arch) {\r
String[] xPath;\r
if (usage == null || usage.equals("")) {\r
xPath = new String[] { "/LibraryClass" };\r
* xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getModuleEntryPointArray() {\r
+ public String[] getModuleEntryPointArray() {\r
String[] xPath = new String[] { "/Extern/ModuleEntryPoint" };\r
\r
Object[] returns = get("Externs", xPath);\r
* @returns Protocol String list if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getProtocolArray(String arch, String usage) {\r
+ public String[] getProtocolArray(String arch, String usage) {\r
String[] xPath;\r
String usageXpath = "";\r
String archXpath = "";\r
* @returns Protocol String list if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getProtocolArray(String arch) {\r
+ public String[] getProtocolArray(String arch) {\r
String[] xPath;\r
\r
if (arch == null || arch.equals("")) {\r
* @returns String[] if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getProtocolNotifyArray(String arch) {\r
+ public String[] getProtocolNotifyArray(String arch) {\r
String[] xPath;\r
\r
if (arch == null || arch.equals("")) {\r
* @returns String[] if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getProtocolNotifyArray(String arch, String usage) {\r
+ public String[] getProtocolNotifyArray(String arch, String usage) {\r
\r
String[] xPath;\r
String usageXpath;\r
* xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getModuleUnloadImageArray() {\r
+ public String[] getModuleUnloadImageArray() {\r
String[] xPath = new String[] { "/Extern/ModuleUnloadImage" };\r
\r
Object[] returns = get("Externs", xPath);\r
* @returns Extern objects list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static ExternsDocument.Externs.Extern[] getExternArray() {\r
+ public ExternsDocument.Externs.Extern[] getExternArray() {\r
String[] xPath = new String[] { "/Extern" };\r
\r
Object[] returns = get("Externs", xPath);\r
* @returns String[] if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getPpiNotifyArray(String arch) {\r
+ public String[] getPpiNotifyArray(String arch) {\r
String[] xPath;\r
\r
if (arch == null || arch.equals("")) {\r
* @returns String[] if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getPpiNotifyArray(String arch, String usage) {\r
+ public String[] getPpiNotifyArray(String arch, String usage) {\r
\r
String[] xPath;\r
String usageXpath;\r
* @returns String[] if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getPpiArray(String arch) {\r
+ public String[] getPpiArray(String arch) {\r
String[] xPath;\r
\r
if (arch == null || arch.equals("")) {\r
* @returns String[] if elements are found at the known xpath\r
* @returns String[0] if nothing is there\r
*/\r
- public static String[] getPpiArray(String arch, String usage) {\r
+ public String[] getPpiArray(String arch, String usage) {\r
\r
String[] xPath;\r
String usageXpath;\r
* @returns GuidEntry objects list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getGuidEntryArray(String arch) {\r
+ public String[] getGuidEntryArray(String arch) {\r
String[] xPath;\r
\r
if (arch == null || arch.equals("")) {\r
* @returns GuidEntry objects list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getGuidEntryArray(String arch, String usage) {\r
+ public String[] getGuidEntryArray(String arch, String usage) {\r
String[] xPath;\r
String archXpath;\r
String usageXpath;\r
* xpath\r
* @returns null if nothing is there\r
*/\r
- public static ModuleIdentification[] getLibraryInstance(String arch) {\r
+ public ModuleIdentification[] getLibraryInstance(String arch) {\r
String[] xPath;\r
String saGuid = null;\r
String saVersion = null;\r
// / This method is used for retrieving the elements information which has\r
// / CName sub-element\r
// /\r
- private static String[] getCNames(String from, String xPath[]) {\r
+ private String[] getCNames(String from, String xPath[]) {\r
Object[] returns = get(from, xPath);\r
if (returns == null || returns.length == 0) {\r
return null;\r
* @returns constructor name list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String getLibConstructorName() {\r
+ public String getLibConstructorName() {\r
String[] xPath = new String[] { "/Extern/Constructor" };\r
\r
Object[] returns = get("Externs", xPath);\r
* @returns destructor name list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String getLibDestructorName() {\r
+ public String getLibDestructorName() {\r
String[] xPath = new String[] { "/Extern/Destructor" };\r
\r
Object[] returns = get("Externs", xPath);\r
* @returns DriverBinding name list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getDriverBindingArray() {\r
+ public String[] getDriverBindingArray() {\r
String[] xPath = new String[] { "/Extern/DriverBinding" };\r
return getCNames("Externs", xPath);\r
}\r
* @returns ComponentName name list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getComponentNameArray() {\r
+ public String[] getComponentNameArray() {\r
String[] xPath = new String[] { "/Extern/ComponentName" };\r
return getCNames("Externs", xPath);\r
}\r
* @returns DriverConfig name list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getDriverConfigArray() {\r
+ public String[] getDriverConfigArray() {\r
String[] xPath = new String[] { "/Extern/DriverConfig" };\r
return getCNames("Externs", xPath);\r
}\r
* @returns DriverDiag name list if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getDriverDiagArray() {\r
+ public String[] getDriverDiagArray() {\r
String[] xPath = new String[] { "/Extern/DriverDiag" };\r
return getCNames("Externs", xPath);\r
}\r
* the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getSetVirtualAddressMapCallBackArray() {\r
+ public String[] getSetVirtualAddressMapCallBackArray() {\r
String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" };\r
return getCNames("Externs", xPath);\r
}\r
* known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[] getExitBootServicesCallBackArray() {\r
+ public String[] getExitBootServicesCallBackArray() {\r
String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" };\r
return getCNames("Externs", xPath);\r
}\r
\r
@return CommonDefinition.PCD_DRIVER_TYPE the type of current driver\r
**/\r
- public static CommonDefinition.PCD_DRIVER_TYPE getPcdDriverType() {\r
+ public CommonDefinition.PCD_DRIVER_TYPE getPcdDriverType() {\r
String[] xPath = new String[] {"/PcdIsDriver"};\r
Object[] results = get ("Externs", xPath);\r
\r
* @returns ModuleSA objects list if elements are found at the known xpath\r
* @returns Empty ModuleSA list if nothing is there\r
*/\r
- public static Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() {\r
+ public Map<FpdModuleIdentification, Map<String, XmlObject>> getFpdModules() {\r
String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };\r
Object[] result = get("PlatformSurfaceArea", xPath);\r
String arch = null;\r
* @returns valid iamges name list if elements are found at the known xpath\r
* @returns empty list if nothing is there\r
*/\r
- public static String[] getFpdValidImageNames() {\r
+ public String[] getFpdValidImageNames() {\r
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='ImageName']/FvImageNames" };\r
\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
return result;\r
}\r
\r
- public static Node getFpdUserExtensionPreBuild() {\r
+ public Node getFpdUserExtensionPreBuild() {\r
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };\r
\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
return a.getDomNode();\r
}\r
\r
- public static Node getFpdUserExtensionPostBuild() {\r
+ public Node getFpdUserExtensionPostBuild() {\r
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };\r
\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
* @returns option name/value list if elements are found at the known xpath\r
* @returns empty list if nothing is there\r
*/\r
- public static String[][] getFpdOptions(String fvName) {\r
+ public String[][] getFpdOptions(String fvName) {\r
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='"\r
+ fvName + "']/FvImageOptions" };\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
\r
}\r
\r
- public static XmlObject getFpdBuildOptions() {\r
+ public XmlObject getFpdBuildOptions() {\r
String[] xPath = new String[] { "/BuildOptions" };\r
\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
return (XmlObject)queryResult[0];\r
}\r
\r
- public static PlatformIdentification getFpdHeader() {\r
+ public PlatformIdentification getFpdHeader() {\r
String[] xPath = new String[] { "/PlatformHeader" };\r
\r
Object[] returns = get("PlatformSurfaceArea", xPath);\r
* xpath\r
* @returns empty list if nothing is there\r
*/\r
- public static String[][] getFpdAttributes(String fvName) {\r
+ public String[][] getFpdAttributes(String fvName) {\r
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='"\r
+ fvName + "']/FvImageOptions" };\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
* @returns file name if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String getFlashDefinitionFile() {\r
+ public String getFlashDefinitionFile() {\r
String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" };\r
\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
return filename.getStringValue();\r
}\r
\r
- public static String[][] getFpdGlobalVariable() {\r
+ public String[][] getFpdGlobalVariable() {\r
String[] xPath = new String[] { "/Flash/FvImages/NameValue" };\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
if (queryResult == null) {\r
* @returns name/value pairs list if elements are found at the known xpath\r
* @returns empty list if nothing is there\r
*/\r
- public static String[][] getFpdComponents(String fvName) {\r
+ public String[][] getFpdComponents(String fvName) {\r
String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName + "']/FvImageOptions" };\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
if (queryResult == null) {\r
* xpath\r
* @returns null if nothing is there\r
*/\r
- public static String[][] getPcdTokenArray() {\r
+ public String[][] getPcdTokenArray() {\r
String[] xPath = new String[] { "/PcdData" };\r
\r
Object[] returns = get("PCDs", xPath);\r
* @return\r
* @return\r
*/\r
- public static ModuleIdentification getMsaHeader() {\r
+ public ModuleIdentification getMsaHeader() {\r
String[] xPath = new String[] { "/" };\r
Object[] returns = get("MsaHeader", xPath);\r
\r
*\r
*/\r
\r
- public static String[] getExternSpecificaiton() {\r
+ public String[] getExternSpecificaiton() {\r
String[] xPath = new String[] { "/Specification" };\r
\r
Object[] queryResult = get("Externs", xPath);\r
* @return String[][3] The string sequence is ModuleName, ModuleGuid,\r
* ModuleVersion, MsaFile String[0][] If no msafile in SPD\r
*/\r
- public static String[] getSpdMsaFile() {\r
+ public String[] getSpdMsaFile() {\r
String[] xPath = new String[] { "/MsaFiles" };\r
\r
Object[] returns = get("PackageSurfaceArea", xPath);\r
/**\r
* Reteive\r
*/\r
- public static Map<String, String[]> getSpdLibraryClasses() {\r
+ public Map<String, String[]> getSpdLibraryClasses() {\r
String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" };\r
\r
Object[] returns = get("PackageSurfaceArea", xPath);\r
/**\r
* Reteive\r
*/\r
- public static Map<String, String> getSpdPackageHeaderFiles() {\r
+ public Map<String, String> getSpdPackageHeaderFiles() {\r
String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" };\r
\r
Object[] returns = get("PackageSurfaceArea", xPath);\r
return packageIncludeMap;\r
}\r
\r
- public static PackageIdentification getSpdHeader() {\r
+ public PackageIdentification getSpdHeader() {\r
String[] xPath = new String[] { "/SpdHeader" };\r
\r
Object[] returns = get("PackageSurfaceArea", xPath);\r
/**\r
* Reteive\r
*/\r
- public static Map<String, String[]> getSpdGuid() {\r
+ public Map<String, String[]> getSpdGuid() {\r
String[] xPath = new String[] { "/GuidDeclarations/Entry" };\r
\r
Object[] returns = get("PackageSurfaceArea", xPath);\r
/**\r
* Reteive\r
*/\r
- public static Map<String, String[]> getSpdProtocol() {\r
+ public Map<String, String[]> getSpdProtocol() {\r
String[] xPath = new String[] { "/ProtocolDeclarations/Entry" };\r
\r
Object[] returns = get("PackageSurfaceArea", xPath);\r
* Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI\r
* entry in SPD.\r
*/\r
- public static Map<String, String[]> getSpdPpi() {\r
+ public Map<String, String[]> getSpdPpi() {\r
String[] xPath = new String[] { "/PpiDeclarations/Entry" };\r
\r
Object[] returns = get("PackageSurfaceArea", xPath);\r
* @returns GUILD string if elements are found at the known xpath\r
* @returns null if nothing is there\r
*/\r
- public static String getModuleGuid() {\r
+ public String getModuleGuid() {\r
String[] xPath = new String[] { "" };\r
\r
Object[] returns = get("MsaHeader", xPath);\r
//\r
// For new Pcd\r
//\r
- public static ModuleSADocument.ModuleSA[] getFpdModuleSAs() {\r
+ public ModuleSADocument.ModuleSA[] getFpdModuleSAs() {\r
String[] xPath = new String[] { "/FrameworkModules/ModuleSA" };\r
Object[] result = get("PlatformSurfaceArea", xPath);\r
if (result != null) {\r
\r
@return String[]\r
**/\r
- public static String[] getModulePcdEntryNameArray() {\r
+ public String[] getModulePcdEntryNameArray() {\r
PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null;\r
String[] results;\r
int index;\r
\r
@return boolean\r
**/\r
- public static boolean contains(List list, String str) {\r
+ public boolean contains(List list, String str) {\r
if (list == null || list.size()== 0) {\r
return true;\r
}\r
return false;\r
}\r
\r
- public static boolean isHaveTianoR8FlashMap(){\r
+ public boolean isHaveTianoR8FlashMap(){\r
String[] xPath = new String[] {"/"};\r
Object[] returns = get ("Externs", xPath);\r
\r