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