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