]>
Commit | Line | Data |
---|---|---|
a13899c5 | 1 | /** @file\r |
2 | Java class SpdFileContents is used to parse spd xml file.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | **/\r | |
13 | package org.tianocore.frameworkwizard.packaging.ui;\r | |
14 | \r | |
15 | import java.io.File;\r | |
16 | import java.io.IOException;\r | |
17 | import java.util.ArrayList;\r | |
18 | import java.util.List;\r | |
19 | import java.util.ListIterator;\r | |
20 | import java.util.Vector;\r | |
21 | \r | |
a13899c5 | 22 | \r |
23 | import org.apache.xmlbeans.XmlObject;\r | |
24 | import org.apache.xmlbeans.XmlOptions;\r | |
25 | import org.apache.xmlbeans.XmlCursor;\r | |
26 | \r | |
a13899c5 | 27 | import org.tianocore.GuidDeclarationsDocument;\r |
28 | \r | |
29 | import org.tianocore.LibraryClassDeclarationsDocument;\r | |
30 | \r | |
31 | import org.tianocore.ModuleTypeDef;\r | |
32 | import org.tianocore.MsaFilesDocument;\r | |
33 | import org.tianocore.PackageDefinitionsDocument;\r | |
34 | import org.tianocore.PackageHeadersDocument;\r | |
35 | import org.tianocore.PackageSurfaceAreaDocument;\r | |
36 | import org.tianocore.PcdDataTypes;\r | |
37 | import org.tianocore.PcdDeclarationsDocument;\r | |
a13899c5 | 38 | import org.tianocore.PpiDeclarationsDocument;\r |
39 | import org.tianocore.ProtocolDeclarationsDocument;\r | |
40 | import org.tianocore.SpdHeaderDocument;\r | |
41 | import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;\r | |
a13899c5 | 42 | \r |
43 | /**\r | |
44 | This class processes spd file contents such as add remove xml elements.\r | |
45 | \r | |
46 | @since PackageEditor 1.0\r | |
47 | **/\r | |
48 | \r | |
49 | public class SpdFileContents {\r | |
50 | \r | |
51 | private File file = null;\r | |
52 | \r | |
53 | private PackageSurfaceAreaDocument psad = null;\r | |
54 | \r | |
55 | private PackageSurfaceAreaDocument.PackageSurfaceArea psaRoot = null;\r | |
56 | \r | |
57 | private SpdHeaderDocument.SpdHeader spdHdr = null;\r | |
58 | \r | |
59 | private PackageDefinitionsDocument.PackageDefinitions spdPkgDefs = null;\r | |
60 | \r | |
61 | private LibraryClassDeclarationsDocument.LibraryClassDeclarations spdLibClassDeclarations = null;\r | |
62 | \r | |
63 | private MsaFilesDocument.MsaFiles spdMsaFiles = null;\r | |
64 | \r | |
65 | private PackageHeadersDocument.PackageHeaders spdModHdrs = null;\r | |
66 | \r | |
67 | private GuidDeclarationsDocument.GuidDeclarations spdGuidDeclarations = null;\r | |
68 | \r | |
69 | private ProtocolDeclarationsDocument.ProtocolDeclarations spdProtocolDeclarations = null;\r | |
70 | \r | |
71 | private PpiDeclarationsDocument.PpiDeclarations spdPpiDeclarations = null;\r | |
72 | \r | |
73 | private PcdDeclarationsDocument.PcdDeclarations spdPcdDefinitions = null;\r | |
74 | \r | |
75 | /**\r | |
76 | Constructor to create a new spd file\r | |
77 | **/\r | |
78 | public SpdFileContents() {\r | |
79 | \r | |
80 | psad = PackageSurfaceAreaDocument.Factory.newInstance();\r | |
81 | psaRoot = psad.addNewPackageSurfaceArea();\r | |
82 | \r | |
83 | }\r | |
84 | \r | |
85 | /**\r | |
86 | Constructor for existing document object\r | |
87 | @param psa\r | |
88 | **/\r | |
89 | public SpdFileContents(PackageSurfaceAreaDocument.PackageSurfaceArea psa) {\r | |
90 | psaRoot = psa;\r | |
91 | spdHdr = psaRoot.getSpdHeader();\r | |
92 | spdPkgDefs = psaRoot.getPackageDefinitions();\r | |
93 | }\r | |
94 | /**\r | |
95 | Constructor based on an existing spd file\r | |
96 | \r | |
97 | @param f Existing spd file\r | |
98 | **/\r | |
99 | public SpdFileContents(File f) {\r | |
100 | try {\r | |
101 | psad = PackageSurfaceAreaDocument.Factory.parse(f);\r | |
102 | psaRoot = psad.getPackageSurfaceArea();\r | |
103 | file = f;\r | |
104 | } catch (Exception e) {\r | |
105 | System.out.println(e.toString());\r | |
106 | }\r | |
107 | }\r | |
108 | \r | |
109 | /**\r | |
110 | Remove existing pcd definitions elements using XmlCursor\r | |
111 | **/\r | |
112 | public void removeSpdPcdDefinition() {\r | |
113 | XmlObject o = psaRoot.getPcdDeclarations();\r | |
114 | if (o == null)\r | |
115 | return;\r | |
116 | XmlCursor cursor = o.newCursor();\r | |
117 | cursor.removeXml();\r | |
118 | spdPcdDefinitions = null;\r | |
119 | cursor.dispose();\r | |
120 | }\r | |
121 | \r | |
122 | public void removeSpdPcdDefinition(int i){\r | |
123 | XmlObject o = psaRoot.getPcdDeclarations();\r | |
124 | if (o == null)\r | |
125 | return;\r | |
126 | XmlCursor cursor = o.newCursor();\r | |
127 | if (cursor.toFirstChild()) {\r | |
128 | for (int j = 0; j < i; ++j) {\r | |
129 | cursor.toNextSibling();\r | |
130 | }\r | |
131 | cursor.removeXml();\r | |
af25df16 | 132 | if (getSpdPcdDefinitionCount() == 0) {\r |
133 | cursor.toParent();\r | |
134 | cursor.removeXml();\r | |
135 | }\r | |
a13899c5 | 136 | } \r |
137 | cursor.dispose();\r | |
138 | }\r | |
139 | \r | |
140 | /**\r | |
141 | Remove existing ppi declarations using XmlCursor\r | |
142 | **/\r | |
143 | public void removeSpdPpiDeclaration() {\r | |
144 | XmlObject o = psaRoot.getPpiDeclarations();\r | |
145 | if (o == null)\r | |
146 | return;\r | |
147 | XmlCursor cursor = o.newCursor();\r | |
148 | cursor.removeXml();\r | |
149 | spdPpiDeclarations = null;\r | |
150 | cursor.dispose();\r | |
151 | }\r | |
152 | \r | |
153 | public void removeSpdPpiDeclaration(int i){\r | |
154 | XmlObject o = psaRoot.getPpiDeclarations();\r | |
155 | if (o == null)\r | |
156 | return;\r | |
157 | XmlCursor cursor = o.newCursor();\r | |
158 | if (cursor.toFirstChild()) {\r | |
159 | for (int j = 0; j < i; ++j) {\r | |
160 | cursor.toNextSibling();\r | |
161 | }\r | |
162 | cursor.removeXml();\r | |
af25df16 | 163 | if (getSpdPpiDeclarationCount() == 0){\r |
164 | cursor.toParent();\r | |
165 | cursor.removeXml();\r | |
166 | }\r | |
a13899c5 | 167 | } \r |
168 | cursor.dispose();\r | |
169 | }\r | |
170 | /**\r | |
171 | Remove existing protocols declarations using XmlCursor\r | |
172 | **/\r | |
173 | public void removeSpdProtocolDeclaration() {\r | |
174 | XmlObject o = psaRoot.getProtocolDeclarations();\r | |
175 | if (o == null)\r | |
176 | return;\r | |
177 | XmlCursor cursor = o.newCursor();\r | |
178 | cursor.removeXml();\r | |
179 | spdProtocolDeclarations = null;\r | |
180 | cursor.dispose();\r | |
181 | }\r | |
182 | \r | |
183 | public void removeSpdProtocolDeclaration(int i) {\r | |
184 | XmlObject o = psaRoot.getProtocolDeclarations();\r | |
185 | if (o == null)\r | |
186 | return;\r | |
187 | XmlCursor cursor = o.newCursor();\r | |
188 | if (cursor.toFirstChild()) {\r | |
189 | for (int j = 0; j < i; ++j) {\r | |
190 | cursor.toNextSibling();\r | |
191 | }\r | |
192 | cursor.removeXml();\r | |
af25df16 | 193 | if (getSpdProtocolDeclarationCount() == 0) {\r |
194 | cursor.toParent();\r | |
195 | cursor.removeXml();\r | |
196 | }\r | |
a13899c5 | 197 | }\r |
198 | cursor.dispose();\r | |
199 | }\r | |
200 | /**\r | |
201 | Remove existing GUID declarations using XmlCursor\r | |
202 | **/\r | |
203 | public void removeSpdGuidDeclaration() {\r | |
204 | XmlObject o = psaRoot.getGuidDeclarations();\r | |
205 | if (o == null)\r | |
206 | return;\r | |
207 | XmlCursor cursor = o.newCursor();\r | |
208 | cursor.removeXml();\r | |
209 | spdGuidDeclarations = null; \r | |
210 | cursor.dispose();\r | |
211 | }\r | |
212 | \r | |
213 | public void removeSpdGuidDeclaration(int i) {\r | |
214 | XmlObject o = psaRoot.getGuidDeclarations();\r | |
215 | if (o == null)\r | |
216 | return;\r | |
217 | XmlCursor cursor = o.newCursor();\r | |
218 | if (cursor.toFirstChild()) {\r | |
219 | for (int j = 0; j < i; ++j) {\r | |
220 | cursor.toNextSibling();\r | |
221 | }\r | |
222 | cursor.removeXml();\r | |
af25df16 | 223 | if (getSpdGuidDeclarationCount() == 0) {\r |
224 | cursor.toParent();\r | |
225 | cursor.removeXml();\r | |
226 | }\r | |
a13899c5 | 227 | } \r |
228 | cursor.dispose();\r | |
229 | }\r | |
230 | \r | |
231 | /**\r | |
232 | Remove existing spd package include files using XmlCursor\r | |
233 | **/\r | |
234 | public void removeSpdPkgHeader() {\r | |
235 | XmlObject o = psaRoot.getPackageHeaders();\r | |
236 | if (o == null)\r | |
237 | return;\r | |
238 | XmlCursor cursor = o.newCursor();\r | |
239 | cursor.removeXml();\r | |
240 | spdModHdrs = null;\r | |
241 | cursor.dispose();\r | |
242 | }\r | |
243 | \r | |
244 | public void removeSpdPkgHeader(int i){\r | |
245 | XmlObject o = psaRoot.getPackageHeaders();\r | |
246 | if (o == null)\r | |
247 | return;\r | |
248 | XmlCursor cursor = o.newCursor();\r | |
249 | if (cursor.toFirstChild()) {\r | |
250 | for (int j = 0; j < i; ++j) {\r | |
251 | cursor.toNextSibling();\r | |
252 | }\r | |
253 | cursor.removeXml();\r | |
af25df16 | 254 | if (getSpdPackageHeaderCount() == 0) {\r |
255 | cursor.toParent();\r | |
256 | cursor.removeXml();\r | |
257 | }\r | |
a13899c5 | 258 | } \r |
259 | cursor.dispose();\r | |
260 | }\r | |
261 | \r | |
262 | /**\r | |
263 | Remove existing msa files using XmlCursor\r | |
264 | **/\r | |
265 | public void removeSpdMsaFile() {\r | |
266 | XmlObject o = psaRoot.getMsaFiles();\r | |
267 | if (o == null)\r | |
268 | return;\r | |
269 | XmlCursor cursor = o.newCursor();\r | |
270 | cursor.removeXml();\r | |
271 | spdMsaFiles = null;\r | |
272 | cursor.dispose();\r | |
273 | }\r | |
274 | \r | |
275 | public void removeSpdMsaFile(int i){\r | |
276 | XmlObject o = psaRoot.getMsaFiles();\r | |
277 | if (o == null)\r | |
278 | return;\r | |
279 | XmlCursor cursor = o.newCursor();\r | |
280 | if (cursor.toFirstChild()) {\r | |
281 | for (int j = 0; j < i; ++j) {\r | |
282 | cursor.toNextSibling();\r | |
283 | }\r | |
284 | cursor.removeXml();\r | |
af25df16 | 285 | if (getSpdMsaFileCount() == 0) {\r |
286 | cursor.toParent();\r | |
287 | cursor.removeXml();\r | |
288 | }\r | |
a13899c5 | 289 | }\r |
290 | cursor.dispose();\r | |
291 | }\r | |
292 | \r | |
293 | /**\r | |
294 | Remove existing library class declarations using XmlCursor\r | |
295 | **/\r | |
296 | public void removeSpdLibClass() {\r | |
297 | XmlObject o = psaRoot.getLibraryClassDeclarations();\r | |
298 | if (o == null)\r | |
299 | return;\r | |
300 | XmlCursor cursor = o.newCursor();\r | |
301 | cursor.removeXml();\r | |
302 | spdLibClassDeclarations = null;\r | |
303 | cursor.dispose();\r | |
304 | }\r | |
305 | \r | |
306 | public void removeSpdLibClass(int i) {\r | |
307 | XmlObject o = psaRoot.getLibraryClassDeclarations();\r | |
308 | if (o == null)\r | |
309 | return;\r | |
310 | XmlCursor cursor = o.newCursor();\r | |
311 | if (cursor.toFirstChild()) {\r | |
312 | for (int j = 0; j < i; ++j) {\r | |
313 | cursor.toNextSibling();\r | |
314 | }\r | |
315 | cursor.removeXml();\r | |
af25df16 | 316 | if (getSpdLibClassDeclarationCount() == 0) {\r |
317 | cursor.toParent();\r | |
318 | cursor.removeXml();\r | |
319 | }\r | |
a13899c5 | 320 | }\r |
321 | cursor.dispose();\r | |
322 | }\r | |
323 | \r | |
324 | public void updateSpdLibClass(int i, String lib, String hdr, String hlp, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType) {\r | |
325 | XmlObject o = psaRoot.getLibraryClassDeclarations();\r | |
326 | if (o == null)\r | |
327 | return;\r | |
328 | \r | |
329 | XmlCursor cursor = o.newCursor();\r | |
330 | if (cursor.toFirstChild()) {\r | |
331 | for (int j = 0; j < i; ++j) {\r | |
332 | cursor.toNextSibling();\r | |
333 | }\r | |
334 | LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();\r | |
335 | lc.setName(lib);\r | |
336 | lc.setIncludeHeader(hdr);\r | |
337 | lc.setHelpText(hlp);\r | |
338 | if (clsUsage != null) {\r | |
97796eaa | 339 | lc.setRecommendedInstanceGuid(clsUsage);\r |
340 | if (instanceVer != null){\r | |
a13899c5 | 341 | lc.setRecommendedInstanceVersion(instanceVer);\r |
97796eaa | 342 | } else {\r |
322b7723 | 343 | if (lc.isSetRecommendedInstanceVersion()) {\r |
344 | lc.unsetRecommendedInstanceVersion();\r | |
345 | }\r | |
97796eaa | 346 | }\r |
347 | } else {\r | |
322b7723 | 348 | if (lc.isSetRecommendedInstanceGuid()) {\r |
349 | lc.unsetRecommendedInstanceGuid();\r | |
350 | }\r | |
d129bd96 | 351 | if (lc.isSetRecommendedInstanceVersion()) {\r |
352 | lc.unsetRecommendedInstanceVersion();\r | |
353 | }\r | |
a13899c5 | 354 | }\r |
97796eaa | 355 | \r |
a13899c5 | 356 | if (stringToList(hdrAttribArch) != null){\r |
97796eaa | 357 | lc.setSupArchList(stringToList(hdrAttribArch));\r |
358 | } else {\r | |
322b7723 | 359 | if (lc.isSetSupArchList()) {\r |
360 | lc.unsetSupArchList();\r | |
361 | }\r | |
a13899c5 | 362 | }\r |
363 | if (stringToList(hdrAttribModType) != null){\r | |
97796eaa | 364 | lc.setSupModuleList(stringToList(hdrAttribModType));\r |
365 | } else {\r | |
322b7723 | 366 | if (lc.isSetSupModuleList()) {\r |
367 | lc.unsetSupModuleList();\r | |
368 | }\r | |
a13899c5 | 369 | }\r |
370 | }\r | |
371 | \r | |
372 | cursor.dispose();\r | |
373 | }\r | |
374 | \r | |
375 | public void updateSpdMsaFile(int i, String msaFile, String mName, String v, String g){\r | |
376 | XmlObject o = psaRoot.getMsaFiles();\r | |
377 | if (o == null)\r | |
378 | return;\r | |
379 | \r | |
380 | XmlCursor cursor = o.newCursor();\r | |
381 | if (cursor.toFirstChild()) {\r | |
382 | for (int j = 0; j < i; ++j) {\r | |
383 | cursor.toNextSibling();\r | |
384 | }\r | |
385 | cursor.setTextValue(msaFile);\r | |
386 | \r | |
387 | }\r | |
388 | \r | |
389 | cursor.dispose();\r | |
390 | }\r | |
391 | \r | |
392 | public void updateSpdGuidDecl(int i, String name, String cName, String guid, String hlp, String archList, \r | |
393 | String modTypeList, String guidTypeList){\r | |
394 | XmlObject o = psaRoot.getGuidDeclarations();\r | |
395 | if (o == null){\r | |
396 | return;\r | |
397 | }\r | |
398 | \r | |
399 | XmlCursor cursor = o.newCursor();\r | |
400 | if (cursor.toFirstChild()) {\r | |
401 | for (int j = 0; j < i; ++j) {\r | |
402 | cursor.toNextSibling();\r | |
403 | }\r | |
404 | GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();\r | |
405 | e.setName(name);\r | |
406 | e.setCName(cName);\r | |
407 | e.setGuidValue(guid);\r | |
408 | e.setHelpText(hlp);\r | |
ce73a791 | 409 | if (stringToList(guidTypeList) != null) {\r |
322b7723 | 410 | e.setGuidTypeList(stringToList(guidTypeList));\r |
a13899c5 | 411 | }\r |
ce73a791 | 412 | else{\r |
322b7723 | 413 | if (e.isSetGuidTypeList()) {\r |
97796eaa | 414 | e.unsetGuidTypeList();\r |
322b7723 | 415 | }\r |
ce73a791 | 416 | }\r |
a13899c5 | 417 | if (stringToList(archList) != null){\r |
418 | e.setSupArchList(stringToList(archList));\r | |
419 | }\r | |
ce73a791 | 420 | else{\r |
322b7723 | 421 | if (e.isSetSupArchList()) {\r |
97796eaa | 422 | e.unsetSupArchList();\r |
322b7723 | 423 | }\r |
ce73a791 | 424 | }\r |
a13899c5 | 425 | if (stringToList(modTypeList) != null) {\r |
426 | e.setSupModuleList(stringToList(modTypeList));\r | |
427 | }\r | |
ce73a791 | 428 | else{\r |
322b7723 | 429 | if (e.isSetSupModuleList()) {\r |
97796eaa | 430 | e.unsetSupModuleList();\r |
322b7723 | 431 | }\r |
ce73a791 | 432 | }\r |
a13899c5 | 433 | \r |
434 | }\r | |
435 | cursor.dispose();\r | |
436 | }\r | |
437 | \r | |
438 | public void updateSpdPpiDecl(int i, String name, String cName, String guid, String hlp, String archList, \r | |
439 | String modTypeList){\r | |
440 | XmlObject o = psaRoot.getPpiDeclarations();\r | |
441 | if (o == null){\r | |
442 | return;\r | |
443 | }\r | |
444 | \r | |
445 | XmlCursor cursor = o.newCursor();\r | |
446 | if (cursor.toFirstChild()) {\r | |
447 | for (int j = 0; j < i; ++j) {\r | |
448 | cursor.toNextSibling();\r | |
449 | }\r | |
450 | PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();\r | |
451 | e.setName(name);\r | |
452 | e.setCName(cName);\r | |
453 | e.setGuidValue(guid);\r | |
454 | e.setHelpText(hlp);\r | |
455 | if (stringToList(archList) != null){\r | |
456 | e.setSupArchList(stringToList(archList));\r | |
457 | }\r | |
ce73a791 | 458 | else{\r |
322b7723 | 459 | if (e.isSetSupArchList()) {\r |
97796eaa | 460 | e.unsetSupArchList();\r |
322b7723 | 461 | }\r |
ce73a791 | 462 | }\r |
a13899c5 | 463 | if (stringToList(modTypeList) != null) {\r |
464 | e.setSupModuleList(stringToList(modTypeList));\r | |
465 | }\r | |
ce73a791 | 466 | else{\r |
322b7723 | 467 | if (e.isSetSupModuleList()) {\r |
97796eaa | 468 | e.unsetSupModuleList();\r |
322b7723 | 469 | }\r |
ce73a791 | 470 | }\r |
a13899c5 | 471 | }\r |
472 | cursor.dispose();\r | |
473 | }\r | |
474 | \r | |
475 | public void updateSpdProtocolDecl(int i, String name, String cName, String guid, String hlp, String archList, \r | |
476 | String modTypeList){\r | |
477 | XmlObject o = psaRoot.getProtocolDeclarations();\r | |
478 | if (o == null){\r | |
479 | return;\r | |
480 | }\r | |
481 | \r | |
482 | XmlCursor cursor = o.newCursor();\r | |
483 | if (cursor.toFirstChild()) {\r | |
484 | for (int j = 0; j < i; ++j) {\r | |
485 | cursor.toNextSibling();\r | |
486 | }\r | |
487 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();\r | |
488 | e.setName(name);\r | |
489 | e.setCName(cName);\r | |
490 | e.setGuidValue(guid);\r | |
491 | e.setHelpText(hlp);\r | |
492 | if (stringToList(archList) != null){\r | |
493 | e.setSupArchList(stringToList(archList));\r | |
494 | }\r | |
ce73a791 | 495 | else{\r |
322b7723 | 496 | if (e.isSetSupArchList()) {\r |
97796eaa | 497 | e.unsetSupArchList();\r |
322b7723 | 498 | }\r |
ce73a791 | 499 | }\r |
a13899c5 | 500 | if (stringToList(modTypeList) != null) {\r |
501 | e.setSupModuleList(stringToList(modTypeList));\r | |
502 | }\r | |
ce73a791 | 503 | else{\r |
322b7723 | 504 | if (e.isSetSupModuleList()) {\r |
97796eaa | 505 | e.unsetSupModuleList();\r |
322b7723 | 506 | }\r |
ce73a791 | 507 | }\r |
a13899c5 | 508 | }\r |
509 | cursor.dispose();\r | |
510 | }\r | |
511 | \r | |
512 | public void updateSpdPkgHdr(int i, String pkgName, String hdrName){\r | |
513 | XmlObject o = psaRoot.getPackageHeaders();\r | |
514 | if (o == null){\r | |
515 | return;\r | |
516 | }\r | |
517 | \r | |
518 | XmlCursor cursor = o.newCursor();\r | |
519 | if (cursor.toFirstChild()) {\r | |
520 | for (int j = 0; j < i; ++j) {\r | |
521 | cursor.toNextSibling();\r | |
522 | }\r | |
523 | \r | |
524 | PackageHeadersDocument.PackageHeaders.IncludePkgHeader iph = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();\r | |
525 | iph.setModuleType(ModuleTypeDef.Enum.forString(pkgName));\r | |
526 | iph.setStringValue(hdrName);\r | |
527 | }\r | |
528 | cursor.dispose();\r | |
529 | }\r | |
530 | \r | |
531 | public void updateSpdPcdDefinition(int i, String cName, String token, String dataType, String pcdItemTypes, \r | |
532 | String spaceGuid, String defaultString, String help, String archList, String modTypeList){\r | |
533 | XmlObject o = psaRoot.getPcdDeclarations();\r | |
534 | if (o == null)\r | |
535 | return;\r | |
536 | XmlCursor cursor = o.newCursor();\r | |
537 | if (cursor.toFirstChild()) {\r | |
538 | for (int j = 0; j < i; ++j) {\r | |
539 | cursor.toNextSibling();\r | |
540 | }\r | |
541 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();\r | |
542 | e.setCName(cName);\r | |
543 | e.setToken(token);\r | |
544 | e.setDatumType(PcdDataTypes.Enum.forString(dataType));\r | |
545 | if (pcdItemTypes != null && pcdItemTypes.length() > 0) {\r | |
546 | String usage[] = pcdItemTypes.split("( )+");\r | |
547 | List<String> l = new ArrayList<String>();\r | |
548 | for (int k = 0; k < usage.length; ++k) {\r | |
549 | l.add(usage[k]); \r | |
550 | }\r | |
551 | e.setValidUsage(l);\r | |
552 | }\r | |
553 | \r | |
554 | e.setTokenSpaceGuidCName(spaceGuid);\r | |
555 | e.setDefaultValue(defaultString);\r | |
556 | e.setHelpText(help);\r | |
209abc92 | 557 | if (stringToList(archList) != null){\r |
a13899c5 | 558 | e.setSupArchList(stringToList(archList));\r |
559 | }\r | |
209abc92 | 560 | else{\r |
561 | if (e.isSetSupArchList()) {\r | |
562 | e.unsetSupArchList();\r | |
563 | }\r | |
564 | }\r | |
565 | if (stringToList(modTypeList) != null) {\r | |
a13899c5 | 566 | e.setSupModuleList(stringToList(modTypeList));\r |
567 | }\r | |
209abc92 | 568 | else{\r |
569 | if (e.isSetSupModuleList()) {\r | |
570 | e.unsetSupModuleList();\r | |
571 | }\r | |
572 | }\r | |
573 | \r | |
a13899c5 | 574 | } \r |
575 | cursor.dispose();\r | |
576 | }\r | |
577 | /**\r | |
578 | Get spd file header contents into String array\r | |
579 | \r | |
580 | @param s Caller allocated String array\r | |
581 | **/\r | |
582 | public void getSpdHdrDetails(String[] s) {\r | |
583 | if (getSpdHdr() == null) {\r | |
584 | spdHdr = psaRoot.addNewSpdHeader();\r | |
585 | }\r | |
586 | s[0] = getSpdHdrPkgName();\r | |
587 | s[1] = getSpdHdr().getGuidValue();\r | |
588 | s[2] = getSpdHdrVer();\r | |
589 | // s[3] = getSpdHdr().getAbstract();\r | |
590 | s[4] = getSpdHdr().getDescription();\r | |
591 | s[5] = getSpdHdr().getCopyright();\r | |
592 | s[6] = getSpdHdrLicense();\r | |
593 | \r | |
594 | }\r | |
595 | \r | |
596 | /**\r | |
597 | Get the number of library class declarations from the size of List\r | |
598 | \r | |
599 | @return int\r | |
600 | **/\r | |
601 | public int getSpdLibClassDeclarationCount() {\r | |
602 | if (psaRoot.getLibraryClassDeclarations() == null\r | |
603 | || psaRoot.getLibraryClassDeclarations().getLibraryClassList() == null) {\r | |
604 | return 0;\r | |
605 | }\r | |
606 | return psaRoot.getLibraryClassDeclarations().getLibraryClassList().size();\r | |
607 | }\r | |
608 | \r | |
609 | /**\r | |
610 | Get available library class declaration into String array\r | |
611 | @param libClass Caller allocated two-dimentional String array\r | |
612 | **/\r | |
613 | public void getSpdLibClassDeclarations(String[][] libClass) {\r | |
614 | if (psaRoot.getLibraryClassDeclarations() == null){\r | |
615 | return;\r | |
616 | }\r | |
617 | \r | |
618 | List<LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass> l = psaRoot.getLibraryClassDeclarations().getLibraryClassList();\r | |
619 | int i = 0;\r | |
620 | ListIterator li = l.listIterator();\r | |
621 | while (li.hasNext()) {\r | |
622 | LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) li.next();\r | |
623 | if (lc != null) {\r | |
624 | libClass[i][0] = lc.getName();\r | |
625 | libClass[i][1] = lc.getIncludeHeader();\r | |
626 | libClass[i][2] = lc.getHelpText();\r | |
2f8a7517 | 627 | // LAH added logic so you cannot set the version unless the GUID is defined.\r |
97796eaa | 628 | /* LAH do not set now\r |
2f8a7517 | 629 | if (lc.getRecommendedInstanceGuid() != null) {\r |
630 | libClass[i][3] = lc.getRecommendedInstanceGuid();\r | |
631 | if (lc.getRecommendedInstanceVersion() != null) {\r | |
632 | libClass[i][4] = lc.getRecommendedInstanceVersion();\r | |
633 | }\r | |
634 | }\r | |
97796eaa | 635 | */\r |
a13899c5 | 636 | if (lc.getSupArchList() != null) {\r |
637 | libClass[i][5] = listToString(lc.getSupArchList());\r | |
638 | }\r | |
639 | if (lc.getSupModuleList() != null) {\r | |
640 | libClass[i][6] = listToString(lc.getSupModuleList());\r | |
641 | }\r | |
642 | \r | |
643 | }\r | |
644 | \r | |
645 | i++;\r | |
646 | }\r | |
647 | \r | |
648 | }\r | |
649 | \r | |
650 | /**\r | |
651 | Get the number of Msa files from the size of List\r | |
652 | \r | |
653 | @return int\r | |
654 | **/\r | |
655 | public int getSpdMsaFileCount() {\r | |
656 | if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getFilenameList() == null) {\r | |
657 | return 0;\r | |
658 | }\r | |
659 | return psaRoot.getMsaFiles().getFilenameList().size();\r | |
660 | }\r | |
661 | \r | |
662 | /**\r | |
663 | Get available Msa file into String array\r | |
664 | \r | |
665 | @param msaFile Caller allocated two-dimentional String array\r | |
666 | **/\r | |
667 | public void getSpdMsaFiles(String[][] msaFile) {\r | |
668 | if (psaRoot.getMsaFiles() == null) {\r | |
669 | return;\r | |
670 | }\r | |
671 | List<String> l = psaRoot.getMsaFiles().getFilenameList();\r | |
672 | int i = 0;\r | |
673 | ListIterator li = l.listIterator();\r | |
674 | while (li.hasNext()) {\r | |
675 | msaFile[i][0] = (String)li.next();\r | |
676 | \r | |
677 | i++;\r | |
678 | }\r | |
679 | }\r | |
680 | \r | |
681 | /**\r | |
682 | Get the number of include header files in PackageHeaders from the size of List\r | |
683 | \r | |
684 | @return int\r | |
685 | **/\r | |
686 | public int getSpdPackageHeaderCount() {\r | |
687 | if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludePkgHeaderList() == null) {\r | |
688 | return 0;\r | |
689 | }\r | |
690 | return psaRoot.getPackageHeaders().getIncludePkgHeaderList().size();\r | |
691 | }\r | |
692 | \r | |
693 | /**\r | |
694 | Get available package header contents into String array\r | |
695 | \r | |
696 | @param pkgHeader Caller allocated two-dimentional String array\r | |
697 | **/\r | |
698 | public void getSpdPackageHeaders(String[][] pkgHeader) {\r | |
699 | if (psaRoot.getPackageHeaders() == null) {\r | |
700 | return;\r | |
701 | }\r | |
702 | \r | |
703 | List<PackageHeadersDocument.PackageHeaders.IncludePkgHeader> l = psaRoot.getPackageHeaders().getIncludePkgHeaderList();\r | |
704 | int i = 0;\r | |
705 | ListIterator li = l.listIterator();\r | |
706 | while (li.hasNext()) {\r | |
707 | PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) li.next();\r | |
708 | if (ih.getModuleType() != null) {\r | |
709 | pkgHeader[i][0] = ih.getModuleType().toString();\r | |
710 | }\r | |
711 | \r | |
712 | pkgHeader[i][1] = ih.getStringValue();\r | |
713 | i++;\r | |
714 | }\r | |
715 | }\r | |
716 | \r | |
717 | /**\r | |
718 | Get the number of GUID declarations from the size of List\r | |
719 | \r | |
720 | @return int\r | |
721 | **/\r | |
722 | public int getSpdGuidDeclarationCount() {\r | |
723 | if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) {\r | |
724 | return 0;\r | |
725 | }\r | |
726 | return psaRoot.getGuidDeclarations().getEntryList().size();\r | |
727 | }\r | |
728 | \r | |
729 | /**\r | |
730 | Get available Guid declaration contents into String array\r | |
731 | \r | |
732 | @param guid Caller allocated two-dimentional String array\r | |
733 | **/\r | |
734 | public void getSpdGuidDeclarations(String[][] guid) {\r | |
735 | if (psaRoot.getGuidDeclarations() == null) {\r | |
736 | return;\r | |
737 | }\r | |
738 | \r | |
739 | List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();\r | |
740 | int i = 0;\r | |
741 | ListIterator li = l.listIterator();\r | |
742 | while (li.hasNext()) {\r | |
743 | GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li\r | |
744 | .next();\r | |
745 | guid[i][0] = e.getName();\r | |
746 | guid[i][1] = e.getCName();\r | |
747 | if (e.getGuidValue() != null) {\r | |
748 | guid[i][2] = e.getGuidValue();\r | |
749 | }\r | |
750 | guid[i][3] = e.getHelpText();\r | |
751 | guid[i][4] = listToString(e.getSupArchList());\r | |
752 | guid[i][5] = listToString(e.getSupModuleList());\r | |
753 | guid[i][6] = listToString(e.getGuidTypeList());\r | |
754 | i++;\r | |
755 | }\r | |
756 | }\r | |
757 | \r | |
758 | /**\r | |
759 | Get the number of protocol declarations from the size of List\r | |
760 | \r | |
761 | @return int\r | |
762 | **/\r | |
763 | public int getSpdProtocolDeclarationCount() {\r | |
764 | if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) {\r | |
765 | return 0;\r | |
766 | }\r | |
767 | return psaRoot.getProtocolDeclarations().getEntryList().size();\r | |
768 | }\r | |
769 | \r | |
770 | /**\r | |
771 | Get available protocol declaration contents into String array\r | |
772 | \r | |
773 | @param protocol Caller allocated two-dimentional String array\r | |
774 | **/\r | |
775 | public void getSpdProtocolDeclarations(String[][] protocol) {\r | |
776 | if (psaRoot.getProtocolDeclarations() == null) {\r | |
777 | return;\r | |
778 | }\r | |
779 | \r | |
780 | List<ProtocolDeclarationsDocument.ProtocolDeclarations.Entry> l = psaRoot.getProtocolDeclarations()\r | |
781 | .getEntryList();\r | |
782 | int i = 0;\r | |
783 | ListIterator li = l.listIterator();\r | |
784 | while (li.hasNext()) {\r | |
785 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li\r | |
786 | .next();\r | |
787 | protocol[i][0] = e.getName();\r | |
788 | protocol[i][1] = e.getCName();\r | |
789 | if (e.getGuidValue() != null) {\r | |
790 | protocol[i][2] = e.getGuidValue();\r | |
791 | }\r | |
792 | protocol[i][3] = e.getHelpText();\r | |
793 | protocol[i][4] = listToString(e.getSupArchList());\r | |
794 | protocol[i][5] = listToString(e.getSupModuleList());\r | |
795 | i++;\r | |
796 | }\r | |
797 | }\r | |
798 | \r | |
799 | /**\r | |
800 | Get the number of Ppi declarations from the size of List\r | |
801 | \r | |
802 | @return int\r | |
803 | **/\r | |
804 | public int getSpdPpiDeclarationCount() {\r | |
805 | if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) {\r | |
806 | return 0;\r | |
807 | }\r | |
808 | return psaRoot.getPpiDeclarations().getEntryList().size();\r | |
809 | }\r | |
810 | \r | |
811 | /**\r | |
812 | Get available Ppi declaration contents into String array\r | |
813 | \r | |
814 | @param ppi Caller allocated two-dimentional String array\r | |
815 | **/\r | |
816 | public void getSpdPpiDeclarations(String[][] ppi) {\r | |
817 | if (psaRoot.getPpiDeclarations() == null) {\r | |
818 | return;\r | |
819 | }\r | |
820 | \r | |
821 | List<PpiDeclarationsDocument.PpiDeclarations.Entry> l = psaRoot.getPpiDeclarations().getEntryList();\r | |
822 | int i = 0;\r | |
823 | ListIterator li = l.listIterator();\r | |
824 | while (li.hasNext()) {\r | |
825 | PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next();\r | |
826 | ppi[i][0] = e.getName();\r | |
827 | ppi[i][1] = e.getCName();\r | |
828 | if (e.getGuidValue() != null) {\r | |
829 | ppi[i][2] = e.getGuidValue();\r | |
830 | }\r | |
831 | ppi[i][3] = e.getHelpText();\r | |
832 | ppi[i][4] = listToString(e.getSupArchList());\r | |
833 | ppi[i][5] = listToString(e.getSupModuleList());\r | |
834 | \r | |
835 | i++;\r | |
836 | }\r | |
837 | }\r | |
838 | \r | |
839 | /**\r | |
840 | Get the number of Pcd definitions from the size of List\r | |
841 | \r | |
842 | @return int\r | |
843 | **/\r | |
844 | public int getSpdPcdDefinitionCount() {\r | |
845 | if (psaRoot.getPcdDeclarations() == null || psaRoot.getPcdDeclarations().getPcdEntryList() == null) {\r | |
846 | return 0;\r | |
847 | }\r | |
848 | return psaRoot.getPcdDeclarations().getPcdEntryList().size();\r | |
849 | }\r | |
850 | \r | |
851 | /**\r | |
852 | Get available Pcd definition contents into String array\r | |
853 | \r | |
854 | @param pcd Caller allocated two-dimentional String array\r | |
855 | **/\r | |
856 | public void getSpdPcdDefinitions(String[][] pcd, String pcdUsage[][]) {\r | |
857 | if (psaRoot.getPcdDeclarations() == null) {\r | |
858 | return;\r | |
859 | }\r | |
860 | \r | |
861 | List<PcdDeclarationsDocument.PcdDeclarations.PcdEntry> l = psaRoot.getPcdDeclarations().getPcdEntryList();\r | |
862 | int i = 0;\r | |
863 | while (i < l.size()) {\r | |
864 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)l.get(i);\r | |
865 | pcd[i][0] = e.getCName();\r | |
866 | pcd[i][1] = e.getToken() + ""; \r | |
867 | pcd[i][2] = e.getTokenSpaceGuidCName();\r | |
868 | if (e.getDatumType() != null) {\r | |
869 | pcd[i][3] = e.getDatumType().toString();\r | |
870 | }\r | |
871 | pcd[i][4] = e.getDefaultValue()+"";\r | |
872 | pcd[i][5] = e.getHelpText();\r | |
873 | String archList = listToString(e.getSupArchList());\r | |
874 | if (archList != null) {\r | |
875 | pcd[i][6] = archList;\r | |
876 | }\r | |
877 | String modTypeList = listToString(e.getSupModuleList());\r | |
878 | if (modTypeList != null) {\r | |
879 | pcd[i][7] = modTypeList;\r | |
880 | }\r | |
881 | \r | |
882 | int j = 0;\r | |
883 | while (j < e.getValidUsage().size() && j < 5) {\r | |
884 | pcdUsage[i][j] = (String)e.getValidUsage().get(j);\r | |
885 | ++j;\r | |
886 | }\r | |
887 | i++;\r | |
888 | }\r | |
889 | }\r | |
890 | \r | |
891 | /**\r | |
892 | Save the processed xml contents to file\r | |
893 | \r | |
894 | @param spdFile The file to save xml contents\r | |
895 | @throws IOException Exceptions during file operation\r | |
896 | **/\r | |
897 | public void saveAs(File spdFile) throws IOException {\r | |
898 | \r | |
899 | XmlOptions options = new XmlOptions();\r | |
900 | \r | |
901 | options.setCharacterEncoding("UTF-8");\r | |
902 | options.setSavePrettyPrint();\r | |
903 | options.setSavePrettyPrintIndent(2);\r | |
904 | try {\r | |
905 | psad.save(spdFile, options);\r | |
906 | } catch (IOException e) {\r | |
907 | e.printStackTrace();\r | |
908 | }\r | |
909 | \r | |
910 | }\r | |
911 | \r | |
912 | /**\r | |
913 | Generate SpdHeader contents using parameters passed in.\r | |
914 | \r | |
915 | @param pkgName PackageName \r | |
916 | @param pkgGuid Guid\r | |
917 | @param pkgVer Version\r | |
918 | @param pkgAbs Abstract\r | |
919 | @param pkgDes Description\r | |
920 | @param pkgCpRight Copyright\r | |
921 | @param pkgLicense License\r | |
922 | @param pkgCreateDate Created\r | |
923 | @param pkgUpdateDate Updated\r | |
924 | @param pkgURL URL\r | |
925 | @param pkgType PackageType\r | |
926 | @param pkgRdOnly ReadOnly\r | |
927 | @param pkgRePkg RePackage\r | |
928 | @param pkgSpec Reserved\r | |
929 | @param pkgOutDir Reserved\r | |
930 | **/\r | |
931 | public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes,\r | |
932 | String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate,\r | |
933 | String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec,\r | |
934 | String pkgOutDir) {\r | |
935 | if (getSpdHdr() == null) {\r | |
936 | spdHdr = psaRoot.addNewSpdHeader();\r | |
937 | }\r | |
938 | \r | |
939 | setSpdHdrPkgName(pkgName);\r | |
940 | setSpdHdrGuidValue(pkgGuid);\r | |
941 | setSpdHdrVer(pkgVer);\r | |
942 | setSpdHdrAbs(pkgAbs);\r | |
943 | setSpdHdrDescription(pkgDes);\r | |
944 | setSpdHdrCopyright(pkgCpRight);\r | |
945 | setSpdHdrLicense(pkgLicense);\r | |
946 | \r | |
947 | \r | |
948 | setSpdHdrSpec(pkgSpec);\r | |
949 | }\r | |
950 | \r | |
951 | /**\r | |
952 | Generate library class declaration element using parameters passed in\r | |
953 | \r | |
954 | @param libClassBaseName LibraryClass element value\r | |
955 | @param libClassUsage Reserved\r | |
956 | @param incHdrFileName IncludeHeader element value\r | |
957 | @param incHdrAttribGuid Reserved\r | |
958 | @param incHdrAttribArch Reserved\r | |
959 | @param incHdrAttribPath Reserved\r | |
960 | @param incHdrAttribClass Reserved\r | |
961 | @param incHdrAttribVer Reserved\r | |
962 | @param incHdrAttribOverrideID Reserved\r | |
963 | @param incHdrAttribModuleType Reserved\r | |
964 | **/\r | |
965 | public void genSpdLibClassDeclarations(String libClassBaseName, String instanceUsage, String incHdrFileName,\r | |
966 | String help, String incHdrAttribArch, String incHdrAttribPath,\r | |
967 | String incHdrAttribClass, String incHdrAttribVer,\r | |
968 | String incHdrAttribOverrideID, String incHdrAttribModuleType) {\r | |
969 | if (getSpdLibClassDeclarations() == null) {\r | |
970 | spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations();\r | |
971 | }\r | |
972 | //\r | |
973 | // add contents under LibraryClassDeclarations tag \r | |
974 | //\r | |
975 | setSpdLibClassDeclaration(libClassBaseName, instanceUsage, incHdrFileName, help, incHdrAttribArch,\r | |
976 | incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID,\r | |
977 | incHdrAttribModuleType, spdLibClassDeclarations);\r | |
978 | }\r | |
979 | \r | |
980 | /**\r | |
981 | Set library class declaration contents under parent tag\r | |
982 | \r | |
983 | @param clsName LibraryClass element value\r | |
984 | @param clsUsage Reserved\r | |
985 | @param hdrFile IncludeHeader element value\r | |
986 | @param hdrAttribGuid Reserved\r | |
987 | @param hdrAttribArch Reserved\r | |
988 | @param hdrAttribPath Reserved\r | |
989 | @param hdrAttribClass Reserved\r | |
990 | @param hdrAttribVer Reserved\r | |
991 | @param hdrAttribOverID Reserved\r | |
992 | @param hdrAttribModType Reserved\r | |
993 | @param parent The tag under which library class declaration goes to\r | |
994 | **/\r | |
995 | public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String help,\r | |
996 | String hdrAttribArch, String hdrAttribPath, String hdrAttribClass,\r | |
997 | String instanceVer, String hdrAttribOverID, String hdrAttribModType,\r | |
998 | XmlObject parent) {\r | |
999 | \r | |
1000 | setSpdLibraryClass(clsName, hdrFile, help, clsUsage, instanceVer, hdrAttribArch, hdrAttribModType, parent);\r | |
1001 | \r | |
1002 | }\r | |
1003 | \r | |
1004 | /**\r | |
1005 | Set the contents of LibraryClass under parent element\r | |
1006 | \r | |
1007 | @param clsName LibraryClass element value \r | |
1008 | @param clsUsage Reserved\r | |
1009 | @param parent The tag under which library class declaration goes to\r | |
1010 | **/\r | |
1011 | public void setSpdLibraryClass(String clsName, String clsIncludeFile, String help, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType, XmlObject parent) {\r | |
1012 | LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent).addNewLibraryClass();\r | |
1013 | lc.setName(clsName);\r | |
1014 | lc.setIncludeHeader(clsIncludeFile);\r | |
1015 | lc.setHelpText(help);\r | |
2f8a7517 | 1016 | // LAH added logic so you cannot set the version unless the GUID is defined.\r |
d129bd96 | 1017 | \r |
2f8a7517 | 1018 | if (clsUsage != null) {\r |
1019 | lc.setRecommendedInstanceGuid(clsUsage);\r | |
1020 | if (instanceVer != null) {\r | |
1021 | lc.setRecommendedInstanceVersion(instanceVer);\r | |
1022 | }\r | |
1023 | }\r | |
d129bd96 | 1024 | else {\r |
1025 | if (lc.isSetRecommendedInstanceGuid()) {\r | |
1026 | lc.unsetRecommendedInstanceGuid();\r | |
1027 | }\r | |
1028 | if (lc.isSetRecommendedInstanceVersion()) {\r | |
1029 | lc.unsetRecommendedInstanceVersion();\r | |
1030 | }\r | |
1031 | }\r | |
1032 | \r | |
a13899c5 | 1033 | if (hdrAttribArch != null) {\r |
1034 | lc.setSupArchList(stringToList(hdrAttribArch));\r | |
322b7723 | 1035 | } else {\r |
1036 | if (lc.isSetSupArchList()) {\r | |
1037 | lc.unsetSupArchList();\r | |
1038 | }\r | |
a13899c5 | 1039 | }\r |
322b7723 | 1040 | \r |
a13899c5 | 1041 | if (hdrAttribModType != null) {\r |
97796eaa | 1042 | lc.setSupModuleList(stringToList(hdrAttribModType));\r |
1043 | } else {\r | |
322b7723 | 1044 | if (lc.isSetSupModuleList()) {\r |
1045 | lc.unsetSupModuleList();\r | |
1046 | }\r | |
a13899c5 | 1047 | }\r |
1048 | \r | |
1049 | }\r | |
1050 | \r | |
1051 | /**\r | |
1052 | Set contents of IncludeHeader under parent element\r | |
1053 | \r | |
1054 | @param modType Reserved\r | |
1055 | @param hdrFile IncludeHeader element value\r | |
1056 | @param hdrAttribGuid Reserved\r | |
1057 | @param hdrAttribArch Reserved\r | |
1058 | @param hdrAttribPath Reserved\r | |
1059 | @param hdrAttribClass Reserved\r | |
1060 | @param hdrAttribVer Reserved\r | |
1061 | @param hdrAttribOverID Reserved\r | |
1062 | @param parent The tag under which library class declaration goes to\r | |
1063 | **/\r | |
1064 | public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r | |
1065 | String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r | |
1066 | String hdrAttribOverID, XmlObject parent) {\r | |
1067 | \r | |
1068 | if (parent instanceof LibraryClassDeclarationsDocument.LibraryClassDeclarations) {\r | |
1069 | } else if (parent instanceof PackageHeadersDocument.PackageHeaders) {\r | |
1070 | PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = null;\r | |
1071 | ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludePkgHeader();\r | |
1072 | ih.setStringValue(hdrFile);\r | |
1073 | ih.setModuleType(ModuleTypeDef.Enum.forString(modType));\r | |
1074 | } else {\r | |
1075 | return;\r | |
1076 | }\r | |
1077 | \r | |
1078 | if (hdrAttribGuid != null) {\r | |
1079 | }\r | |
1080 | if (hdrAttribPath != null) {\r | |
1081 | }\r | |
1082 | if (hdrAttribClass != null) {\r | |
1083 | }\r | |
1084 | if (hdrAttribVer != null) {\r | |
1085 | }\r | |
1086 | if (hdrAttribOverID != null) {\r | |
1087 | }\r | |
1088 | \r | |
1089 | }\r | |
1090 | \r | |
1091 | /**\r | |
1092 | Generate MsaFile element.\r | |
1093 | \r | |
1094 | @param msaFileName MsaFile element value\r | |
1095 | @param archType Reserved\r | |
1096 | **/\r | |
1097 | public void genSpdMsaFiles(String msaFileName, String moduleName, String ver, String guid) {\r | |
1098 | if (getSpdMsaFiles() == null) {\r | |
1099 | spdMsaFiles = psaRoot.addNewMsaFiles();\r | |
1100 | }\r | |
1101 | setSpdMsaFile(msaFileName, moduleName, ver, guid, spdMsaFiles);\r | |
1102 | \r | |
1103 | }\r | |
1104 | \r | |
1105 | /**\r | |
1106 | Set MsaFile contents under parent element.\r | |
1107 | \r | |
1108 | @param msaFileName MsaFile element value\r | |
1109 | @param parent Element under which MsaFile goes to\r | |
1110 | **/\r | |
1111 | public void setSpdMsaFile(String msaFileName, String moduleName, String ver, String guid, XmlObject parent) {\r | |
1112 | MsaFilesDocument.MsaFiles f = (MsaFilesDocument.MsaFiles)parent;\r | |
1113 | f.addNewFilename().setStringValue(msaFileName);\r | |
1114 | // f.setFilename(msaFileName);\r | |
1115 | // f.setModuleName(moduleName);\r | |
1116 | // f.setModuleVersion(ver);\r | |
1117 | // f.setModuleGuid(guid);\r | |
1118 | }\r | |
1119 | \r | |
1120 | /**\r | |
1121 | Generate PackageHeader element using parameters passed in.\r | |
1122 | \r | |
1123 | @param ModHdrModType ModuleType attribute of IncludeHeader element\r | |
1124 | @param hdrFile IncludeHeader element value\r | |
1125 | @param hdrAttribGuid Reserved\r | |
1126 | @param hdrAttribArch Reserved\r | |
1127 | @param hdrAttribPath Reserved\r | |
1128 | @param hdrAttribClass Reserved\r | |
1129 | @param hdrAttribVer Reserved\r | |
1130 | @param hdrAttribOverID Reserved\r | |
1131 | **/\r | |
1132 | public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r | |
1133 | String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r | |
1134 | String hdrAttribOverID) {\r | |
1135 | if (getSpdModHdrs() == null) {\r | |
1136 | spdModHdrs = psaRoot.addNewPackageHeaders();\r | |
1137 | }\r | |
1138 | \r | |
1139 | //\r | |
1140 | // add IncludeHeader under PackageHeaders element\r | |
1141 | //\r | |
1142 | setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass,\r | |
1143 | hdrAttribVer, hdrAttribOverID, spdModHdrs);\r | |
1144 | }\r | |
1145 | \r | |
1146 | /**\r | |
1147 | Generate GUID declaration element using parameters passed in.\r | |
1148 | \r | |
1149 | @param guidDeclEntryName Name attribute of Entry element\r | |
1150 | @param guidDeclCName CName element value\r | |
1151 | @param guidDeclGuid Guid element value\r | |
1152 | @param guidDeclFeatureFlag Reserved\r | |
1153 | **/\r | |
1154 | public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid,\r | |
1155 | String guidDeclHelp, Vector<String> archList, Vector<String> modTypeList,\r | |
1156 | Vector<String> guidTypeList) {\r | |
1157 | if (getSpdGuidDeclarations() == null) {\r | |
1158 | spdGuidDeclarations = psaRoot.addNewGuidDeclarations();\r | |
1159 | }\r | |
1160 | \r | |
1161 | setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclHelp, archList, modTypeList, guidTypeList, spdGuidDeclarations);\r | |
1162 | }\r | |
1163 | \r | |
1164 | /**\r | |
1165 | Generate protocol declaration element using parameters passed in.\r | |
1166 | \r | |
1167 | @param protocolDeclEntryName Name attribute of Entry element\r | |
1168 | @param protocolDeclCName CName element value\r | |
1169 | @param protocolDeclGuid Guid element value\r | |
1170 | @param protocolDeclFeatureFlag Reserved\r | |
1171 | **/\r | |
1172 | public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName,\r | |
1173 | String protocolDeclGuid, String protocolDeclFeatureFlag,\r | |
1174 | Vector<String> archList, Vector<String> modTypeList) {\r | |
1175 | if (getSpdProtocolDeclarations() == null) {\r | |
1176 | spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations();\r | |
1177 | }\r | |
1178 | \r | |
1179 | setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag,\r | |
1180 | archList, modTypeList, null, spdProtocolDeclarations);\r | |
1181 | }\r | |
1182 | \r | |
1183 | /**\r | |
1184 | Generate PPI declaration element using parameters passed in.\r | |
1185 | \r | |
1186 | @param ppiDeclEntryName Name attribute of Entry element\r | |
1187 | @param ppiDeclCName CName element value\r | |
1188 | @param ppiDeclGuid Guid element value\r | |
1189 | @param ppiDeclFeatureFlag Reserved\r | |
1190 | **/\r | |
1191 | public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid,\r | |
1192 | String ppiDeclFeatureFlag, Vector<String> archList, Vector<String> modTypeList) {\r | |
1193 | if (getSpdPpiDeclarations() == null) {\r | |
1194 | spdPpiDeclarations = psaRoot.addNewPpiDeclarations();\r | |
1195 | }\r | |
1196 | \r | |
1197 | setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, archList, modTypeList, null, spdPpiDeclarations);\r | |
1198 | }\r | |
1199 | \r | |
1200 | /**\r | |
1201 | Set Entry contents using parameters passed in\r | |
1202 | \r | |
1203 | @param entryName Name attribute of Entry element\r | |
1204 | @param cName CName element value\r | |
1205 | @param guid Guid element value\r | |
1206 | @param featureFlag Reserved\r | |
1207 | @param parent The tag under which Entry element goes to\r | |
1208 | **/\r | |
1209 | public void setSpdEntry(String entryName, String cName, String guid, String help, \r | |
1210 | Vector<String> archList, Vector<String> modTypeList,\r | |
1211 | Vector<String> guidTypeList, XmlObject parent) {\r | |
1212 | \r | |
1213 | if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {\r | |
1214 | GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry();\r | |
1215 | e.setName(entryName);\r | |
1216 | e.setCName(cName);\r | |
1217 | e.setGuidValue(guid);\r | |
1218 | e.setHelpText(help);\r | |
ce73a791 | 1219 | e.setGuidTypeList(guidTypeList);\r |
1220 | e.setSupArchList(archList);\r | |
1221 | e.setSupModuleList(modTypeList);\r | |
1222 | // if (guidTypeList != null && guidTypeList.size() > 0) {\r | |
1223 | // e.setGuidTypeList(new ArrayList<String>(guidTypeList));\r | |
1224 | // }\r | |
1225 | // if (archList != null && archList.size() > 0){\r | |
1226 | // e.setSupArchList(new ArrayList<String>(archList));\r | |
1227 | // }\r | |
1228 | // if (modTypeList != null && modTypeList.size() > 0) {\r | |
1229 | // e.setSupModuleList(new ArrayList<String>(modTypeList));\r | |
1230 | // }\r | |
a13899c5 | 1231 | return;\r |
1232 | }\r | |
1233 | if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {\r | |
1234 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent)\r | |
1235 | .addNewEntry();\r | |
1236 | pe.setName(entryName);\r | |
1237 | pe.setCName(cName);\r | |
1238 | pe.setGuidValue(guid);\r | |
1239 | pe.setHelpText(help);\r | |
ce73a791 | 1240 | pe.setSupArchList(archList);\r |
1241 | pe.setSupModuleList(modTypeList);\r | |
1242 | // if (archList != null && archList.size() > 0){\r | |
1243 | // pe.setSupArchList(new ArrayList<String>(archList));\r | |
1244 | // }\r | |
1245 | // if (modTypeList != null && modTypeList.size() > 0) {\r | |
1246 | // pe.setSupModuleList(new ArrayList<String>(modTypeList));\r | |
1247 | // }\r | |
a13899c5 | 1248 | return;\r |
1249 | }\r | |
1250 | if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {\r | |
1251 | PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent)\r | |
1252 | .addNewEntry();\r | |
1253 | ppe.setName(entryName);\r | |
1254 | ppe.setCName(cName);\r | |
1255 | ppe.setGuidValue(guid);\r | |
1256 | ppe.setHelpText(help);\r | |
ce73a791 | 1257 | ppe.setSupArchList(archList);\r |
1258 | ppe.setSupModuleList(modTypeList);\r | |
1259 | // if (archList != null && archList.size() > 0){\r | |
1260 | // ppe.setSupArchList(new ArrayList<String>(archList));\r | |
1261 | // }\r | |
1262 | // if (archList != null && modTypeList.size() > 0) {\r | |
1263 | // ppe.setSupModuleList(new ArrayList<String>(modTypeList));\r | |
1264 | // }\r | |
a13899c5 | 1265 | return;\r |
1266 | }\r | |
1267 | \r | |
1268 | return;\r | |
1269 | \r | |
1270 | }\r | |
1271 | \r | |
1272 | /**\r | |
1273 | Generate Pcd definition using parameters passed in\r | |
1274 | \r | |
1275 | @param pcdItemTypes ItemType attribute of PcdEntry element\r | |
1276 | @param cName C_Name element value\r | |
1277 | @param token Token element value\r | |
1278 | @param dataType DatumType element value\r | |
1279 | @param skuEnable Reserved\r | |
1280 | @param sku Reserved\r | |
1281 | @param maxSku Reserved\r | |
1282 | @param hiiEnable Reserved\r | |
1283 | @param varGuid Reserved\r | |
1284 | @param varName Reserved\r | |
1285 | @param defaultString DefaultString element value\r | |
1286 | **/\r | |
1287 | public void genSpdPcdDefinitions(String cName, String token, String dataType, String pcdItemTypes, \r | |
1288 | String spaceGuid, String defaultString, String help, String archList,\r | |
1289 | String modTypeList) {\r | |
1290 | if (getSpdPcdDefinitions() == null) {\r | |
1291 | spdPcdDefinitions = psaRoot.addNewPcdDeclarations();\r | |
1292 | }\r | |
1293 | \r | |
1294 | setSpdPcdEntry(pcdItemTypes, cName, token, dataType, spaceGuid, help,\r | |
1295 | defaultString, archList, modTypeList, spdPcdDefinitions);\r | |
1296 | }\r | |
1297 | \r | |
1298 | /**\r | |
1299 | Set Pcd entry contents under parent tag\r | |
1300 | \r | |
1301 | @param pcdItemTypes ItemType attribute of PcdEntry element\r | |
1302 | @param cName C_Name element value\r | |
1303 | @param token Token element value\r | |
1304 | @param dataType DatumType element value\r | |
1305 | @param spaceGuid Reserved\r | |
1306 | @param help Reserved\r | |
1307 | @param defaultString DefaultString element value\r | |
1308 | @param parent Tag under which PcdEntry goes to\r | |
1309 | **/\r | |
1310 | public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String spaceGuid, String help,\r | |
1311 | String defaultString, String archList, String modTypeList, XmlObject parent) {\r | |
1312 | \r | |
1313 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = ((PcdDeclarationsDocument.PcdDeclarations) parent).addNewPcdEntry();\r | |
1314 | \r | |
1315 | //ToDo: maybe multiple types in, need parse pcdItemTypes.\r | |
1316 | String usage[] = pcdItemTypes.split("( )+");\r | |
1317 | List<String> l = new ArrayList<String>();\r | |
1318 | for (int i = 0; i < usage.length; ++i) {\r | |
1319 | l.add(usage[i]); \r | |
1320 | }\r | |
1321 | pe.setValidUsage(l);\r | |
1322 | pe.setCName(cName);\r | |
1323 | pe.setToken(token);\r | |
1324 | pe.setDatumType(PcdDataTypes.Enum.forString(dataType));\r | |
1325 | pe.setDefaultValue(defaultString);\r | |
1326 | pe.setTokenSpaceGuidCName(spaceGuid);\r | |
1327 | pe.setHelpText(help);\r | |
1328 | if (archList != null){\r | |
97796eaa | 1329 | pe.setSupArchList(stringToList(archList));\r |
1330 | } else {\r | |
322b7723 | 1331 | if (pe.isSetSupArchList()) {\r |
1332 | pe.unsetSupArchList();\r | |
1333 | }\r | |
a13899c5 | 1334 | }\r |
1335 | if (modTypeList != null){\r | |
97796eaa | 1336 | pe.setSupModuleList(stringToList(modTypeList));\r |
1337 | } else {\r | |
322b7723 | 1338 | if (pe.isSetSupModuleList()) {\r |
1339 | pe.unsetSupModuleList();\r | |
1340 | }\r | |
a13899c5 | 1341 | }\r |
1342 | }\r | |
1343 | \r | |
1344 | /**\r | |
1345 | Get PpiDeclarations element\r | |
1346 | \r | |
1347 | @return PpiDeclarationsDocument.PpiDeclarations\r | |
1348 | **/\r | |
1349 | public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() {\r | |
1350 | if (spdPpiDeclarations == null) {\r | |
1351 | spdPpiDeclarations = psaRoot.getPpiDeclarations();\r | |
1352 | }\r | |
1353 | return spdPpiDeclarations;\r | |
1354 | }\r | |
1355 | \r | |
1356 | /**\r | |
1357 | Get ProtocolDeclarations element\r | |
1358 | \r | |
1359 | @return ProtocolDeclarationsDocument.ProtocolDeclarations\r | |
1360 | **/\r | |
1361 | public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() {\r | |
1362 | if (spdProtocolDeclarations == null) {\r | |
1363 | spdProtocolDeclarations = psaRoot.getProtocolDeclarations();\r | |
1364 | }\r | |
1365 | return spdProtocolDeclarations;\r | |
1366 | }\r | |
1367 | \r | |
1368 | /**\r | |
1369 | Get GuidDeclarations element\r | |
1370 | \r | |
1371 | @return GuidDeclarationsDocument.GuidDeclarations\r | |
1372 | **/\r | |
1373 | public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() {\r | |
1374 | if (spdGuidDeclarations == null) {\r | |
1375 | spdGuidDeclarations = psaRoot.getGuidDeclarations();\r | |
1376 | }\r | |
1377 | return spdGuidDeclarations;\r | |
1378 | }\r | |
1379 | \r | |
1380 | /**\r | |
1381 | Get PcdDefinitions element\r | |
1382 | \r | |
1383 | @return PcdDefinitionsDocument.PcdDefinitions\r | |
1384 | **/\r | |
1385 | public PcdDeclarationsDocument.PcdDeclarations getSpdPcdDefinitions() {\r | |
1386 | if (spdPcdDefinitions == null) {\r | |
1387 | spdPcdDefinitions = psaRoot.getPcdDeclarations();\r | |
1388 | }\r | |
1389 | return spdPcdDefinitions;\r | |
1390 | }\r | |
1391 | \r | |
1392 | /**\r | |
1393 | Get PackageHeaders element\r | |
1394 | \r | |
1395 | @return PackageHeadersDocument.PackageHeaders\r | |
1396 | **/\r | |
1397 | public PackageHeadersDocument.PackageHeaders getSpdModHdrs() {\r | |
1398 | if (spdModHdrs == null) {\r | |
1399 | spdModHdrs = psaRoot.getPackageHeaders();\r | |
1400 | }\r | |
1401 | return spdModHdrs;\r | |
1402 | }\r | |
1403 | \r | |
1404 | /**\r | |
1405 | Get MsaFiles element\r | |
1406 | \r | |
1407 | @return MsaFilesDocument.MsaFiles\r | |
1408 | **/\r | |
1409 | public MsaFilesDocument.MsaFiles getSpdMsaFiles() {\r | |
1410 | if (spdMsaFiles == null) {\r | |
1411 | spdMsaFiles = psaRoot.getMsaFiles();\r | |
1412 | }\r | |
1413 | return spdMsaFiles;\r | |
1414 | }\r | |
1415 | \r | |
1416 | /**\r | |
1417 | Get LibraryClassDeclarations element\r | |
1418 | \r | |
1419 | @return LibraryClassDeclarationsDocument.LibraryClassDeclarations\r | |
1420 | **/\r | |
1421 | public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() {\r | |
1422 | if (spdLibClassDeclarations == null) {\r | |
1423 | spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations();\r | |
1424 | }\r | |
1425 | return spdLibClassDeclarations;\r | |
1426 | }\r | |
1427 | \r | |
1428 | public PackageDefinitionsDocument.PackageDefinitions getSpdPkgDefs() {\r | |
1429 | if (spdPkgDefs == null) {\r | |
1430 | spdPkgDefs = psaRoot.addNewPackageDefinitions();\r | |
1431 | }\r | |
1432 | return spdPkgDefs;\r | |
1433 | }\r | |
1434 | /**\r | |
1435 | Get SpdHeader element\r | |
1436 | \r | |
1437 | @return SpdHeaderDocument.SpdHeader\r | |
1438 | **/\r | |
1439 | public SpdHeaderDocument.SpdHeader getSpdHdr() {\r | |
1440 | if (spdHdr == null) {\r | |
1441 | spdHdr = psaRoot.addNewSpdHeader();\r | |
1442 | }\r | |
1443 | return spdHdr;\r | |
1444 | }\r | |
1445 | \r | |
1446 | /**\r | |
1447 | Set value to Guid element\r | |
1448 | \r | |
1449 | @param guid The value set to Guid element\r | |
1450 | **/\r | |
1451 | public void setSpdHdrGuidValue(String guid) {\r | |
1452 | getSpdHdr().setGuidValue(guid);\r | |
1453 | }\r | |
1454 | \r | |
1455 | /**\r | |
1456 | Get Version element under SpdHdr\r | |
1457 | \r | |
1458 | @return String\r | |
1459 | **/\r | |
1460 | public String getSpdHdrVer() {\r | |
1461 | return getSpdHdr().getVersion();\r | |
1462 | }\r | |
1463 | \r | |
1464 | /**\r | |
1465 | Set value to Version element\r | |
1466 | \r | |
1467 | @param ver The value set to Version element\r | |
1468 | **/\r | |
1469 | public void setSpdHdrVer(String ver) {\r | |
1470 | getSpdHdr().setVersion(ver);\r | |
1471 | }\r | |
1472 | \r | |
1473 | public String getSpdHdrAbs(){\r | |
1474 | return getSpdHdr().getAbstract();\r | |
1475 | \r | |
1476 | }\r | |
1477 | \r | |
1478 | /**\r | |
1479 | Set value to Abstract element\r | |
1480 | \r | |
1481 | @param abs The value set to Abstract element\r | |
1482 | **/\r | |
1483 | public void setSpdHdrAbs(String abs) {\r | |
1484 | \r | |
1485 | getSpdHdr().setAbstract(abs);\r | |
1486 | }\r | |
1487 | \r | |
1488 | public String getSpdHdrDescription(){\r | |
1489 | return getSpdHdr().getDescription(); \r | |
1490 | }\r | |
1491 | /**\r | |
1492 | Set value to Description element\r | |
1493 | \r | |
1494 | @param des The value set to Description element\r | |
1495 | **/\r | |
1496 | public void setSpdHdrDescription(String des) {\r | |
1497 | getSpdHdr().setDescription(des);\r | |
1498 | }\r | |
1499 | \r | |
1500 | public String getSpdHdrCopyright(){\r | |
1501 | return getSpdHdr().getCopyright();\r | |
1502 | }\r | |
1503 | /**\r | |
1504 | Set value to Copyright element\r | |
1505 | \r | |
1506 | @param cpRit The value set to Copyright element\r | |
1507 | **/\r | |
1508 | public void setSpdHdrCopyright(String cpRit) {\r | |
1509 | \r | |
1510 | getSpdHdr().setCopyright(cpRit);\r | |
1511 | \r | |
1512 | }\r | |
1513 | /**\r | |
1514 | Get License element under SpdHdr\r | |
1515 | \r | |
1516 | @return String\r | |
1517 | **/\r | |
1518 | public String getSpdHdrLicense() {\r | |
1519 | if (getSpdHdr().getLicense() != null) {\r | |
1520 | return getSpdHdr().getLicense().getStringValue();\r | |
1521 | }\r | |
1522 | return null;\r | |
1523 | }\r | |
1524 | \r | |
1525 | /**\r | |
1526 | Set value to License element\r | |
1527 | \r | |
1528 | @param license The value set to License element\r | |
1529 | **/\r | |
1530 | public void setSpdHdrLicense(String license) {\r | |
1531 | if (getSpdHdr().getLicense() == null){\r | |
1532 | getSpdHdr().addNewLicense().setStringValue(license);\r | |
1533 | }\r | |
1534 | else {\r | |
1535 | getSpdHdr().getLicense().setStringValue(license);\r | |
1536 | }\r | |
1537 | }\r | |
1538 | \r | |
1539 | public String getSpdHdrUrl(){\r | |
1540 | if (getSpdHdr().getLicense() != null) {\r | |
1541 | return getSpdHdr().getLicense().getURL();\r | |
1542 | }\r | |
1543 | return null;\r | |
1544 | }\r | |
1545 | \r | |
1546 | public void setSpdHdrUrl(String url){\r | |
1547 | getSpdHdr().getLicense().setURL(url);\r | |
1548 | }\r | |
1549 | \r | |
1550 | /**\r | |
1551 | Get PackageName element under SpdHdr\r | |
1552 | \r | |
1553 | @return String\r | |
1554 | **/\r | |
1555 | public String getSpdHdrPkgName() {\r | |
1556 | \r | |
1557 | return getSpdHdr().getPackageName();\r | |
1558 | }\r | |
1559 | \r | |
1560 | /**\r | |
1561 | Set value to PackageName element\r | |
1562 | \r | |
1563 | @param pkgName The value set to PackageName element\r | |
1564 | **/\r | |
1565 | public void setSpdHdrPkgName(String pkgName) {\r | |
1566 | getSpdHdr().setPackageName(pkgName);\r | |
1567 | }\r | |
1568 | \r | |
1569 | public String getSpdHdrGuidValue(){\r | |
1570 | return getSpdHdr().getGuidValue();\r | |
1571 | }\r | |
1572 | \r | |
1573 | /**\r | |
1574 | Reserved method\r | |
1575 | \r | |
1576 | @return SpecificationDocument.Specification\r | |
1577 | **/\r | |
1578 | public String getSpdHdrSpec() {\r | |
c06e8657 | 1579 | return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r |
a13899c5 | 1580 | // return getSpdHdr().getSpecification();\r |
1581 | }\r | |
1582 | \r | |
1583 | /**\r | |
1584 | Reserved method\r | |
1585 | \r | |
1586 | @param spec \r | |
1587 | **/\r | |
1588 | public void setSpdHdrSpec(String spec) {\r | |
c06e8657 | 1589 | spec = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r |
a13899c5 | 1590 | getSpdHdr().setSpecification(spec);\r |
1591 | \r | |
1592 | }\r | |
1593 | \r | |
1594 | public String getSpdPkgDefsRdOnly(){\r | |
1595 | return getSpdPkgDefs().getReadOnly() + "";\r | |
1596 | }\r | |
1597 | /**\r | |
1598 | Set value to ReadOnly element\r | |
1599 | \r | |
1600 | @param rdOnly The value set to ReadOnly element\r | |
1601 | **/\r | |
1602 | public void setSpdPkgDefsRdOnly(String rdOnly) {\r | |
1603 | \r | |
1604 | getSpdPkgDefs().setReadOnly(new Boolean(rdOnly));\r | |
1605 | }\r | |
1606 | \r | |
1607 | public String getSpdPkgDefsRePkg(){\r | |
1608 | return getSpdPkgDefs().getRePackage() + "";\r | |
1609 | }\r | |
1610 | /**\r | |
1611 | Set value to RePackage element\r | |
1612 | \r | |
1613 | @param rePkg The value set to RePackage element\r | |
1614 | **/\r | |
1615 | public void setSpdPkgDefsRePkg(String rePkg) {\r | |
1616 | \r | |
1617 | getSpdPkgDefs().setRePackage(new Boolean(rePkg));\r | |
1618 | }\r | |
1619 | \r | |
1620 | /**\r | |
1621 | Set value to URL element\r | |
1622 | \r | |
1623 | @param url The value set to URL element\r | |
1624 | **/\r | |
1625 | // public void setSpdHdrURL(String url) {\r | |
1626 | // getSpdHdr().setURL(url);\r | |
1627 | // }\r | |
1628 | \r | |
1629 | /**\r | |
1630 | Get xml file\r | |
1631 | \r | |
1632 | @return File\r | |
1633 | **/\r | |
1634 | public File getFile() {\r | |
1635 | return file;\r | |
1636 | }\r | |
1637 | \r | |
1638 | /**\r | |
1639 | Set file\r | |
1640 | \r | |
1641 | @param file File with xml format\r | |
1642 | **/\r | |
1643 | public void setFile(File file) {\r | |
1644 | this.file = file;\r | |
1645 | }\r | |
1646 | \r | |
1647 | private List<String> stringToList(String s){\r | |
ce73a791 | 1648 | if (s == null || s.length() == 0) {\r |
a13899c5 | 1649 | return null;\r |
1650 | }\r | |
ce73a791 | 1651 | Vector<String> al = new Vector<String>();\r |
a13899c5 | 1652 | String[] sArray = s.split(" ");\r |
1653 | for(int i = 0; i < sArray.length; ++i){\r | |
1654 | al.add(sArray[i]);\r | |
1655 | }\r | |
1656 | return al; \r | |
1657 | }\r | |
1658 | \r | |
ce73a791 | 1659 | private String listToString(List l) {\r |
a13899c5 | 1660 | if (l == null) {\r |
1661 | return null;\r | |
1662 | }\r | |
1663 | String s = " ";\r | |
1664 | ListIterator li = l.listIterator();\r | |
1665 | while(li.hasNext()) {\r | |
1666 | s += li.next();\r | |
1667 | s += " ";\r | |
1668 | }\r | |
1669 | return s.trim();\r | |
1670 | }\r | |
1671 | \r | |
1672 | }\r |