]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
PCD tools update:
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / action / CollectPCDAction.java
index 1eb060b6a618dbaef69a0a773ff4f83c553b9f2f..4001558ef697092f2c897a3a32b84cc74923c07b 100644 (file)
@@ -31,11 +31,16 @@ import java.util.UUID;
 \r
 import org.apache.xmlbeans.XmlException;\r
 import org.apache.xmlbeans.XmlObject;\r
+import org.tianocore.FrameworkModulesDocument;\r
 import org.tianocore.FrameworkPlatformDescriptionDocument;\r
+import org.tianocore.FrameworkPlatformDescriptionDocument.FrameworkPlatformDescription;\r
 import org.tianocore.ModuleSADocument;\r
+import org.tianocore.ModuleSADocument.ModuleSA;\r
 import org.tianocore.PackageSurfaceAreaDocument;\r
 import org.tianocore.PcdBuildDeclarationsDocument.PcdBuildDeclarations.PcdBuildData;\r
+import org.tianocore.PcdBuildDeclarationsDocument.PcdBuildDeclarations.PcdBuildData.SkuData;\r
 import org.tianocore.PcdDefinitionsDocument.PcdDefinitions;\r
+import org.tianocore.PcdDynamicBuildDeclarationsDocument.PcdDynamicBuildDeclarations;\r
 import org.tianocore.build.autogen.CommonDefinition;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.global.SurfaceAreaQuery;\r
@@ -706,7 +711,7 @@ class PcdDatabase {
 \r
     private void getTwoGroupsOfTokens (ArrayList<Token> alTokens, List<Token> initTokens, List<Token> uninitTokens) {\r
         for (int i = 0; i < alTokens.size(); i++) {\r
-            Token t = alTokens.get(i);\r
+            Token t = (Token)alTokens.get(i);\r
             if (t.hasDefaultValue()) {\r
                 initTokens.add(t);\r
             } else {\r
@@ -970,7 +975,7 @@ class PcdDatabase {
 \r
             sizeTable.add(token);\r
             localTokenNumberTable.add(token);\r
-            token.assignedtokenNumber = assignedTokenNumber++;\r
+            token.tokenNumber = assignedTokenNumber++;\r
 \r
         }\r
 \r
@@ -1109,7 +1114,6 @@ class PcdDatabase {
                                  "Conf" + File.separator +\r
                                  "Pcd" + File.separator +\r
                                  "PcdDatabaseCommonDefinitions.sample");\r
-            System.out.println(GlobalData.getWorkspacePath());\r
             FileReader reader = new FileReader(file);\r
             BufferedReader  in = new BufferedReader(reader);\r
             String str;\r
@@ -1171,6 +1175,16 @@ class PcdDatabase {
 \r
 }\r
 \r
+class ModuleInfo {\r
+    public ModuleSADocument.ModuleSA module;\r
+    public UsageInstance.MODULE_TYPE type;\r
+\r
+    public ModuleInfo (ModuleSADocument.ModuleSA module, UsageInstance.MODULE_TYPE type) {\r
+        this.module = module;\r
+        this.type   = type;\r
+    }\r
+}\r
+\r
 /** This action class is to collect PCD information from MSA, SPD, FPD xml file.\r
     This class will be used for wizard and build tools, So it can *not* inherit\r
     from buildAction or UIAction.\r
@@ -1188,6 +1202,9 @@ public class CollectPCDAction {
     /// Message level for CollectPCDAction.\r
     private int                   originalMessageLevel;\r
 \r
+    /// Cache the fpd docment instance for private usage.\r
+    private FrameworkPlatformDescriptionDocument fpdDocInstance;\r
+\r
     /**\r
       Set WorkspacePath parameter for this action class.\r
 \r
@@ -1243,103 +1260,34 @@ public class CollectPCDAction {
       Core execution function for this action class.\r
      \r
       This function work flows will be:\r
-      1) Get all token's platform information from FPD, and create token object into memory database.\r
-      2) Get all token's module information from MSA, and create usage instance for every module's PCD entry.\r
-      3) Get all token's inherited information from MSA's library, and create usage instance \r
-         for module who consume this library and create usage instance for library for building.\r
-      4) Collect token's package information from SPD, update these information for token in memory\r
-         database.\r
-      5) Generate 3 strings for a) All modules using Dynamic(Ex) PCD entry. (Token Number)\r
-                                b) PEI PCD Database (C Structure) for PCD Service PEIM\r
-                                c) DXE PCD Database (C structure) for PCD Service DXE\r
+      1) Collect and prepocess PCD information from FPD file, all PCD\r
+      information will be stored into memory database.\r
+      2) Generate 3 strings for\r
+        a) All modules using Dynamic(Ex) PCD entry.(Token Number)\r
+        b) PEI PCDDatabase (C Structure) for PCD Service PEIM.\r
+        c) DXE PCD Database (C structure) for PCD Service DXE.\r
                                 \r
       \r
       @throws  EntityException Exception indicate failed to execute this action.\r
       \r
     **/\r
     private void execute() throws EntityException {\r
-        FrameworkPlatformDescriptionDocument fpdDoc               = null;\r
-        Object[][]                           modulePCDArray       = null;\r
-        Map<String, XmlObject>               docMap               = null;\r
-        ModuleSADocument.ModuleSA[]          moduleSAs            = null;\r
-        UsageInstance                        usageInstance        = null;\r
-        String                               packageName          = null;\r
-        String                               packageFullPath      = null;\r
-        int                                  index                = 0;\r
-        int                                  libraryIndex         = 0;\r
-        int                                  pcdArrayIndex        = 0;\r
-        List<String>                         listLibraryInstance  = null;\r
-        String                               componentTypeStr     = null;\r
+        //\r
+        // Get memoryDatabaseManager instance from GlobalData.\r
+        // The memoryDatabaseManager should be initialized for whatever build\r
+        // tools or wizard tools\r
+        //\r
+        if((dbManager = GlobalData.getPCDMemoryDBManager()) == null) {\r
+            throw new EntityException("The instance of PCD memory database manager is null");\r
+        }\r
 \r
         //\r
         // Collect all PCD information defined in FPD file.\r
         // Evenry token defind in FPD will be created as an token into \r
         // memory database.\r
         //\r
-        fpdDoc = createTokenInDBFromFPD();\r
-\r
-        //\r
-        // Searching MSA and SPD document. \r
-        // The information of MSA will be used to create usage instance into database.\r
-        // The information of SPD will be used to update the token information in database.\r
-        //\r
-\r
-        HashMap<String, XmlObject> map = new HashMap<String, XmlObject>();\r
-        map.put("FrameworkPlatformDescription", fpdDoc);\r
-        SurfaceAreaQuery.setDoc(map);    \r
-\r
-        moduleSAs = SurfaceAreaQuery.getFpdModules();\r
-        for(index = 0; index < moduleSAs.length; index ++) {\r
-            //\r
-            // Get module document and use SurfaceAreaQuery to get PCD information\r
-            //\r
-            docMap = GlobalData.getDoc(moduleSAs[index].getModuleName());\r
-            SurfaceAreaQuery.setDoc(docMap);\r
-            modulePCDArray    = SurfaceAreaQuery.getModulePCDTokenArray();\r
-            componentTypeStr  = SurfaceAreaQuery.getComponentType();\r
-            packageName       = \r
-                GlobalData.getPackageNameForModule(moduleSAs[index].getModuleName());\r
-            packageFullPath   = this.workspacePath + File.separator    +\r
-                                GlobalData.getPackagePath(packageName) +\r
-                                packageName + ".spd";\r
-\r
-            if(modulePCDArray != null) {\r
-                //\r
-                // If current MSA contains <PCDs> information, then create usage\r
-                // instance for PCD information from MSA\r
-                //\r
-                for(pcdArrayIndex = 0; pcdArrayIndex < modulePCDArray.length; \r
-                     pcdArrayIndex ++) {\r
-                    usageInstance = \r
-                        createUsageInstanceFromMSA(moduleSAs[index].getModuleName(),\r
-                                                   modulePCDArray[pcdArrayIndex]);\r
-\r
-                    if(usageInstance == null) {\r
-                        continue;\r
-                    }\r
-                    //\r
-                    // Get remaining PCD information from the package which this module belongs to\r
-                    //\r
-                    updateTokenBySPD(usageInstance, packageFullPath);\r
-                }\r
-            }\r
+        createTokenInDBFromFPD();\r
 \r
-            //\r
-            // Get inherit PCD information which inherit from library instance of this module.\r
-            //\r
-            listLibraryInstance = \r
-                SurfaceAreaQuery.getLibraryInstance(moduleSAs[index].getArch().toString(),\r
-                                                    CommonDefinition.AlwaysConsumed);\r
-            if(listLibraryInstance != null) {\r
-                for(libraryIndex = 0; libraryIndex < listLibraryInstance.size(); \r
-                     libraryIndex ++) {\r
-                    inheritPCDFromLibraryInstance(listLibraryInstance.get(libraryIndex),\r
-                                                  moduleSAs[index].getModuleName(),\r
-                                                  packageName,\r
-                                                  componentTypeStr);\r
-                }\r
-            }\r
-        }\r
         \r
         //\r
         // Call Private function genPcdDatabaseSourceCode (void); ComponentTypeBsDriver\r
@@ -1356,9 +1304,8 @@ public class CollectPCDAction {
       @throws EntityException  If the token does *not* exist in memory database.\r
 \r
     **/\r
-\r
-    private void genPcdDatabaseSourceCode     ()\r
-      throws EntityException {\r
+    private void genPcdDatabaseSourceCode()\r
+        throws EntityException {\r
         String PcdCommonHeaderString = PcdDatabase.getPcdDatabaseCommonDefinitions ();\r
 \r
         ArrayList<Token> alPei = new ArrayList<Token> ();\r
@@ -1382,424 +1329,488 @@ public class CollectPCDAction {
     }\r
 \r
     /**\r
-      This function will collect inherit PCD information from library for a module.\r
-     \r
-      This function will create two usage instance for inherited PCD token, one is \r
-      for module and another is for library.\r
-      For module, if it inherited a PCD token from library, this PCD token's value \r
-      should be instanced in module level, and belongs to module.\r
-      For library, it also need a usage instance for build.\r
+      Get component array from FPD.\r
       \r
-      @param libraryName         The name of library instance.\r
-      @param moduleName          The name of module.\r
-      @param packageName         The name of package while module belongs to.\r
-      @param parentcomponentType The component type of module.\r
+      This function maybe provided by some Global class.\r
       \r
-      @throws EntityException  If the token does *not* exist in memory database.\r
+      @return List<ModuleInfo> the component array.\r
       \r
-    **/\r
-    private void inheritPCDFromLibraryInstance(String libraryName,\r
-                                               String moduleName,\r
-                                               String packageName,\r
-                                               String parentcomponentType) \r
+     */\r
+    private List<ModuleInfo> getComponentsFromFPD() \r
         throws EntityException {\r
-        Map<String, XmlObject>  docMap            = null;\r
-        String                  primaryKeyString  = null;\r
-        Object[][]              libPcdDataArray   = null;\r
-        UUID                    nullUUID          = new UUID(0,0);\r
-        UUID                    platformUUID      = nullUUID;\r
-        UUID                    tokenSpaceGuid    = null;\r
-        int                     tokenIndex        = 0;\r
-        Token                   token             = null;\r
-        Token.PCD_TYPE          pcdType           = Token.PCD_TYPE.UNKNOWN;\r
-        UsageInstance           usageInstance     = null;\r
-        String                  packageFullPath   = null;\r
+        HashMap<String, XmlObject>  map         = new HashMap<String, XmlObject>();\r
+        List<ModuleInfo>            allModules  = new ArrayList<ModuleInfo>();\r
+        ModuleInfo                  current     = null;\r
+        int                         index       = 0;\r
+        org.tianocore.Components    components  = null;\r
+        FrameworkModulesDocument.FrameworkModules fModules = null;\r
+        java.util.List<ModuleSADocument.ModuleSA> modules  = null;\r
+        \r
 \r
-        //\r
-        // Query PCD information from library's document.\r
-        //\r
-        docMap          = GlobalData.getDoc(libraryName);\r
-        SurfaceAreaQuery.setDoc(docMap);\r
-        libPcdDataArray = SurfaceAreaQuery.getModulePCDTokenArray();\r
+        if (fpdDocInstance == null) {\r
+            try {\r
+                fpdDocInstance = (FrameworkPlatformDescriptionDocument)XmlObject.Factory.parse(new File(fpdFilePath));\r
+            } catch(IOException ioE) {\r
+                throw new EntityException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());\r
+            } catch(XmlException xmlE) {\r
+                throw new EntityException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());\r
+            }\r
 \r
-        if(libPcdDataArray == null) {\r
-            return;\r
         }\r
 \r
-        for(tokenIndex = 0; tokenIndex < libPcdDataArray.length; tokenIndex ++) {\r
-            tokenSpaceGuid =((UUID)libPcdDataArray[tokenIndex][2] == null) ? \r
-                             nullUUID :(UUID)libPcdDataArray[tokenIndex][2];\r
-\r
-            //\r
-            // Get token from memory database. The token must be created from FPD already.\r
-            //\r
-            primaryKeyString = Token.getPrimaryKeyString((String)libPcdDataArray[tokenIndex][0],\r
-                                                         tokenSpaceGuid,\r
-                                                         platformUUID\r
-                                                         );\r
-\r
-            if(dbManager.isTokenInDatabase(primaryKeyString)) {\r
-                token = dbManager.getTokenByKey(primaryKeyString);\r
-            } else {\r
-                throw new EntityException("The PCD token " + primaryKeyString + \r
-                                          " defined in module " + moduleName + \r
-                                          " does not exist in FPD file!");\r
-            }      \r
-\r
-            //\r
-            // Create usage instance for module.\r
-            //\r
-            pcdType = Token.getpcdTypeFromString((String)libPcdDataArray[tokenIndex][1]);\r
-            usageInstance = new UsageInstance(token,\r
-                                              Token.PCD_USAGE.ALWAYS_CONSUMED,\r
-                                              pcdType,\r
-                                              CommonDefinition.getComponentType(parentcomponentType),\r
-                                              libPcdDataArray[tokenIndex][3],\r
-                                              null,\r
-                                             (String) libPcdDataArray[tokenIndex][5],\r
-                                              "",\r
-                                              moduleName,\r
-                                              packageName,\r
-                                              true);\r
-            if(Token.PCD_USAGE.UNKNOWN == token.isUsageInstanceExist(moduleName)) {\r
-                token.addUsageInstance(usageInstance);\r
+        //\r
+        // Check whether FPD contians <FramworkModules>\r
+        // \r
+        fModules = fpdDocInstance.getFrameworkPlatformDescription().getFrameworkModules();\r
+        if (fModules == null) {\r
+            return null;\r
+        }\r
 \r
-                packageFullPath = this.workspacePath + File.separator    +\r
-                                  GlobalData.getPackagePath(packageName) +\r
-                                  packageName + ".spd";\r
-                updateTokenBySPD(usageInstance, packageFullPath);\r
+        //\r
+        // BUGBUG: The following is work around code, the final component type should be get from\r
+        // GlobalData class.\r
+        // \r
+        components = fModules.getSEC();\r
+        if (components != null) {\r
+            modules = components.getModuleSAList();\r
+            for (index = 0; index < modules.size(); index ++) {\r
+                allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.SEC));\r
             }\r
+        }\r
 \r
-            //\r
-            // We need create second usage instance for inherited case, which\r
-            // add library as an usage instance, because when build a module, and \r
-            // if module inherited from base library, then build process will build\r
-            // library at first. \r
-            //\r
-            if(Token.PCD_USAGE.UNKNOWN == token.isUsageInstanceExist(libraryName)) {\r
-                packageName   = GlobalData.getPackageNameForModule(libraryName);\r
-                usageInstance = new UsageInstance(token,\r
-                                                  Token.PCD_USAGE.ALWAYS_CONSUMED,\r
-                                                  pcdType,\r
-                                                  CommonDefinition.ComponentTypeLibrary,\r
-                                                  libPcdDataArray[tokenIndex][3],\r
-                                                  null,\r
-                                                 (String)libPcdDataArray[tokenIndex][5],\r
-                                                  "",\r
-                                                  libraryName,\r
-                                                  packageName,\r
-                                                  false);\r
-                token.addUsageInstance(usageInstance);\r
+        components = fModules.getPEICORE();\r
+        if (components != null) {\r
+            modules = components.getModuleSAList();\r
+            for (index = 0; index < modules.size(); index ++) {\r
+                allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.PEI_CORE));\r
             }\r
         }\r
-    }\r
 \r
-    /**\r
-      Create usage instance for PCD token defined in MSA document\r
-\r
-      A PCD token maybe used by many modules, and every module is one of usage\r
-      instance of this token. For ALWAY_CONSUMED, SOMETIMES_CONSUMED, it is \r
-      consumer type usage instance of this token, and for ALWAYS_PRODUCED, \r
-      SOMETIMES_PRODUCED, it is produce type usage instance.\r
-     \r
-      @param moduleName      The name of module \r
-      @param tokenInfoInMsa  The PCD token information array retrieved from MSA.\r
-      \r
-      @return UsageInstance  The usage instance created in memroy database.\r
-      \r
-      @throws EntityException  If token did not exist in database yet.\r
-      \r
-    **/\r
-    private UsageInstance createUsageInstanceFromMSA(String   moduleName,\r
-                                                     Object[] tokenInfoInMsa) \r
-        throws EntityException {\r
-        String          packageName         = null;\r
-        UsageInstance   usageInstance       = null;\r
-        UUID            tokenSpaceGuid      = null;\r
-        UUID            nullUUID            = new UUID(0,0);\r
-        String          primaryKeyString    = null;\r
-        UUID            platformTokenSpace  = nullUUID;\r
-        Token           token               = null;\r
-        Token.PCD_TYPE  pcdType             = Token.PCD_TYPE.UNKNOWN;\r
-        Token.PCD_USAGE pcdUsage            = Token.PCD_USAGE.UNKNOWN;\r
-\r
-        tokenSpaceGuid =((UUID)tokenInfoInMsa[2] == null) ? nullUUID :(UUID)tokenInfoInMsa[2];\r
-\r
-        primaryKeyString = Token.getPrimaryKeyString((String)tokenInfoInMsa[0],\r
-                                                     tokenSpaceGuid,\r
-                                                     platformTokenSpace);\r
-\r
-        //\r
-        // Get token object from memory database firstly.\r
-        //\r
-        if(dbManager.isTokenInDatabase(primaryKeyString)) {\r
-            token = dbManager.getTokenByKey(primaryKeyString);\r
-        } else {\r
-            throw new EntityException("The PCD token " + primaryKeyString + " defined in module " + \r
-                                      moduleName + " does not exist in FPD file!" );\r
+        components = fModules.getPEIM();\r
+        if (components != null) {\r
+            modules = components.getModuleSAList();\r
+            for (index = 0; index < modules.size(); index ++) {\r
+                allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.PEIM));\r
+            }\r
         }\r
-        pcdType     = Token.getpcdTypeFromString((String)tokenInfoInMsa[1]);\r
-        pcdUsage    = Token.getUsageFromString((String)tokenInfoInMsa[4]);\r
-\r
-        packageName = GlobalData.getPackageNameForModule(moduleName);\r
 \r
-        if(Token.PCD_USAGE.UNKNOWN != token.isUsageInstanceExist(moduleName)) {\r
-            //\r
-            // BUGBUG: It is legal that same base name exist in one FPD file. In furture\r
-            //         we should use "Guid, Version, Package" and "Arch" to differ a module.\r
-            //         So currently, warning should be disabled.\r
-            //\r
-            //ActionMessage.warning(this,\r
-            //                      "In module " + moduleName + " exist more than one PCD token " + token.cName\r
-            //                      );\r
-            return null;\r
+        components = fModules.getDXECORE();\r
+        if (components != null) {\r
+            modules = components.getModuleSAList();\r
+            for (index = 0; index < modules.size(); index ++) {\r
+                allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.DXE_CORE));\r
+            }\r
         }\r
 \r
-        //\r
-        // BUGBUG: following code could be enabled at current schema. Because \r
-        //         current schema does not provide usage information.\r
-        // \r
-        // For FEATRURE_FLAG, FIXED_AT_BUILD, PATCH_IN_MODULE type PCD token, his \r
-        // usage is always ALWAYS_CONSUMED\r
-        //\r
-        //if((pcdType != Token.PCD_TYPE.DYNAMIC) &&\r
-        //   (pcdType != Token.PCD_TYPE.DYNAMIC_EX)) {\r
-        pcdUsage = Token.PCD_USAGE.ALWAYS_CONSUMED;\r
-        //}\r
-\r
-        usageInstance = new UsageInstance(token,\r
-                                          pcdUsage,\r
-                                          pcdType,\r
-                                          CommonDefinition.getComponentType(SurfaceAreaQuery.getComponentType()),\r
-                                          tokenInfoInMsa[3],\r
-                                          null,\r
-                                         (String) tokenInfoInMsa[5],\r
-                                          "",\r
-                                          moduleName,\r
-                                          packageName,\r
-                                          false);\r
-\r
-        //\r
-        // Use default value defined in MSA to update datum of token,\r
-        // if datum of token does not defined in FPD file.\r
-        //\r
-        if((token.datum == null) &&(tokenInfoInMsa[3] != null)) {\r
-            token.datum = tokenInfoInMsa[3];\r
+        components = fModules.getDXEDRIVERS();\r
+        if (components != null) {\r
+            modules = components.getModuleSAList();\r
+            for (index = 0; index < modules.size(); index ++) {\r
+                allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.DXE_DRIVERS));\r
+            }\r
         }\r
 \r
-        token.addUsageInstance(usageInstance);\r
-\r
-        return usageInstance;\r
+        components = fModules.getOTHERCOMPONENTS();\r
+        if (components != null) {\r
+            modules = components.getModuleSAList();\r
+            for (index = 0; index < modules.size(); index ++) {\r
+                allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.OTHER_COMPONENTS));\r
+            }\r
+        }\r
+        \r
+        return allModules;\r
     }\r
 \r
     /**\r
       Create token instance object into memory database, the token information\r
       comes for FPD file. Normally, FPD file will contain all token platform \r
       informations.\r
-     \r
-      This fucntion should be executed at firsly before others collection work\r
-      such as searching token information from MSA, SPD.\r
       \r
       @return FrameworkPlatformDescriptionDocument   The FPD document instance for furture usage.\r
       \r
       @throws EntityException                        Failed to parse FPD xml file.\r
       \r
     **/\r
-    private FrameworkPlatformDescriptionDocument createTokenInDBFromFPD() \r
+    private void createTokenInDBFromFPD() \r
         throws EntityException {\r
-        XmlObject                            doc               = null;\r
-        FrameworkPlatformDescriptionDocument fpdDoc            = null;\r
-        int                                  index             = 0;\r
-        List<PcdBuildData>                   pcdBuildDataArray = new ArrayList<PcdBuildData>();\r
-        PcdBuildData                         pcdBuildData      = null;\r
-        Token                                token             = null;\r
-        UUID                                 nullUUID          = new UUID(0,0);\r
-        UUID                                 platformTokenSpace= nullUUID;\r
-        List                                 skuDataArray      = new ArrayList();\r
-        SkuInstance                          skuInstance       = null;\r
-        int                                  skuIndex          = 0;\r
+        int                                 index             = 0;\r
+        int                                 index2            = 0;\r
+        int                                 pcdIndex          = 0;\r
+        List<PcdBuildData>                  pcdBuildDataArray = new ArrayList<PcdBuildData>();\r
+        PcdBuildData                        pcdBuildData      = null;\r
+        Token                               token             = null;\r
+        UUID                                nullUUID          = new UUID(0,0);\r
+        UUID                                platformTokenSpace= nullUUID;\r
+        SkuInstance                         skuInstance       = null;\r
+        int                                 skuIndex          = 0;\r
+        List<ModuleInfo>                    modules           = null;\r
+        String                              primaryKey        = null;\r
+        PcdBuildData.SkuData[]              skuDataArray      = null;\r
+        String                              exceptionString   = null;\r
+        UsageInstance                       usageInstance     = null;\r
+        String                              primaryKey1       = null;\r
+        String                              primaryKey2       = null;\r
+        boolean                             isDuplicate       = false;\r
+        java.util.List<java.lang.String>    tokenGuidStringArray = null;\r
 \r
         //\r
-        // Get all tokens from FPD file and create token into database.\r
+        // Get all <ModuleSA> from FPD file.\r
         // \r
+        modules = getComponentsFromFPD();\r
 \r
-        try {\r
-            doc = XmlObject.Factory.parse(new File(fpdFilePath));\r
-        } catch(IOException ioE) {\r
-            throw new EntityException("Can't find the FPD xml fle:" + fpdFilePath);\r
-        } catch(XmlException xmlE) {\r
-            throw new EntityException("Can't parse the FPD xml fle:" + fpdFilePath);\r
+        if (modules == null) {\r
+            throw new EntityException("No modules in FPD file, Please check whether there are elements in <FrameworkModules> in FPD file!");\r
         }\r
 \r
         //\r
-        // Get memoryDatabaseManager instance from GlobalData.\r
-        //\r
-        if((dbManager = GlobalData.getPCDMemoryDBManager()) == null) {\r
-            throw new EntityException("The instance of PCD memory database manager is null");\r
-        }\r
-\r
-        dbManager = new MemoryDatabaseManager();\r
+        // Loop all modules to process <PcdBuildDeclarations> for each module.\r
+        // \r
+        for (index = 0; index < modules.size(); index ++) {\r
+            isDuplicate =  false;\r
+            for (index2 = 0; index2 < index; index2 ++) {\r
+                //\r
+                // BUGBUG: For transition schema, we can *not* get module's version from \r
+                // <ModuleSAs>, It is work around code.\r
+                // \r
+                primaryKey1 = UsageInstance.getPrimaryKey(modules.get(index).module.getModuleName(), \r
+                                                          translateSchemaStringToUUID(modules.get(index).module.getModuleGuid()),\r
+                                                          modules.get(index).module.getPackageName(), \r
+                                                          translateSchemaStringToUUID(modules.get(index).module.getPackageGuid()), \r
+                                                          modules.get(index).module.getArch().toString(),\r
+                                                          null);\r
+                primaryKey2 = UsageInstance.getPrimaryKey(modules.get(index2).module.getModuleName(), \r
+                                                          translateSchemaStringToUUID(modules.get(index2).module.getModuleGuid()), \r
+                                                          modules.get(index2).module.getPackageName(), \r
+                                                          translateSchemaStringToUUID(modules.get(index2).module.getPackageGuid()), \r
+                                                          modules.get(index2).module.getArch().toString(), \r
+                                                          null);\r
+                if (primaryKey1.equalsIgnoreCase(primaryKey2)) {\r
+                    isDuplicate = true;\r
+                    break;\r
+                }\r
+            }\r
 \r
-        if(!(doc instanceof FrameworkPlatformDescriptionDocument)) {\r
-            throw new EntityException("File " + fpdFilePath + \r
-                                       " is not a FrameworkPlatformDescriptionDocument");\r
-        }\r
+            if (isDuplicate) {\r
+                continue;\r
+            }\r
 \r
-        fpdDoc =(FrameworkPlatformDescriptionDocument)doc;\r
+            if (modules.get(index).module.getPcdBuildDeclarations() == null) {\r
+                continue;\r
+            }\r
+            pcdBuildDataArray = modules.get(index).module.getPcdBuildDeclarations().getPcdBuildDataList();\r
+            if (pcdBuildDataArray == null) {\r
+                continue;\r
+            }\r
+            if (pcdBuildDataArray.size() == 0) {\r
+                continue;\r
+            }\r
 \r
-        //\r
-        // Add all tokens in FPD into Memory Database.\r
-        //\r
-        pcdBuildDataArray = \r
-            fpdDoc.getFrameworkPlatformDescription().getPcdBuildDeclarations().getPcdBuildDataList();\r
-        for(index = 0; \r
-             index < fpdDoc.getFrameworkPlatformDescription().getPcdBuildDeclarations().sizeOfPcdBuildDataArray(); \r
-             index ++) {\r
-            pcdBuildData = pcdBuildDataArray.get(index);\r
-            token        = new Token(pcdBuildData.getCName(), new UUID(0, 0), new UUID(0, 0));\r
-            //\r
-            // BUGBUG: in FPD, <defaultValue> should be defined as <Value>\r
             //\r
-            token.datum        = pcdBuildData.getDefaultValue();\r
-            token.tokenNumber  = Integer.decode(pcdBuildData.getToken().getStringValue());\r
-            token.hiiEnabled   = pcdBuildData.getHiiEnable();\r
-            token.variableGuid = Token.getGUIDFromSchemaObject(pcdBuildData.getVariableGuid());\r
-            token.variableName = pcdBuildData.getVariableName();\r
-            token.variableOffset = Integer.decode(pcdBuildData.getDataOffset());\r
-            token.skuEnabled   = pcdBuildData.getSkuEnable();\r
-            token.maxSkuCount  = Integer.decode(pcdBuildData.getMaxSku());\r
-            token.skuId        = Integer.decode(pcdBuildData.getSkuId());\r
-            token.skuDataArrayEnabled  = pcdBuildData.getSkuDataArrayEnable();\r
-            token.assignedtokenNumber  = Integer.decode(pcdBuildData.getToken().getStringValue());\r
-            skuDataArray               = pcdBuildData.getSkuDataArray1();\r
-            token.datumType    = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
-            token.datumSize    = pcdBuildData.getDatumSize();\r
-\r
-            if(skuDataArray != null) {\r
-                for(skuIndex = 0; skuIndex < skuDataArray.size(); skuIndex ++) {\r
+            // Loop all Pcd entry for a module and add it into memory database.\r
+            // \r
+            for (pcdIndex = 0; pcdIndex < pcdBuildDataArray.size(); pcdIndex ++) {\r
+                pcdBuildData = pcdBuildDataArray.get(pcdIndex);\r
+                primaryKey   = Token.getPrimaryKeyString(pcdBuildData.getCName(),\r
+                                                         translateSchemaStringToUUID(pcdBuildData.getTokenSpaceGuid()));\r
+\r
+\r
+                if (dbManager.isTokenInDatabase(primaryKey)) {\r
+                    //\r
+                    // If the token is already exist in database, do some necessary checking\r
+                    // and add a usage instance into this token in database\r
+                    // \r
+                    token = dbManager.getTokenByKey(primaryKey);\r
+\r
                     //\r
-                    // BUGBUG: Now in current schema, The value is defined as String type, \r
-                    // it is not correct, the type should be same as the datumType\r
+                    // Checking for DatumSize\r
+                    // \r
+                    if (token.datumSize != pcdBuildData.getDatumSize()) {\r
+                        exceptionString = String.format("The datum size of PCD entry %s is %d, which is different with %d defined in before!",\r
+                                                        pcdBuildData.getCName(),  pcdBuildData.getDatumSize(), token.datumSize);\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+\r
                     //\r
-                    skuInstance = new SkuInstance(((PcdBuildData.SkuData)skuDataArray.get(skuIndex)).getId(),\r
-                                                  ((PcdBuildData.SkuData)skuDataArray.get(skuIndex)).getValue());\r
-                    token.skuData.add(skuInstance);\r
+                    // checking for DatumType\r
+                    // \r
+                    if (token.datumType != Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString())) {\r
+                        exceptionString = String.format("The datum type of PCD entry %s is %s, which is different with  %s defined in before!",\r
+                                                        pcdBuildData.getCName(), \r
+                                                        pcdBuildData.getDatumType().toString(), \r
+                                                        Token.getStringOfdatumType(token.datumType));\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+                } else {\r
+                    //\r
+                    // If the token is not in database, create a new token instance and add\r
+                    // a usage instance into this token in database.\r
+                    // \r
+                    token = new Token(pcdBuildData.getCName(), \r
+                                      translateSchemaStringToUUID(pcdBuildData.getTokenSpaceGuid()));\r
+\r
+                    token.datum         = pcdBuildData.getDefaultValue();\r
+                    token.pcdType       = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());\r
+                    token.datumType     = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
+                    token.datumSize     = pcdBuildData.getDatumSize();\r
+                    token.skuId         = Integer.decode(pcdBuildData.getSkuId());\r
+\r
+                    if (pcdBuildData.getToken() == null) {\r
+                        exceptionString = String.format("In FPD file, No <TokenNumber> defined for PCD entry %s in module %s",\r
+                                                        token.cName,\r
+                                                        modules.get(index).module.getModuleName());\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+                    token.tokenNumber = Integer.decode(pcdBuildData.getToken().getStringValue());\r
+\r
+                    if ((token.pcdType == Token.PCD_TYPE.DYNAMIC) ||\r
+                        (token.pcdType == Token.PCD_TYPE.DYNAMIC_EX)) {\r
+                        updateDynamicInformation(modules.get(index).module.getModuleName(),  token);\r
+                    }\r
+\r
+                    dbManager.addTokenToDatabase(primaryKey, token);\r
                 }\r
-            }\r
 \r
-            if(dbManager.isTokenInDatabase(Token.getPrimaryKeyString(token.cName, \r
-                                                                      token.tokenSpaceName, \r
-                                                                      platformTokenSpace))) {\r
-                //\r
-                // If found duplicate token, Should tool be hold?\r
                 //\r
-                ActionMessage.warning(this, \r
-                                       "Token " + token.cName + " exists in token database");\r
-                continue;\r
+                // Create an usage instance for this token\r
+                // \r
+                usageInstance = new UsageInstance(token, \r
+                                                  Token.getpcdTypeFromString(pcdBuildData.getItemType().toString()),\r
+                                                  modules.get(index).module.getModuleName(), \r
+                                                  translateSchemaStringToUUID(modules.get(index).module.getModuleGuid()),\r
+                                                  modules.get(index).module.getPackageName(),\r
+                                                  translateSchemaStringToUUID(modules.get(index).module.getPackageGuid()),\r
+                                                  modules.get(index).type, \r
+                                                  Token.getpcdTypeFromString(pcdBuildData.getItemType().toString()),\r
+                                                  modules.get(index).module.getArch().toString(), \r
+                                                  null,\r
+                                                  pcdBuildData.getDefaultValue());\r
+                token.addUsageInstance(usageInstance);\r
             }\r
-            token.pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());\r
-            dbManager.addTokenToDatabase(Token.getPrimaryKeyString(token.cName, \r
-                                                                   token.tokenSpaceName, \r
-                                                                   platformTokenSpace), \r
-                                         token);\r
         }\r
-\r
-        return fpdDoc;\r
     }\r
 \r
     /**\r
-      Update PCD token in memory database by help information in SPD.\r
-\r
-      After create token from FPD and create usage instance from MSA, we should collect\r
-      PCD package level information from SPD and update token information in memory \r
-      database.\r
-      \r
-      @param usageInstance   The usage instance defined in MSA and want to search in SPD.\r
-      @param packageFullPath The SPD file path.\r
-      \r
-      @throws EntityException Failed to parse SPD xml file.\r
-      \r
+       Update dynamic information for PCD entry.\r
+       \r
+       Dynamic information is retrieved from <PcdDynamicBuildDeclarations> in\r
+       FPD file.\r
+       \r
+       @param moduleName\r
+       @param token\r
+       \r
+       @return Token\r
     **/\r
-    private void updateTokenBySPD(UsageInstance  usageInstance,\r
-                                  String         packageFullPath) \r
+    private Token updateDynamicInformation(String moduleName, Token token) \r
         throws EntityException {\r
-        PackageSurfaceAreaDocument      pkgDoc          = null;\r
-        PcdDefinitions                  pcdDefinitions  = null;\r
-        List<PcdDefinitions.PcdEntry>   pcdEntryArray   = new ArrayList<PcdDefinitions.PcdEntry>();\r
-        int                             index           = 0;\r
-        boolean                         isFoundInSpd    = false;\r
-        Token.DATUM_TYPE                datumType       = Token.DATUM_TYPE.UNKNOWN;\r
+        PcdDynamicBuildDeclarations                pcdDynamicBuildDescriptions = null;\r
+        \r
+        boolean                                    isFound                     = false;            \r
+        int                                        index                       = 0;\r
+        String                                     primaryKey                  = null;\r
+        SkuInstance                                skuInstance                 = null;\r
+        int                                        skuIndex                    = 0;\r
+        String                                     exceptionString             = null;\r
+        PcdDynamicBuildDeclarations.PcdBuildData.SkuData[] skuDataArray             = null;\r
+        List<PcdDynamicBuildDeclarations.PcdBuildData>     pcdDynamicBuildDataArray = null;\r
 \r
-        try {\r
-            pkgDoc =(PackageSurfaceAreaDocument)XmlObject.Factory.parse(new File(packageFullPath));\r
-        } catch(IOException ioE) {\r
-            throw new EntityException("Can't find the FPD xml fle:" + packageFullPath);\r
-        } catch(XmlException xmlE) {\r
-            throw new EntityException("Can't parse the FPD xml fle:" + packageFullPath);\r
-        }\r
-        pcdDefinitions = pkgDoc.getPackageSurfaceArea().getPcdDefinitions();\r
-        //\r
-        // It is illege for SPD file does not contains any PCD information.\r
         //\r
-        if (pcdDefinitions == null) {\r
-            return;\r
+        // If FPD document is not be opened, open and initialize it.\r
+        // \r
+        if (fpdDocInstance == null) {\r
+            try {\r
+                fpdDocInstance = (FrameworkPlatformDescriptionDocument)XmlObject.Factory.parse(new File(fpdFilePath));\r
+            } catch(IOException ioE) {\r
+                throw new EntityException("File IO error for xml file:" + fpdFilePath + "\n" + ioE.getMessage());\r
+            } catch(XmlException xmlE) {\r
+                throw new EntityException("Can't parse the FPD xml fle:" + fpdFilePath + "\n" + xmlE.getMessage());\r
+            }\r
         }\r
 \r
-        pcdEntryArray = pcdDefinitions.getPcdEntryList();\r
-        if (pcdEntryArray == null) {\r
-            return;\r
+        pcdDynamicBuildDescriptions = fpdDocInstance.getFrameworkPlatformDescription().getPcdDynamicBuildDeclarations();\r
+        if (pcdDynamicBuildDescriptions == null) {\r
+            throw new EntityException(String.format("There are no <PcdDynamicBuildDescriptions> in FPD file but contains Dynamic type "+\r
+                                                    "PCD entry %s in module %s!",\r
+                                                    token.cName,\r
+                                                    moduleName));\r
         }\r
-        for(index = 0; index < pcdEntryArray.size(); index ++) {\r
-            if(pcdEntryArray.get(index).getCName().equalsIgnoreCase(\r
-                usageInstance.parentToken.cName)) {\r
-                isFoundInSpd = true;\r
-                //\r
-                // From SPD file , we can get following information.\r
-                //  Token:        Token number defined in package level.\r
-                //  PcdItemType:  This item does not single one. It means all supported item type.\r
-                //  datumType:    UINT8, UNIT16, UNIT32, UINT64, VOID*, BOOLEAN \r
-                //  datumSize:    The size of default value or maxmine size.\r
-                //  defaultValue: This value is defined in package level.\r
-                //  HelpText:     The help text is provided in package level.\r
+\r
+        pcdDynamicBuildDataArray    = pcdDynamicBuildDescriptions.getPcdBuildDataList();\r
+        if (pcdDynamicBuildDataArray == null) {\r
+            throw new EntityException(String.format("There are no PcdDynamicBuildData in <PcdDynamicBuildDeclaration> section but contains Dynamic type"+\r
+                                                    "PCD entry %s in module %s.!",\r
+                                                    token.cName,\r
+                                                    moduleName));\r
+        }\r
+\r
+        isFound = false;\r
+        for (index = 0; index < pcdDynamicBuildDataArray.size(); index ++) {\r
+            if (pcdDynamicBuildDataArray.get(index).getTokenSpaceGuidList().size() != 0) {\r
+                primaryKey = Token.getPrimaryKeyString(pcdDynamicBuildDataArray.get(index).getCName(), \r
+                                                       translateSchemaStringToUUID(pcdDynamicBuildDataArray.get(index).getTokenSpaceGuidList().get(0)));\r
+            } else {\r
+                primaryKey = Token.getPrimaryKeyString(pcdDynamicBuildDataArray.get(index).getCName(), \r
+                                                       translateSchemaStringToUUID(null));\r
+            }\r
+\r
+            if (primaryKey.equalsIgnoreCase(token.getPrimaryKeyString())) {\r
+                isFound = true;\r
+\r
                 //\r
+                // For Hii related value\r
+                // \r
+                token.hiiEnabled    = pcdDynamicBuildDataArray.get(index).getHiiEnable();\r
+                if (token.hiiEnabled) {\r
+                    token.variableGuid      = Token.getGUIDFromSchemaObject(pcdDynamicBuildDataArray.get(index).getVariableGuid());\r
+                    if (token.variableGuid == null) {\r
+                        throw new EntityException(String.format("In <PcdDynamicBuildDeclarations> for PCD entry %s, HiiEnable is true" +\r
+                                                                "but no <VariableGuid> is found! Please fix the FPD file!",\r
+                                                                token.cName));\r
 \r
-                usageInstance.parentToken.tokenNumber = Integer.decode(pcdEntryArray.get(index).getToken());\r
-\r
-                if(pcdEntryArray.get(index).getDatumType() != null) {\r
-                    datumType = Token.getdatumTypeFromString(\r
-                        pcdEntryArray.get(index).getDatumType().toString());\r
-                    if(usageInstance.parentToken.datumType == Token.DATUM_TYPE.UNKNOWN) {\r
-                        usageInstance.parentToken.datumType = datumType;\r
-                    } else {\r
-                        if(datumType != usageInstance.parentToken.datumType) {\r
-                            throw new EntityException("Different datum types are defined for Token :" + \r
-                                                      usageInstance.parentToken.cName);\r
-                        }\r
+                    }\r
+                    token.variableName      = pcdDynamicBuildDataArray.get(index).getVariableName();\r
+                    if (token.variableName == null) {\r
+                        throw new EntityException(String.format("In <PcdDynamicBuildDeclarations> for PCD entry %s, HiiEnable is true" +\r
+                                                                "but no <VariableName> is found! Please fix the FPD file!",\r
+                                                                token.cName));\r
                     }\r
 \r
-                } else {\r
-                    throw new EntityException("The datum type for token " + usageInstance.parentToken.cName + \r
-                                              " is not defind in SPD file " + packageFullPath);\r
+                    if (pcdDynamicBuildDataArray.get(index).getDataOffset() == null) {\r
+                        throw new EntityException(String.format("In <PcdDynamicBuildDeclarations> for PCD entry %s, HiiEnable is true" +\r
+                                                                "but no <DataOffset> is found! Please fix the FPD file!",\r
+                                                                token.cName));\r
+                    }\r
+                    token.variableOffset    = Integer.decode(pcdDynamicBuildDataArray.get(index).getDataOffset());\r
                 }\r
 \r
-                usageInstance.defaultValueInSPD = pcdEntryArray.get(index).getDefaultValue();\r
-                usageInstance.helpTextInSPD     = "Help Text in SPD";\r
-\r
                 //\r
-                // If token's datum is not valid, it indicate that datum is not provided\r
-                // in FPD and defaultValue is not provided in MSA, then use defaultValue\r
-                // in SPD as the datum of token.\r
+                // For Vpd related value\r
+                // \r
+                token.vpdEnabled    = pcdDynamicBuildDataArray.get(index).getVpdEnable();\r
+                if (token.vpdEnabled) {\r
+                    if (pcdDynamicBuildDataArray.get(index).getDataOffset() == null) {\r
+                        throw new EntityException(String.format("In <PcdDynamicBuildDeclarations> for PCD entry %s, VpdEnable is true" +\r
+                                                                "but no <DataOffset> is found! Please fix the FPD file!",\r
+                                                                token.cName));\r
+                    }\r
+                    token.vpdOffset         = Integer.decode(pcdDynamicBuildDataArray.get(index).getDataOffset());\r
+                }\r
+\r
                 //\r
-                if(usageInstance.parentToken.datum == null) {\r
-                    if(pcdEntryArray.get(index).getDefaultValue() != null) {\r
-                        usageInstance.parentToken.datum = pcdEntryArray.get(index).getDefaultValue();\r
-                    } else {\r
-                        throw new EntityException("FPD does not provide datum for token " + usageInstance.parentToken.cName +\r
-                                                  ", MSA and SPD also does not provide <defaultValue> for this token!");\r
+                // For SkuData\r
+                // \r
+                token.skuEnabled    = pcdDynamicBuildDataArray.get(index).getSkuEnable();\r
+                if (token.skuEnabled) {\r
+                    skuDataArray      = (PcdDynamicBuildDeclarations.PcdBuildData.SkuData[])pcdDynamicBuildDataArray.get(index).getSkuDataList().toArray();\r
+                    token.maxSkuCount = Integer.decode(pcdDynamicBuildDataArray.get(index).getMaxSku());\r
+                    if (skuDataArray == null) {\r
+                        exceptionString = String.format("In FPD file, the <SkuEnable> is true for PCD entry %s in module %s, But no any sku data.",\r
+                                                        token.cName, moduleName);\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+                    if (token.maxSkuCount != pcdDynamicBuildDataArray.get(index).sizeOfSkuDataArray()) {\r
+                        exceptionString = String.format("In FPD file, <MaxSku> is not equal to the size of <SkuDataArray> for PCD entry %s in module %s",\r
+                                                        token.cName, moduleName);\r
+                        throw new EntityException(exceptionString);\r
+                    }\r
+\r
+                    for (skuIndex = 0; skuIndex < pcdDynamicBuildDataArray.get(index).sizeOfSkuDataArray(); skuIndex ++) {\r
+                        skuInstance = new SkuInstance(skuDataArray[skuIndex].getId(),\r
+                                                      skuDataArray[skuIndex].getValue());\r
+                        token.skuData.add(skuInstance);\r
                     }\r
                 }\r
+                break;\r
             }\r
         }\r
+        if (!isFound) {\r
+            exceptionString = String.format("In FPD file, No dynamic PCD data for PCD entry %s in module %s",\r
+                                            token.cName,\r
+                                            moduleName);\r
+            throw new EntityException(exceptionString);\r
+        }\r
+\r
+        return token;\r
+    }\r
+\r
+    /**\r
+       Translate the schema string to UUID instance.\r
+       \r
+       In schema, the string of UUID is defined as following two types string:\r
+        1) GuidArrayType: pattern = 0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},(\r
+        )*0x[a-fA-F0-9]{1,4}(,( )*\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\})?\r
+       \r
+        2) GuidNamingConvention: pattern =\r
+        [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\r
+       \r
+       This function will convert string and create uuid instance.\r
+       \r
+       @param uuidString    UUID string in XML file\r
+       \r
+       @return UUID         UUID instance\r
+    **/\r
+    private UUID translateSchemaStringToUUID(String uuidString) \r
+        throws EntityException {\r
+        String      temp;\r
+        String[]    splitStringArray;\r
+        int         index;\r
+        int         chIndex;\r
+        int         chLen;\r
+\r
+        if (uuidString == null) {\r
+            return null;\r
+        }\r
+\r
+        if (uuidString.length() == 0) {\r
+            return null;\r
+        }\r
+\r
+        //\r
+        // If the UUID schema string is GuidArrayType type then need translate \r
+        // to GuidNamingConvention type at first.\r
+        // \r
+        if ((uuidString.charAt(0) == '0') && ((uuidString.charAt(1) == 'x') || (uuidString.charAt(1) == 'X'))) {\r
+            splitStringArray = uuidString.split("," );\r
+            if (splitStringArray.length != 11) {\r
+                throw new EntityException ("Wrong format for UUID string: " + uuidString);\r
+            }\r
+\r
+            //\r
+            // Remove blank space from these string and remove header string "0x"\r
+            // \r
+            for (index = 0; index < 11; index ++) {\r
+                splitStringArray[index] = splitStringArray[index].trim();\r
+                splitStringArray[index] = splitStringArray[index].substring(2, splitStringArray[index].length());\r
+            }\r
+\r
+            //\r
+            // Add heading '0' to normalize the string length\r
+            // \r
+            for (index = 3; index < 11; index ++) {\r
+                chLen = splitStringArray[index].length();\r
+                for (chIndex = 0; chIndex < 2 - chLen; chIndex ++) {\r
+                    splitStringArray[index] = "0" + splitStringArray[index];\r
+                }\r
+            }\r
+\r
+            //\r
+            // construct the final GuidNamingConvention string\r
+            // \r
+            temp = String.format("%s-%s-%s-%s%s-%s%s%s%s%s%s",\r
+                                 splitStringArray[0],\r
+                                 splitStringArray[1],\r
+                                 splitStringArray[2],\r
+                                 splitStringArray[3],\r
+                                 splitStringArray[4],\r
+                                 splitStringArray[5],\r
+                                 splitStringArray[6],\r
+                                 splitStringArray[7],\r
+                                 splitStringArray[8],\r
+                                 splitStringArray[9],\r
+                                 splitStringArray[10]);\r
+            uuidString = temp;\r
+        }\r
+\r
+        return UUID.fromString(uuidString);\r
     }\r
 \r
     /**\r
@@ -1837,11 +1848,11 @@ public class CollectPCDAction {
     **/\r
     public static void main(String argv[]) throws EntityException {\r
         CollectPCDAction ca = new CollectPCDAction();\r
-        ca.setWorkspacePath("G:/mdk");\r
-        ca.setFPDFilePath("G:/mdk/EdkNt32Pkg/build/Nt32.fpd");\r
+        ca.setWorkspacePath("M:/ForPcd/edk2");\r
+        ca.setFPDFilePath("M:/ForPcd/edk2/EdkNt32Pkg/Nt32.fpd");\r
         ca.setActionMessageLevel(ActionMessage.MAX_MESSAGE_LEVEL);\r
         GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db",\r
-                            "G:/mdk");\r
+                            "M:/ForPcd/edk2");\r
         ca.execute();\r
     }\r
 }\r