2 WorkspaceProfile class.
4 WorkspaceProfile provide initializing, instoring, querying and update global data.
5 It is a bridge to intercommunicate between multiple component, such as AutoGen,
8 Copyright (c) 2006, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 package org
.tianocore
.frameworkwizard
.platform
.ui
.global
;
19 import org
.tianocore
.ModuleSurfaceAreaDocument
;
20 import org
.tianocore
.PackageSurfaceAreaDocument
;
21 import org
.tianocore
.PcdCodedDocument
;
22 import org
.tianocore
.frameworkwizard
.common
.GlobalData
;
23 import org
.tianocore
.frameworkwizard
.module
.Identifications
.ModuleIdentification
;
24 import org
.tianocore
.frameworkwizard
.packaging
.PackageIdentification
;
25 import java
.util
.Iterator
;
26 import java
.util
.ListIterator
;
27 import java
.util
.Vector
;
30 WorkspaceProfile provide initializing, instoring, querying and update global data.
31 It is a bridge to intercommunicate between multiple component, such as AutoGen,
34 <p>Note that all global information are initialized incrementally. All data will
35 parse and record only of necessary during build time. </p>
39 public class WorkspaceProfile
{
41 /// Record current WORKSPACE Directory
43 private static String workspaceDir
= "";
46 Get the current WORKSPACE Directory.
48 @return current workspace directory
50 public synchronized static String
getWorkspacePath() {
54 public synchronized static PackageIdentification
getPackageForModule(ModuleIdentification moduleId
) {
56 // If package already defined in module
58 if (moduleId
.getPackageId() != null) {
59 return moduleId
.getPackageId();
65 // expanded by FrameworkWizard
67 public synchronized static ModuleSurfaceAreaDocument
.ModuleSurfaceArea
getModuleXmlObject(ModuleIdentification moduleId
) {
68 return GlobalData
.openingModuleList
.getModuleSurfaceAreaFromId(moduleId
);
71 public synchronized static PackageSurfaceAreaDocument
.PackageSurfaceArea
getPackageXmlObject(PackageIdentification packageId
) {
72 return GlobalData
.openingPackageList
.getPackageSurfaceAreaFromId(packageId
);
75 public static ModuleIdentification
getModuleId(String key
){
77 // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
79 String
[] keyPart
= key
.split(" ");
81 Iterator
<ModuleIdentification
> iMiList
= GlobalData
.vModuleList
.iterator();
83 while (iMiList
.hasNext()) {
84 ModuleIdentification mi
= iMiList
.next();
85 if (mi
.getGuid().equalsIgnoreCase(keyPart
[0])){
86 if (keyPart
[1] != null && keyPart
[1].length() > 0 && !keyPart
[1].equals("null")){
87 if(!mi
.getVersion().equals(keyPart
[1])){
92 PackageIdentification pi
= mi
.getPackageId();
93 if ( !pi
.getGuid().equalsIgnoreCase(keyPart
[2])){
96 if (keyPart
[3] != null && keyPart
[3].length() > 0 && !keyPart
[3].equals("null")){
97 if(!pi
.getVersion().equals(keyPart
[3])){
108 public static Vector
<String
> getModuleSupArchs(ModuleIdentification mi
) throws Exception
{
109 Vector
<String
> vArchs
= null;
110 ModuleSurfaceAreaDocument
.ModuleSurfaceArea msa
= (ModuleSurfaceAreaDocument
.ModuleSurfaceArea
)getModuleXmlObject(mi
);
111 if (msa
.getModuleDefinitions() == null || msa
.getModuleDefinitions().getSupportedArchitectures() == null) {
114 ListIterator li
= msa
.getModuleDefinitions().getSupportedArchitectures().listIterator();
115 while (li
.hasNext()) {
116 if (vArchs
== null) {
117 vArchs
= new Vector
<String
>();
119 vArchs
.add((String
)li
.next());
125 public static boolean pcdInMsa (String cName
, String tsGuid
, ModuleIdentification mi
) throws Exception
{
126 ModuleSurfaceAreaDocument
.ModuleSurfaceArea msa
= (ModuleSurfaceAreaDocument
.ModuleSurfaceArea
)getModuleXmlObject(mi
);
127 if (msa
.getPcdCoded() == null || msa
.getPcdCoded().getPcdEntryList() == null) {
130 ListIterator li
= msa
.getPcdCoded().getPcdEntryList().listIterator();
131 while (li
.hasNext()) {
132 PcdCodedDocument
.PcdCoded
.PcdEntry msaPcd
= (PcdCodedDocument
.PcdCoded
.PcdEntry
)li
.next();
133 if (msaPcd
.getCName().equals(cName
) && msaPcd
.getTokenSpaceGuidCName().equals(tsGuid
)) {