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