X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2Fglobal%2FSurfaceAreaQuery.java;fp=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2Fglobal%2FSurfaceAreaQuery.java;h=85b406621c47f8f3cf2dd3250d9387d0034c86c0;hp=ac081431a6eacfe05b7f35f4cb0a72d3e0d189df;hb=3658f95e1a73626ff1cdb9cde3676ebc1edc3523;hpb=55e83b18d8d46470c05701cb410f1bc49e33ffc3 diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java index ac081431a6..85b406621c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java @@ -14,46 +14,25 @@ package org.tianocore.frameworkwizard.platform.ui.global; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Stack; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.xmlbeans.XmlNormalizedString; import org.apache.xmlbeans.XmlObject; -import org.apache.xmlbeans.XmlString; import org.tianocore.BuildTargetList; -import org.tianocore.DataIdDocument; -import org.tianocore.ExternsDocument; -import org.tianocore.FileNameConvention; -//import org.tianocore.FvImageDocument; -import org.tianocore.GuidDeclarationsDocument; -import org.tianocore.LibrariesDocument; -import org.tianocore.LibraryClassDeclarationsDocument; import org.tianocore.LibraryClassDocument; -import org.tianocore.ModuleSADocument; import org.tianocore.ModuleSurfaceAreaDocument; -import org.tianocore.ModuleTypeDef; -import org.tianocore.MsaFilesDocument; -import org.tianocore.MsaHeaderDocument; import org.tianocore.PackageDependenciesDocument; -import org.tianocore.PackageHeadersDocument; -import org.tianocore.PpiDeclarationsDocument; -import org.tianocore.ProtocolDeclarationsDocument; -import org.tianocore.SpdHeaderDocument; +import org.tianocore.PackageSurfaceAreaDocument; import org.tianocore.FilenameDocument.Filename; -import org.tianocore.MsaHeaderDocument.MsaHeader; -import org.tianocore.PlatformHeaderDocument; -import org.tianocore.frameworkwizard.platform.ui.id.FpdModuleIdentification; -import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification; -import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification; -import org.tianocore.frameworkwizard.platform.ui.id.PlatformIdentification; + +import org.tianocore.frameworkwizard.common.GlobalData; +import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; +import org.tianocore.frameworkwizard.packaging.PackageIdentification; /** * SurfaceAreaQuery class is used to query Surface Area information from msa, @@ -322,16 +301,10 @@ public class SurfaceAreaQuery { * @returns The module type name if elements are found at the known xpath * @returns null if nothing is there */ - public static String getModuleType() { - String[] xPath = new String[] { "/ModuleType" }; - - XmlObject[] returns = get(xPath); - if (returns != null && returns.length > 0) { - ModuleTypeDef type = (ModuleTypeDef) returns[0]; - return type.enumValue().toString(); - } + public static String getModuleType(ModuleIdentification mi) { + ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = WorkspaceProfile.getModuleXmlObject(mi); - return null; + return msa.getMsaHeader().getModuleType()+""; } /** @@ -365,8 +338,7 @@ public class SurfaceAreaQuery { packageGuid = item.getPackageGuid(); packageVersion = item.getPackageVersion(); - Set spi = WorkspaceProfile.getPackageList(); - Iterator ispi = spi.iterator(); + Iterator ispi = GlobalData.vPackageList.iterator(); String ver = ""; while(ispi.hasNext()) { PackageIdentification pi = ispi.next(); @@ -422,813 +394,18 @@ public class SurfaceAreaQuery { return libraryClassName; } - /** - * Retrieve ModuleEntryPoint names - * - * @returns ModuleEntryPoint name list if elements are found at the known - * xpath - * @returns null if nothing is there - */ - public static String[] getModuleEntryPointArray() { - String[] xPath = new String[] { "/Extern/ModuleEntryPoint" }; - - XmlObject[] returns = get("Externs", xPath); - - if (returns != null && returns.length > 0) { - String[] entryPoints = new String[returns.length]; - - for (int i = 0; i < returns.length; ++i) { - entryPoints[i] = ((XmlNormalizedString) returns[i]) - .getStringValue(); - } - - return entryPoints; - } - - return null; - } - - - - - /** - * Retrieve ModuleUnloadImage names - * - * @returns ModuleUnloadImage name list if elements are found at the known - * xpath - * @returns null if nothing is there - */ - public static String[] getModuleUnloadImageArray() { - String[] xPath = new String[] { "/Extern/ModuleUnloadImage" }; - - XmlObject[] returns = get("Externs", xPath); - if (returns != null && returns.length > 0) { - String[] stringArray = new String[returns.length]; - XmlNormalizedString[] doc = (XmlNormalizedString[]) returns; - - for (int i = 0; i < returns.length; ++i) { - stringArray[i] = doc[i].getStringValue(); - } - - return stringArray; - } - - return null; - } - - /** - * Retrieve Extern - * - * @returns Extern objects list if elements are found at the known xpath - * @returns null if nothing is there - */ - public static ExternsDocument.Externs.Extern[] getExternArray() { - String[] xPath = new String[] { "/Extern" }; - - XmlObject[] returns = get("Externs", xPath); - if (returns != null && returns.length > 0) { - return (ExternsDocument.Externs.Extern[]) returns; - } - - return null; - } - - /** - * Retrieve Library instance information - * - * @param arch - * Architecture name - * @param usage - * Library instance usage - * - * @returns library instance name list if elements are found at the known - * xpath - * @returns null if nothing is there - */ - public static ModuleIdentification[] getLibraryInstance(String arch) { - String[] xPath; - String saGuid = null; - String saVersion = null; - String pkgGuid = null; - String pkgVersion = null; - - if (arch == null || arch.equalsIgnoreCase("")) { - xPath = new String[] { "/Instance" }; - } else { - xPath = new String[] { "/Instance[not(@SupArchList) or @SupArchList='" - + arch + "']" }; - } - - XmlObject[] returns = get("Libraries", xPath); - if (returns == null || returns.length == 0) { - return new ModuleIdentification[0]; - } - - ModuleIdentification[] saIdList = new ModuleIdentification[returns.length]; - for (int i = 0; i < returns.length; i++) { - LibrariesDocument.Libraries.Instance library = (LibrariesDocument.Libraries.Instance) returns[i]; - saGuid = library.getModuleGuid(); - saVersion = library.getModuleVersion(); - - pkgGuid = library.getPackageGuid(); - pkgVersion = library.getPackageVersion(); - - ModuleIdentification saId = new ModuleIdentification(null, saGuid, - saVersion); - PackageIdentification pkgId = new PackageIdentification(null, - pkgGuid, pkgVersion); - saId.setPackage(pkgId); - - saIdList[i] = saId; - - } - return saIdList; - } - - // / - // / This method is used for retrieving the elements information which has - // / CName sub-element - // / - private static String[] getCNames(String from, String xPath[]) { - XmlObject[] returns = get(from, xPath); - if (returns == null || returns.length == 0) { - return null; - } - - String[] strings = new String[returns.length]; - for (int i = 0; i < returns.length; ++i) { - // TBD - // strings[i] = ((CName) returns[i]).getStringValue(); - } - - return strings; - } - - /** - * Retrive library's constructor name - * - * @returns constructor name list if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String getLibConstructorName() { - String[] xPath = new String[] { "/Extern/Constructor" }; - - XmlObject[] returns = get("Externs", xPath); - if (returns != null && returns.length > 0) { - // CName constructor = (CName) returns[0]; - // return constructor.getStringValue(); - } - - return null; - } - - /** - * Retrive library's destructor name - * - * @returns destructor name list if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String getLibDestructorName() { - String[] xPath = new String[] { "/Extern/Destructor" }; - - XmlObject[] returns = get("Externs", xPath); - if (returns != null && returns.length > 0) { - // CName destructor = (CName) returns[0]; - // return destructor.getStringValue(); - } - - return null; - } - - /** - * Retrive DriverBinding names - * - * @returns DriverBinding name list if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String[] getDriverBindingArray() { - String[] xPath = new String[] { "/Extern/DriverBinding" }; - return getCNames("Externs", xPath); - } - - /** - * Retrive ComponentName names - * - * @returns ComponentName name list if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String[] getComponentNameArray() { - String[] xPath = new String[] { "/Extern/ComponentName" }; - return getCNames("Externs", xPath); - } - - /** - * Retrive DriverConfig names - * - * @returns DriverConfig name list if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String[] getDriverConfigArray() { - String[] xPath = new String[] { "/Extern/DriverConfig" }; - return getCNames("Externs", xPath); - } - - /** - * Retrive DriverDiag names - * - * @returns DriverDiag name list if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String[] getDriverDiagArray() { - String[] xPath = new String[] { "/Extern/DriverDiag" }; - return getCNames("Externs", xPath); - } - - /** - * Retrive SetVirtualAddressMapCallBack names - * - * @returns SetVirtualAddressMapCallBack name list if elements are found at - * the known xpath - * @returns null if nothing is there - */ - public static String[] getSetVirtualAddressMapCallBackArray() { - String[] xPath = new String[] { "/Extern/SetVirtualAddressMapCallBack" }; - return getCNames("Externs", xPath); - } - - /** - * Retrive ExitBootServicesCallBack names - * - * @returns ExitBootServicesCallBack name list if elements are found at the - * known xpath - * @returns null if nothing is there - */ - public static String[] getExitBootServicesCallBackArray() { - String[] xPath = new String[] { "/Extern/ExitBootServicesCallBack" }; - return getCNames("Externs", xPath); - } - - /** - * Retrieve module surface area file information - * - * @returns ModuleSA objects list if elements are found at the known xpath - * @returns Empty ModuleSA list if nothing is there - */ - public static Map> getFpdModules() { - String[] xPath = new String[] { "/FrameworkModules/ModuleSA" }; - XmlObject[] result = get("FrameworkPlatformDescription", xPath); - String arch = null; - String fvBinding = null; - String saGuid = null; - String saVersion = null; - String pkgGuid = null; - String pkgVersion = null; - - Map> fpdModuleMap = new LinkedHashMap>(); - - if (result == null) { - return fpdModuleMap; - } - - for (int i = 0; i < result.length; i++) { - // - // Get Fpd SA Module element node and add to xmlObjectMap. - // - Map xmlObjectMap = new HashMap(); - ModuleSADocument.ModuleSA moduleSA = (ModuleSADocument.ModuleSA) result[i]; - if (((ModuleSADocument.ModuleSA) result[i]).getLibraries() != null) { - xmlObjectMap.put("Libraries", moduleSA.getLibraries()); - } - if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) { - xmlObjectMap.put("PcdBuildDefinition", moduleSA - .getPcdBuildDefinition()); - } - if (((ModuleSADocument.ModuleSA) result[i]) - .getModuleSaBuildOptions() != null) { - xmlObjectMap.put("ModuleSaBuildOptions", moduleSA - .getModuleSaBuildOptions()); - } - - // - // Get Fpd SA Module attribute and create FpdMoudleIdentification. - // - arch = moduleSA.getSupArchList().toString(); - - // TBD - fvBinding = null; - saVersion = ((ModuleSADocument.ModuleSA) result[i]) - .getModuleVersion(); - - saGuid = moduleSA.getModuleGuid(); - pkgGuid = moduleSA.getPackageGuid(); - pkgVersion = moduleSA.getPackageVersion(); - - // - // Create Module Identification which have class member of package - // identification. - // - PackageIdentification pkgId = new PackageIdentification(null, - pkgGuid, pkgVersion); - ModuleIdentification saId = new ModuleIdentification(null, saGuid, - saVersion); - - saId.setPackage(pkgId); - - // - // Create FpdModule Identification which have class member of module - // identification - // - FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, - arch); - if (arch != null) { - fpdSaId.setArch(arch); - } - if (fvBinding != null) { - fpdSaId.setFvBinding(fvBinding); - } - - // - // Put element to Map>. - // - fpdModuleMap.put(fpdSaId, xmlObjectMap); - } - return fpdModuleMap; - } - - /** - * Retrieve valid image names - * - * @returns valid iamges name list if elements are found at the known xpath - * @returns empty list if nothing is there - */ - public static String[] getFpdValidImageNames() { - String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FvImages/FvImage[@Type='ValidImageNames']/FvImageNames" }; - - XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath); - if (queryResult == null) { - return new String[0]; - } - - String[] result = new String[queryResult.length]; - for (int i = 0; i < queryResult.length; i++) { - result[i] = ((XmlString) queryResult[i]).getStringValue(); - } - - return result; - } - - - - public static XmlObject getFpdBuildOptions() { - String[] xPath = new String[] { "/BuildOptions" }; - - XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath); - - if (queryResult == null || queryResult.length == 0) { - return null; - } - return queryResult[0]; - } - - public static PlatformIdentification getFpdHeader() { - String[] xPath = new String[] { "/PlatformHeader" }; - - XmlObject[] returns = get("FrameworkPlatformDescription", xPath); - - if (returns == null || returns.length == 0) { - return null; - } - PlatformHeaderDocument.PlatformHeader header = (PlatformHeaderDocument.PlatformHeader) returns[0]; - - String name = header.getPlatformName(); - - String guid = header.getGuidValue(); - - String version = header.getVersion(); - - return new PlatformIdentification(name, guid, version); - } - - /** - * Retrieve flash definition file name - * - * @returns file name if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String getFlashDefinitionFile() { - String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/FlashDefinitionFile" }; - - XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath); - if (queryResult == null || queryResult.length == 0) { - return null; - } - - FileNameConvention filename = (FileNameConvention) queryResult[queryResult.length - 1]; - return filename.getStringValue(); - } - - /** - * Retrieve FV image component options - * - * @param fvName - * FV image name - * - * @returns name/value pairs list if elements are found at the known xpath - * @returns empty list if nothing is there - */ - public static String[][] getFpdComponents(String fvName) { - String[] xPath = new String[] { "/PlatformDefinitions/FlashDeviceDefinitions/DataRegions/FvDataRegion[@Name='" - + fvName.toUpperCase() + "']/DataId" }; - - XmlObject[] queryResult = get("FrameworkPlatformDescription", xPath); - if (queryResult == null) { - return new String[0][]; - } - - ArrayList list = new ArrayList(); - for (int i = 0; i < queryResult.length; i++) { - DataIdDocument.DataId item = (DataIdDocument.DataId) queryResult[i]; - list - .add(new String[] { item.getStringValue(), - item.getDataSize() }); - } - - String[][] result = new String[list.size()][2]; - for (int i = 0; i < list.size(); i++) { - result[i][0] = list.get(i)[0]; - result[i][1] = list.get(i)[1]; - } - - return result; - } - - /** - * Retrieve PCD tokens - * - * @returns CName/ItemType pairs list if elements are found at the known - * xpath - * @returns null if nothing is there - */ - public static String[][] getPcdTokenArray() { - String[] xPath = new String[] { "/PcdData" }; - - XmlObject[] returns = get("PCDs", xPath); - if (returns == null || returns.length == 0) { - return null; - } - - // PcdCoded.PcdData[] pcds = (PcdCoded.PcdData[]) returns; - // String[][] result = new String[pcds.length][2]; - // for (int i = 0; i < returns.length; ++i) { - // if (pcds[i].getItemType() != null) { - // result[i][1] = pcds[i].getItemType().toString(); - // } else { - // result[i][1] = null; - // } - // result[i][0] = pcds[i].getCName(); - // } - - return null; - } - - - - /** - * Retrieve MSA header - * - * @return - * @return - */ - public static ModuleIdentification getMsaHeader() { - String[] xPath = new String[] { "/" }; - XmlObject[] returns = get("MsaHeader", xPath); - - if (returns == null || returns.length == 0) { - return null; - } - - MsaHeader msaHeader = (MsaHeader) returns[0]; - // - // Get BaseName, ModuleType, GuidValue, Version - // which in MsaHeader. - // - String name = msaHeader.getModuleName(); - String moduleType = ""; - if (msaHeader.getModuleType() != null) { - moduleType = msaHeader.getModuleType().toString(); + public static XmlObject[] getSpdPcdDeclarations(PackageIdentification pi) { + XmlObject[] returns = null; + PackageSurfaceAreaDocument.PackageSurfaceArea psa = WorkspaceProfile.getPackageXmlObject(pi); + if (psa.getPcdDeclarations() != null && psa.getPcdDeclarations().getPcdEntryList() != null) { + int size = psa.getPcdDeclarations().getPcdEntryList().size(); + returns = new XmlObject[size]; + for (int i = 0; i < size; ++i) { + returns[i] = psa.getPcdDeclarations().getPcdEntryList().get(i); + } } - - String guid = msaHeader.getGuidValue(); - String version = msaHeader.getVersion(); - - ModuleIdentification moduleId = new ModuleIdentification(name, guid, - version); - - moduleId.setModuleType(moduleType); - - return moduleId; - } - - /** - * Retrieve Extern Specification - * - * @param - * - * @return String[] If have specification element in the String[0] - * If no specification element in the - * - */ - - public static String[] getExternSpecificaiton() { - String[] xPath = new String[] { "/Specification" }; - - XmlObject[] queryResult = get("Externs", xPath); - if (queryResult == null) { - return new String[0]; - } - - String[] specificationList = new String[queryResult.length]; - for (int i = 0; i < queryResult.length; i++) { - // specificationList[i] = ((SpecificationDocument.Specification) - // queryResult[i]) - // .getStringValue(); - } - return specificationList; - } - - /** - * Retreive MsaFile which in SPD - * - * @param - * @return String[][3] The string sequence is ModuleName, ModuleGuid, - * ModuleVersion, MsaFile String[0][] If no msafile in SPD - */ - public static String[] getSpdMsaFile() { - String[] xPath = new String[] { "/MsaFiles" }; - - XmlObject[] returns = get("PackageSurfaceArea", xPath); - if (returns == null) { - return new String[0]; - } - - List filenameList = ((MsaFilesDocument.MsaFiles) returns[0]) - .getFilenameList(); - return filenameList.toArray(new String[filenameList.size()]); - } - - /** - * Reteive - */ - public static Map getSpdLibraryClasses() { - String[] xPath = new String[] { "/LibraryClassDeclarations/LibraryClass" }; - - XmlObject[] returns = get("PackageSurfaceArea", xPath); - - // - // Create Map, Key - LibraryClass, String[] - LibraryClass Header file. - // - Map libClassHeaderMap = new HashMap(); - - if (returns == null) { - return libClassHeaderMap; - } - - for (int i = 0; i < returns.length; i++) { - LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass library = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) returns[i]; - libClassHeaderMap.put(library.getName(), new String[] { library - .getIncludeHeader() }); - } - return libClassHeaderMap; - } - - /** - * Reteive - */ - public static Map getSpdPackageHeaderFiles() { - String[] xPath = new String[] { "/PackageHeaders/IncludePkgHeader" }; - - XmlObject[] returns = get("PackageSurfaceArea", xPath); - - // - // Create Map, Key - ModuleType, String - PackageInclude Header file. - // - Map packageIncludeMap = new HashMap(); - - if (returns == null) { - return packageIncludeMap; - } - WorkspaceProfile.log.info("" + returns[0].getClass().getName()); - for (int i = 0; i < returns.length; i++) { - PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i]; - packageIncludeMap.put(includeHeader.getModuleType().toString(), - includeHeader.getStringValue()); - } - return packageIncludeMap; - } - - public static PackageIdentification getSpdHeader() { - String[] xPath = new String[] { "/SpdHeader" }; - - XmlObject[] returns = get("PackageSurfaceArea", xPath); - - if (returns == null || returns.length == 0) { - return null; - } - - SpdHeaderDocument.SpdHeader header = (SpdHeaderDocument.SpdHeader) returns[0]; - - String name = header.getPackageName(); - - String guid = header.getGuidValue(); - - String version = header.getVersion(); - - return new PackageIdentification(name, guid, version); - } - - /** - * Reteive - */ - public static Map getSpdGuid() { - String[] xPath = new String[] { "/GuidDeclarations/Entry" }; - - XmlObject[] returns = get("PackageSurfaceArea", xPath); - - // - // Create Map, Key - GuidName, String[] - C_NAME & GUID value. - // - Map guidDeclMap = new HashMap(); - if (returns == null) { - return guidDeclMap; - } - - for (int i = 0; i < returns.length; i++) { - GuidDeclarationsDocument.GuidDeclarations.Entry entry = (GuidDeclarationsDocument.GuidDeclarations.Entry) returns[i]; - String[] guidPair = new String[2]; - guidPair[0] = entry.getCName(); - guidPair[1] = entry.getGuidValue(); - guidDeclMap.put(entry.getName(), guidPair); - } - return guidDeclMap; - } - - /** - * Reteive - */ - public static Map getSpdProtocol() { - String[] xPath = new String[] { "/ProtocolDeclarations/Entry" }; - - XmlObject[] returns = get("PackageSurfaceArea", xPath); - - // - // Create Map, Key - protocolName, String[] - C_NAME & GUID value. - // - Map protoclMap = new HashMap(); - - if (returns == null) { - return protoclMap; - } - - for (int i = 0; i < returns.length; i++) { - ProtocolDeclarationsDocument.ProtocolDeclarations.Entry entry = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) returns[i]; - String[] protocolPair = new String[2]; - - protocolPair[0] = entry.getCName(); - protocolPair[1] = entry.getGuidValue(); - protoclMap.put(entry.getName(), protocolPair); - } - return protoclMap; - } - - /** - * getSpdPpi() Retrieve the SPD PPI Entry - * - * @param - * @return Map if get the PPI entry from SPD. Key - PPI - * Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI - * entry in SPD. - */ - public static Map getSpdPpi() { - String[] xPath = new String[] { "/PpiDeclarations/Entry" }; - - XmlObject[] returns = get("PackageSurfaceArea", xPath); - - // - // Create Map, Key - protocolName, String[] - C_NAME & GUID value. - // - Map ppiMap = new HashMap(); - - if (returns == null) { - return ppiMap; - } - - for (int i = 0; i < returns.length; i++) { - PpiDeclarationsDocument.PpiDeclarations.Entry entry = (PpiDeclarationsDocument.PpiDeclarations.Entry) returns[i]; - String[] ppiPair = new String[2]; - ppiPair[0] = entry.getCName(); - ppiPair[1] = entry.getGuidValue(); - ppiMap.put(entry.getName(), ppiPair); - } - return ppiMap; - } - - /** - * getModuleSupportedArchs() - * - * This function is to Retrieve Archs one module supported. - * - * @param - * @return supportArch String of supporting archs. null No arch specified in - * element. - */ - public static List getModuleSupportedArchs() { - String[] xPath = new String[] { "/ModuleDefinitions/SupportedArchitectures" }; - - XmlObject[] returns = get("ModuleSurfaceArea", xPath); - - if (returns == null) { - return null; - } - - return (List)returns[0]; - } - - public static XmlObject[] getSpdPcdDeclarations() { - String[] xPath = null; -// if (tsGuid != null){ -// xPath = new String[] { "/PcdDeclarations/PcdEntry[C_Name='" + cName + "' and TokenSpaceGuid='"+ tsGuid + "']" }; -// } -// else{ -// xPath = new String[] { "/PcdDeclarations/PcdEntry[C_Name='" + cName + "']" }; -// } - xPath = new String[] { "/PcdDeclarations/PcdEntry"}; - XmlObject[] returns = get("PackageSurfaceArea", xPath); return returns; } - - public static XmlObject[] getFpdPcdBuildDefinitions(String cName, String tsGuid, String type) { - String[] xPath = new String[] { "/PcdBuildDefinition/PcdData[C_Name='" + cName + "' and TokenSpaceGuid='" - + tsGuid + "' and DatumType!='" + type + "']" }; - - XmlObject[] returns = get("ModuleSA", xPath); - - return returns; - } - /** - * getToolChainFamily - * - * This function is to retrieve ToolChainFamily attribute of FPD - * - * - * @param - * @return toolChainFamily If find toolChainFamily attribute in - * Null If don't have toolChainFamily in - * . - */ - public String getToolChainFamily() { - String[] xPath = new String[] { "/BuildOptions" }; - - XmlObject[] result = get("FrameworkPlatformDescription", xPath); - if (result == null) { - return null; - } - // toolChainFamily = - // ((BuildOptionsDocument.BuildOptions)result[0]).getToolChainFamilies(); - // return toolChainFamily; - return null; - } - /** - * Retrieve module Guid string - * - * @returns GUILD string if elements are found at the known xpath - * @returns null if nothing is there - */ - public static String getModuleGuid() { - String[] xPath = new String[] { "" }; - - XmlObject[] returns = get("MsaHeader", xPath); - if (returns != null && returns.length > 0) { - String guid = ((MsaHeaderDocument.MsaHeader) returns[0]) - .getGuidValue(); - return guid; - } - - return null; - } - - // - // For new Pcd - // - public static ModuleSADocument.ModuleSA[] getFpdModuleSAs() { - String[] xPath = new String[] { "/FrameworkModules/ModuleSA" }; - XmlObject[] result = get("FrameworkPlatformDescription", xPath); - if (result != null) { - return (ModuleSADocument.ModuleSA[]) result; - } - return new ModuleSADocument.ModuleSA[0]; - - } -} +} \ No newline at end of file