2 Java class FpdFileContents is used to parse fpd xml file.
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
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.
13 package org
.tianocore
.frameworkwizard
.platform
.ui
;
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
;
26 import java
.util
.Vector
;
28 import javax
.xml
.namespace
.QName
;
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
;
65 This class processes fpd file contents such as add remove xml elements.
66 @since PackageEditor 1.0
68 public class FpdFileContents
{
70 static final String xmlNs
= "http://www.TianoCore.org/2006/Edk2.0";
72 private PlatformSurfaceAreaDocument fpdd
= null;
74 private PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpdRoot
= null;
76 private PlatformHeaderDocument
.PlatformHeader fpdHdr
= null;
78 private PlatformDefinitionsDocument
.PlatformDefinitions fpdPlatformDefs
= null;
80 private FlashDocument
.Flash fpdFlash
= null;
82 private BuildOptionsDocument
.BuildOptions fpdBuildOpts
= null;
84 private FrameworkModulesDocument
.FrameworkModules fpdFrameworkModules
= null;
86 private DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions fpdDynPcdBuildDefs
= null;
88 public static HashMap
<String
, ArrayList
<String
>> dynPcdMap
= null;
91 * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.
93 public void initDynPcdMap() {
94 if (dynPcdMap
== null) {
95 dynPcdMap
= new HashMap
<String
, ArrayList
<String
>>();
96 List
<ModuleSADocument
.ModuleSA
> l
= getfpdFrameworkModules().getModuleSAList();
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) {
106 String ModuleInfo
= msa
.getModuleGuid() + " " + msa
.getModuleVersion() +
107 " " + msa
.getPackageGuid() + " " + msa
.getPackageVersion();
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
);
119 dynPcdMap
.get(pcdKey
).add(ModuleInfo
+ " " + pcdData
.getItemType().toString());
126 Constructor to create a new spd file
128 public FpdFileContents() {
130 fpdd
= PlatformSurfaceAreaDocument
.Factory
.newInstance();
131 fpdRoot
= fpdd
.addNewPlatformSurfaceArea();
136 Constructor for existing document object
139 public FpdFileContents(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
141 fpdHdr
= fpdRoot
.getPlatformHeader();
142 fpdPlatformDefs
= fpdRoot
.getPlatformDefinitions();
143 fpdBuildOpts
= fpdRoot
.getBuildOptions();
144 fpdFrameworkModules
= fpdRoot
.getFrameworkModules();
145 fpdDynPcdBuildDefs
= fpdRoot
.getDynamicPcdBuildDefinitions();
146 fpdFlash
= fpdRoot
.getFlash();
150 Constructor based on an existing spd file
152 @param f Existing spd file
154 public FpdFileContents(File f
) {
156 fpdd
= PlatformSurfaceAreaDocument
.Factory
.parse(f
);
157 fpdRoot
= fpdd
.getPlatformSurfaceArea();
158 } catch (Exception e
) {
159 System
.out
.println(e
.toString());
163 public DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
getfpdDynPcdBuildDefs() {
164 if (fpdDynPcdBuildDefs
== null){
165 fpdDynPcdBuildDefs
= fpdRoot
.addNewDynamicPcdBuildDefinitions();
167 return fpdDynPcdBuildDefs
;
170 public FrameworkModulesDocument
.FrameworkModules
getfpdFrameworkModules() {
171 if (fpdFrameworkModules
== null){
172 fpdFrameworkModules
= fpdRoot
.addNewFrameworkModules();
174 return fpdFrameworkModules
;
177 public int getFrameworkModulesCount() {
178 if (getfpdFrameworkModules().getModuleSAList() == null){
181 return getfpdFrameworkModules().getModuleSAList().size();
184 public void getFrameworkModulesInfo(String
[][] saa
) {
185 if (getFrameworkModulesCount() == 0){
189 ListIterator li
= getfpdFrameworkModules().getModuleSAList().listIterator();
191 while(li
.hasNext()) {
192 ModuleSADocument
.ModuleSA msa
= (ModuleSADocument
.ModuleSA
)li
.next();
193 saa
[i
][1] = msa
.getModuleGuid();
194 saa
[i
][2] = msa
.getModuleVersion();
196 saa
[i
][3] = msa
.getPackageGuid();
197 saa
[i
][4] = msa
.getPackageVersion();
198 // saa[i][4] = listToString(msa.getSupArchList());
203 public ModuleSADocument
.ModuleSA
getModuleSA(String key
) {
204 String
[] s
= key
.split(" ");
205 if (getfpdFrameworkModules().getModuleSAList() == null) {
208 ListIterator li
= getfpdFrameworkModules().getModuleSAList().listIterator();
209 while(li
.hasNext()) {
210 ModuleSADocument
.ModuleSA msa
= (ModuleSADocument
.ModuleSA
)li
.next();
211 if (msa
.getModuleGuid().equals(s
[0]) && msa
.getModuleVersion().equals(s
[1])
212 && msa
.getPackageGuid().equals(s
[2]) && msa
.getPackageVersion().equals(s
[3])) {
219 public void removeModuleSA(int i
) {
220 XmlObject o
= getfpdFrameworkModules();
225 XmlCursor cursor
= o
.newCursor();
226 if (cursor
.toFirstChild()) {
227 for (int j
= 0; j
< i
; ++j
) {
228 cursor
.toNextSibling();
231 // remove pcd from dynPcdMap, if DynamicPcdBuildData exists, remove them too.
233 ModuleSADocument
.ModuleSA moduleSa
= (ModuleSADocument
.ModuleSA
)cursor
.getObject();
234 String moduleInfo
= moduleSa
.getModuleGuid() + " " + moduleSa
.getModuleVersion() + " " +
235 moduleSa
.getPackageGuid()+ " " + moduleSa
.getPackageVersion();
236 PcdBuildDefinitionDocument
.PcdBuildDefinition pcdBuildDef
= moduleSa
.getPcdBuildDefinition();
237 if (pcdBuildDef
!= null) {
238 maintainDynPcdMap(pcdBuildDef
, moduleInfo
);
245 private void maintainDynPcdMap(PcdBuildDefinitionDocument
.PcdBuildDefinition o
, String moduleInfo
) {
246 XmlCursor cursor
= o
.newCursor();
247 boolean fromLibInstance
= false;
248 if (!cursor
.toFirstChild()){
252 // deal with first child, same process in the while loop below for siblings.
254 PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData pcdData
= (PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData
)cursor
.getObject();
255 String pcdKey
= pcdData
.getCName() + " " + pcdData
.getTokenSpaceGuidCName();
256 ArrayList
<String
> al
= dynPcdMap
.get(pcdKey
);
257 for(int i
= 0; i
< al
.size(); ++i
){
258 if (al
.get(i
).startsWith(moduleInfo
)){
259 fromLibInstance
= true;
263 al
.remove(moduleInfo
+ " " + pcdData
.getItemType().toString());
264 if (al
.size() == 0) {
265 dynPcdMap
.remove(pcdKey
);
268 if (pcdData
.getItemType().toString().equals("DYNAMIC")) {
269 if (dynPcdMap
.get(pcdKey
) == null) {
270 removeDynamicPcdBuildData(pcdData
.getCName(), pcdData
.getTokenSpaceGuidCName());
273 if (fromLibInstance
){
276 while(cursor
.toNextSibling()) {
277 fromLibInstance
= false;
278 pcdData
= (PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData
)cursor
.getObject();
280 // remove each pcd record from dynPcdMap
282 pcdKey
= pcdData
.getCName() + " " + pcdData
.getTokenSpaceGuidCName();
283 al
= dynPcdMap
.get(pcdKey
);
284 for(int i
= 0; i
< al
.size(); ++i
){
285 if (al
.get(i
).startsWith(moduleInfo
)){
286 fromLibInstance
= true;
290 al
.remove(moduleInfo
+ " " + pcdData
.getItemType().toString());
291 if (al
.size() == 0) {
292 dynPcdMap
.remove(pcdKey
);
295 if (pcdData
.getItemType().toString().equals("DYNAMIC")) {
297 // First check whether this is the only consumer of this dyn pcd.
299 if (dynPcdMap
.get(pcdKey
) == null) {
301 // delete corresponding entry in DynamicPcdBuildData
303 removeDynamicPcdBuildData(pcdData
.getCName(), pcdData
.getTokenSpaceGuidCName());
306 if (fromLibInstance
){
312 // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer"
314 public int getPcdDataCount(String key
){
315 ModuleSADocument
.ModuleSA msa
= getModuleSA(key
);
316 if (msa
== null || msa
.getPcdBuildDefinition() == null || msa
.getPcdBuildDefinition().getPcdDataList() == null){
319 return msa
.getPcdBuildDefinition().getPcdDataList().size();
322 public void getPcdData(String key
, String
[][] saa
) {
323 ModuleSADocument
.ModuleSA msa
= getModuleSA(key
);
324 if (msa
== null || msa
.getPcdBuildDefinition() == null || msa
.getPcdBuildDefinition().getPcdDataList() == null){
327 ListIterator
<PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData
>li
= msa
.getPcdBuildDefinition().getPcdDataList().listIterator();
328 for (int i
= 0; i
< saa
.length
; ++i
) {
329 PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData pcdData
= li
.next();
330 saa
[i
][0] = pcdData
.getCName();
331 saa
[i
][1] = pcdData
.getTokenSpaceGuidCName();
332 saa
[i
][2] = pcdData
.getItemType().toString();
333 saa
[i
][3] = pcdData
.getToken().toString();
334 saa
[i
][4] = pcdData
.getDatumType().toString();
335 saa
[i
][5] = pcdData
.getValue();
340 // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer"
342 public int getLibraryInstancesCount(String key
) {
343 ModuleSADocument
.ModuleSA msa
= getModuleSA(key
);
344 if (msa
== null || msa
.getLibraries() == null || msa
.getLibraries().getInstanceList() == null){
347 return msa
.getLibraries().getInstanceList().size();
350 public void getLibraryInstances(String key
, String
[][] saa
){
351 ModuleSADocument
.ModuleSA msa
= getModuleSA(key
);
352 if (msa
== null || msa
.getLibraries() == null || msa
.getLibraries().getInstanceList() == null){
356 ListIterator
<LibrariesDocument
.Libraries
.Instance
> li
= msa
.getLibraries().getInstanceList().listIterator();
357 for (int i
= 0; i
< saa
.length
; ++i
) {
358 LibrariesDocument
.Libraries
.Instance instance
= li
.next();
359 saa
[i
][1] = instance
.getModuleGuid();
360 saa
[i
][2] = instance
.getModuleVersion();
361 saa
[i
][3] = instance
.getPackageGuid();
362 saa
[i
][4] = instance
.getPackageVersion();
366 public void removeLibraryInstances(String key
) {
367 ModuleSADocument
.ModuleSA msa
= getModuleSA(key
);
368 if (msa
== null || msa
.getLibraries() == null){
372 XmlCursor cursor
= msa
.getLibraries().newCursor();
377 public void genLibraryInstance(String mg
, String mv
, String pg
, String pv
, String key
) {
378 ModuleSADocument
.ModuleSA msa
= getModuleSA(key
);
380 msa
= getfpdFrameworkModules().addNewModuleSA();
382 LibrariesDocument
.Libraries libs
= msa
.getLibraries();
384 libs
= msa
.addNewLibraries();
387 LibrariesDocument
.Libraries
.Instance instance
= libs
.addNewInstance();
388 instance
.setModuleGuid(mg
);
389 instance
.setModuleVersion(mv
);
390 instance
.setPackageGuid(pg
);
391 instance
.setPackageVersion(pv
);
394 /**add pcd information of module mi to a ModuleSA.
396 * @param moduleSa if null, generate a new ModuleSA.
398 public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi
, ModuleSADocument
.ModuleSA moduleSa
){
399 //ToDo add Arch filter
402 ModuleSurfaceAreaDocument
.ModuleSurfaceArea msa
= (ModuleSurfaceAreaDocument
.ModuleSurfaceArea
)GlobalData
.getModuleXmlObject(mi
);
403 if (msa
.getPcdCoded() == null) {
406 if (moduleSa
== null) {
407 moduleSa
= genModuleSA(mi
);
409 Map
<String
, XmlObject
> m
= new HashMap
<String
, XmlObject
>();
410 m
.put("ModuleSurfaceArea", msa
);
411 SurfaceAreaQuery
.setDoc(m
);
412 PackageIdentification
[] depPkgs
= SurfaceAreaQuery
.getDependencePkg(null);
414 // Implementing InitializePlatformPcdBuildDefinitions
416 List
<PcdCodedDocument
.PcdCoded
.PcdEntry
> l
= msa
.getPcdCoded().getPcdEntryList();
417 ListIterator li
= l
.listIterator();
418 while(li
.hasNext()) {
419 PcdCodedDocument
.PcdCoded
.PcdEntry msaPcd
= (PcdCodedDocument
.PcdCoded
.PcdEntry
)li
.next();
420 PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry spdPcd
= LookupPcdDeclaration(msaPcd
, depPkgs
);
421 if (spdPcd
== null) {
428 // AddItem to ModuleSA PcdBuildDefinitions
430 String defaultVal
= msaPcd
.getDefaultValue() == null ? spdPcd
.getDefaultValue() : msaPcd
.getDefaultValue();
431 genPcdData(msaPcd
.getCName(), spdPcd
.getToken(), msaPcd
.getTokenSpaceGuidCName(), msaPcd
.getPcdItemType().toString(), spdPcd
.getDatumType()+"", defaultVal
, moduleSa
);
441 private PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry
LookupPcdDeclaration (PcdCodedDocument
.PcdCoded
.PcdEntry msaPcd
, PackageIdentification
[] depPkgs
) {
443 Map
<String
, XmlObject
> m
= new HashMap
<String
, XmlObject
>();
444 PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry spdPcd
= null;
445 for (int i
= 0; i
< depPkgs
.length
; ++i
) {
446 m
.put("PackageSurfaceArea", GlobalData
.getPackageXmlObject(depPkgs
[i
]));
447 SurfaceAreaQuery
.setDoc(m
);
448 XmlObject
[] xo
= SurfaceAreaQuery
.getSpdPcdDeclarations();
452 for (int j
= 0; j
< xo
.length
; ++j
) {
453 spdPcd
= (PcdDeclarationsDocument
.PcdDeclarations
.PcdEntry
)xo
[j
];
454 if (msaPcd
.getTokenSpaceGuidCName() == null) {
455 if (spdPcd
.getCName().equals(msaPcd
.getCName())) {
460 if (spdPcd
.getCName().equals(msaPcd
.getCName()) && spdPcd
.getTokenSpaceGuidCName().equals(msaPcd
.getTokenSpaceGuidCName())) {
471 private ModuleSADocument
.ModuleSA
genModuleSA (ModuleIdentification mi
) {
472 PackageIdentification pi
= GlobalData
.getPackageForModule(mi
);
473 ModuleSADocument
.ModuleSA msa
= getfpdFrameworkModules().addNewModuleSA();
474 msa
.setModuleGuid(mi
.getGuid());
475 msa
.setModuleVersion(mi
.getVersion());
476 msa
.setPackageGuid(pi
.getGuid());
477 msa
.setPackageVersion(pi
.getVersion());
482 private void genPcdData (String cName
, Object token
, String tsGuid
, String itemType
, String dataType
, String defaultVal
, ModuleSADocument
.ModuleSA moduleSa
) {
483 if (moduleSa
.getPcdBuildDefinition() == null){
484 moduleSa
.addNewPcdBuildDefinition();
487 // constructe pcd to modulesa mapping first.
488 // Attention : for any error condition, remove from map this pcd.
490 ArrayList
<String
> pcdConsumer
= LookupPlatformPcdData(cName
+ " " + tsGuid
);
491 if (pcdConsumer
== null) {
492 pcdConsumer
= new ArrayList
<String
>();
494 String listValue
= moduleSa
.getModuleGuid() + " " + moduleSa
.getModuleVersion()
495 + " " + moduleSa
.getPackageGuid() + " " + moduleSa
.getPackageVersion()
497 pcdConsumer
.add(listValue
);
498 dynPcdMap
.put(cName
+ " " + tsGuid
, pcdConsumer
);
500 // Special dynamic type, if this pcd already exists in other ModuleSA
502 if (itemType
.equals("DYNAMIC")) {
504 ListIterator li
= pcdConsumer
.listIterator();
505 while(li
.hasNext()) {
506 String value
= li
.next().toString();
507 String
[] valuePart
= value
.split(" ");
508 if (!valuePart
[4].equals("DYNAMIC")) {
509 //ToDo error for same pcd, other type than dynamic
510 pcdConsumer
.remove(listValue
);
516 ListIterator li
= pcdConsumer
.listIterator();
517 while(li
.hasNext()) {
518 String value
= li
.next().toString();
519 String
[] valuePart
= value
.split(" ");
520 if (valuePart
[4].equals("DYNAMIC")) {
521 //ToDo error for same pcd, other type than non-dynamic
522 pcdConsumer
.remove(listValue
);
528 PcdBuildDefinitionDocument
.PcdBuildDefinition
.PcdData fpdPcd
= moduleSa
.getPcdBuildDefinition().addNewPcdData();
529 fpdPcd
.setCName(cName
);
530 fpdPcd
.setToken(token
);
531 fpdPcd
.setTokenSpaceGuidCName(tsGuid
);
532 fpdPcd
.setDatumType(PcdDataTypes
.Enum
.forString(dataType
));
533 fpdPcd
.setItemType(PcdItemTypes
.Enum
.forString(itemType
));
535 if (itemType
.equals("DYNAMIC") || itemType
.equals("DYNAMIC_EX")) {
536 ArrayList
<String
> al
= LookupDynamicPcdBuildDefinition(cName
+ " " + tsGuid
);
538 // if only one module mapped to this pcd, then the one is myself. so no other module mapped.
539 // so need to add one dyn pcd.
541 if (al
.size() == 1) {
542 addDynamicPcdBuildData(cName
, token
, tsGuid
, itemType
, dataType
, defaultVal
);
546 if (defaultVal
!= null){
547 fpdPcd
.setValue(defaultVal
);
550 if (dataType
.equals("UINT8") || dataType
.equals("UINT16") || dataType
.equals("UINT32") || dataType
.equals("UINT64")) {
551 fpdPcd
.setValue("0");
553 if (dataType
.equals("BOOLEAN")){
554 fpdPcd
.setValue("false");
556 if (dataType
.equals("VOID*")) {
560 if (dataType
.equals("UINT8")){
561 fpdPcd
.setMaxDatumSize(1);
563 if (dataType
.equals("UINT16")) {
564 fpdPcd
.setMaxDatumSize(2);
566 if (dataType
.equals("UINT32")) {
567 fpdPcd
.setMaxDatumSize(4);
569 if (dataType
.equals("UINT64")){
570 fpdPcd
.setMaxDatumSize(8);
572 if (dataType
.equals("BOOLEAN")){
573 fpdPcd
.setMaxDatumSize(1);
575 if (dataType
.equals("VOID*")) {
576 int maxSize
= setMaxSizeForPointer(fpdPcd
.getValue());
577 fpdPcd
.setMaxDatumSize(maxSize
);
582 private int setMaxSizeForPointer(String datum
) {
586 char ch
= datum
.charAt(0);
590 // For void* type PCD, only three datum is support:
591 // 1) Unicode: string with start char is "L"
592 // 2) Ansci: String is ""
593 // 3) byte array: String start char "{"
596 start
= datum
.indexOf('\"');
597 end
= datum
.lastIndexOf('\"');
599 (end
> datum
.length())||
600 ((start
== end
) && (datum
.length() > 0))) {
601 //ToDo Error handling here
604 strValue
= datum
.substring(start
+ 1, end
);
605 return strValue
.length() * 2;
606 } else if (ch
== '\"'){
607 start
= datum
.indexOf('\"');
608 end
= datum
.lastIndexOf('\"');
610 (end
> datum
.length())||
611 ((start
== end
) && (datum
.length() > 0))) {
614 strValue
= datum
.substring(start
+ 1, end
);
615 return strValue
.length();
616 } else if (ch
=='{') {
617 String
[] strValueArray
;
619 start
= datum
.indexOf('{');
620 end
= datum
.lastIndexOf('}');
621 strValue
= datum
.substring(start
+ 1, end
);
622 strValue
= strValue
.trim();
623 if (strValue
.length() == 0) {
626 strValueArray
= strValue
.split(",");
627 for (int index
= 0; index
< strValueArray
.length
; index
++) {
628 Integer value
= Integer
.decode(strValueArray
[index
].trim());
631 // "[FPD file error] The datum type of PCD %s in %s is VOID*, "+
632 // "it is byte array in fact. But the element of %s exceed the byte range",
636 return strValueArray
.length
;
640 // "[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n "+
641 // "1) UNICODE string: like L\"xxxx\";\r\n"+
642 // "2) ANSIC string: like \"xxx\";\r\n"+
643 // "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+
644 // "but the datum in seems does not following above format!",
650 private ArrayList
<String
> LookupDynamicPcdBuildDefinition(String dynPcdKey
) {
651 ArrayList
<String
> al
= dynPcdMap
.get(dynPcdKey
);
656 private ArrayList
<String
> LookupPlatformPcdData(String pcdKey
) {
658 return dynPcdMap
.get("pcdKey");
661 public int getDynamicPcdBuildDataCount() {
662 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
665 return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();
668 public void getDynamicPcdBuildData(String
[][] saa
) {
669 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
672 List
<DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
> l
= getfpdDynPcdBuildDefs().getPcdBuildDataList();
673 ListIterator
<DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
> li
= l
.listIterator();
675 while(li
.hasNext()) {
676 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData dynPcd
= li
.next();
677 saa
[i
][0] = dynPcd
.getCName();
678 saa
[i
][1] = dynPcd
.getToken().toString();
679 saa
[i
][2] = dynPcd
.getTokenSpaceGuidCName();
680 saa
[i
][3] = dynPcd
.getMaxDatumSize()+"";
681 saa
[i
][4] = dynPcd
.getDatumType().toString();
687 private void addDynamicPcdBuildData(String cName
, Object token
, String tsGuid
, String itemType
, String dataType
, String defaultVal
) {
688 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData dynPcdData
= getfpdDynPcdBuildDefs().addNewPcdBuildData();
689 dynPcdData
.setItemType(PcdItemTypes
.Enum
.forString(itemType
));
690 dynPcdData
.setCName(cName
);
691 dynPcdData
.setToken(token
);
692 dynPcdData
.setTokenSpaceGuidCName(tsGuid
);
693 dynPcdData
.setDatumType(PcdDataTypes
.Enum
.forString(dataType
));
695 BigInteger bigInt
= new BigInteger("0");
696 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
.SkuInfo skuInfo
= dynPcdData
.addNewSkuInfo();
697 skuInfo
.setSkuId(bigInt
);
698 if (defaultVal
!= null){
699 skuInfo
.setValue(defaultVal
);
702 if (dataType
.equals("UINT8")){
703 skuInfo
.setValue("0");
705 if (dataType
.equals("UINT16")) {
706 skuInfo
.setValue("0");
708 if (dataType
.equals("UINT32")) {
709 skuInfo
.setValue("0");
711 if (dataType
.equals("UINT64")){
712 skuInfo
.setValue("0");
714 if (dataType
.equals("BOOLEAN")){
715 skuInfo
.setValue("false");
717 if (dataType
.equals("VOID*")) {
718 skuInfo
.setValue("");
721 if (dataType
.equals("UINT8")){
722 dynPcdData
.setMaxDatumSize(1);
724 if (dataType
.equals("UINT16")) {
725 dynPcdData
.setMaxDatumSize(2);
727 if (dataType
.equals("UINT32")) {
728 dynPcdData
.setMaxDatumSize(4);
730 if (dataType
.equals("UINT64")){
731 dynPcdData
.setMaxDatumSize(8);
733 if (dataType
.equals("BOOLEAN")){
734 dynPcdData
.setMaxDatumSize(1);
736 if (dataType
.equals("VOID*")) {
737 int maxSize
= setMaxSizeForPointer(defaultVal
);
738 dynPcdData
.setMaxDatumSize(maxSize
);
742 private void removeDynamicPcdBuildData(String cName
, String tsGuid
) {
743 XmlObject o
= getfpdDynPcdBuildDefs();
745 XmlCursor cursor
= o
.newCursor();
746 if (cursor
.toFirstChild()) {
747 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdBuildData
=
748 (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
749 while (!(pcdBuildData
.getCName().equals(cName
) && pcdBuildData
.getTokenSpaceGuidCName().equals(tsGuid
))) {
750 cursor
.toNextSibling();
751 pcdBuildData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
759 // Get the Sku Info count of ith dyn pcd element.
761 public int getDynamicPcdSkuInfoCount(int i
){
762 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
766 int skuInfoCount
= 0;
767 XmlCursor cursor
= getfpdDynPcdBuildDefs().newCursor();
768 if (cursor
.toFirstChild()) {
769 for (int j
= 0; j
< i
; ++j
) {
770 cursor
.toNextSibling();
772 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
773 if (pcdData
.getSkuInfoList() == null) {
777 skuInfoCount
= pcdData
.getSkuInfoList().size();
784 public void getDynamicPcdSkuInfos(int i
, String
[][] saa
){
785 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
789 XmlCursor cursor
= getfpdDynPcdBuildDefs().newCursor();
790 if (cursor
.toFirstChild()) {
791 for (int j
= 0; j
< i
; ++j
) {
792 cursor
.toNextSibling();
794 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
795 if (pcdData
.getSkuInfoList() == null) {
800 ListIterator
<DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
.SkuInfo
> li
= pcdData
.getSkuInfoList().listIterator();
802 while (li
.hasNext()) {
803 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
.SkuInfo skuInfo
= li
.next();
804 saa
[k
][0] = skuInfo
.getSkuId()+"";
805 saa
[k
][1] = skuInfo
.getVariableName();
806 saa
[k
][2] = skuInfo
.getVariableGuid();
807 saa
[k
][3] = skuInfo
.getVariableOffset();
808 saa
[k
][4] = skuInfo
.getHiiDefaultValue();
809 saa
[k
][5] = skuInfo
.getVpdOffset();
810 saa
[k
][6] = skuInfo
.getValue();
820 public String
getDynamicPcdBuildDataValue(int i
){
822 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
826 XmlCursor cursor
= getfpdDynPcdBuildDefs().newCursor();
827 if (cursor
.toFirstChild()) {
828 for (int j
= 0; j
< i
; ++j
) {
829 cursor
.toNextSibling();
831 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
832 if (pcdData
.getSkuInfoList() == null) {
836 value
= pcdData
.getSkuInfoArray(0).getValue();
843 public String
getDynamicPcdBuildDataVpdOffset(int i
){
844 String vpdOffset
= null;
845 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
849 XmlCursor cursor
= getfpdDynPcdBuildDefs().newCursor();
850 if (cursor
.toFirstChild()) {
851 for (int j
= 0; j
< i
; ++j
) {
852 cursor
.toNextSibling();
854 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
855 if (pcdData
.getSkuInfoList() == null) {
859 vpdOffset
= pcdData
.getSkuInfoArray(0).getVpdOffset();
866 public void removeDynamicPcdBuildDataSkuInfo(int i
) {
867 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
871 XmlCursor cursor
= getfpdDynPcdBuildDefs().newCursor();
872 if (cursor
.toFirstChild()) {
873 for (int j
= 0; j
< i
; ++j
) {
874 cursor
.toNextSibling();
876 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
877 if (pcdData
.getSkuInfoList() == null) {
882 QName qSkuInfo
= new QName(xmlNs
, "SkuInfo");
883 cursor
.toChild(qSkuInfo
);
890 // generate sku info for ith dyn pcd build data.
892 public void genDynamicPcdBuildDataSkuInfo(String id
, String varName
, String varGuid
, String varOffset
,
893 String hiiDefault
, String vpdOffset
, String value
, int i
) {
894 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
898 XmlCursor cursor
= getfpdDynPcdBuildDefs().newCursor();
899 if (cursor
.toFirstChild()) {
900 for (int j
= 0; j
< i
; ++j
) {
901 cursor
.toNextSibling();
903 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
904 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
.SkuInfo skuInfo
= pcdData
.addNewSkuInfo();
905 skuInfo
.setSkuId(new BigInteger(id
));
906 if (varName
!= null){
907 skuInfo
.setVariableName(varName
);
908 skuInfo
.setVariableGuid(varGuid
);
909 skuInfo
.setVariableOffset(varOffset
);
910 skuInfo
.setHiiDefaultValue(hiiDefault
);
912 else if (vpdOffset
!= null){
913 skuInfo
.setVpdOffset(vpdOffset
);
916 skuInfo
.setValue(value
);
921 public void updateDynamicPcdBuildDataSkuInfo(String id
, String varName
, String varGuid
, String varOffset
,
922 String hiiDefault
, String vpdOffset
, String value
, int i
){
923 if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
927 XmlCursor cursor
= getfpdDynPcdBuildDefs().newCursor();
928 if (cursor
.toFirstChild()) {
929 for (int j
= 0; j
< i
; ++j
) {
930 cursor
.toNextSibling();
932 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData pcdData
= (DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
)cursor
.getObject();
933 ListIterator
<DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
.SkuInfo
> li
= pcdData
.getSkuInfoList().listIterator();
934 while (li
.hasNext()) {
935 DynamicPcdBuildDefinitionsDocument
.DynamicPcdBuildDefinitions
.PcdBuildData
.SkuInfo skuInfo
= li
.next();
936 if (skuInfo
.getSkuId().toString().equals(id
)){
937 if (varName
!= null){
938 skuInfo
.setVariableName(varName
);
939 skuInfo
.setVariableGuid(varGuid
);
940 skuInfo
.setVariableOffset(varOffset
);
941 skuInfo
.setHiiDefaultValue(hiiDefault
);
943 else if (vpdOffset
!= null){
944 skuInfo
.setVpdOffset(vpdOffset
);
947 skuInfo
.setValue(value
);
955 public void removePcdDataFromLibraryInstance(String moduleKey
, String libInstanceKey
){
956 ModuleSADocument
.ModuleSA moduleSa
= getModuleSA(moduleKey
);
958 // should better maintain pcd from lib instance only, but maintain all is acceptable now.
960 maintainDynPcdMap(moduleSa
.getPcdBuildDefinition(), libInstanceKey
);
964 public BuildOptionsDocument
.BuildOptions
getfpdBuildOpts() {
965 if (fpdBuildOpts
== null) {
966 fpdBuildOpts
= fpdRoot
.addNewBuildOptions();
971 public void genBuildOptionsUserDefAntTask (String id
, String fileName
, String execOrder
) {
972 UserDefinedAntTasksDocument
.UserDefinedAntTasks udats
= getfpdBuildOpts().getUserDefinedAntTasks();
974 udats
= getfpdBuildOpts().addNewUserDefinedAntTasks();
977 AntTaskDocument
.AntTask at
= udats
.addNewAntTask();
978 setBuildOptionsUserDefAntTask(id
, fileName
, execOrder
, at
);
981 private void setBuildOptionsUserDefAntTask(String id
, String fileName
, String execOrder
, AntTaskDocument
.AntTask at
) {
982 at
.setId(new Integer(id
));
983 if (fileName
!= null){
984 at
.setFilename(fileName
);
986 if (execOrder
!= null) {
987 at
.setAntCmdOptions(execOrder
);
991 public void removeBuildOptionsUserDefAntTask(int i
) {
992 XmlObject o
= getfpdBuildOpts().getUserDefinedAntTasks();
996 XmlCursor cursor
= o
.newCursor();
997 if (cursor
.toFirstChild()) {
998 for (int j
= 0; j
< i
; ++j
) {
999 cursor
.toNextSibling();
1006 public void updateBuildOptionsUserDefAntTask(int i
, String id
, String fileName
, String execOrder
){
1007 XmlObject o
= getfpdBuildOpts().getUserDefinedAntTasks();
1011 XmlCursor cursor
= o
.newCursor();
1012 if (cursor
.toFirstChild()) {
1013 for (int j
= 0; j
< i
; ++j
) {
1014 cursor
.toNextSibling();
1016 AntTaskDocument
.AntTask at
= (AntTaskDocument
.AntTask
)cursor
.getObject();
1017 setBuildOptionsUserDefAntTask(id
, fileName
, execOrder
, at
);
1022 public int getBuildOptionsUserDefAntTaskCount() {
1023 UserDefinedAntTasksDocument
.UserDefinedAntTasks udats
= getfpdBuildOpts().getUserDefinedAntTasks();
1024 if (udats
== null || udats
.getAntTaskList() == null) {
1028 return udats
.getAntTaskList().size();
1031 public void getBuildOptionsUserDefAntTasks(String
[][] saa
) {
1032 UserDefinedAntTasksDocument
.UserDefinedAntTasks udats
= getfpdBuildOpts().getUserDefinedAntTasks();
1033 if (udats
== null || udats
.getAntTaskList() == null) {
1037 List
<AntTaskDocument
.AntTask
> l
= udats
.getAntTaskList();
1038 ListIterator li
= l
.listIterator();
1040 while (li
.hasNext()) {
1041 AntTaskDocument
.AntTask at
= (AntTaskDocument
.AntTask
)li
.next();
1042 saa
[i
][0] = at
.getId() + "";
1043 saa
[i
][1] = saa
[i
][2] = "";
1044 if (at
.getFilename() != null){
1045 saa
[i
][1] = at
.getFilename();
1047 if (at
.getAntCmdOptions() != null) {
1048 saa
[i
][2] = at
.getAntCmdOptions();
1053 public void genBuildOptionsOpt(String buildTargets
, String toolChain
, String tagName
, String toolCmd
, String archList
, String contents
) {
1054 OptionsDocument
.Options opts
= getfpdBuildOpts().getOptions();
1056 opts
= getfpdBuildOpts().addNewOptions();
1058 OptionDocument
.Option opt
= opts
.addNewOption();
1059 setBuildOptionsOpt(buildTargets
, toolChain
, tagName
, toolCmd
, archList
, contents
, opt
);
1062 private void setBuildOptionsOpt(String buildTargets
, String toolChain
, String tagName
, String toolCmd
, String archList
, String contents
, OptionDocument
.Option opt
){
1063 opt
.setStringValue(contents
);
1064 // opt.setBuildTargets(buildTargets);
1065 opt
.setToolChainFamily(toolChain
);
1066 opt
.setTagName(tagName
);
1067 opt
.setToolCode(toolCmd
);
1068 String
[] s
= archList
.split(" ");
1069 ArrayList
<String
> al
= new ArrayList
<String
>();
1070 for (int i
= 0; i
< s
.length
; ++i
) {
1073 opt
.setSupArchList(al
);
1076 public void removeBuildOptionsOpt(int i
){
1078 XmlObject o
= getfpdBuildOpts().getOptions();
1083 XmlCursor cursor
= o
.newCursor();
1084 if (cursor
.toFirstChild()) {
1085 for (int j
= 0; j
< i
; ++j
) {
1086 cursor
.toNextSibling();
1093 public void updateBuildOptionsOpt(int i
, String buildTargets
, String toolChain
, String tagName
, String toolCmd
, String archList
, String contents
) {
1094 XmlObject o
= getfpdBuildOpts().getOptions();
1099 XmlCursor cursor
= o
.newCursor();
1100 if (cursor
.toFirstChild()) {
1101 for (int j
= 0; j
< i
; ++j
) {
1102 cursor
.toNextSibling();
1104 OptionDocument
.Option opt
= (OptionDocument
.Option
)cursor
.getObject();
1105 setBuildOptionsOpt(buildTargets
, toolChain
, tagName
, toolCmd
, archList
, contents
, opt
);
1110 public int getBuildOptionsOptCount(){
1111 if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
1114 return getfpdBuildOpts().getOptions().getOptionList().size();
1117 public void getBuildOptionsOpts(String
[][] saa
) {
1118 if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
1122 List
<OptionDocument
.Option
> lOpt
= getfpdBuildOpts().getOptions().getOptionList();
1123 ListIterator li
= lOpt
.listIterator();
1125 while(li
.hasNext()) {
1126 OptionDocument
.Option opt
= (OptionDocument
.Option
)li
.next();
1127 if (opt
.getBuildTargets() != null) {
1128 saa
[i
][0] = listToString(opt
.getBuildTargets());
1130 saa
[i
][1] = opt
.getToolChainFamily();
1131 if (opt
.getSupArchList() != null){
1132 saa
[i
][2] = listToString(opt
.getSupArchList());
1135 saa
[i
][3] = opt
.getToolCode();
1136 saa
[i
][4] = opt
.getTagName();
1137 saa
[i
][5] = opt
.getStringValue();
1143 public void genBuildOptionsFfs(String ffsKey
, String type
) {
1144 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getfpdBuildOpts().addNewFfs();
1145 ffs
.setFfsKey(ffsKey
);
1147 ffs
.addNewSections().setEncapsulationType(type
);
1151 public void updateBuildOptionsFfsSectionsType(int i
, String type
) {
1152 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getfpdBuildOpts().addNewFfs();
1154 ffs
.addNewSections().setEncapsulationType(type
);
1158 public void genBuildOptionsFfsAttribute(int i
, String name
, String value
) {
1159 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1160 BuildOptionsDocument
.BuildOptions
.Ffs
.Attribute attrib
= ffs
.addNewAttribute();
1161 attrib
.setName(name
);
1162 attrib
.setValue(value
);
1165 /**update jth attribute of ith ffs.
1169 public void updateBuildOptionsFfsAttribute(int i
, int j
, String name
, String value
){
1170 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1171 XmlCursor cursor
= ffs
.newCursor();
1172 QName qAttrib
= new QName(xmlNs
, "Attribute");
1173 if (cursor
.toChild(qAttrib
)) {
1174 for (int k
= 0; k
< j
; ++k
) {
1175 cursor
.toNextSibling(qAttrib
);
1177 BuildOptionsDocument
.BuildOptions
.Ffs
.Attribute attrib
= (BuildOptionsDocument
.BuildOptions
.Ffs
.Attribute
)cursor
.getObject();
1178 attrib
.setName(name
);
1179 attrib
.setValue(value
);
1184 public void removeBuildOptionsFfsAttribute(int i
, int j
){
1185 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1186 XmlCursor cursor
= ffs
.newCursor();
1187 QName qAttrib
= new QName(xmlNs
, "Attribute");
1188 if (cursor
.toChild(qAttrib
)) {
1189 for (int k
= 0; k
< j
; ++k
) {
1190 cursor
.toNextSibling(qAttrib
);
1197 public void genBuildOptionsFfsSectionsSection(int i
, String sectionType
) {
1198 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1202 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1204 if (sections
== null){
1205 sections
= ffs
.addNewSections();
1207 sections
.addNewSection().setSectionType(EfiSectionType
.Enum
.forString(sectionType
));
1210 public void removeBuildOptionsFfsSectionsSection(int i
, int j
) {
1211 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1212 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1213 if (sections
== null) {
1216 XmlCursor cursor
= sections
.newCursor();
1217 QName qSection
= new QName(xmlNs
, "Section");
1218 if (cursor
.toChild(qSection
)) {
1219 for (int k
= 0; k
< j
; ++k
) {
1220 cursor
.toNextSibling(qSection
);
1227 public void updateBuildOptionsFfsSectionsSection(int i
, int j
, String type
){
1228 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1229 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1230 if (sections
== null) {
1233 XmlCursor cursor
= sections
.newCursor();
1234 QName qSection
= new QName(xmlNs
, "Section");
1235 if (cursor
.toChild(qSection
)) {
1236 for (int k
= 0; k
< j
; ++k
) {
1237 cursor
.toNextSibling(qSection
);
1239 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Section section
= (BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Section
)cursor
.getObject();
1240 section
.setSectionType(EfiSectionType
.Enum
.forString(type
));
1245 public void genBuildOptionsFfsSectionsSections(int i
, String encapType
) {
1246 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1250 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1252 if (sections
== null){
1253 sections
= ffs
.addNewSections();
1255 sections
.addNewSections().setEncapsulationType(encapType
);
1258 public void removeBuildOptionsFfsSectionsSections(int i
, int j
) {
1259 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1260 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1261 if (sections
== null) {
1264 XmlCursor cursor
= sections
.newCursor();
1265 QName qSections
= new QName(xmlNs
, "Sections");
1266 if (cursor
.toChild(qSections
)) {
1267 for (int k
= 0; k
< j
; ++k
) {
1268 cursor
.toNextSibling(qSections
);
1275 public void updateBuildOptionsFfsSectionsSections(int i
, int j
, String type
) {
1276 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1277 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1278 if (sections
== null) {
1281 XmlCursor cursor
= sections
.newCursor();
1282 QName qSections
= new QName(xmlNs
, "Sections");
1283 if (cursor
.toChild(qSections
)) {
1284 for (int k
= 0; k
< j
; ++k
) {
1285 cursor
.toNextSibling(qSections
);
1287 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2 sections2
= (BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
)cursor
.getObject();
1288 sections2
.setEncapsulationType(type
);
1293 public void genBuildOptionsFfsSectionsSectionsSection(int i
, int j
, String type
) {
1294 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1298 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1299 XmlCursor cursor
= sections
.newCursor();
1300 QName qSections
= new QName(xmlNs
, "Sections");
1301 if (cursor
.toChild(qSections
)){
1302 for (int k
= 0; k
< j
; ++k
) {
1303 cursor
.toNextSibling(qSections
);
1305 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2 sections2
= (BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
)cursor
.getObject();
1306 sections2
.addNewSection().setSectionType(EfiSectionType
.Enum
.forString(type
));
1311 public void removeBuildOptionsFfsSectionsSectionsSection(int i
, int j
, int k
) {
1312 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1313 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1314 if (sections
== null) {
1317 XmlCursor cursor
= sections
.newCursor();
1318 QName qSections
= new QName(xmlNs
, "Sections");
1319 if (cursor
.toChild(qSections
)) {
1320 for (int l
= 0; l
< j
; ++l
) {
1321 cursor
.toNextSibling(qSections
);
1323 if (cursor
.toFirstChild()) {
1324 for (int m
= 0; m
< k
; ++m
) {
1325 cursor
.toNextSibling();
1333 public void updateBuildOptionsFfsSectionsSectionsSection(int i
, int j
, int k
, String type
) {
1334 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1335 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1336 if (sections
== null) {
1339 XmlCursor cursor
= sections
.newCursor();
1340 QName qSections
= new QName(xmlNs
, "Sections");
1341 if (cursor
.toChild(qSections
)) {
1342 for (int l
= 0; l
< j
; ++l
) {
1343 cursor
.toNextSibling(qSections
);
1345 if (cursor
.toFirstChild()) {
1346 for (int m
= 0; m
< k
; ++m
) {
1347 cursor
.toNextSibling();
1349 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
.Section section
= (BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
.Section
)cursor
.getObject();
1350 section
.setSectionType(EfiSectionType
.Enum
.forString(type
));
1356 public void getBuildOptionsFfsSectionsSectionsSection(int i
, int j
, ArrayList
<String
> al
) {
1357 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1361 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections sections
= ffs
.getSections();
1362 XmlCursor cursor
= sections
.newCursor();
1363 QName qSections
= new QName(xmlNs
, "Sections");
1364 if (cursor
.toChild(qSections
)){
1365 for (int k
= 0; k
< j
; ++k
) {
1366 cursor
.toNextSibling(qSections
);
1368 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2 sections2
= (BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
)cursor
.getObject();
1369 if (sections2
.getSectionList() == null){
1373 ListIterator
<BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
.Section
> li
= sections2
.getSectionList().listIterator();
1374 while(li
.hasNext()) {
1375 BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
.Section section
= li
.next();
1376 if (section
.isSetSectionType()) {
1377 al
.add(section
.getSectionType().toString());
1386 public int getBuildOptionsFfsCount(){
1387 if (getfpdBuildOpts().getFfsList() == null) {
1390 return getfpdBuildOpts().getFfsList().size();
1393 public void getBuildOptionsFfsKey(String
[][] saa
) {
1394 if (getfpdBuildOpts().getFfsList() == null) {
1397 ListIterator
<BuildOptionsDocument
.BuildOptions
.Ffs
> li
= getfpdBuildOpts().getFfsList().listIterator();
1399 while(li
.hasNext()){
1400 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= li
.next();
1401 saa
[i
][0] = ffs
.getFfsKey();
1406 public void updateBuildOptionsFfsKey(int i
, String key
) {
1407 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1411 /**Get ith FFS key and contents.
1414 public void getBuildOptionsFfs(int i
, String
[] sa
, LinkedHashMap
<String
, String
> ffsAttribMap
, ArrayList
<String
> firstLevelSections
, ArrayList
<String
> firstLevelSection
) {
1415 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1419 sa
[0] = ffs
.getFfsKey();
1420 if (ffs
.getSections() != null) {
1421 if(ffs
.getSections().getEncapsulationType() != null){
1422 sa
[1] = ffs
.getSections().getEncapsulationType();
1424 if (ffs
.getSections().getSectionList() != null){
1425 ListIterator
<BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Section
> li
= ffs
.getSections().getSectionList().listIterator();
1426 while (li
.hasNext()) {
1427 firstLevelSection
.add(li
.next().getSectionType().toString());
1430 if (ffs
.getSections().getSectionsList() != null) {
1431 ListIterator
<BuildOptionsDocument
.BuildOptions
.Ffs
.Sections
.Sections2
> li
= ffs
.getSections().getSectionsList().listIterator();
1432 while(li
.hasNext()) {
1433 firstLevelSections
.add(li
.next().getEncapsulationType());
1437 if (ffs
.getAttributeList() != null) {
1438 ListIterator
<BuildOptionsDocument
.BuildOptions
.Ffs
.Attribute
> li
= ffs
.getAttributeList().listIterator();
1439 while(li
.hasNext()) {
1440 BuildOptionsDocument
.BuildOptions
.Ffs
.Attribute attrib
= li
.next();
1441 ffsAttribMap
.put(attrib
.getName(), attrib
.getValue());
1450 private BuildOptionsDocument
.BuildOptions
.Ffs
getFfs(int i
) {
1451 XmlObject o
= getfpdBuildOpts();
1452 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= null;
1454 XmlCursor cursor
= o
.newCursor();
1455 QName qFfs
= new QName(xmlNs
, "Ffs");
1456 if (cursor
.toChild(qFfs
)) {
1457 for (int j
= 0; j
< i
; ++j
) {
1458 cursor
.toNextSibling(qFfs
);
1460 ffs
= (BuildOptionsDocument
.BuildOptions
.Ffs
)cursor
.getObject();
1466 public void removeBuildOptionsFfs(int i
) {
1467 BuildOptionsDocument
.BuildOptions
.Ffs ffs
= getFfs(i
);
1472 XmlCursor cursor
= ffs
.newCursor();
1479 public PlatformDefinitionsDocument
.PlatformDefinitions
getfpdPlatformDefs(){
1480 if (fpdPlatformDefs
== null){
1481 fpdPlatformDefs
= fpdRoot
.addNewPlatformDefinitions();
1483 return fpdPlatformDefs
;
1486 public void getPlatformDefsSupportedArchs(Vector
<Object
> archs
){
1487 if (getfpdPlatformDefs().getSupportedArchitectures() == null) {
1490 ListIterator li
= getfpdPlatformDefs().getSupportedArchitectures().listIterator();
1491 while(li
.hasNext()) {
1492 archs
.add(li
.next());
1496 public void setPlatformDefsSupportedArchs(Vector
<Object
> archs
) {
1497 getfpdPlatformDefs().setSupportedArchitectures(archs
);
1500 public void getPlatformDefsBuildTargets(Vector
<Object
> targets
) {
1501 if (getfpdPlatformDefs().getBuildTargets() == null) {
1504 ListIterator li
= getfpdPlatformDefs().getBuildTargets().listIterator();
1505 while(li
.hasNext()) {
1506 targets
.add(li
.next());
1510 public void setPlatformDefsBuildTargets(Vector
<Object
> targets
) {
1511 getfpdPlatformDefs().setBuildTargets(targets
);
1514 public void genPlatformDefsSkuInfo(String id
, String name
) {
1515 SkuInfoDocument
.SkuInfo skuInfo
= null;
1516 if (getfpdPlatformDefs().getSkuInfo() == null) {
1517 skuInfo
= getfpdPlatformDefs().addNewSkuInfo();
1519 skuInfo
= getfpdPlatformDefs().getSkuInfo();
1520 if (skuInfo
.getUiSkuNameList() == null || skuInfo
.getUiSkuNameList().size() == 0) {
1521 SkuInfoDocument
.SkuInfo
.UiSkuName skuName
= skuInfo
.addNewUiSkuName();
1522 skuName
.setSkuID(new BigInteger("0"));
1523 skuName
.setStringValue("DEFAULT");
1525 if (id
.equals("0")) {
1528 SkuInfoDocument
.SkuInfo
.UiSkuName skuName
= skuInfo
.addNewUiSkuName();
1529 skuName
.setSkuID(new BigInteger(id
));
1530 skuName
.setStringValue(name
);
1533 public int getPlatformDefsSkuInfoCount(){
1534 if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
1537 return getfpdPlatformDefs().getSkuInfo().getUiSkuNameList().size();
1540 public void getPlatformDefsSkuInfos(String
[][] saa
){
1541 if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
1545 List
<SkuInfoDocument
.SkuInfo
.UiSkuName
> l
= getfpdPlatformDefs().getSkuInfo().getUiSkuNameList();
1546 ListIterator
<SkuInfoDocument
.SkuInfo
.UiSkuName
> li
= l
.listIterator();
1548 while(li
.hasNext()) {
1549 SkuInfoDocument
.SkuInfo
.UiSkuName sku
= li
.next();
1550 saa
[i
][0] = sku
.getSkuID()+"";
1551 saa
[i
][1] = sku
.getStringValue();
1556 public void removePlatformDefsSkuInfo(int i
) {
1557 SkuInfoDocument
.SkuInfo skuInfo
= getfpdPlatformDefs().getSkuInfo();
1558 if (skuInfo
== null || i
== 0) {
1562 XmlCursor cursor
= skuInfo
.newCursor();
1563 if (cursor
.toFirstChild()) {
1564 for (int j
= 0; j
< i
; ++j
) {
1565 cursor
.toNextSibling();
1572 public void updatePlatformDefsSkuInfo(int i
, String id
, String name
) {
1573 SkuInfoDocument
.SkuInfo skuInfo
= getfpdPlatformDefs().getSkuInfo();
1574 if (skuInfo
== null || i
== 0) {
1578 XmlCursor cursor
= skuInfo
.newCursor();
1579 if (cursor
.toFirstChild()) {
1580 for (int j
= 0; j
< i
; ++j
) {
1581 cursor
.toNextSibling();
1583 SkuInfoDocument
.SkuInfo
.UiSkuName sku
= (SkuInfoDocument
.SkuInfo
.UiSkuName
)cursor
.getObject();
1584 sku
.setSkuID(new BigInteger(id
));
1585 sku
.setStringValue(name
);
1590 public String
getPlatformDefsInterDir(){
1591 if (getfpdPlatformDefs().getIntermediateDirectories() == null) {
1594 return getfpdPlatformDefs().getIntermediateDirectories().toString();
1597 public void setPlatformDefsInterDir(String interDir
){
1598 getfpdPlatformDefs().setIntermediateDirectories(IntermediateOutputType
.Enum
.forString(interDir
));
1601 public String
getPlatformDefsOutputDir() {
1602 return getfpdPlatformDefs().getOutputDirectory();
1605 public void setPlatformDefsOutputDir(String outputDir
) {
1606 getfpdPlatformDefs().setOutputDirectory(outputDir
);
1609 public FlashDocument
.Flash
getfpdFlash() {
1610 if (fpdFlash
== null) {
1611 fpdFlash
= fpdRoot
.addNewFlash();
1616 public void genFlashDefinitionFile(String file
) {
1617 FlashDefinitionFileDocument
.FlashDefinitionFile fdf
= getfpdFlash().getFlashDefinitionFile();
1619 fdf
= getfpdFlash().addNewFlashDefinitionFile();
1622 fdf
.setStringValue(file
);
1625 public String
getFlashDefinitionFile() {
1626 FlashDefinitionFileDocument
.FlashDefinitionFile fdf
= getfpdFlash().getFlashDefinitionFile();
1631 return fdf
.getStringValue();
1636 public void genFvImagesNameValue(String name
, String value
) {
1638 FvImagesDocument
.FvImages fi
= getfpdFlash().getFvImages();
1640 fi
= getfpdFlash().addNewFvImages();
1643 FvImagesDocument
.FvImages
.NameValue nv
= fi
.addNewNameValue();
1648 public void removeFvImagesNameValue(int i
){
1650 XmlObject o
= getfpdFlash().getFvImages();
1655 QName qNameValue
= new QName(xmlNs
, "NameValue");
1656 XmlCursor cursor
= o
.newCursor();
1657 if (cursor
.toChild(qNameValue
)) {
1658 for (int j
= 0; j
< i
; ++j
) {
1659 cursor
.toNextSibling(qNameValue
);
1666 public void updateFvImagesNameValue(int i
, String name
, String value
){
1668 XmlObject o
= getfpdFlash().getFvImages();
1673 QName qNameValue
= new QName(xmlNs
, "NameValue");
1674 XmlCursor cursor
= o
.newCursor();
1675 if (cursor
.toChild(qNameValue
)) {
1676 for (int j
= 0; j
< i
; ++j
) {
1677 cursor
.toNextSibling(qNameValue
);
1679 FvImagesDocument
.FvImages
.NameValue nv
= (FvImagesDocument
.FvImages
.NameValue
)cursor
.getObject();
1686 public int getFvImagesNameValueCount() {
1688 FvImagesDocument
.FvImages fi
= null;
1689 if ((fi
= getfpdFlash().getFvImages()) == null || fi
.getNameValueList() == null) {
1692 return fi
.getNameValueList().size();
1695 public void getFvImagesNameValues(String
[][] nv
) {
1697 FvImagesDocument
.FvImages fi
= getfpdFlash().getFvImages();
1701 List
<FvImagesDocument
.FvImages
.NameValue
> l
= fi
.getNameValueList();
1703 ListIterator li
= l
.listIterator();
1704 while (li
.hasNext()) {
1705 FvImagesDocument
.FvImages
.NameValue e
= (FvImagesDocument
.FvImages
.NameValue
) li
1707 nv
[i
][0] = e
.getName();
1708 nv
[i
][1] = e
.getValue();
1714 public void genFvImagesFvImage(String
[] names
, String types
, Map
<String
, String
> options
) {
1716 FvImagesDocument
.FvImages fis
= null;
1717 if ((fis
= getfpdFlash().getFvImages()) == null) {
1718 fis
= getfpdFlash().addNewFvImages();
1722 //gen FvImage with FvImageNames array
1724 FvImagesDocument
.FvImages
.FvImage fi
= fis
.addNewFvImage();
1725 for (int i
= 0; i
< names
.length
; ++i
) {
1726 fi
.addFvImageNames(names
[i
]);
1728 fi
.setType(FvImageTypes
.Enum
.forString(types
));
1729 if (options
!= null){
1730 setFvImagesFvImageFvImageOptions(options
, fi
);
1734 private void setFvImagesFvImageFvImageOptions(Map
<String
, String
> options
, FvImagesDocument
.FvImages
.FvImage fi
){
1735 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions fio
= fi
.getFvImageOptions();
1737 fio
= fi
.addNewFvImageOptions();
1740 Set
<String
> key
= options
.keySet();
1741 Iterator
<String
> i
= key
.iterator();
1742 while (i
.hasNext()) {
1744 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue nv
= fio
.addNewNameValue();
1745 String k
= (String
)i
.next();
1748 nv
.setValue((String
)options
.get(k
));
1755 public void removeFvImagesFvImage(int i
) {
1757 XmlObject o
= getfpdFlash().getFvImages();
1762 QName qFvImage
= new QName(xmlNs
, "FvImage");
1763 XmlCursor cursor
= o
.newCursor();
1764 if (cursor
.toChild(qFvImage
)) {
1765 for (int j
= 0; j
< i
; ++j
) {
1766 cursor
.toNextSibling(qFvImage
);
1773 public void updateFvImagesFvImage(int i
, String
[] names
, String types
, Map
<String
, String
> options
){
1775 XmlObject o
= getfpdFlash().getFvImages();
1779 XmlCursor cursor
= o
.newCursor();
1780 QName qFvImage
= new QName(xmlNs
, "FvImage");
1781 if (cursor
.toChild(qFvImage
)) {
1782 for (int j
= 0; j
< i
; ++j
) {
1783 cursor
.toNextSibling(qFvImage
);
1785 FvImagesDocument
.FvImages
.FvImage fi
= (FvImagesDocument
.FvImages
.FvImage
)cursor
.getObject();
1786 fi
.setType(FvImageTypes
.Enum
.forString(types
));
1789 // remove old FvImageNames before adding new ones
1791 QName qFvImageNames
= new QName(xmlNs
, "FvImageNames");
1792 cursor
.toChild(qFvImageNames
);
1794 while (cursor
.toNextSibling(qFvImageNames
)) {
1798 for (int k
= 0; k
< names
.length
; ++k
) {
1799 fi
.addFvImageNames(names
[k
]);
1802 // remove old FvImageOptions before adding new options
1804 QName qFvImageOptions
= new QName(xmlNs
, "FvImageOptions");
1805 cursor
.toNextSibling(qFvImageOptions
);
1808 setFvImagesFvImageFvImageOptions(options
, fi
);
1813 public int getFvImagesFvImageCount() {
1815 if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
1818 return getfpdFlash().getFvImages().getFvImageList().size();
1821 /**Only Get Fv image setting - name and type.
1824 public void getFvImagesFvImages(String
[][] saa
) {
1826 if (getfpdFlash().getFvImages() == null) {
1829 List
<FvImagesDocument
.FvImages
.FvImage
> l
= getfpdFlash().getFvImages().getFvImageList();
1833 ListIterator li
= l
.listIterator();
1835 while(li
.hasNext()) {
1836 FvImagesDocument
.FvImages
.FvImage fi
= (FvImagesDocument
.FvImages
.FvImage
)li
.next();
1838 // get FvImageNames array, space separated
1840 List
<String
> lfn
= fi
.getFvImageNamesList();
1841 ListIterator lfni
= lfn
.listIterator();
1843 while (lfni
.hasNext()) {
1844 saa
[i
][0] += (String
)lfni
.next();
1847 saa
[i
][0] = saa
[i
][0].trim();
1849 saa
[i
][1] = fi
.getType()+"";
1855 /**Get FvImage Options for FvImage i
1856 * @param i the ith FvImage
1858 public void getFvImagesFvImageOptions(int i
, Map
<String
, String
> m
) {
1859 XmlObject o
= getfpdFlash().getFvImages();
1863 XmlCursor cursor
= o
.newCursor();
1864 QName qFvImage
= new QName(xmlNs
, "FvImage");
1865 if (cursor
.toChild(qFvImage
)) {
1866 for (int j
= 0; j
< i
; ++j
) {
1867 cursor
.toNextSibling(qFvImage
);
1869 FvImagesDocument
.FvImages
.FvImage fi
= (FvImagesDocument
.FvImages
.FvImage
)cursor
.getObject();
1870 if (fi
.getFvImageOptions() == null || fi
.getFvImageOptions().getNameValueList() == null){
1873 ListIterator
<FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue
> li
= fi
.getFvImageOptions().getNameValueList().listIterator();
1874 while(li
.hasNext()){
1875 FvImagesDocument
.FvImages
.FvImage
.FvImageOptions
.NameValue nv
= li
.next();
1876 m
.put(nv
.getName(), nv
.getValue());
1882 Get platform header element
1883 @return PlatformHeaderDocument.PlatformHeader
1885 public PlatformHeaderDocument
.PlatformHeader
getFpdHdr() {
1886 if (fpdHdr
== null) {
1887 fpdHdr
= fpdRoot
.addNewPlatformHeader();
1889 genPlatformDefsSkuInfo("0", "DEFAULT");
1893 public String
getFpdHdrPlatformName() {
1894 return getFpdHdr().getPlatformName();
1897 public String
getFpdHdrGuidValue() {
1898 return getFpdHdr().getGuidValue();
1901 public String
getFpdHdrVer() {
1902 return getFpdHdr().getVersion();
1905 public String
getFpdHdrAbs() {
1906 return getFpdHdr().getAbstract();
1909 public String
getFpdHdrDescription() {
1910 return getFpdHdr().getDescription();
1913 public String
getFpdHdrCopyright() {
1914 return getFpdHdr().getCopyright();
1917 public String
getFpdHdrLicense() {
1918 LicenseDocument
.License l
= getFpdHdr().getLicense();
1922 return l
.getStringValue();
1925 public String
getFpdHdrUrl() {
1926 LicenseDocument
.License l
= getFpdHdr().getLicense();
1933 public String
getFpdHdrSpec() {
1935 return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
1936 // return getFpdHdr().getSpecification();
1939 public void setFpdHdrPlatformName(String name
){
1940 getFpdHdr().setPlatformName(name
);
1943 public void setFpdHdrGuidValue(String guid
){
1944 getFpdHdr().setGuidValue(guid
);
1947 public void setFpdHdrVer(String v
){
1948 getFpdHdr().setVersion(v
);
1951 public void setFpdHdrAbs(String abs
) {
1952 getFpdHdr().setAbstract(abs
);
1955 public void setFpdHdrDescription(String desc
){
1956 getFpdHdr().setDescription(desc
);
1959 public void setFpdHdrCopyright(String cr
) {
1960 getFpdHdr().setCopyright(cr
);
1963 public void setFpdHdrLicense(String license
){
1964 LicenseDocument
.License l
= getFpdHdr().getLicense();
1966 getFpdHdr().addNewLicense().setStringValue(license
);
1969 l
.setStringValue(license
);
1973 public void setFpdHdrUrl(String url
){
1974 LicenseDocument
.License l
= getFpdHdr().getLicense();
1980 public void setFpdHdrSpec(String s
){
1981 s
= "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
1982 getFpdHdr().setSpecification(s
);
1985 Save the processed xml contents to file
1987 @param fpdFile The file to save xml contents
1988 @throws IOException Exceptions during file operation
1990 public void saveAs(File fpdFile
) throws IOException
{
1992 XmlOptions options
= new XmlOptions();
1994 options
.setCharacterEncoding("UTF-8");
1995 options
.setSavePrettyPrint();
1996 options
.setSavePrettyPrintIndent(2);
1998 fpdd
.save(fpdFile
, options
);
1999 } catch (IOException e
) {
2000 e
.printStackTrace();
2005 private String
listToString(List
<String
> l
) {
2010 ListIterator li
= l
.listIterator();
2011 while(li
.hasNext()) {