]>
Commit | Line | Data |
---|---|---|
a13899c5 | 1 | /** @file\r |
2 | Java class FpdFileContents is used to parse fpd xml file.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | **/\r | |
13 | package org.tianocore.frameworkwizard.platform.ui;\r | |
14 | \r | |
15 | import java.io.File;\r | |
16 | import java.io.IOException;\r | |
17 | import java.math.BigInteger;\r | |
18 | import java.util.ArrayList;\r | |
19 | import java.util.HashMap;\r | |
20 | import java.util.Iterator;\r | |
21 | import java.util.LinkedHashMap;\r | |
22 | import java.util.List;\r | |
23 | import java.util.ListIterator;\r | |
24 | import java.util.Map;\r | |
25 | import java.util.Set;\r | |
6a09eb19 | 26 | import java.util.Vector;\r |
a13899c5 | 27 | \r |
28 | import javax.xml.namespace.QName;\r | |
29 | \r | |
30 | import org.apache.xmlbeans.XmlCursor;\r | |
31 | import org.apache.xmlbeans.XmlObject;\r | |
32 | import org.apache.xmlbeans.XmlOptions;\r | |
33 | import org.tianocore.AntTaskDocument;\r | |
34 | import org.tianocore.BuildOptionsDocument;\r | |
35 | import org.tianocore.DynamicPcdBuildDefinitionsDocument;\r | |
6cba26e8 | 36 | import org.tianocore.EfiSectionType;\r |
a13899c5 | 37 | import org.tianocore.FlashDefinitionFileDocument;\r |
a13899c5 | 38 | import org.tianocore.FlashDocument;\r |
39 | import org.tianocore.FrameworkModulesDocument;\r | |
6a09eb19 | 40 | import org.tianocore.IntermediateOutputType;\r |
a13899c5 | 41 | import org.tianocore.LibrariesDocument;\r |
42 | import org.tianocore.ModuleSADocument;\r | |
8f55ea73 | 43 | import org.tianocore.ModuleSaBuildOptionsDocument;\r |
a13899c5 | 44 | import org.tianocore.ModuleSurfaceAreaDocument;\r |
45 | import org.tianocore.OptionDocument;\r | |
46 | import org.tianocore.OptionsDocument;\r | |
47 | import org.tianocore.PcdBuildDefinitionDocument;\r | |
48 | import org.tianocore.PcdCodedDocument;\r | |
49 | import org.tianocore.PcdDataTypes;\r | |
50 | import org.tianocore.PcdDeclarationsDocument;\r | |
51 | import org.tianocore.PcdItemTypes;\r | |
52 | import org.tianocore.PlatformDefinitionsDocument;\r | |
53 | import org.tianocore.PlatformSurfaceAreaDocument;\r | |
54 | import org.tianocore.FvImageTypes;\r | |
55 | import org.tianocore.FvImagesDocument;\r | |
56 | import org.tianocore.LicenseDocument;\r | |
57 | import org.tianocore.PlatformHeaderDocument;\r | |
58 | import org.tianocore.SkuInfoDocument;\r | |
59 | import org.tianocore.UserDefinedAntTasksDocument;\r | |
60 | import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r | |
61 | import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r | |
62 | import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r | |
63 | import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r | |
64 | \r | |
65 | /**\r | |
66 | This class processes fpd file contents such as add remove xml elements. \r | |
67 | @since PackageEditor 1.0\r | |
68 | **/\r | |
69 | public class FpdFileContents {\r | |
70 | \r | |
71 | static final String xmlNs = "http://www.TianoCore.org/2006/Edk2.0";\r | |
72 | \r | |
73 | private PlatformSurfaceAreaDocument fpdd = null;\r | |
74 | \r | |
75 | private PlatformSurfaceAreaDocument.PlatformSurfaceArea fpdRoot = null;\r | |
76 | \r | |
77 | private PlatformHeaderDocument.PlatformHeader fpdHdr = null;\r | |
78 | \r | |
79 | private PlatformDefinitionsDocument.PlatformDefinitions fpdPlatformDefs = null;\r | |
80 | \r | |
81 | private FlashDocument.Flash fpdFlash = null;\r | |
82 | \r | |
83 | private BuildOptionsDocument.BuildOptions fpdBuildOpts = null;\r | |
84 | \r | |
85 | private FrameworkModulesDocument.FrameworkModules fpdFrameworkModules = null;\r | |
86 | \r | |
87 | private DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions fpdDynPcdBuildDefs = null;\r | |
88 | \r | |
908b1c05 | 89 | private HashMap<String, ArrayList<String>> dynPcdMap = null;\r |
a13899c5 | 90 | \r |
91 | /**\r | |
92 | * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.\r | |
93 | */\r | |
94 | public void initDynPcdMap() {\r | |
95 | if (dynPcdMap == null) {\r | |
96 | dynPcdMap = new HashMap<String, ArrayList<String>>();\r | |
97 | List<ModuleSADocument.ModuleSA> l = getfpdFrameworkModules().getModuleSAList();\r | |
98 | if (l == null) {\r | |
e232295e | 99 | removeElement(getfpdFrameworkModules());\r |
100 | fpdFrameworkModules = null;\r | |
a13899c5 | 101 | return;\r |
102 | }\r | |
103 | ListIterator<ModuleSADocument.ModuleSA> li = l.listIterator();\r | |
104 | while (li.hasNext()) {\r | |
1dac04ab | 105 | ModuleSADocument.ModuleSA moduleSa = li.next();\r |
106 | if (moduleSa.getPcdBuildDefinition() == null || moduleSa.getPcdBuildDefinition().getPcdDataList() == null) {\r | |
a13899c5 | 107 | continue;\r |
108 | }\r | |
1dac04ab | 109 | String ModuleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() +\r |
110 | " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());\r | |
111 | List<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lp = moduleSa.getPcdBuildDefinition().getPcdDataList();\r | |
a13899c5 | 112 | ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lpi = lp.listIterator();\r |
113 | while (lpi.hasNext()) {\r | |
114 | PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = lpi.next();\r | |
115 | String pcdKey = pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName();\r | |
116 | if (dynPcdMap.get(pcdKey) == null) {\r | |
117 | ArrayList<String> al = new ArrayList<String>();\r | |
118 | al.add(ModuleInfo + " " + pcdData.getItemType().toString());\r | |
119 | dynPcdMap.put(pcdKey, al);\r | |
120 | }\r | |
121 | else{\r | |
122 | dynPcdMap.get(pcdKey).add(ModuleInfo + " " + pcdData.getItemType().toString());\r | |
123 | }\r | |
124 | }\r | |
125 | }\r | |
126 | }\r | |
127 | }\r | |
908b1c05 | 128 | \r |
129 | public ArrayList<String> getDynPcdMapValue(String key) {\r | |
130 | return dynPcdMap.get(key);\r | |
131 | }\r | |
a13899c5 | 132 | /**\r |
133 | Constructor to create a new spd file\r | |
134 | **/\r | |
135 | public FpdFileContents() {\r | |
136 | \r | |
137 | fpdd = PlatformSurfaceAreaDocument.Factory.newInstance();\r | |
138 | fpdRoot = fpdd.addNewPlatformSurfaceArea();\r | |
139 | \r | |
140 | }\r | |
141 | \r | |
142 | /**\r | |
143 | Constructor for existing document object\r | |
144 | @param psa\r | |
145 | **/\r | |
146 | public FpdFileContents(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r | |
147 | fpdRoot = fpd;\r | |
148 | fpdHdr = fpdRoot.getPlatformHeader();\r | |
149 | fpdPlatformDefs = fpdRoot.getPlatformDefinitions();\r | |
150 | fpdBuildOpts = fpdRoot.getBuildOptions();\r | |
151 | fpdFrameworkModules = fpdRoot.getFrameworkModules();\r | |
152 | fpdDynPcdBuildDefs = fpdRoot.getDynamicPcdBuildDefinitions();\r | |
153 | fpdFlash = fpdRoot.getFlash();\r | |
154 | }\r | |
155 | \r | |
156 | /**\r | |
157 | Constructor based on an existing spd file\r | |
158 | \r | |
159 | @param f Existing spd file\r | |
160 | **/\r | |
161 | public FpdFileContents(File f) {\r | |
162 | try {\r | |
163 | fpdd = PlatformSurfaceAreaDocument.Factory.parse(f);\r | |
164 | fpdRoot = fpdd.getPlatformSurfaceArea();\r | |
165 | } catch (Exception e) {\r | |
166 | System.out.println(e.toString());\r | |
167 | }\r | |
168 | }\r | |
169 | \r | |
170 | public DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions getfpdDynPcdBuildDefs() {\r | |
171 | if (fpdDynPcdBuildDefs == null){\r | |
172 | fpdDynPcdBuildDefs = fpdRoot.addNewDynamicPcdBuildDefinitions();\r | |
173 | }\r | |
174 | return fpdDynPcdBuildDefs;\r | |
175 | }\r | |
176 | \r | |
177 | public FrameworkModulesDocument.FrameworkModules getfpdFrameworkModules() {\r | |
178 | if (fpdFrameworkModules == null){\r | |
179 | fpdFrameworkModules = fpdRoot.addNewFrameworkModules();\r | |
180 | }\r | |
181 | return fpdFrameworkModules;\r | |
182 | }\r | |
183 | \r | |
a13899c5 | 184 | public int getFrameworkModulesCount() {\r |
5af6b67f | 185 | if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){\r |
e232295e | 186 | removeElement(getfpdFrameworkModules());\r |
187 | fpdFrameworkModules = null;\r | |
a13899c5 | 188 | return 0;\r |
189 | }\r | |
190 | return getfpdFrameworkModules().getModuleSAList().size();\r | |
191 | }\r | |
192 | \r | |
193 | public void getFrameworkModulesInfo(String[][] saa) {\r | |
194 | if (getFrameworkModulesCount() == 0){\r | |
195 | return;\r | |
196 | }\r | |
197 | \r | |
198 | ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();\r | |
199 | int i = 0;\r | |
200 | while(li.hasNext()) {\r | |
201 | ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next();\r | |
bf5abaff | 202 | saa[i][0] = msa.getModuleGuid();\r |
203 | saa[i][1] = msa.getModuleVersion();\r | |
a13899c5 | 204 | \r |
bf5abaff | 205 | saa[i][2] = msa.getPackageGuid();\r |
206 | saa[i][3] = msa.getPackageVersion();\r | |
207 | saa[i][4] = listToString(msa.getSupArchList());\r | |
a13899c5 | 208 | ++i;\r |
209 | }\r | |
210 | }\r | |
211 | \r | |
bf5abaff | 212 | public void getFrameworkModuleInfo(int i, String[] sa) {\r |
213 | ModuleSADocument.ModuleSA msa = getModuleSA(i);\r | |
214 | if (msa == null) {\r | |
215 | return;\r | |
216 | }\r | |
217 | sa[0] = msa.getModuleGuid();\r | |
218 | sa[1] = msa.getModuleVersion();\r | |
219 | sa[2] = msa.getPackageGuid();\r | |
220 | sa[3] = msa.getPackageVersion();\r | |
221 | sa[4] = listToString(msa.getSupArchList());\r | |
222 | }\r | |
223 | \r | |
a13899c5 | 224 | public ModuleSADocument.ModuleSA getModuleSA(String key) {\r |
225 | String[] s = key.split(" ");\r | |
5af6b67f | 226 | if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {\r |
e232295e | 227 | removeElement(getfpdFrameworkModules());\r |
228 | fpdFrameworkModules = null;\r | |
a13899c5 | 229 | return null;\r |
230 | }\r | |
231 | ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();\r | |
232 | while(li.hasNext()) {\r | |
1dac04ab | 233 | ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();\r |
234 | if (moduleSa.getModuleGuid().equalsIgnoreCase(s[0]) && moduleSa.getPackageGuid().equalsIgnoreCase(s[2])) {\r | |
235 | if (moduleSa.getModuleVersion() != null) {\r | |
236 | if (!moduleSa.getModuleVersion().equals(s[1])) {\r | |
12e17a0a | 237 | continue;\r |
238 | }\r | |
239 | }\r | |
1dac04ab | 240 | if (moduleSa.getPackageVersion() != null) {\r |
241 | if (!moduleSa.getPackageVersion().equals(s[3])) {\r | |
12e17a0a | 242 | continue;\r |
243 | }\r | |
244 | }\r | |
bf5abaff | 245 | //ToDo add arch check for s[4]\r |
1dac04ab | 246 | if (moduleSa.getSupArchList() != null) {\r |
247 | if (!listToString(moduleSa.getSupArchList()).equals(s[4])) {\r | |
bf5abaff | 248 | continue;\r |
249 | }\r | |
250 | }\r | |
1dac04ab | 251 | return moduleSa;\r |
a13899c5 | 252 | }\r |
253 | }\r | |
254 | return null;\r | |
255 | }\r | |
bf5abaff | 256 | \r |
257 | private ModuleSADocument.ModuleSA getModuleSA(int i) {\r | |
1dac04ab | 258 | ModuleSADocument.ModuleSA moduleSa = null;\r |
e232295e | 259 | if (fpdRoot.getFrameworkModules() == null) {\r |
260 | return null;\r | |
261 | }\r | |
262 | XmlCursor cursor = fpdRoot.getFrameworkModules().newCursor();\r | |
bf5abaff | 263 | if (cursor.toFirstChild()) {\r |
264 | for (int j = 0; j < i; ++j) {\r | |
265 | cursor.toNextSibling();\r | |
266 | }\r | |
1dac04ab | 267 | moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();\r |
bf5abaff | 268 | }\r |
269 | cursor.dispose();\r | |
1dac04ab | 270 | return moduleSa;\r |
bf5abaff | 271 | }\r |
272 | \r | |
a13899c5 | 273 | public void removeModuleSA(int i) {\r |
e232295e | 274 | XmlObject o = fpdRoot.getFrameworkModules();\r |
a13899c5 | 275 | if (o == null) {\r |
276 | return;\r | |
277 | }\r | |
278 | \r | |
279 | XmlCursor cursor = o.newCursor();\r | |
280 | if (cursor.toFirstChild()) {\r | |
281 | for (int j = 0; j < i; ++j) {\r | |
282 | cursor.toNextSibling();\r | |
283 | }\r | |
284 | //\r | |
285 | // remove pcd from dynPcdMap, if DynamicPcdBuildData exists, remove them too.\r | |
286 | //\r | |
287 | ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();\r | |
288 | String moduleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() + " " +\r | |
bf5abaff | 289 | moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());\r |
a13899c5 | 290 | PcdBuildDefinitionDocument.PcdBuildDefinition pcdBuildDef = moduleSa.getPcdBuildDefinition();\r |
908b1c05 | 291 | if (pcdBuildDef != null && pcdBuildDef.getPcdDataList() != null) {\r |
292 | ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> li = pcdBuildDef.getPcdDataList().listIterator();\r | |
293 | while(li.hasNext()) {\r | |
294 | PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();\r | |
295 | maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);\r | |
296 | }\r | |
a13899c5 | 297 | }\r |
82dcbb45 | 298 | \r |
299 | cursor.push();\r | |
300 | cursor.toPrevToken();\r | |
301 | if (cursor.isComment()) {\r | |
302 | cursor.removeXml();\r | |
303 | }\r | |
304 | cursor.pop();\r | |
a13899c5 | 305 | cursor.removeXml();\r |
af25df16 | 306 | if (getFrameworkModulesCount() == 0) {\r |
307 | cursor.toParent();\r | |
308 | cursor.removeXml();\r | |
309 | }\r | |
a13899c5 | 310 | }\r |
311 | cursor.dispose();\r | |
312 | }\r | |
313 | \r | |
1dac04ab | 314 | public boolean adjustPcd (int seqModuleSa) throws Exception {\r |
315 | boolean dataModified = false;\r | |
316 | ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);\r | |
317 | int pcdCount = getPcdDataCount(seqModuleSa);\r | |
318 | String[][] saaModuleSaPcd = new String[pcdCount][7];\r | |
319 | getPcdData(seqModuleSa, saaModuleSaPcd);\r | |
320 | String mg = moduleSa.getModuleGuid();\r | |
321 | String mv = moduleSa.getModuleVersion();\r | |
322 | String pg = moduleSa.getPackageGuid();\r | |
323 | String pv = moduleSa.getPackageVersion();\r | |
324 | String arch = listToString(moduleSa.getSupArchList());\r | |
325 | //\r | |
326 | // delete pcd in ModuleSA but not in MSA files any longer.\r | |
327 | //\r | |
328 | String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;\r | |
329 | int libCount = getLibraryInstancesCount(moduleKey);\r | |
330 | String[][] saaLib = new String[libCount][5];\r | |
331 | getLibraryInstances(moduleKey, saaLib);\r | |
332 | ModuleIdentification mi = GlobalData.getModuleId(moduleKey);\r | |
333 | Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r | |
334 | vMi.add(mi);\r | |
335 | try {\r | |
336 | nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {\r | |
337 | if (GlobalData.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], mi)){\r | |
338 | continue;\r | |
339 | }\r | |
340 | for (int j = 0; j < saaLib.length; ++j) {\r | |
341 | String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];\r | |
342 | ModuleIdentification libMi = GlobalData.getModuleId(libKey);\r | |
343 | vMi.add(libMi);\r | |
344 | if (GlobalData.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], libMi)) {\r | |
345 | continue nextPcd;\r | |
346 | }\r | |
347 | }\r | |
348 | removePcdData(seqModuleSa, saaModuleSaPcd[i][0], saaModuleSaPcd[i][1]);\r | |
349 | dataModified = true;\r | |
350 | }\r | |
351 | }\r | |
352 | catch (Exception e) {\r | |
353 | \r | |
354 | }\r | |
355 | //\r | |
356 | // add new Pcd from MSA file to ModuleSA.\r | |
357 | //\r | |
358 | try {\r | |
359 | \r | |
360 | for (int i = 0; i < vMi.size(); ++i) {\r | |
361 | ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) GlobalData\r | |
362 | .getModuleXmlObject(vMi\r | |
363 | .get(i));\r | |
364 | if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {\r | |
365 | continue;\r | |
366 | }\r | |
367 | ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();\r | |
368 | msaPcdIter:while (li.hasNext()) {\r | |
369 | PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();\r | |
370 | ArrayList<String> al = getDynPcdMapValue(msaPcd.getCName() + " " + msaPcd.getTokenSpaceGuidCName());\r | |
371 | if (al != null) {\r | |
372 | for (int j = 0; j < al.size(); ++j) {\r | |
373 | if (al.get(j).contains(moduleKey)) {\r | |
374 | continue msaPcdIter;\r | |
375 | }\r | |
376 | }\r | |
377 | }\r | |
378 | \r | |
379 | Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r | |
380 | m.put("ModuleSurfaceArea", msa);\r | |
381 | SurfaceAreaQuery.setDoc(m);\r | |
382 | PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r | |
383 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);\r | |
384 | if (spdPcd == null) {\r | |
385 | //\r | |
386 | // ToDo Error \r | |
387 | //\r | |
388 | throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r | |
389 | + mi.getName());\r | |
390 | }\r | |
391 | //\r | |
392 | // AddItem to ModuleSA PcdBuildDefinitions\r | |
393 | //\r | |
394 | String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue()\r | |
395 | : msaPcd.getDefaultValue();\r | |
396 | \r | |
397 | genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(),\r | |
398 | msaPcd.getPcdItemType().toString(), spdPcd.getDatumType() + "", defaultVal, moduleSa);\r | |
399 | dataModified = true;\r | |
400 | }\r | |
401 | \r | |
402 | }\r | |
403 | }\r | |
404 | catch (Exception e){\r | |
405 | throw e;\r | |
406 | }\r | |
407 | \r | |
408 | return dataModified;\r | |
409 | }\r | |
410 | \r | |
908b1c05 | 411 | private void maintainDynPcdMap(String pcdKey, String moduleInfo) {\r |
412 | \r | |
413 | ArrayList<String> al = dynPcdMap.get(pcdKey);\r | |
414 | if (al == null) {\r | |
a13899c5 | 415 | return;\r |
416 | }\r | |
908b1c05 | 417 | String[] s = moduleInfo.split(" ");\r |
a13899c5 | 418 | for(int i = 0; i < al.size(); ++i){\r |
908b1c05 | 419 | String consumer = al.get(i);\r |
420 | if (consumer.contains(s[0]) && consumer.contains(s[2])){\r | |
bf5abaff | 421 | String[] consumerPart = consumer.split(" ");\r |
422 | if (!consumerPart[4].equals(s[4])) {\r | |
423 | continue;\r | |
424 | }\r | |
908b1c05 | 425 | al.remove(consumer);\r |
a13899c5 | 426 | break;\r |
427 | }\r | |
428 | }\r | |
908b1c05 | 429 | \r |
a13899c5 | 430 | if (al.size() == 0) {\r |
431 | dynPcdMap.remove(pcdKey);\r | |
908b1c05 | 432 | String[] s1 = pcdKey.split(" ");\r |
433 | removeDynamicPcdBuildData(s1[0], s1[1]);\r | |
a13899c5 | 434 | }\r |
435 | \r | |
a13899c5 | 436 | }\r |
437 | //\r | |
bf5abaff | 438 | // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"\r |
a13899c5 | 439 | //\r |
1dac04ab | 440 | public int getPcdDataCount (int i){\r |
bf5abaff | 441 | ModuleSADocument.ModuleSA msa = getModuleSA(i);\r |
055e7ae6 | 442 | \r |
a13899c5 | 443 | if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){\r |
444 | return 0;\r | |
445 | }\r | |
446 | return msa.getPcdBuildDefinition().getPcdDataList().size();\r | |
055e7ae6 | 447 | \r |
a13899c5 | 448 | }\r |
449 | \r | |
1dac04ab | 450 | public void getPcdData (int i, String[][] saa) {\r |
bf5abaff | 451 | ModuleSADocument.ModuleSA msa = getModuleSA(i);\r |
055e7ae6 | 452 | \r |
a13899c5 | 453 | if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){\r |
454 | return;\r | |
455 | }\r | |
456 | ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData>li = msa.getPcdBuildDefinition().getPcdDataList().listIterator();\r | |
055e7ae6 | 457 | for (int k = 0; k < saa.length; ++k) {\r |
a13899c5 | 458 | PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();\r |
055e7ae6 | 459 | saa[k][0] = pcdData.getCName();\r |
460 | saa[k][1] = pcdData.getTokenSpaceGuidCName();\r | |
461 | saa[k][2] = pcdData.getItemType()+"";\r | |
462 | saa[k][3] = pcdData.getToken().toString();\r | |
463 | saa[k][4] = pcdData.getMaxDatumSize()+"";\r | |
464 | saa[k][5] = pcdData.getDatumType()+"";\r | |
465 | saa[k][6] = pcdData.getValue();\r | |
a13899c5 | 466 | \r |
467 | }\r | |
468 | }\r | |
908b1c05 | 469 | \r |
1dac04ab | 470 | public void removePcdData (int seqModuleSa, String cName, String tsGuid) {\r |
471 | ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);\r | |
472 | if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){\r | |
908b1c05 | 473 | return;\r |
474 | }\r | |
475 | \r | |
1dac04ab | 476 | String mg = moduleSa.getModuleGuid();\r |
477 | String mv = moduleSa.getModuleVersion();\r | |
478 | String pg = moduleSa.getPackageGuid();\r | |
479 | String pv = moduleSa.getPackageVersion();\r | |
480 | String arch = listToString(moduleSa.getSupArchList());\r | |
481 | String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;\r | |
482 | \r | |
483 | XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();\r | |
484 | if (cursor.toFirstChild()){\r | |
485 | \r | |
486 | do {\r | |
487 | PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();\r | |
488 | if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {\r | |
489 | maintainDynPcdMap(cName + " " + tsGuid, moduleKey);\r | |
490 | if (getPcdDataCount(seqModuleSa) == 1) {\r | |
491 | cursor.toParent();\r | |
492 | }\r | |
493 | cursor.removeXml();\r | |
494 | break;\r | |
495 | }\r | |
496 | }\r | |
497 | while(cursor.toNextSibling());\r | |
498 | \r | |
499 | }\r | |
500 | cursor.dispose();\r | |
501 | }\r | |
502 | \r | |
503 | public void updatePcdData (String key, String cName, String tsGuid, String itemType, String maxSize, String value){\r | |
504 | ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);\r | |
505 | if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){\r | |
506 | return;\r | |
507 | }\r | |
508 | \r | |
509 | XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();\r | |
908b1c05 | 510 | if (cursor.toFirstChild()){\r |
511 | do {\r | |
512 | PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();\r | |
513 | if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {\r | |
514 | pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r | |
515 | if(pcdData.getDatumType().equals("VOID*")) {\r | |
516 | pcdData.setMaxDatumSize(new Integer(maxSize));\r | |
517 | }\r | |
518 | pcdData.setValue(value);\r | |
519 | break;\r | |
520 | }\r | |
521 | }\r | |
522 | while(cursor.toNextSibling());\r | |
523 | }\r | |
524 | cursor.dispose();\r | |
525 | }\r | |
526 | \r | |
527 | /**Get original Pcd info from MSA & SPD files.\r | |
528 | * @param mi ModuleIdentification from which MSA & SPD come\r | |
529 | * @param cName PCD cName\r | |
530 | * @param sa Results: HelpText, Original item type.\r | |
531 | * @return\r | |
532 | */\r | |
1dac04ab | 533 | public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String tsGuid, String[] sa) throws Exception{\r |
908b1c05 | 534 | try {\r |
535 | \r | |
536 | ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r | |
537 | if (msa.getPcdCoded() == null) {\r | |
538 | return false;\r | |
539 | }\r | |
540 | \r | |
541 | Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r | |
542 | m.put("ModuleSurfaceArea", msa);\r | |
543 | SurfaceAreaQuery.setDoc(m);\r | |
544 | PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r | |
545 | //\r | |
546 | // First look through MSA pcd entries.\r | |
547 | //\r | |
548 | List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();\r | |
549 | ListIterator li = l.listIterator();\r | |
550 | while(li.hasNext()) {\r | |
551 | PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();\r | |
552 | if (!msaPcd.getCName().equals(cName)) {\r | |
553 | continue;\r | |
554 | }\r | |
1dac04ab | 555 | if (!msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {\r |
556 | continue;\r | |
557 | }\r | |
908b1c05 | 558 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);\r |
559 | if (spdPcd == null) {\r | |
560 | //\r | |
561 | // ToDo Error \r | |
562 | //\r | |
563 | throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName());\r | |
564 | }\r | |
565 | //\r | |
566 | // Get Pcd help text and original item type.\r | |
567 | //\r | |
568 | sa[0] = spdPcd.getHelpText() + msaPcd.getHelpText();\r | |
569 | sa[1] = msaPcd.getPcdItemType()+"";\r | |
570 | return true;\r | |
571 | }\r | |
572 | \r | |
573 | \r | |
574 | }\r | |
575 | catch (Exception e){\r | |
e232295e | 576 | e.printStackTrace();\r |
908b1c05 | 577 | throw e;\r |
578 | }\r | |
579 | \r | |
580 | return false;\r | |
581 | }\r | |
582 | \r | |
583 | /**Remove PCDBuildDefinition entries from ModuleSA\r | |
584 | * @param moduleKey identifier of ModuleSA.\r | |
585 | * @param consumer where these entries come from.\r | |
586 | */\r | |
587 | public void removePcdData(String moduleKey, ModuleIdentification consumer) {\r | |
588 | try {\r | |
589 | ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(consumer);\r | |
590 | if (msa.getPcdCoded() == null) {\r | |
591 | return;\r | |
592 | }\r | |
593 | \r | |
594 | List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();\r | |
595 | ListIterator li = l.listIterator();\r | |
596 | \r | |
597 | while(li.hasNext()) {\r | |
598 | PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();\r | |
599 | ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);\r | |
82dcbb45 | 600 | if (moduleSA.getPcdBuildDefinition() != null) {\r |
601 | XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();\r | |
602 | if (cursor.toFirstChild()) {\r | |
603 | PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor\r | |
604 | .getObject();\r | |
605 | if (msaPcd.getCName().equals(pcdData.getCName())\r | |
606 | && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {\r | |
607 | \r | |
608 | maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleKey);\r | |
908b1c05 | 609 | cursor.removeXml();\r |
610 | break;\r | |
611 | }\r | |
82dcbb45 | 612 | while (cursor.toNextSibling()) {\r |
613 | pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor.getObject();\r | |
614 | if (msaPcd.getCName().equals(pcdData.getCName())\r | |
615 | && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {\r | |
616 | maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),\r | |
617 | moduleKey);\r | |
618 | cursor.removeXml();\r | |
619 | break;\r | |
620 | }\r | |
621 | }\r | |
908b1c05 | 622 | }\r |
82dcbb45 | 623 | cursor.dispose();\r |
908b1c05 | 624 | }\r |
908b1c05 | 625 | }\r |
626 | \r | |
627 | }\r | |
628 | catch (Exception e){\r | |
629 | e.printStackTrace();\r | |
630 | \r | |
631 | }\r | |
632 | }\r | |
a13899c5 | 633 | //\r |
bf5abaff | 634 | // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"\r |
a13899c5 | 635 | //\r |
636 | public int getLibraryInstancesCount(String key) {\r | |
637 | ModuleSADocument.ModuleSA msa = getModuleSA(key);\r | |
638 | if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){\r | |
639 | return 0;\r | |
640 | }\r | |
641 | return msa.getLibraries().getInstanceList().size();\r | |
642 | }\r | |
643 | \r | |
644 | public void getLibraryInstances(String key, String[][] saa){\r | |
645 | ModuleSADocument.ModuleSA msa = getModuleSA(key);\r | |
646 | if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){\r | |
647 | return ;\r | |
648 | }\r | |
649 | \r | |
650 | ListIterator<LibrariesDocument.Libraries.Instance> li = msa.getLibraries().getInstanceList().listIterator();\r | |
651 | for (int i = 0; i < saa.length; ++i) {\r | |
652 | LibrariesDocument.Libraries.Instance instance = li.next();\r | |
653 | saa[i][1] = instance.getModuleGuid();\r | |
654 | saa[i][2] = instance.getModuleVersion();\r | |
655 | saa[i][3] = instance.getPackageGuid();\r | |
656 | saa[i][4] = instance.getPackageVersion();\r | |
657 | }\r | |
658 | }\r | |
659 | \r | |
908b1c05 | 660 | public void removeLibraryInstance(String key, int i) {\r |
a13899c5 | 661 | ModuleSADocument.ModuleSA msa = getModuleSA(key);\r |
662 | if (msa == null || msa.getLibraries() == null){\r | |
663 | return ;\r | |
664 | }\r | |
665 | \r | |
666 | XmlCursor cursor = msa.getLibraries().newCursor();\r | |
908b1c05 | 667 | if (cursor.toFirstChild()) {\r |
668 | for (int j = 0; j < i; ++j) {\r | |
669 | cursor.toNextSibling();\r | |
670 | }\r | |
82dcbb45 | 671 | cursor.push();\r |
672 | cursor.toPrevToken();\r | |
673 | if (cursor.isComment()) {\r | |
674 | cursor.removeXml();\r | |
675 | }\r | |
676 | cursor.pop();\r | |
908b1c05 | 677 | cursor.removeXml();\r |
82dcbb45 | 678 | if (getLibraryInstancesCount(key) == 0) {\r |
679 | cursor.toParent();\r | |
680 | cursor.removeXml();\r | |
681 | }\r | |
908b1c05 | 682 | }\r |
683 | \r | |
a13899c5 | 684 | cursor.dispose();\r |
685 | }\r | |
686 | \r | |
82dcbb45 | 687 | public void genLibraryInstance(ModuleIdentification libMi, String key) {\r |
a13899c5 | 688 | ModuleSADocument.ModuleSA msa = getModuleSA(key);\r |
689 | if (msa == null){\r | |
690 | msa = getfpdFrameworkModules().addNewModuleSA();\r | |
691 | }\r | |
692 | LibrariesDocument.Libraries libs = msa.getLibraries();\r | |
693 | if(libs == null){\r | |
694 | libs = msa.addNewLibraries();\r | |
695 | }\r | |
696 | \r | |
82dcbb45 | 697 | String mn = libMi.getName();\r |
698 | String mg = libMi.getGuid();\r | |
699 | String mv = libMi.getVersion();\r | |
700 | String pn = libMi.getPackage().getName();\r | |
701 | String pg = libMi.getPackage().getGuid();\r | |
702 | String pv = libMi.getPackage().getVersion();\r | |
a13899c5 | 703 | LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();\r |
82dcbb45 | 704 | XmlCursor cursor = instance.newCursor();\r |
705 | try{\r | |
706 | String comment = "Pkg: " + pn + " Mod: " + mn \r | |
1dac04ab | 707 | + " Path: " + GlobalData.getMsaFile(libMi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r |
82dcbb45 | 708 | cursor.insertComment(comment);\r |
709 | }\r | |
710 | catch (Exception e){\r | |
711 | e.printStackTrace();\r | |
712 | }\r | |
713 | finally {\r | |
714 | cursor.dispose();\r | |
715 | }\r | |
716 | \r | |
a13899c5 | 717 | instance.setModuleGuid(mg);\r |
718 | instance.setModuleVersion(mv);\r | |
719 | instance.setPackageGuid(pg);\r | |
720 | instance.setPackageVersion(pv);\r | |
721 | \r | |
722 | }\r | |
1800d80f | 723 | \r |
724 | public String getFvBinding(String moduleKey){\r | |
725 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
726 | if (msa == null || msa.getModuleSaBuildOptions() == null) {\r | |
727 | return null;\r | |
728 | }\r | |
729 | return msa.getModuleSaBuildOptions().getFvBinding();\r | |
730 | }\r | |
731 | \r | |
732 | public void setFvBinding(String moduleKey, String fvBinding){\r | |
733 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
734 | if (msa == null ) {\r | |
735 | return;\r | |
736 | }\r | |
737 | if(msa.getModuleSaBuildOptions() == null){\r | |
738 | msa.addNewModuleSaBuildOptions().setFvBinding(fvBinding);\r | |
739 | return;\r | |
740 | }\r | |
741 | msa.getModuleSaBuildOptions().setFvBinding(fvBinding);\r | |
742 | }\r | |
743 | \r | |
744 | public String getFfsFileNameGuid(String moduleKey){\r | |
745 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
746 | if (msa == null || msa.getModuleSaBuildOptions() == null) {\r | |
747 | return null;\r | |
748 | }\r | |
749 | return msa.getModuleSaBuildOptions().getFfsFileNameGuid();\r | |
750 | }\r | |
751 | \r | |
752 | public void setFfsFileNameGuid(String moduleKey, String fileGuid){\r | |
753 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
754 | if (msa == null ) {\r | |
755 | return;\r | |
756 | }\r | |
757 | if(msa.getModuleSaBuildOptions() == null){\r | |
8f55ea73 | 758 | msa.addNewModuleSaBuildOptions();\r |
759 | \r | |
1800d80f | 760 | }\r |
8f55ea73 | 761 | ModuleSaBuildOptionsDocument.ModuleSaBuildOptions msaBuildOpts= msa.getModuleSaBuildOptions();\r |
762 | if (fileGuid != null) {\r | |
763 | msaBuildOpts.setFfsFileNameGuid(fileGuid);\r | |
764 | }\r | |
765 | else{\r | |
766 | XmlCursor cursor = msaBuildOpts.newCursor();\r | |
767 | if (cursor.toChild(xmlNs, "FfsFileNameGuid")) {\r | |
768 | cursor.removeXml();\r | |
769 | }\r | |
770 | cursor.dispose();\r | |
771 | }\r | |
772 | \r | |
1800d80f | 773 | }\r |
774 | \r | |
775 | public String getFfsFormatKey(String moduleKey){\r | |
776 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
777 | if (msa == null || msa.getModuleSaBuildOptions() == null) {\r | |
778 | return null;\r | |
779 | }\r | |
780 | return msa.getModuleSaBuildOptions().getFfsFormatKey();\r | |
781 | }\r | |
782 | \r | |
783 | public void setFfsFormatKey(String moduleKey, String ffsKey){\r | |
784 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
785 | if (msa == null ) {\r | |
786 | return;\r | |
787 | }\r | |
788 | if(msa.getModuleSaBuildOptions() == null){\r | |
789 | msa.addNewModuleSaBuildOptions().setFfsFormatKey(ffsKey);\r | |
790 | return;\r | |
791 | }\r | |
bf5abaff | 792 | msa.getModuleSaBuildOptions().setFfsFormatKey(ffsKey);\r |
1800d80f | 793 | }\r |
794 | \r | |
795 | public void getModuleSAOptions(String moduleKey, String[][] saa) {\r | |
796 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
e232295e | 797 | if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null\r |
1800d80f | 798 | || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {\r |
799 | return ;\r | |
800 | }\r | |
801 | \r | |
802 | List<OptionDocument.Option> lOpt = msa.getModuleSaBuildOptions().getOptions().getOptionList();\r | |
803 | ListIterator li = lOpt.listIterator();\r | |
804 | int i = 0;\r | |
805 | while(li.hasNext()) {\r | |
806 | OptionDocument.Option opt = (OptionDocument.Option)li.next();\r | |
807 | if (opt.getBuildTargets() != null) {\r | |
808 | saa[i][0] = listToString(opt.getBuildTargets());\r | |
809 | }\r | |
810 | saa[i][1] = opt.getToolChainFamily();\r | |
bf5abaff | 811 | saa[i][2] = opt.getTagName();\r |
812 | saa[i][3] = opt.getToolCode();\r | |
813 | \r | |
1800d80f | 814 | if (opt.getSupArchList() != null){\r |
bf5abaff | 815 | saa[i][4] = listToString(opt.getSupArchList());\r |
1800d80f | 816 | \r |
817 | }\r | |
bf5abaff | 818 | \r |
1800d80f | 819 | saa[i][5] = opt.getStringValue();\r |
820 | \r | |
821 | ++i;\r | |
822 | }\r | |
823 | }\r | |
824 | \r | |
825 | public int getModuleSAOptionsCount(String moduleKey){\r | |
826 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
e232295e | 827 | if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null\r |
1800d80f | 828 | || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {\r |
829 | return 0;\r | |
830 | }\r | |
831 | return msa.getModuleSaBuildOptions().getOptions().getOptionList().size();\r | |
832 | }\r | |
833 | \r | |
834 | public void genModuleSAOptionsOpt(String moduleKey, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {\r | |
835 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
836 | if (msa.getModuleSaBuildOptions() == null) {\r | |
837 | msa.addNewModuleSaBuildOptions();\r | |
838 | }\r | |
839 | if (msa.getModuleSaBuildOptions().getOptions() == null){\r | |
840 | msa.getModuleSaBuildOptions().addNewOptions();\r | |
841 | }\r | |
842 | OptionDocument.Option opt = msa.getModuleSaBuildOptions().getOptions().addNewOption();\r | |
843 | setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);\r | |
844 | }\r | |
845 | \r | |
846 | public void removeModuleSAOptionsOpt(String moduleKey, int i) {\r | |
847 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
848 | if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {\r | |
849 | return ;\r | |
850 | }\r | |
851 | OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();\r | |
852 | XmlCursor cursor = opts.newCursor();\r | |
853 | if (cursor.toFirstChild()) {\r | |
854 | for (int j = 0; j < i; ++j){\r | |
855 | cursor.toNextSibling();\r | |
856 | }\r | |
857 | cursor.removeXml();\r | |
858 | }\r | |
859 | cursor.dispose();\r | |
860 | }\r | |
861 | \r | |
862 | public void updateModuleSAOptionsOpt(String moduleKey, int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {\r | |
863 | ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r | |
864 | if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {\r | |
865 | return ;\r | |
866 | }\r | |
867 | OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();\r | |
868 | XmlCursor cursor = opts.newCursor();\r | |
869 | if (cursor.toFirstChild()) {\r | |
870 | for (int j = 0; j < i; ++j){\r | |
871 | cursor.toNextSibling();\r | |
872 | }\r | |
873 | OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();\r | |
874 | setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);\r | |
875 | }\r | |
876 | cursor.dispose();\r | |
877 | }\r | |
878 | \r | |
a13899c5 | 879 | /**add pcd information of module mi to a ModuleSA. \r |
880 | * @param mi\r | |
881 | * @param moduleSa if null, generate a new ModuleSA.\r | |
882 | */\r | |
bf5abaff | 883 | public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, String arch, ModuleSADocument.ModuleSA moduleSa) throws Exception {\r |
a13899c5 | 884 | //ToDo add Arch filter\r |
885 | \r | |
886 | try {\r | |
af25df16 | 887 | if (moduleSa == null) {\r |
bf5abaff | 888 | moduleSa = genModuleSA(mi, arch);\r |
af25df16 | 889 | }\r |
890 | \r | |
a13899c5 | 891 | ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r |
892 | if (msa.getPcdCoded() == null) {\r | |
893 | return;\r | |
894 | }\r | |
af25df16 | 895 | \r |
a13899c5 | 896 | Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r |
897 | m.put("ModuleSurfaceArea", msa);\r | |
898 | SurfaceAreaQuery.setDoc(m);\r | |
899 | PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r | |
900 | //\r | |
901 | // Implementing InitializePlatformPcdBuildDefinitions\r | |
902 | //\r | |
903 | List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();\r | |
904 | ListIterator li = l.listIterator();\r | |
905 | while(li.hasNext()) {\r | |
906 | PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();\r | |
907 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);\r | |
908 | if (spdPcd == null) {\r | |
909 | //\r | |
910 | // ToDo Error \r | |
911 | //\r | |
34c614e1 | 912 | throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module " + mi.getName());\r |
a13899c5 | 913 | }\r |
914 | //\r | |
915 | // AddItem to ModuleSA PcdBuildDefinitions\r | |
916 | //\r | |
917 | String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue() : msaPcd.getDefaultValue();\r | |
908b1c05 | 918 | \r |
a13899c5 | 919 | genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(), msaPcd.getPcdItemType().toString(), spdPcd.getDatumType()+"", defaultVal, moduleSa);\r |
920 | }\r | |
921 | \r | |
922 | }\r | |
923 | catch (Exception e){\r | |
34c614e1 | 924 | \r |
82961247 | 925 | throw e; \r |
a13899c5 | 926 | }\r |
927 | \r | |
928 | }\r | |
929 | \r | |
930 | private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) {\r | |
931 | \r | |
932 | Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r | |
933 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;\r | |
934 | for (int i = 0; i < depPkgs.length; ++i) {\r | |
935 | m.put("PackageSurfaceArea", GlobalData.getPackageXmlObject(depPkgs[i]));\r | |
936 | SurfaceAreaQuery.setDoc(m);\r | |
937 | XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations();\r | |
938 | if (xo == null) {\r | |
939 | continue;\r | |
940 | }\r | |
941 | for (int j = 0; j < xo.length; ++j) {\r | |
942 | spdPcd = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)xo[j];\r | |
943 | if (msaPcd.getTokenSpaceGuidCName() == null) {\r | |
944 | if (spdPcd.getCName().equals(msaPcd.getCName())) {\r | |
945 | return spdPcd;\r | |
946 | }\r | |
947 | }\r | |
948 | else{\r | |
949 | if (spdPcd.getCName().equals(msaPcd.getCName()) && spdPcd.getTokenSpaceGuidCName().equals(msaPcd.getTokenSpaceGuidCName())) {\r | |
950 | return spdPcd;\r | |
951 | }\r | |
952 | }\r | |
953 | \r | |
954 | }\r | |
955 | \r | |
956 | }\r | |
957 | return null;\r | |
958 | }\r | |
959 | \r | |
bf5abaff | 960 | private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {\r |
a13899c5 | 961 | PackageIdentification pi = GlobalData.getPackageForModule(mi);\r |
962 | ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();\r | |
82dcbb45 | 963 | XmlCursor cursor = msa.newCursor();\r |
964 | try{\r | |
965 | String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: "\r | |
1dac04ab | 966 | + GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r |
82dcbb45 | 967 | cursor.insertComment(comment);\r |
968 | }\r | |
969 | catch(Exception e){\r | |
970 | e.printStackTrace();\r | |
971 | }\r | |
972 | finally { \r | |
973 | cursor.dispose();\r | |
974 | }\r | |
a13899c5 | 975 | msa.setModuleGuid(mi.getGuid());\r |
976 | msa.setModuleVersion(mi.getVersion());\r | |
977 | msa.setPackageGuid(pi.getGuid());\r | |
978 | msa.setPackageVersion(pi.getVersion());\r | |
bf5abaff | 979 | if (arch != null) {\r |
980 | Vector<String> v = new Vector<String>();\r | |
981 | v.add(arch);\r | |
982 | msa.setSupArchList(v); \r | |
983 | }\r | |
a13899c5 | 984 | \r |
985 | return msa;\r | |
986 | }\r | |
987 | \r | |
82961247 | 988 | private void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal, ModuleSADocument.ModuleSA moduleSa) \r |
989 | throws PcdItemTypeConflictException, PcdValueMalFormed{\r | |
a13899c5 | 990 | if (moduleSa.getPcdBuildDefinition() == null){\r |
991 | moduleSa.addNewPcdBuildDefinition();\r | |
992 | }\r | |
993 | //\r | |
994 | // constructe pcd to modulesa mapping first.\r | |
995 | // Attention : for any error condition, remove from map this pcd.\r | |
996 | //\r | |
997 | ArrayList<String> pcdConsumer = LookupPlatformPcdData(cName + " " + tsGuid);\r | |
998 | if (pcdConsumer == null) {\r | |
999 | pcdConsumer = new ArrayList<String>();\r | |
1000 | }\r | |
1001 | String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() \r | |
bf5abaff | 1002 | + " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList())\r |
a13899c5 | 1003 | + " " + itemType;\r |
1004 | pcdConsumer.add(listValue);\r | |
1005 | dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);\r | |
1006 | //\r | |
1007 | // Special dynamic type, if this pcd already exists in other ModuleSA\r | |
1008 | //\r | |
1faac7b6 | 1009 | /* Comment out Item type checking temporarily.\r |
a13899c5 | 1010 | if (itemType.equals("DYNAMIC")) {\r |
1011 | \r | |
1012 | ListIterator li = pcdConsumer.listIterator();\r | |
1013 | while(li.hasNext()) {\r | |
1014 | String value = li.next().toString();\r | |
1015 | String[] valuePart= value.split(" ");\r | |
34c614e1 | 1016 | if (!valuePart[5].equals("DYNAMIC")) {\r |
a13899c5 | 1017 | //ToDo error for same pcd, other type than dynamic\r |
1018 | pcdConsumer.remove(listValue);\r | |
34c614e1 | 1019 | throw new PcdItemTypeConflictException(cName, value);\r |
a13899c5 | 1020 | }\r |
1021 | }\r | |
1022 | }\r | |
1023 | else {\r | |
1024 | ListIterator li = pcdConsumer.listIterator();\r | |
1025 | while(li.hasNext()) {\r | |
1026 | String value = li.next().toString();\r | |
1027 | String[] valuePart= value.split(" ");\r | |
34c614e1 | 1028 | if (valuePart[5].equals("DYNAMIC")) {\r |
a13899c5 | 1029 | //ToDo error for same pcd, other type than non-dynamic\r |
1030 | pcdConsumer.remove(listValue);\r | |
34c614e1 | 1031 | throw new PcdItemTypeConflictException(cName, value);\r |
a13899c5 | 1032 | }\r |
1033 | }\r | |
1034 | }\r | |
1faac7b6 | 1035 | */\r |
a13899c5 | 1036 | PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();\r |
1037 | fpdPcd.setCName(cName);\r | |
1038 | fpdPcd.setToken(token);\r | |
1039 | fpdPcd.setTokenSpaceGuidCName(tsGuid);\r | |
1040 | fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType));\r | |
1041 | fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType));\r | |
a390c35d | 1042 | \r |
1043 | if (defaultVal != null){\r | |
1044 | fpdPcd.setValue(defaultVal);\r | |
1045 | }\r | |
1046 | else {\r | |
1047 | if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {\r | |
1048 | fpdPcd.setValue("0");\r | |
1049 | }\r | |
1050 | if (dataType.equals("BOOLEAN")){\r | |
1051 | fpdPcd.setValue("false");\r | |
1052 | }\r | |
1053 | if (dataType.equals("VOID*")) {\r | |
1054 | fpdPcd.setValue("");\r | |
1055 | }\r | |
1056 | }\r | |
802e0055 | 1057 | if (dataType.equals("UINT8")){\r |
1058 | fpdPcd.setMaxDatumSize(1);\r | |
1059 | }\r | |
1060 | if (dataType.equals("UINT16")) {\r | |
1061 | fpdPcd.setMaxDatumSize(2);\r | |
1062 | }\r | |
1063 | if (dataType.equals("UINT32")) {\r | |
1064 | fpdPcd.setMaxDatumSize(4);\r | |
1065 | }\r | |
1066 | if (dataType.equals("UINT64")){\r | |
1067 | fpdPcd.setMaxDatumSize(8);\r | |
1068 | }\r | |
1069 | if (dataType.equals("BOOLEAN")){\r | |
1070 | fpdPcd.setMaxDatumSize(1);\r | |
1071 | }\r | |
1072 | if (dataType.equals("VOID*")) {\r | |
1073 | int maxSize = setMaxSizeForPointer(fpdPcd.getValue());\r | |
1074 | fpdPcd.setMaxDatumSize(maxSize);\r | |
1075 | }\r | |
a13899c5 | 1076 | \r |
a390c35d | 1077 | \r |
a13899c5 | 1078 | if (itemType.equals("DYNAMIC") || itemType.equals("DYNAMIC_EX")) {\r |
1079 | ArrayList<String> al = LookupDynamicPcdBuildDefinition(cName + " " + tsGuid);\r | |
1080 | //\r | |
1081 | // if only one module mapped to this pcd, then the one is myself. so no other module mapped.\r | |
1082 | // so need to add one dyn pcd.\r | |
1083 | //\r | |
1084 | if (al.size() == 1) {\r | |
1085 | addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);\r | |
1086 | }\r | |
1087 | }\r | |
1088 | else {\r | |
a390c35d | 1089 | /*\r |
a13899c5 | 1090 | if (defaultVal != null){\r |
1091 | fpdPcd.setValue(defaultVal);\r | |
1092 | }\r | |
1093 | else {\r | |
1094 | if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {\r | |
1095 | fpdPcd.setValue("0");\r | |
1096 | }\r | |
1097 | if (dataType.equals("BOOLEAN")){\r | |
1098 | fpdPcd.setValue("false");\r | |
1099 | }\r | |
1100 | if (dataType.equals("VOID*")) {\r | |
1101 | fpdPcd.setValue("");\r | |
1102 | }\r | |
1103 | }\r | |
a390c35d | 1104 | \r |
a13899c5 | 1105 | if (dataType.equals("UINT8")){\r |
1106 | fpdPcd.setMaxDatumSize(1);\r | |
1107 | }\r | |
1108 | if (dataType.equals("UINT16")) {\r | |
1109 | fpdPcd.setMaxDatumSize(2);\r | |
1110 | }\r | |
1111 | if (dataType.equals("UINT32")) {\r | |
1112 | fpdPcd.setMaxDatumSize(4);\r | |
1113 | }\r | |
1114 | if (dataType.equals("UINT64")){\r | |
1115 | fpdPcd.setMaxDatumSize(8);\r | |
1116 | }\r | |
1117 | if (dataType.equals("BOOLEAN")){\r | |
1118 | fpdPcd.setMaxDatumSize(1);\r | |
1119 | }\r | |
1120 | if (dataType.equals("VOID*")) {\r | |
1121 | int maxSize = setMaxSizeForPointer(fpdPcd.getValue());\r | |
1122 | fpdPcd.setMaxDatumSize(maxSize);\r | |
1123 | }\r | |
802e0055 | 1124 | */\r |
a13899c5 | 1125 | }\r |
1126 | }\r | |
1127 | \r | |
908b1c05 | 1128 | public int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{\r |
a13899c5 | 1129 | if (datum == null) {\r |
1130 | return 0;\r | |
1131 | }\r | |
1132 | char ch = datum.charAt(0);\r | |
1133 | int start, end;\r | |
1134 | String strValue;\r | |
1135 | //\r | |
1136 | // For void* type PCD, only three datum is support:\r | |
1137 | // 1) Unicode: string with start char is "L"\r | |
1138 | // 2) Ansci: String is ""\r | |
1139 | // 3) byte array: String start char "{"\r | |
1140 | // \r | |
1141 | if (ch == 'L') {\r | |
1142 | start = datum.indexOf('\"');\r | |
1143 | end = datum.lastIndexOf('\"');\r | |
1144 | if ((start > end) || \r | |
1145 | (end > datum.length())||\r | |
1146 | ((start == end) && (datum.length() > 0))) {\r | |
1147 | //ToDo Error handling here\r | |
82961247 | 1148 | throw new PcdValueMalFormed (datum);\r |
a13899c5 | 1149 | }\r |
1150 | \r | |
1151 | strValue = datum.substring(start + 1, end);\r | |
1152 | return strValue.length() * 2;\r | |
1153 | } else if (ch == '\"'){\r | |
1154 | start = datum.indexOf('\"');\r | |
1155 | end = datum.lastIndexOf('\"');\r | |
1156 | if ((start > end) || \r | |
1157 | (end > datum.length())||\r | |
1158 | ((start == end) && (datum.length() > 0))) {\r | |
82961247 | 1159 | throw new PcdValueMalFormed (datum);\r |
a13899c5 | 1160 | }\r |
1161 | strValue = datum.substring(start + 1, end);\r | |
1162 | return strValue.length();\r | |
1163 | } else if (ch =='{') {\r | |
1164 | String[] strValueArray;\r | |
1165 | \r | |
1166 | start = datum.indexOf('{');\r | |
1167 | end = datum.lastIndexOf('}');\r | |
1168 | strValue = datum.substring(start + 1, end);\r | |
1169 | strValue = strValue.trim();\r | |
1170 | if (strValue.length() == 0) {\r | |
1171 | return 0;\r | |
1172 | }\r | |
1173 | strValueArray = strValue.split(",");\r | |
1174 | for (int index = 0; index < strValueArray.length; index ++) {\r | |
1175 | Integer value = Integer.decode(strValueArray[index].trim());\r | |
1176 | \r | |
1177 | if (value > 0xFF) {\r | |
1178 | // "[FPD file error] The datum type of PCD %s in %s is VOID*, "+\r | |
1179 | // "it is byte array in fact. But the element of %s exceed the byte range",\r | |
82961247 | 1180 | throw new PcdValueMalFormed (datum); \r |
a13899c5 | 1181 | }\r |
1182 | }\r | |
1183 | return strValueArray.length;\r | |
1184 | \r | |
1185 | \r | |
1186 | } else {\r | |
1187 | // "[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n "+\r | |
1188 | // "1) UNICODE string: like L\"xxxx\";\r\n"+\r | |
1189 | // "2) ANSIC string: like \"xxx\";\r\n"+\r | |
1190 | // "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+\r | |
1191 | // "but the datum in seems does not following above format!",\r | |
82961247 | 1192 | throw new PcdValueMalFormed (datum);\r |
a13899c5 | 1193 | \r |
1194 | }\r | |
1195 | }\r | |
1196 | \r | |
1197 | private ArrayList<String> LookupDynamicPcdBuildDefinition(String dynPcdKey) {\r | |
1198 | ArrayList<String> al = dynPcdMap.get(dynPcdKey);\r | |
1199 | \r | |
1200 | return al;\r | |
1201 | }\r | |
1202 | \r | |
1203 | private ArrayList<String> LookupPlatformPcdData(String pcdKey) {\r | |
1204 | \r | |
34c614e1 | 1205 | return dynPcdMap.get(pcdKey);\r |
a13899c5 | 1206 | }\r |
1207 | \r | |
1208 | public int getDynamicPcdBuildDataCount() {\r | |
5af6b67f | 1209 | if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r |
e232295e | 1210 | removeElement(getfpdDynPcdBuildDefs());\r |
1211 | fpdDynPcdBuildDefs = null;\r | |
a13899c5 | 1212 | return 0;\r |
1213 | }\r | |
1214 | return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();\r | |
1215 | }\r | |
1216 | \r | |
1217 | public void getDynamicPcdBuildData(String[][] saa) {\r | |
5af6b67f | 1218 | if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r |
e232295e | 1219 | removeElement(getfpdDynPcdBuildDefs());\r |
1220 | fpdDynPcdBuildDefs = null;\r | |
a13899c5 | 1221 | return ;\r |
1222 | }\r | |
1223 | List<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> l = getfpdDynPcdBuildDefs().getPcdBuildDataList();\r | |
1224 | ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> li = l.listIterator();\r | |
1225 | int i = 0;\r | |
1226 | while(li.hasNext()) {\r | |
1227 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcd = li.next();\r | |
1228 | saa[i][0] = dynPcd.getCName();\r | |
1229 | saa[i][1] = dynPcd.getToken().toString();\r | |
1230 | saa[i][2] = dynPcd.getTokenSpaceGuidCName();\r | |
1231 | saa[i][3] = dynPcd.getMaxDatumSize()+"";\r | |
1232 | saa[i][4] = dynPcd.getDatumType().toString();\r | |
1233 | \r | |
1234 | ++i;\r | |
1235 | }\r | |
1236 | }\r | |
1237 | \r | |
908b1c05 | 1238 | public void addDynamicPcdBuildData(String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal) \r |
82961247 | 1239 | throws PcdValueMalFormed{\r |
a13899c5 | 1240 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcdData = getfpdDynPcdBuildDefs().addNewPcdBuildData();\r |
1241 | dynPcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r | |
1242 | dynPcdData.setCName(cName);\r | |
1243 | dynPcdData.setToken(token);\r | |
1244 | dynPcdData.setTokenSpaceGuidCName(tsGuid);\r | |
1245 | dynPcdData.setDatumType(PcdDataTypes.Enum.forString(dataType));\r | |
1246 | \r | |
1247 | BigInteger bigInt = new BigInteger("0");\r | |
1248 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = dynPcdData.addNewSkuInfo();\r | |
1249 | skuInfo.setSkuId(bigInt);\r | |
1250 | if (defaultVal != null){\r | |
1251 | skuInfo.setValue(defaultVal);\r | |
1252 | }\r | |
1253 | else {\r | |
1254 | if (dataType.equals("UINT8")){\r | |
1255 | skuInfo.setValue("0");\r | |
1256 | }\r | |
1257 | if (dataType.equals("UINT16")) {\r | |
1258 | skuInfo.setValue("0");\r | |
1259 | }\r | |
1260 | if (dataType.equals("UINT32")) {\r | |
1261 | skuInfo.setValue("0");\r | |
1262 | }\r | |
1263 | if (dataType.equals("UINT64")){\r | |
1264 | skuInfo.setValue("0");\r | |
1265 | }\r | |
1266 | if (dataType.equals("BOOLEAN")){\r | |
1267 | skuInfo.setValue("false");\r | |
1268 | }\r | |
1269 | if (dataType.equals("VOID*")) {\r | |
1270 | skuInfo.setValue("");\r | |
1271 | }\r | |
1272 | }\r | |
1273 | if (dataType.equals("UINT8")){\r | |
1274 | dynPcdData.setMaxDatumSize(1);\r | |
1275 | }\r | |
1276 | if (dataType.equals("UINT16")) {\r | |
1277 | dynPcdData.setMaxDatumSize(2);\r | |
1278 | }\r | |
1279 | if (dataType.equals("UINT32")) {\r | |
1280 | dynPcdData.setMaxDatumSize(4);\r | |
1281 | }\r | |
1282 | if (dataType.equals("UINT64")){\r | |
1283 | dynPcdData.setMaxDatumSize(8);\r | |
1284 | }\r | |
1285 | if (dataType.equals("BOOLEAN")){\r | |
1286 | dynPcdData.setMaxDatumSize(1);\r | |
1287 | }\r | |
1288 | if (dataType.equals("VOID*")) {\r | |
1289 | int maxSize = setMaxSizeForPointer(defaultVal);\r | |
1290 | dynPcdData.setMaxDatumSize(maxSize);\r | |
1291 | }\r | |
1292 | }\r | |
1293 | \r | |
908b1c05 | 1294 | public void removeDynamicPcdBuildData(String cName, String tsGuid) {\r |
e232295e | 1295 | XmlObject o = fpdRoot.getDynamicPcdBuildDefinitions();\r |
1296 | if (o == null) {\r | |
1297 | return;\r | |
1298 | }\r | |
a13899c5 | 1299 | \r |
1300 | XmlCursor cursor = o.newCursor();\r | |
1301 | if (cursor.toFirstChild()) {\r | |
af25df16 | 1302 | do {\r |
1303 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData = \r | |
1304 | (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
908b1c05 | 1305 | if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) {\r |
add40ab2 | 1306 | \r |
1307 | if (getDynamicPcdBuildDataCount() == 1) {\r | |
af25df16 | 1308 | cursor.toParent();\r |
af25df16 | 1309 | }\r |
add40ab2 | 1310 | cursor.removeXml();\r |
908b1c05 | 1311 | cursor.dispose();\r |
1312 | return;\r | |
1313 | }\r | |
a13899c5 | 1314 | }\r |
af25df16 | 1315 | while (cursor.toNextSibling());\r |
a13899c5 | 1316 | }\r |
1317 | cursor.dispose();\r | |
1318 | }\r | |
1319 | //\r | |
1320 | // Get the Sku Info count of ith dyn pcd element.\r | |
1321 | //\r | |
1322 | public int getDynamicPcdSkuInfoCount(int i){\r | |
e232295e | 1323 | if (fpdRoot.getDynamicPcdBuildDefinitions() == null || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList() == null \r |
1324 | || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList().size() == 0) {\r | |
a13899c5 | 1325 | return 0;\r |
1326 | }\r | |
1327 | \r | |
1328 | int skuInfoCount = 0;\r | |
1329 | XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r | |
1330 | if (cursor.toFirstChild()) {\r | |
1331 | for (int j = 0; j < i; ++j) {\r | |
1332 | cursor.toNextSibling();\r | |
1333 | }\r | |
1334 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
1335 | if (pcdData.getSkuInfoList() == null) {\r | |
1336 | skuInfoCount = 0;\r | |
1337 | }\r | |
1338 | else {\r | |
1339 | skuInfoCount = pcdData.getSkuInfoList().size();\r | |
1340 | }\r | |
1341 | }\r | |
1342 | cursor.dispose();\r | |
1343 | return skuInfoCount;\r | |
1344 | }\r | |
1345 | \r | |
1346 | public void getDynamicPcdSkuInfos(int i, String[][] saa){\r | |
1347 | if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r | |
e232295e | 1348 | removeElement(getfpdDynPcdBuildDefs());\r |
1349 | fpdDynPcdBuildDefs = null;\r | |
a13899c5 | 1350 | return;\r |
1351 | }\r | |
1352 | \r | |
1353 | XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r | |
1354 | if (cursor.toFirstChild()) {\r | |
1355 | for (int j = 0; j < i; ++j) {\r | |
1356 | cursor.toNextSibling();\r | |
1357 | }\r | |
1358 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
1359 | if (pcdData.getSkuInfoList() == null) {\r | |
1360 | cursor.dispose();\r | |
1361 | return;\r | |
1362 | }\r | |
1363 | else {\r | |
1364 | ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();\r | |
1365 | int k = 0;\r | |
1366 | while (li.hasNext()) {\r | |
1367 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();\r | |
1368 | saa[k][0] = skuInfo.getSkuId()+"";\r | |
1369 | saa[k][1] = skuInfo.getVariableName();\r | |
1370 | saa[k][2] = skuInfo.getVariableGuid();\r | |
1371 | saa[k][3] = skuInfo.getVariableOffset();\r | |
1372 | saa[k][4] = skuInfo.getHiiDefaultValue();\r | |
1373 | saa[k][5] = skuInfo.getVpdOffset();\r | |
1374 | saa[k][6] = skuInfo.getValue();\r | |
1375 | ++k;\r | |
1376 | }\r | |
1377 | \r | |
1378 | }\r | |
1379 | }\r | |
1380 | cursor.dispose();\r | |
1381 | \r | |
1382 | }\r | |
1383 | \r | |
1384 | public String getDynamicPcdBuildDataValue(int i){\r | |
1385 | String value = null;\r | |
1386 | if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r | |
e232295e | 1387 | removeElement(getfpdDynPcdBuildDefs());\r |
1388 | fpdDynPcdBuildDefs = null;\r | |
a13899c5 | 1389 | return value;\r |
1390 | }\r | |
1391 | \r | |
1392 | XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r | |
1393 | if (cursor.toFirstChild()) {\r | |
1394 | for (int j = 0; j < i; ++j) {\r | |
1395 | cursor.toNextSibling();\r | |
1396 | }\r | |
1397 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
1398 | if (pcdData.getSkuInfoList() == null) {\r | |
1399 | value = null;\r | |
1400 | }\r | |
1401 | else {\r | |
1402 | value = pcdData.getSkuInfoArray(0).getValue();\r | |
1403 | }\r | |
1404 | }\r | |
1405 | cursor.dispose();\r | |
1406 | return value;\r | |
1407 | }\r | |
1408 | \r | |
1409 | public String getDynamicPcdBuildDataVpdOffset(int i){\r | |
1410 | String vpdOffset = null;\r | |
1411 | if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r | |
e232295e | 1412 | removeElement(getfpdDynPcdBuildDefs());\r |
1413 | fpdDynPcdBuildDefs = null;\r | |
a13899c5 | 1414 | return vpdOffset;\r |
1415 | }\r | |
1416 | \r | |
1417 | XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r | |
1418 | if (cursor.toFirstChild()) {\r | |
1419 | for (int j = 0; j < i; ++j) {\r | |
1420 | cursor.toNextSibling();\r | |
1421 | }\r | |
1422 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
1423 | if (pcdData.getSkuInfoList() == null) {\r | |
1424 | vpdOffset = null;\r | |
1425 | }\r | |
1426 | else {\r | |
1427 | vpdOffset = pcdData.getSkuInfoArray(0).getVpdOffset();\r | |
1428 | }\r | |
1429 | }\r | |
1430 | cursor.dispose();\r | |
1431 | return vpdOffset;\r | |
1432 | }\r | |
1433 | \r | |
1434 | public void removeDynamicPcdBuildDataSkuInfo(int i) {\r | |
1435 | if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r | |
e232295e | 1436 | removeElement(getfpdDynPcdBuildDefs());\r |
1437 | fpdDynPcdBuildDefs = null;\r | |
a13899c5 | 1438 | return;\r |
1439 | }\r | |
1440 | \r | |
1441 | XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r | |
1442 | if (cursor.toFirstChild()) {\r | |
1443 | for (int j = 0; j < i; ++j) {\r | |
1444 | cursor.toNextSibling();\r | |
1445 | }\r | |
1446 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
1447 | if (pcdData.getSkuInfoList() == null) {\r | |
1448 | cursor.dispose();\r | |
1449 | return;\r | |
1450 | }\r | |
1451 | else {\r | |
1452 | QName qSkuInfo = new QName(xmlNs, "SkuInfo");\r | |
1453 | cursor.toChild(qSkuInfo);\r | |
1454 | cursor.removeXml();\r | |
1455 | }\r | |
1456 | }\r | |
1457 | cursor.dispose();\r | |
1458 | }\r | |
1459 | //\r | |
1460 | // generate sku info for ith dyn pcd build data.\r | |
1461 | //\r | |
1462 | public void genDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset, \r | |
1463 | String hiiDefault, String vpdOffset, String value, int i) {\r | |
e232295e | 1464 | // if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r |
1465 | // return;\r | |
1466 | // }\r | |
a13899c5 | 1467 | \r |
1468 | XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r | |
1469 | if (cursor.toFirstChild()) {\r | |
1470 | for (int j = 0; j < i; ++j) {\r | |
1471 | cursor.toNextSibling();\r | |
1472 | }\r | |
1473 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
1474 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = pcdData.addNewSkuInfo();\r | |
1475 | skuInfo.setSkuId(new BigInteger(id));\r | |
1476 | if (varName != null){\r | |
1477 | skuInfo.setVariableName(varName);\r | |
1478 | skuInfo.setVariableGuid(varGuid);\r | |
1479 | skuInfo.setVariableOffset(varOffset);\r | |
1480 | skuInfo.setHiiDefaultValue(hiiDefault);\r | |
1481 | }\r | |
1482 | else if (vpdOffset != null){\r | |
1483 | skuInfo.setVpdOffset(vpdOffset);\r | |
1484 | }\r | |
1485 | else{\r | |
1486 | skuInfo.setValue(value);\r | |
1487 | }\r | |
1488 | }\r | |
1489 | }\r | |
1490 | \r | |
1491 | public void updateDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset, \r | |
1492 | String hiiDefault, String vpdOffset, String value, int i){\r | |
e232295e | 1493 | // if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r |
1494 | // return;\r | |
1495 | // }\r | |
a13899c5 | 1496 | \r |
1497 | XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r | |
1498 | if (cursor.toFirstChild()) {\r | |
1499 | for (int j = 0; j < i; ++j) {\r | |
1500 | cursor.toNextSibling();\r | |
1501 | }\r | |
1502 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r | |
1503 | ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();\r | |
1504 | while (li.hasNext()) {\r | |
1505 | DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();\r | |
1506 | if (skuInfo.getSkuId().toString().equals(id)){\r | |
1507 | if (varName != null){\r | |
1508 | skuInfo.setVariableName(varName);\r | |
1509 | skuInfo.setVariableGuid(varGuid);\r | |
1510 | skuInfo.setVariableOffset(varOffset);\r | |
1511 | skuInfo.setHiiDefaultValue(hiiDefault);\r | |
1512 | }\r | |
1513 | else if (vpdOffset != null){\r | |
1514 | skuInfo.setVpdOffset(vpdOffset);\r | |
1515 | }\r | |
1516 | else{\r | |
1517 | skuInfo.setValue(value);\r | |
1518 | }\r | |
1519 | break;\r | |
1520 | }\r | |
1521 | }\r | |
1522 | }\r | |
1523 | }\r | |
1524 | \r | |
a13899c5 | 1525 | public BuildOptionsDocument.BuildOptions getfpdBuildOpts() {\r |
1526 | if (fpdBuildOpts == null) {\r | |
1527 | fpdBuildOpts = fpdRoot.addNewBuildOptions();\r | |
1528 | }\r | |
1529 | return fpdBuildOpts;\r | |
1530 | }\r | |
1531 | \r | |
1532 | public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {\r | |
1533 | UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r | |
1534 | if (udats == null) {\r | |
1535 | udats = getfpdBuildOpts().addNewUserDefinedAntTasks();\r | |
1536 | }\r | |
1537 | \r | |
1538 | AntTaskDocument.AntTask at = udats.addNewAntTask();\r | |
1539 | setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);\r | |
1540 | }\r | |
1541 | \r | |
1542 | private void setBuildOptionsUserDefAntTask(String id, String fileName, String execOrder, AntTaskDocument.AntTask at) {\r | |
1543 | at.setId(new Integer(id));\r | |
bf5abaff | 1544 | XmlCursor cursor = at.newCursor();\r |
a13899c5 | 1545 | if (fileName != null){\r |
1546 | at.setFilename(fileName);\r | |
1547 | }\r | |
bf5abaff | 1548 | else if (cursor.toChild(xmlNs, "Filename")) {\r |
1549 | cursor.removeXml();\r | |
1550 | }\r | |
202c4f38 | 1551 | if (execOrder != null) {\r |
a13899c5 | 1552 | at.setAntCmdOptions(execOrder);\r |
1553 | }\r | |
bf5abaff | 1554 | else if (cursor.toChild(xmlNs, "AntCmdOptions")) {\r |
1555 | cursor.removeXml();\r | |
1556 | }\r | |
1557 | cursor.dispose();\r | |
a13899c5 | 1558 | }\r |
1559 | \r | |
1560 | public void removeBuildOptionsUserDefAntTask(int i) {\r | |
1561 | XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();\r | |
1562 | if (o == null) {\r | |
1563 | return;\r | |
1564 | }\r | |
1565 | XmlCursor cursor = o.newCursor();\r | |
1566 | if (cursor.toFirstChild()) {\r | |
1567 | for (int j = 0; j < i; ++j) {\r | |
1568 | cursor.toNextSibling();\r | |
1569 | }\r | |
1570 | cursor.removeXml();\r | |
af25df16 | 1571 | if (getBuildOptionsUserDefAntTaskCount() == 0) {\r |
1572 | cursor.toParent();\r | |
1573 | cursor.removeXml();\r | |
1574 | }\r | |
a13899c5 | 1575 | }\r |
1576 | cursor.dispose();\r | |
1577 | }\r | |
1578 | \r | |
1579 | public void updateBuildOptionsUserDefAntTask(int i, String id, String fileName, String execOrder){\r | |
1580 | XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();\r | |
1581 | if (o == null) {\r | |
1582 | return;\r | |
1583 | }\r | |
1584 | XmlCursor cursor = o.newCursor();\r | |
1585 | if (cursor.toFirstChild()) {\r | |
1586 | for (int j = 0; j < i; ++j) {\r | |
1587 | cursor.toNextSibling();\r | |
1588 | }\r | |
1589 | AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)cursor.getObject();\r | |
1590 | setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);\r | |
1591 | }\r | |
1592 | cursor.dispose();\r | |
1593 | }\r | |
1594 | \r | |
1595 | public int getBuildOptionsUserDefAntTaskCount() {\r | |
1596 | UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r | |
1597 | if (udats == null || udats.getAntTaskList() == null) {\r | |
1598 | return 0;\r | |
1599 | }\r | |
1600 | \r | |
1601 | return udats.getAntTaskList().size();\r | |
1602 | }\r | |
1603 | \r | |
1604 | public void getBuildOptionsUserDefAntTasks(String[][] saa) {\r | |
1605 | UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r | |
1606 | if (udats == null || udats.getAntTaskList() == null) {\r | |
1607 | return ;\r | |
1608 | }\r | |
1609 | \r | |
1610 | List<AntTaskDocument.AntTask> l = udats.getAntTaskList();\r | |
1611 | ListIterator li = l.listIterator();\r | |
1612 | int i = 0;\r | |
1613 | while (li.hasNext()) {\r | |
1614 | AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)li.next();\r | |
1615 | saa[i][0] = at.getId() + "";\r | |
1616 | saa[i][1] = saa[i][2] = "";\r | |
1617 | if (at.getFilename() != null){\r | |
1618 | saa[i][1] = at.getFilename();\r | |
1619 | }\r | |
1620 | if (at.getAntCmdOptions() != null) {\r | |
1621 | saa[i][2] = at.getAntCmdOptions();\r | |
1622 | }\r | |
1623 | ++i;\r | |
1624 | }\r | |
1625 | }\r | |
1800d80f | 1626 | public void genBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {\r |
a13899c5 | 1627 | OptionsDocument.Options opts = getfpdBuildOpts().getOptions();\r |
1628 | if (opts == null) {\r | |
1629 | opts = getfpdBuildOpts().addNewOptions();\r | |
1630 | }\r | |
1631 | OptionDocument.Option opt = opts.addNewOption();\r | |
1632 | setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);\r | |
1633 | }\r | |
1634 | \r | |
1800d80f | 1635 | private void setBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents, OptionDocument.Option opt){\r |
a13899c5 | 1636 | opt.setStringValue(contents);\r |
1800d80f | 1637 | \r |
1638 | opt.setBuildTargets(buildTargets);\r | |
a13899c5 | 1639 | opt.setToolChainFamily(toolChain);\r |
1640 | opt.setTagName(tagName);\r | |
1641 | opt.setToolCode(toolCmd);\r | |
1800d80f | 1642 | \r |
bf5abaff | 1643 | if (archList != null) {\r |
1644 | opt.setSupArchList(archList);\r | |
1645 | }\r | |
1646 | else {\r | |
1647 | if (opt.isSetSupArchList()) {\r | |
1648 | opt.unsetSupArchList();\r | |
1649 | }\r | |
1650 | }\r | |
a13899c5 | 1651 | }\r |
1652 | \r | |
1653 | public void removeBuildOptionsOpt(int i){\r | |
1654 | \r | |
1655 | XmlObject o = getfpdBuildOpts().getOptions();\r | |
1656 | if (o == null) {\r | |
1657 | return;\r | |
1658 | }\r | |
1659 | \r | |
1660 | XmlCursor cursor = o.newCursor();\r | |
1661 | if (cursor.toFirstChild()) {\r | |
1662 | for (int j = 0; j < i; ++j) {\r | |
1663 | cursor.toNextSibling();\r | |
1664 | }\r | |
1665 | cursor.removeXml();\r | |
af25df16 | 1666 | if (getBuildOptionsOptCount() == 0) {\r |
1667 | cursor.toParent();\r | |
1668 | cursor.removeXml();\r | |
1669 | }\r | |
a13899c5 | 1670 | }\r |
1671 | cursor.dispose();\r | |
1672 | }\r | |
1673 | \r | |
1800d80f | 1674 | public void updateBuildOptionsOpt(int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {\r |
a13899c5 | 1675 | XmlObject o = getfpdBuildOpts().getOptions();\r |
1676 | if (o == null) {\r | |
1677 | return;\r | |
1678 | }\r | |
1679 | \r | |
1680 | XmlCursor cursor = o.newCursor();\r | |
1681 | if (cursor.toFirstChild()) {\r | |
1682 | for (int j = 0; j < i; ++j) {\r | |
1683 | cursor.toNextSibling();\r | |
1684 | }\r | |
1685 | OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();\r | |
1686 | setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);\r | |
1687 | }\r | |
1688 | cursor.dispose();\r | |
1689 | }\r | |
1690 | \r | |
1691 | public int getBuildOptionsOptCount(){\r | |
1692 | if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {\r | |
1693 | return 0;\r | |
1694 | }\r | |
1695 | return getfpdBuildOpts().getOptions().getOptionList().size();\r | |
1696 | }\r | |
1697 | \r | |
1698 | public void getBuildOptionsOpts(String[][] saa) {\r | |
1699 | if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {\r | |
1700 | return ;\r | |
1701 | }\r | |
1702 | \r | |
1703 | List<OptionDocument.Option> lOpt = getfpdBuildOpts().getOptions().getOptionList();\r | |
1704 | ListIterator li = lOpt.listIterator();\r | |
1705 | int i = 0;\r | |
1706 | while(li.hasNext()) {\r | |
1707 | OptionDocument.Option opt = (OptionDocument.Option)li.next();\r | |
6cba26e8 | 1708 | if (opt.getBuildTargets() != null) {\r |
1709 | saa[i][0] = listToString(opt.getBuildTargets());\r | |
1710 | }\r | |
a13899c5 | 1711 | saa[i][1] = opt.getToolChainFamily();\r |
1712 | if (opt.getSupArchList() != null){\r | |
6cba26e8 | 1713 | saa[i][2] = listToString(opt.getSupArchList());\r |
1714 | \r | |
a13899c5 | 1715 | }\r |
1716 | saa[i][3] = opt.getToolCode();\r | |
1717 | saa[i][4] = opt.getTagName();\r | |
1718 | saa[i][5] = opt.getStringValue();\r | |
1719 | \r | |
1720 | ++i;\r | |
1721 | }\r | |
1722 | }\r | |
1723 | \r | |
6cba26e8 | 1724 | public void genBuildOptionsFfs(String ffsKey, String type) {\r |
1725 | BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs();\r | |
1726 | ffs.setFfsKey(ffsKey);\r | |
1727 | if (type != null) {\r | |
1728 | ffs.addNewSections().setEncapsulationType(type);\r | |
1729 | }\r | |
1730 | }\r | |
1731 | \r | |
3b405e9b | 1732 | public void updateBuildOptionsFfsSectionsType(int i, String type) {\r |
1733 | BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs();\r | |
1734 | if (type != null) {\r | |
1735 | ffs.addNewSections().setEncapsulationType(type);\r | |
1736 | }\r | |
1737 | }\r | |
1738 | \r | |
6cba26e8 | 1739 | public void genBuildOptionsFfsAttribute(int i, String name, String value) {\r |
1740 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1741 | BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = ffs.addNewAttribute();\r | |
1742 | attrib.setName(name);\r | |
1743 | attrib.setValue(value);\r | |
1744 | }\r | |
1745 | \r | |
1746 | /**update jth attribute of ith ffs.\r | |
1747 | * @param i\r | |
1748 | * @param j\r | |
1749 | */\r | |
1750 | public void updateBuildOptionsFfsAttribute(int i, int j, String name, String value){\r | |
1751 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1752 | XmlCursor cursor = ffs.newCursor();\r | |
1753 | QName qAttrib = new QName(xmlNs, "Attribute");\r | |
1754 | if (cursor.toChild(qAttrib)) {\r | |
1755 | for (int k = 0; k < j; ++k) {\r | |
1756 | cursor.toNextSibling(qAttrib);\r | |
1757 | }\r | |
1758 | BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = (BuildOptionsDocument.BuildOptions.Ffs.Attribute)cursor.getObject();\r | |
1759 | attrib.setName(name);\r | |
1760 | attrib.setValue(value);\r | |
1761 | }\r | |
1762 | cursor.dispose();\r | |
1763 | }\r | |
1764 | \r | |
1765 | public void removeBuildOptionsFfsAttribute(int i, int j){\r | |
1766 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1767 | XmlCursor cursor = ffs.newCursor();\r | |
1768 | QName qAttrib = new QName(xmlNs, "Attribute");\r | |
1769 | if (cursor.toChild(qAttrib)) {\r | |
1770 | for (int k = 0; k < j; ++k) {\r | |
1771 | cursor.toNextSibling(qAttrib);\r | |
1772 | }\r | |
1773 | cursor.removeXml();\r | |
1774 | }\r | |
1775 | cursor.dispose();\r | |
1776 | }\r | |
1777 | \r | |
1778 | public void genBuildOptionsFfsSectionsSection(int i, String sectionType) {\r | |
1779 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1780 | if (ffs == null) {\r | |
1781 | return;\r | |
1782 | }\r | |
1783 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1784 | \r | |
1785 | if (sections == null){\r | |
1786 | sections = ffs.addNewSections();\r | |
1787 | }\r | |
1788 | sections.addNewSection().setSectionType(EfiSectionType.Enum.forString(sectionType));\r | |
1789 | }\r | |
1790 | \r | |
3b405e9b | 1791 | public void removeBuildOptionsFfsSectionsSection(int i, int j) {\r |
1792 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1793 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1794 | if (sections == null) {\r | |
1795 | return;\r | |
1796 | }\r | |
1797 | XmlCursor cursor = sections.newCursor();\r | |
1798 | QName qSection = new QName(xmlNs, "Section");\r | |
1799 | if (cursor.toChild(qSection)) {\r | |
1800 | for (int k = 0; k < j; ++k) {\r | |
1801 | cursor.toNextSibling(qSection);\r | |
1802 | }\r | |
1803 | cursor.removeXml();\r | |
1804 | }\r | |
1805 | cursor.dispose();\r | |
1806 | }\r | |
1807 | \r | |
1808 | public void updateBuildOptionsFfsSectionsSection(int i, int j, String type){\r | |
1809 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1810 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1811 | if (sections == null) {\r | |
1812 | return;\r | |
1813 | }\r | |
1814 | XmlCursor cursor = sections.newCursor();\r | |
1815 | QName qSection = new QName(xmlNs, "Section");\r | |
1816 | if (cursor.toChild(qSection)) {\r | |
1817 | for (int k = 0; k < j; ++k) {\r | |
1818 | cursor.toNextSibling(qSection);\r | |
1819 | }\r | |
1820 | BuildOptionsDocument.BuildOptions.Ffs.Sections.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Section)cursor.getObject();\r | |
1821 | section.setSectionType(EfiSectionType.Enum.forString(type));\r | |
1822 | }\r | |
1823 | cursor.dispose();\r | |
1824 | } \r | |
1825 | \r | |
6cba26e8 | 1826 | public void genBuildOptionsFfsSectionsSections(int i, String encapType) {\r |
1827 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1828 | if (ffs == null) {\r | |
1829 | return;\r | |
1830 | }\r | |
1831 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1832 | \r | |
1833 | if (sections == null){\r | |
1834 | sections = ffs.addNewSections();\r | |
1835 | }\r | |
1836 | sections.addNewSections().setEncapsulationType(encapType);\r | |
1837 | }\r | |
1838 | \r | |
3b405e9b | 1839 | public void removeBuildOptionsFfsSectionsSections(int i, int j) {\r |
1840 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1841 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1842 | if (sections == null) {\r | |
1843 | return;\r | |
1844 | }\r | |
1845 | XmlCursor cursor = sections.newCursor();\r | |
1846 | QName qSections = new QName(xmlNs, "Sections");\r | |
1847 | if (cursor.toChild(qSections)) {\r | |
1848 | for (int k = 0; k < j; ++k) {\r | |
1849 | cursor.toNextSibling(qSections);\r | |
1850 | }\r | |
1851 | cursor.removeXml();\r | |
1852 | }\r | |
1853 | cursor.dispose();\r | |
1854 | }\r | |
1855 | \r | |
1856 | public void updateBuildOptionsFfsSectionsSections(int i, int j, String type) {\r | |
1857 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1858 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1859 | if (sections == null) {\r | |
1860 | return;\r | |
1861 | }\r | |
1862 | XmlCursor cursor = sections.newCursor();\r | |
1863 | QName qSections = new QName(xmlNs, "Sections");\r | |
1864 | if (cursor.toChild(qSections)) {\r | |
1865 | for (int k = 0; k < j; ++k) {\r | |
1866 | cursor.toNextSibling(qSections);\r | |
1867 | }\r | |
1868 | BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();\r | |
1869 | sections2.setEncapsulationType(type);\r | |
1870 | }\r | |
1871 | cursor.dispose();\r | |
1872 | }\r | |
1873 | \r | |
6cba26e8 | 1874 | public void genBuildOptionsFfsSectionsSectionsSection(int i, int j, String type) {\r |
1875 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1876 | if (ffs == null) {\r | |
1877 | return;\r | |
1878 | }\r | |
1879 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1880 | XmlCursor cursor = sections.newCursor();\r | |
1881 | QName qSections = new QName(xmlNs, "Sections");\r | |
1882 | if (cursor.toChild(qSections)){\r | |
1883 | for (int k = 0; k < j; ++k) {\r | |
1884 | cursor.toNextSibling(qSections);\r | |
1885 | }\r | |
1886 | BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();\r | |
1887 | sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString(type));\r | |
1888 | }\r | |
1889 | cursor.dispose();\r | |
1890 | }\r | |
1891 | \r | |
3b405e9b | 1892 | public void removeBuildOptionsFfsSectionsSectionsSection(int i, int j, int k) {\r |
1893 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1894 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1895 | if (sections == null) {\r | |
1896 | return;\r | |
1897 | }\r | |
1898 | XmlCursor cursor = sections.newCursor();\r | |
1899 | QName qSections = new QName(xmlNs, "Sections");\r | |
1900 | if (cursor.toChild(qSections)) {\r | |
1901 | for (int l = 0; l < j; ++l) {\r | |
1902 | cursor.toNextSibling(qSections);\r | |
1903 | }\r | |
1904 | if (cursor.toFirstChild()) {\r | |
af25df16 | 1905 | int m = 0;\r |
1906 | for (; m < k; ++m) {\r | |
3b405e9b | 1907 | cursor.toNextSibling();\r |
1908 | }\r | |
1909 | cursor.removeXml();\r | |
af25df16 | 1910 | if (m == 0) {\r |
1911 | cursor.toParent();\r | |
1912 | cursor.removeXml();\r | |
1913 | }\r | |
3b405e9b | 1914 | }\r |
1915 | }\r | |
1916 | cursor.dispose();\r | |
1917 | }\r | |
1918 | \r | |
1919 | public void updateBuildOptionsFfsSectionsSectionsSection(int i, int j, int k, String type) {\r | |
1920 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1921 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1922 | if (sections == null) {\r | |
1923 | return;\r | |
1924 | }\r | |
1925 | XmlCursor cursor = sections.newCursor();\r | |
1926 | QName qSections = new QName(xmlNs, "Sections");\r | |
1927 | if (cursor.toChild(qSections)) {\r | |
1928 | for (int l = 0; l < j; ++l) {\r | |
1929 | cursor.toNextSibling(qSections);\r | |
1930 | }\r | |
1931 | if (cursor.toFirstChild()) {\r | |
1932 | for (int m = 0; m < k; ++m) {\r | |
1933 | cursor.toNextSibling();\r | |
1934 | }\r | |
1935 | BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section)cursor.getObject();\r | |
1936 | section.setSectionType(EfiSectionType.Enum.forString(type));\r | |
1937 | }\r | |
1938 | }\r | |
1939 | cursor.dispose();\r | |
1940 | }\r | |
1941 | \r | |
6cba26e8 | 1942 | public void getBuildOptionsFfsSectionsSectionsSection(int i, int j, ArrayList<String> al) {\r |
1943 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1944 | if (ffs == null) {\r | |
1945 | return;\r | |
1946 | }\r | |
1947 | BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r | |
1948 | XmlCursor cursor = sections.newCursor();\r | |
1949 | QName qSections = new QName(xmlNs, "Sections");\r | |
1950 | if (cursor.toChild(qSections)){\r | |
1951 | for (int k = 0; k < j; ++k) {\r | |
1952 | cursor.toNextSibling(qSections);\r | |
1953 | }\r | |
1954 | BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();\r | |
1955 | if (sections2.getSectionList() == null){\r | |
1956 | cursor.dispose();\r | |
1957 | return;\r | |
1958 | }\r | |
1959 | ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section> li = sections2.getSectionList().listIterator();\r | |
1960 | while(li.hasNext()) {\r | |
1961 | BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next();\r | |
3b405e9b | 1962 | if (section.isSetSectionType()) {\r |
1800d80f | 1963 | al.add(section.getSectionType().toString());\r |
1964 | }\r | |
3b405e9b | 1965 | \r |
1966 | }\r | |
6cba26e8 | 1967 | }\r |
1968 | cursor.dispose();\r | |
1969 | \r | |
1970 | }\r | |
1971 | \r | |
1972 | public int getBuildOptionsFfsCount(){\r | |
1973 | if (getfpdBuildOpts().getFfsList() == null) {\r | |
1974 | return 0;\r | |
1975 | }\r | |
1976 | return getfpdBuildOpts().getFfsList().size();\r | |
1977 | }\r | |
1978 | \r | |
1979 | public void getBuildOptionsFfsKey(String[][] saa) {\r | |
1980 | if (getfpdBuildOpts().getFfsList() == null) {\r | |
1981 | return;\r | |
1982 | }\r | |
1983 | ListIterator<BuildOptionsDocument.BuildOptions.Ffs> li = getfpdBuildOpts().getFfsList().listIterator();\r | |
1984 | int i = 0;\r | |
1985 | while(li.hasNext()){\r | |
1986 | BuildOptionsDocument.BuildOptions.Ffs ffs = li.next();\r | |
1987 | saa[i][0] = ffs.getFfsKey();\r | |
1988 | ++i;\r | |
1989 | }\r | |
1990 | }\r | |
1991 | \r | |
3b405e9b | 1992 | public void updateBuildOptionsFfsKey(int i, String key) {\r |
1993 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
1994 | ffs.setFfsKey(key);\r | |
1995 | }\r | |
1996 | \r | |
6cba26e8 | 1997 | /**Get ith FFS key and contents.\r |
1998 | * @param saa\r | |
1999 | */\r | |
2000 | public void getBuildOptionsFfs(int i, String[] sa, LinkedHashMap<String, String> ffsAttribMap, ArrayList<String> firstLevelSections, ArrayList<String> firstLevelSection) {\r | |
2001 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
2002 | \r | |
2003 | if (ffs != null) {\r | |
2004 | \r | |
2005 | sa[0] = ffs.getFfsKey();\r | |
2006 | if (ffs.getSections() != null) {\r | |
2007 | if(ffs.getSections().getEncapsulationType() != null){\r | |
2008 | sa[1] = ffs.getSections().getEncapsulationType();\r | |
2009 | }\r | |
2010 | if (ffs.getSections().getSectionList() != null){\r | |
2011 | ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Section> li = ffs.getSections().getSectionList().listIterator();\r | |
2012 | while (li.hasNext()) {\r | |
2013 | firstLevelSection.add(li.next().getSectionType().toString());\r | |
2014 | }\r | |
2015 | }\r | |
2016 | if (ffs.getSections().getSectionsList() != null) {\r | |
2017 | ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2> li = ffs.getSections().getSectionsList().listIterator();\r | |
2018 | while(li.hasNext()) {\r | |
2019 | firstLevelSections.add(li.next().getEncapsulationType());\r | |
2020 | }\r | |
2021 | }\r | |
2022 | }\r | |
2023 | if (ffs.getAttributeList() != null) {\r | |
2024 | ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Attribute> li = ffs.getAttributeList().listIterator();\r | |
2025 | while(li.hasNext()) {\r | |
2026 | BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = li.next();\r | |
2027 | ffsAttribMap.put(attrib.getName(), attrib.getValue());\r | |
2028 | }\r | |
2029 | \r | |
2030 | }\r | |
2031 | }\r | |
2032 | \r | |
2033 | \r | |
2034 | }\r | |
2035 | \r | |
2036 | private BuildOptionsDocument.BuildOptions.Ffs getFfs(int i) {\r | |
2037 | XmlObject o = getfpdBuildOpts();\r | |
2038 | BuildOptionsDocument.BuildOptions.Ffs ffs = null;\r | |
2039 | \r | |
2040 | XmlCursor cursor = o.newCursor();\r | |
2041 | QName qFfs = new QName(xmlNs, "Ffs");\r | |
2042 | if (cursor.toChild(qFfs)) {\r | |
2043 | for (int j = 0; j < i; ++j) {\r | |
2044 | cursor.toNextSibling(qFfs);\r | |
2045 | }\r | |
2046 | ffs = (BuildOptionsDocument.BuildOptions.Ffs)cursor.getObject();\r | |
2047 | }\r | |
2048 | cursor.dispose();\r | |
2049 | return ffs;\r | |
2050 | }\r | |
2051 | \r | |
2052 | public void removeBuildOptionsFfs(int i) {\r | |
2053 | BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r | |
2054 | if (ffs == null){\r | |
2055 | return;\r | |
2056 | }\r | |
2057 | \r | |
2058 | XmlCursor cursor = ffs.newCursor();\r | |
2059 | cursor.removeXml();\r | |
2060 | cursor.dispose();\r | |
2061 | }\r | |
2062 | \r | |
3b405e9b | 2063 | \r |
2064 | \r | |
a13899c5 | 2065 | public PlatformDefinitionsDocument.PlatformDefinitions getfpdPlatformDefs(){\r |
2066 | if (fpdPlatformDefs == null){\r | |
2067 | fpdPlatformDefs = fpdRoot.addNewPlatformDefinitions();\r | |
2068 | }\r | |
2069 | return fpdPlatformDefs;\r | |
2070 | }\r | |
2071 | \r | |
6a09eb19 | 2072 | public void getPlatformDefsSupportedArchs(Vector<Object> archs){\r |
2073 | if (getfpdPlatformDefs().getSupportedArchitectures() == null) {\r | |
2074 | return;\r | |
2075 | }\r | |
2076 | ListIterator li = getfpdPlatformDefs().getSupportedArchitectures().listIterator();\r | |
2077 | while(li.hasNext()) {\r | |
2078 | archs.add(li.next());\r | |
2079 | }\r | |
2080 | }\r | |
2081 | \r | |
2082 | public void setPlatformDefsSupportedArchs(Vector<Object> archs) {\r | |
bf5abaff | 2083 | if (archs != null) {\r |
2084 | getfpdPlatformDefs().setSupportedArchitectures(archs);\r | |
2085 | }\r | |
2086 | // else {\r | |
2087 | // XmlCursor cursor = getfpdPlatformDefs().newCursor();\r | |
2088 | // if (cursor.toChild(xmlNs, "SupportedArchitectures")) {\r | |
2089 | // cursor.removeXml();\r | |
2090 | // }\r | |
2091 | // cursor.dispose();\r | |
2092 | // }\r | |
6a09eb19 | 2093 | }\r |
2094 | \r | |
2095 | public void getPlatformDefsBuildTargets(Vector<Object> targets) {\r | |
2096 | if (getfpdPlatformDefs().getBuildTargets() == null) {\r | |
2097 | return;\r | |
2098 | }\r | |
2099 | ListIterator li = getfpdPlatformDefs().getBuildTargets().listIterator();\r | |
2100 | while(li.hasNext()) {\r | |
2101 | targets.add(li.next());\r | |
2102 | }\r | |
2103 | }\r | |
2104 | \r | |
2105 | public void setPlatformDefsBuildTargets(Vector<Object> targets) {\r | |
2106 | getfpdPlatformDefs().setBuildTargets(targets);\r | |
2107 | }\r | |
2108 | \r | |
2109 | public void genPlatformDefsSkuInfo(String id, String name) {\r | |
2110 | SkuInfoDocument.SkuInfo skuInfo = null;\r | |
2111 | if (getfpdPlatformDefs().getSkuInfo() == null) {\r | |
2112 | skuInfo = getfpdPlatformDefs().addNewSkuInfo();\r | |
2113 | }\r | |
2114 | skuInfo = getfpdPlatformDefs().getSkuInfo();\r | |
2115 | if (skuInfo.getUiSkuNameList() == null || skuInfo.getUiSkuNameList().size() == 0) {\r | |
2116 | SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();\r | |
2117 | skuName.setSkuID(new BigInteger("0"));\r | |
2118 | skuName.setStringValue("DEFAULT");\r | |
2119 | }\r | |
2120 | if (id.equals("0")) {\r | |
2121 | return;\r | |
2122 | }\r | |
2123 | SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();\r | |
2124 | skuName.setSkuID(new BigInteger(id));\r | |
2125 | skuName.setStringValue(name);\r | |
2126 | }\r | |
2127 | \r | |
2128 | public int getPlatformDefsSkuInfoCount(){\r | |
2129 | if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {\r | |
2130 | return 0;\r | |
2131 | }\r | |
2132 | return getfpdPlatformDefs().getSkuInfo().getUiSkuNameList().size();\r | |
2133 | }\r | |
2134 | \r | |
2135 | public void getPlatformDefsSkuInfos(String[][] saa){\r | |
2136 | if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {\r | |
5af6b67f | 2137 | if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {\r |
2138 | removeElement(getfpdDynPcdBuildDefs());\r | |
2139 | fpdDynPcdBuildDefs = null;\r | |
2140 | }\r | |
6a09eb19 | 2141 | return ;\r |
2142 | }\r | |
2143 | \r | |
2144 | List<SkuInfoDocument.SkuInfo.UiSkuName> l = getfpdPlatformDefs().getSkuInfo().getUiSkuNameList();\r | |
2145 | ListIterator<SkuInfoDocument.SkuInfo.UiSkuName> li = l.listIterator();\r | |
2146 | int i = 0;\r | |
2147 | while(li.hasNext()) {\r | |
2148 | SkuInfoDocument.SkuInfo.UiSkuName sku = li.next();\r | |
2149 | saa[i][0] = sku.getSkuID()+"";\r | |
2150 | saa[i][1] = sku.getStringValue();\r | |
2151 | ++i;\r | |
2152 | }\r | |
2153 | }\r | |
2154 | \r | |
2155 | public void removePlatformDefsSkuInfo(int i) {\r | |
2156 | SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();\r | |
2157 | if (skuInfo == null || i == 0) {\r | |
2158 | return ;\r | |
2159 | }\r | |
2160 | \r | |
2161 | XmlCursor cursor = skuInfo.newCursor();\r | |
2162 | if (cursor.toFirstChild()) {\r | |
2163 | for (int j = 0; j < i; ++j) {\r | |
2164 | cursor.toNextSibling();\r | |
2165 | }\r | |
2166 | cursor.removeXml();\r | |
2167 | }\r | |
2168 | cursor.dispose();\r | |
2169 | }\r | |
2170 | \r | |
2171 | public void updatePlatformDefsSkuInfo(int i, String id, String name) {\r | |
2172 | SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();\r | |
2173 | if (skuInfo == null || i == 0) {\r | |
2174 | return ;\r | |
2175 | }\r | |
2176 | \r | |
2177 | XmlCursor cursor = skuInfo.newCursor();\r | |
2178 | if (cursor.toFirstChild()) {\r | |
2179 | for (int j = 0; j < i; ++j) {\r | |
2180 | cursor.toNextSibling();\r | |
2181 | }\r | |
2182 | SkuInfoDocument.SkuInfo.UiSkuName sku = (SkuInfoDocument.SkuInfo.UiSkuName)cursor.getObject();\r | |
2183 | sku.setSkuID(new BigInteger(id));\r | |
2184 | sku.setStringValue(name);\r | |
2185 | }\r | |
2186 | cursor.dispose();\r | |
2187 | }\r | |
2188 | \r | |
2189 | public String getPlatformDefsInterDir(){\r | |
2190 | if (getfpdPlatformDefs().getIntermediateDirectories() == null) {\r | |
2191 | return null;\r | |
2192 | }\r | |
2193 | return getfpdPlatformDefs().getIntermediateDirectories().toString();\r | |
2194 | }\r | |
2195 | \r | |
2196 | public void setPlatformDefsInterDir(String interDir){\r | |
2197 | getfpdPlatformDefs().setIntermediateDirectories(IntermediateOutputType.Enum.forString(interDir));\r | |
2198 | }\r | |
2199 | \r | |
2200 | public String getPlatformDefsOutputDir() {\r | |
2201 | return getfpdPlatformDefs().getOutputDirectory();\r | |
2202 | }\r | |
2203 | \r | |
2204 | public void setPlatformDefsOutputDir(String outputDir) {\r | |
af25df16 | 2205 | if (outputDir != null && outputDir.length() > 0) {\r |
2206 | getfpdPlatformDefs().setOutputDirectory(outputDir);\r | |
2207 | }\r | |
2208 | else{\r | |
2209 | XmlCursor cursor = getfpdPlatformDefs().newCursor();\r | |
2210 | if (cursor.toChild(new QName(xmlNs, "OutputDirectory"))) {\r | |
2211 | cursor.removeXml();\r | |
2212 | }\r | |
2213 | cursor.dispose();\r | |
2214 | }\r | |
6a09eb19 | 2215 | }\r |
2216 | \r | |
a13899c5 | 2217 | public FlashDocument.Flash getfpdFlash() {\r |
2218 | if (fpdFlash == null) {\r | |
2219 | fpdFlash = fpdRoot.addNewFlash();\r | |
2220 | }\r | |
2221 | return fpdFlash;\r | |
2222 | }\r | |
2223 | \r | |
2224 | public void genFlashDefinitionFile(String file) {\r | |
2225 | FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();\r | |
2226 | if (fdf == null) {\r | |
2227 | fdf = getfpdFlash().addNewFlashDefinitionFile();\r | |
2228 | }\r | |
2229 | \r | |
2230 | fdf.setStringValue(file);\r | |
2231 | }\r | |
2232 | \r | |
2233 | public String getFlashDefinitionFile() {\r | |
2234 | FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();\r | |
2235 | if (fdf == null) {\r | |
2236 | return "";\r | |
2237 | }\r | |
2238 | \r | |
2239 | return fdf.getStringValue();\r | |
2240 | }\r | |
2241 | \r | |
a13899c5 | 2242 | public void genFvImagesNameValue(String name, String value) {\r |
2243 | \r | |
2244 | FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();\r | |
2245 | if (fi == null) {\r | |
2246 | fi = getfpdFlash().addNewFvImages();\r | |
2247 | }\r | |
2248 | \r | |
2249 | FvImagesDocument.FvImages.NameValue nv = fi.addNewNameValue();\r | |
2250 | nv.setName(name);\r | |
2251 | nv.setValue(value);\r | |
2252 | }\r | |
2253 | \r | |
2254 | public void removeFvImagesNameValue(int i){\r | |
2255 | \r | |
2256 | XmlObject o = getfpdFlash().getFvImages();\r | |
2257 | if (o == null) {\r | |
2258 | return;\r | |
2259 | }\r | |
2260 | \r | |
2261 | QName qNameValue = new QName(xmlNs, "NameValue");\r | |
2262 | XmlCursor cursor = o.newCursor();\r | |
2263 | if (cursor.toChild(qNameValue)) {\r | |
2264 | for (int j = 0; j < i; ++j) {\r | |
2265 | cursor.toNextSibling(qNameValue);\r | |
2266 | }\r | |
2267 | cursor.removeXml();\r | |
2268 | }\r | |
2269 | cursor.dispose();\r | |
2270 | }\r | |
2271 | \r | |
2272 | public void updateFvImagesNameValue(int i, String name, String value){\r | |
2273 | \r | |
2274 | XmlObject o = getfpdFlash().getFvImages();\r | |
2275 | if (o == null) {\r | |
2276 | return;\r | |
2277 | }\r | |
2278 | \r | |
2279 | QName qNameValue = new QName(xmlNs, "NameValue");\r | |
2280 | XmlCursor cursor = o.newCursor();\r | |
2281 | if (cursor.toChild(qNameValue)) {\r | |
2282 | for (int j = 0; j < i; ++j) {\r | |
2283 | cursor.toNextSibling(qNameValue);\r | |
2284 | }\r | |
2285 | FvImagesDocument.FvImages.NameValue nv = (FvImagesDocument.FvImages.NameValue)cursor.getObject();\r | |
2286 | nv.setName(name);\r | |
2287 | nv.setValue(value);\r | |
2288 | }\r | |
2289 | cursor.dispose();\r | |
2290 | }\r | |
2291 | \r | |
2292 | public int getFvImagesNameValueCount() {\r | |
2293 | \r | |
2294 | FvImagesDocument.FvImages fi = null;\r | |
2295 | if ((fi = getfpdFlash().getFvImages()) == null || fi.getNameValueList() == null) {\r | |
2296 | return 0;\r | |
2297 | }\r | |
2298 | return fi.getNameValueList().size();\r | |
2299 | }\r | |
2300 | \r | |
2301 | public void getFvImagesNameValues(String[][] nv) {\r | |
2302 | \r | |
2303 | FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();\r | |
2304 | if (fi == null){\r | |
2305 | return;\r | |
2306 | }\r | |
2307 | List<FvImagesDocument.FvImages.NameValue> l = fi.getNameValueList();\r | |
2308 | int i = 0;\r | |
2309 | ListIterator li = l.listIterator();\r | |
2310 | while (li.hasNext()) {\r | |
2311 | FvImagesDocument.FvImages.NameValue e = (FvImagesDocument.FvImages.NameValue) li\r | |
2312 | .next();\r | |
2313 | nv[i][0] = e.getName();\r | |
2314 | nv[i][1] = e.getValue();\r | |
2315 | \r | |
2316 | i++;\r | |
2317 | }\r | |
2318 | }\r | |
2319 | \r | |
2320 | public void genFvImagesFvImage(String[] names, String types, Map<String, String> options) {\r | |
2321 | \r | |
2322 | FvImagesDocument.FvImages fis = null;\r | |
2323 | if ((fis = getfpdFlash().getFvImages()) == null) {\r | |
2324 | fis = getfpdFlash().addNewFvImages();\r | |
2325 | }\r | |
2326 | \r | |
2327 | //\r | |
2328 | //gen FvImage with FvImageNames array\r | |
2329 | //\r | |
2330 | FvImagesDocument.FvImages.FvImage fi = fis.addNewFvImage();\r | |
2331 | for (int i = 0; i < names.length; ++i) {\r | |
2332 | fi.addFvImageNames(names[i]);\r | |
2333 | }\r | |
2334 | fi.setType(FvImageTypes.Enum.forString(types));\r | |
2335 | if (options != null){\r | |
2336 | setFvImagesFvImageFvImageOptions(options, fi);\r | |
2337 | }\r | |
2338 | }\r | |
2339 | \r | |
2340 | private void setFvImagesFvImageFvImageOptions(Map<String, String> options, FvImagesDocument.FvImages.FvImage fi){\r | |
2341 | FvImagesDocument.FvImages.FvImage.FvImageOptions fio = fi.getFvImageOptions();\r | |
2342 | if (fio == null){\r | |
2343 | fio = fi.addNewFvImageOptions();\r | |
2344 | }\r | |
2345 | \r | |
2346 | Set<String> key = options.keySet();\r | |
2347 | Iterator<String> i = key.iterator();\r | |
2348 | while (i.hasNext()) {\r | |
44053733 | 2349 | \r |
a13899c5 | 2350 | FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fio.addNewNameValue();\r |
2351 | String k = (String)i.next();\r | |
ae0d4fd2 | 2352 | \r |
a13899c5 | 2353 | nv.setName(k);\r |
2354 | nv.setValue((String)options.get(k));\r | |
2355 | \r | |
2356 | }\r | |
2357 | \r | |
2358 | }\r | |
2359 | \r | |
44053733 | 2360 | \r |
a13899c5 | 2361 | public void removeFvImagesFvImage(int i) {\r |
2362 | \r | |
2363 | XmlObject o = getfpdFlash().getFvImages();\r | |
2364 | if (o == null) {\r | |
2365 | return;\r | |
2366 | }\r | |
2367 | \r | |
2368 | QName qFvImage = new QName(xmlNs, "FvImage");\r | |
2369 | XmlCursor cursor = o.newCursor();\r | |
2370 | if (cursor.toChild(qFvImage)) {\r | |
2371 | for (int j = 0; j < i; ++j) {\r | |
2372 | cursor.toNextSibling(qFvImage);\r | |
2373 | }\r | |
2374 | cursor.removeXml();\r | |
2375 | }\r | |
2376 | cursor.dispose();\r | |
2377 | }\r | |
2378 | \r | |
2379 | public void updateFvImagesFvImage(int i, String[] names, String types, Map<String, String> options){\r | |
2380 | \r | |
2381 | XmlObject o = getfpdFlash().getFvImages();\r | |
2382 | if (o == null) {\r | |
2383 | return;\r | |
2384 | }\r | |
2385 | XmlCursor cursor = o.newCursor();\r | |
2386 | QName qFvImage = new QName(xmlNs, "FvImage");\r | |
2387 | if (cursor.toChild(qFvImage)) {\r | |
2388 | for (int j = 0; j < i; ++j) {\r | |
2389 | cursor.toNextSibling(qFvImage);\r | |
2390 | }\r | |
2391 | FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r | |
2392 | fi.setType(FvImageTypes.Enum.forString(types));\r | |
2393 | \r | |
2394 | //\r | |
2395 | // remove old FvImageNames before adding new ones\r | |
2396 | //\r | |
2397 | QName qFvImageNames = new QName(xmlNs, "FvImageNames"); \r | |
2398 | cursor.toChild(qFvImageNames);\r | |
2399 | cursor.removeXml();\r | |
2400 | while (cursor.toNextSibling(qFvImageNames)) {\r | |
2401 | cursor.removeXml();\r | |
2402 | }\r | |
2403 | \r | |
2404 | for (int k = 0; k < names.length; ++k) {\r | |
2405 | fi.addFvImageNames(names[k]);\r | |
2406 | }\r | |
2407 | //\r | |
2408 | // remove old FvImageOptions before adding new options\r | |
2409 | //\r | |
2410 | QName qFvImageOptions = new QName(xmlNs, "FvImageOptions");\r | |
2411 | cursor.toNextSibling(qFvImageOptions);\r | |
2412 | cursor.removeXml();\r | |
2413 | \r | |
2414 | setFvImagesFvImageFvImageOptions(options, fi);\r | |
2415 | }\r | |
2416 | cursor.dispose();\r | |
2417 | }\r | |
2418 | \r | |
2419 | public int getFvImagesFvImageCount() {\r | |
2420 | \r | |
2421 | if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r | |
2422 | return 0;\r | |
2423 | }\r | |
2424 | return getfpdFlash().getFvImages().getFvImageList().size();\r | |
2425 | }\r | |
2426 | \r | |
ae0d4fd2 | 2427 | /**Only Get Fv image setting - name and type.\r |
2428 | * @param saa\r | |
2429 | */\r | |
2430 | public void getFvImagesFvImages(String[][] saa) {\r | |
a13899c5 | 2431 | \r |
2432 | if (getfpdFlash().getFvImages() == null) {\r | |
2433 | return;\r | |
2434 | }\r | |
2435 | List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r | |
2436 | if (l == null) {\r | |
2437 | return;\r | |
2438 | }\r | |
2439 | ListIterator li = l.listIterator();\r | |
2440 | int i = 0;\r | |
2441 | while(li.hasNext()) {\r | |
2442 | FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r | |
2443 | //\r | |
2444 | // get FvImageNames array, space separated\r | |
2445 | //\r | |
2446 | List<String> lfn = fi.getFvImageNamesList();\r | |
2447 | ListIterator lfni = lfn.listIterator();\r | |
2448 | saa[i][0] = " ";\r | |
2449 | while (lfni.hasNext()) {\r | |
2450 | saa[i][0] += (String)lfni.next();\r | |
2451 | saa[i][0] += " ";\r | |
2452 | }\r | |
2453 | saa[i][0] = saa[i][0].trim();\r | |
2454 | \r | |
2455 | saa[i][1] = fi.getType()+"";\r | |
2456 | \r | |
ae0d4fd2 | 2457 | ++i;\r |
2458 | }\r | |
2459 | }\r | |
2460 | \r | |
2461 | /**Get FvImage Options for FvImage i\r | |
2462 | * @param i the ith FvImage\r | |
2463 | */\r | |
2464 | public void getFvImagesFvImageOptions(int i, Map<String, String> m) {\r | |
2465 | XmlObject o = getfpdFlash().getFvImages();\r | |
2466 | if (o == null) {\r | |
2467 | return;\r | |
2468 | }\r | |
2469 | XmlCursor cursor = o.newCursor();\r | |
2470 | QName qFvImage = new QName(xmlNs, "FvImage");\r | |
2471 | if (cursor.toChild(qFvImage)) {\r | |
2472 | for (int j = 0; j < i; ++j) {\r | |
2473 | cursor.toNextSibling(qFvImage);\r | |
a13899c5 | 2474 | }\r |
ae0d4fd2 | 2475 | FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r |
2476 | if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null){\r | |
2477 | return;\r | |
a13899c5 | 2478 | }\r |
ae0d4fd2 | 2479 | ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();\r |
2480 | while(li.hasNext()){\r | |
2481 | FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();\r | |
a13899c5 | 2482 | m.put(nv.getName(), nv.getValue());\r |
2483 | }\r | |
a13899c5 | 2484 | }\r |
2485 | }\r | |
2486 | \r | |
2487 | /**\r | |
2488 | Get platform header element\r | |
2489 | @return PlatformHeaderDocument.PlatformHeader\r | |
2490 | **/\r | |
2491 | public PlatformHeaderDocument.PlatformHeader getFpdHdr() {\r | |
2492 | if (fpdHdr == null) {\r | |
2493 | fpdHdr = fpdRoot.addNewPlatformHeader();\r | |
2494 | }\r | |
1faac7b6 | 2495 | \r |
a13899c5 | 2496 | return fpdHdr;\r |
2497 | }\r | |
2498 | \r | |
a13899c5 | 2499 | public String getFpdHdrPlatformName() {\r |
2500 | return getFpdHdr().getPlatformName();\r | |
2501 | }\r | |
2502 | \r | |
2503 | public String getFpdHdrGuidValue() {\r | |
2504 | return getFpdHdr().getGuidValue();\r | |
2505 | }\r | |
2506 | \r | |
2507 | public String getFpdHdrVer() {\r | |
2508 | return getFpdHdr().getVersion();\r | |
2509 | }\r | |
2510 | \r | |
2511 | public String getFpdHdrAbs() {\r | |
2512 | return getFpdHdr().getAbstract();\r | |
2513 | }\r | |
2514 | \r | |
2515 | public String getFpdHdrDescription() {\r | |
2516 | return getFpdHdr().getDescription();\r | |
2517 | }\r | |
2518 | \r | |
2519 | public String getFpdHdrCopyright() {\r | |
2520 | return getFpdHdr().getCopyright();\r | |
2521 | }\r | |
2522 | \r | |
2523 | public String getFpdHdrLicense() {\r | |
2524 | LicenseDocument.License l = getFpdHdr().getLicense();\r | |
2525 | if (l == null) {\r | |
2526 | return null;\r | |
2527 | }\r | |
2528 | return l.getStringValue();\r | |
2529 | }\r | |
2530 | \r | |
2531 | public String getFpdHdrUrl() {\r | |
2532 | LicenseDocument.License l = getFpdHdr().getLicense();\r | |
2533 | if (l == null) {\r | |
2534 | return null;\r | |
2535 | }\r | |
2536 | return l.getURL();\r | |
2537 | }\r | |
2538 | \r | |
2539 | public String getFpdHdrSpec() {\r | |
2540 | \r | |
c06e8657 | 2541 | return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r |
a13899c5 | 2542 | // return getFpdHdr().getSpecification();\r |
2543 | }\r | |
2544 | \r | |
2545 | public void setFpdHdrPlatformName(String name){\r | |
2546 | getFpdHdr().setPlatformName(name);\r | |
2547 | }\r | |
2548 | \r | |
2549 | public void setFpdHdrGuidValue(String guid){\r | |
2550 | getFpdHdr().setGuidValue(guid);\r | |
2551 | }\r | |
2552 | \r | |
2553 | public void setFpdHdrVer(String v){\r | |
2554 | getFpdHdr().setVersion(v);\r | |
2555 | }\r | |
2556 | \r | |
2557 | public void setFpdHdrAbs(String abs) {\r | |
2558 | getFpdHdr().setAbstract(abs);\r | |
2559 | }\r | |
2560 | \r | |
2561 | public void setFpdHdrDescription(String desc){\r | |
2562 | getFpdHdr().setDescription(desc);\r | |
2563 | }\r | |
2564 | \r | |
2565 | public void setFpdHdrCopyright(String cr) {\r | |
2566 | getFpdHdr().setCopyright(cr);\r | |
2567 | }\r | |
2568 | \r | |
2569 | public void setFpdHdrLicense(String license){\r | |
2570 | LicenseDocument.License l = getFpdHdr().getLicense();\r | |
2571 | if (l == null) {\r | |
2572 | getFpdHdr().addNewLicense().setStringValue(license);\r | |
2573 | }\r | |
2574 | else {\r | |
2575 | l.setStringValue(license);\r | |
2576 | }\r | |
2577 | }\r | |
2578 | \r | |
2579 | public void setFpdHdrUrl(String url){\r | |
2580 | LicenseDocument.License l = getFpdHdr().getLicense();\r | |
2581 | \r | |
2582 | l.setURL(url);\r | |
2583 | \r | |
2584 | }\r | |
2585 | \r | |
2586 | public void setFpdHdrSpec(String s){\r | |
c06e8657 | 2587 | s = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r |
a13899c5 | 2588 | getFpdHdr().setSpecification(s);\r |
2589 | }\r | |
2590 | /**\r | |
2591 | Save the processed xml contents to file\r | |
2592 | \r | |
2593 | @param fpdFile The file to save xml contents\r | |
2594 | @throws IOException Exceptions during file operation\r | |
2595 | **/\r | |
2596 | public void saveAs(File fpdFile) throws IOException {\r | |
2597 | \r | |
2598 | XmlOptions options = new XmlOptions();\r | |
2599 | \r | |
2600 | options.setCharacterEncoding("UTF-8");\r | |
2601 | options.setSavePrettyPrint();\r | |
2602 | options.setSavePrettyPrintIndent(2);\r | |
2603 | try {\r | |
2604 | fpdd.save(fpdFile, options);\r | |
2605 | } catch (IOException e) {\r | |
2606 | e.printStackTrace();\r | |
2607 | }\r | |
2608 | \r | |
2609 | }\r | |
2610 | \r | |
1800d80f | 2611 | private String listToString(List l) {\r |
a13899c5 | 2612 | if (l == null) {\r |
2613 | return null;\r | |
2614 | }\r | |
2615 | String s = " ";\r | |
2616 | ListIterator li = l.listIterator();\r | |
2617 | while(li.hasNext()) {\r | |
2618 | s += li.next();\r | |
2619 | s += " ";\r | |
2620 | }\r | |
2621 | return s.trim();\r | |
2622 | }\r | |
e232295e | 2623 | \r |
2624 | private void removeElement(XmlObject o) {\r | |
2625 | XmlCursor cursor = o.newCursor();\r | |
2626 | cursor.removeXml();\r | |
2627 | cursor.dispose();\r | |
2628 | }\r | |
a13899c5 | 2629 | }\r |
82961247 | 2630 | \r |
2631 | class PcdItemTypeConflictException extends Exception {\r | |
2632 | \r | |
2633 | /**\r | |
2634 | * \r | |
2635 | */\r | |
2636 | private static final long serialVersionUID = 1L;\r | |
2637 | private String details = null;\r | |
2638 | \r | |
34c614e1 | 2639 | PcdItemTypeConflictException(String pcdName, String info){\r |
2640 | ModuleIdentification mi = GlobalData.getModuleId(info);\r | |
2641 | details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();\r | |
82961247 | 2642 | }\r |
2643 | \r | |
2644 | public String getMessage() {\r | |
2645 | return details;\r | |
2646 | }\r | |
2647 | }\r | |
2648 | \r | |
2649 | class PcdDeclNotFound extends Exception {\r | |
2650 | \r | |
2651 | /**\r | |
2652 | * \r | |
2653 | */\r | |
2654 | private static final long serialVersionUID = 1L;\r | |
2655 | private String details = null;\r | |
2656 | \r | |
2657 | PcdDeclNotFound(String info) {\r | |
4da2e625 | 2658 | details = "PcdDeclNotFound: " + info;\r |
82961247 | 2659 | }\r |
2660 | \r | |
2661 | public String getMessage() {\r | |
2662 | return details;\r | |
2663 | }\r | |
2664 | }\r | |
2665 | \r | |
2666 | class PcdValueMalFormed extends Exception {\r | |
2667 | \r | |
2668 | /**\r | |
2669 | * \r | |
2670 | */\r | |
2671 | private static final long serialVersionUID = 1L;\r | |
2672 | private String details = null;\r | |
2673 | \r | |
2674 | PcdValueMalFormed(String info) {\r | |
4da2e625 | 2675 | details = "PcdValueMalFormed: " + info;\r |
82961247 | 2676 | }\r |
2677 | \r | |
2678 | public String getMessage() {\r | |
2679 | return details;\r | |
2680 | }\r | |
2681 | }\r |