]>
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 | |
a13899c5 | 351 | }\r |
97796eaa | 352 | \r |
a13899c5 | 353 | if (stringToList(hdrAttribArch) != null){\r |
97796eaa | 354 | lc.setSupArchList(stringToList(hdrAttribArch));\r |
355 | } else {\r | |
322b7723 | 356 | if (lc.isSetSupArchList()) {\r |
357 | lc.unsetSupArchList();\r | |
358 | }\r | |
a13899c5 | 359 | }\r |
360 | if (stringToList(hdrAttribModType) != null){\r | |
97796eaa | 361 | lc.setSupModuleList(stringToList(hdrAttribModType));\r |
362 | } else {\r | |
322b7723 | 363 | if (lc.isSetSupModuleList()) {\r |
364 | lc.unsetSupModuleList();\r | |
365 | }\r | |
a13899c5 | 366 | }\r |
367 | }\r | |
368 | \r | |
369 | cursor.dispose();\r | |
370 | }\r | |
371 | \r | |
372 | public void updateSpdMsaFile(int i, String msaFile, String mName, String v, String g){\r | |
373 | XmlObject o = psaRoot.getMsaFiles();\r | |
374 | if (o == null)\r | |
375 | return;\r | |
376 | \r | |
377 | XmlCursor cursor = o.newCursor();\r | |
378 | if (cursor.toFirstChild()) {\r | |
379 | for (int j = 0; j < i; ++j) {\r | |
380 | cursor.toNextSibling();\r | |
381 | }\r | |
382 | cursor.setTextValue(msaFile);\r | |
383 | \r | |
384 | }\r | |
385 | \r | |
386 | cursor.dispose();\r | |
387 | }\r | |
388 | \r | |
389 | public void updateSpdGuidDecl(int i, String name, String cName, String guid, String hlp, String archList, \r | |
390 | String modTypeList, String guidTypeList){\r | |
391 | XmlObject o = psaRoot.getGuidDeclarations();\r | |
392 | if (o == null){\r | |
393 | return;\r | |
394 | }\r | |
395 | \r | |
396 | XmlCursor cursor = o.newCursor();\r | |
397 | if (cursor.toFirstChild()) {\r | |
398 | for (int j = 0; j < i; ++j) {\r | |
399 | cursor.toNextSibling();\r | |
400 | }\r | |
401 | GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();\r | |
402 | e.setName(name);\r | |
403 | e.setCName(cName);\r | |
404 | e.setGuidValue(guid);\r | |
405 | e.setHelpText(hlp);\r | |
ce73a791 | 406 | if (stringToList(guidTypeList) != null) {\r |
322b7723 | 407 | e.setGuidTypeList(stringToList(guidTypeList));\r |
a13899c5 | 408 | }\r |
ce73a791 | 409 | else{\r |
322b7723 | 410 | if (e.isSetGuidTypeList()) {\r |
97796eaa | 411 | e.unsetGuidTypeList();\r |
322b7723 | 412 | }\r |
ce73a791 | 413 | }\r |
a13899c5 | 414 | if (stringToList(archList) != null){\r |
415 | e.setSupArchList(stringToList(archList));\r | |
416 | }\r | |
ce73a791 | 417 | else{\r |
322b7723 | 418 | if (e.isSetSupArchList()) {\r |
97796eaa | 419 | e.unsetSupArchList();\r |
322b7723 | 420 | }\r |
ce73a791 | 421 | }\r |
a13899c5 | 422 | if (stringToList(modTypeList) != null) {\r |
423 | e.setSupModuleList(stringToList(modTypeList));\r | |
424 | }\r | |
ce73a791 | 425 | else{\r |
322b7723 | 426 | if (e.isSetSupModuleList()) {\r |
97796eaa | 427 | e.unsetSupModuleList();\r |
322b7723 | 428 | }\r |
ce73a791 | 429 | }\r |
a13899c5 | 430 | \r |
431 | }\r | |
432 | cursor.dispose();\r | |
433 | }\r | |
434 | \r | |
435 | public void updateSpdPpiDecl(int i, String name, String cName, String guid, String hlp, String archList, \r | |
436 | String modTypeList){\r | |
437 | XmlObject o = psaRoot.getPpiDeclarations();\r | |
438 | if (o == null){\r | |
439 | return;\r | |
440 | }\r | |
441 | \r | |
442 | XmlCursor cursor = o.newCursor();\r | |
443 | if (cursor.toFirstChild()) {\r | |
444 | for (int j = 0; j < i; ++j) {\r | |
445 | cursor.toNextSibling();\r | |
446 | }\r | |
447 | PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();\r | |
448 | e.setName(name);\r | |
449 | e.setCName(cName);\r | |
450 | e.setGuidValue(guid);\r | |
451 | e.setHelpText(hlp);\r | |
452 | if (stringToList(archList) != null){\r | |
453 | e.setSupArchList(stringToList(archList));\r | |
454 | }\r | |
ce73a791 | 455 | else{\r |
322b7723 | 456 | if (e.isSetSupArchList()) {\r |
97796eaa | 457 | e.unsetSupArchList();\r |
322b7723 | 458 | }\r |
ce73a791 | 459 | }\r |
a13899c5 | 460 | if (stringToList(modTypeList) != null) {\r |
461 | e.setSupModuleList(stringToList(modTypeList));\r | |
462 | }\r | |
ce73a791 | 463 | else{\r |
322b7723 | 464 | if (e.isSetSupModuleList()) {\r |
97796eaa | 465 | e.unsetSupModuleList();\r |
322b7723 | 466 | }\r |
ce73a791 | 467 | }\r |
a13899c5 | 468 | }\r |
469 | cursor.dispose();\r | |
470 | }\r | |
471 | \r | |
472 | public void updateSpdProtocolDecl(int i, String name, String cName, String guid, String hlp, String archList, \r | |
473 | String modTypeList){\r | |
474 | XmlObject o = psaRoot.getProtocolDeclarations();\r | |
475 | if (o == null){\r | |
476 | return;\r | |
477 | }\r | |
478 | \r | |
479 | XmlCursor cursor = o.newCursor();\r | |
480 | if (cursor.toFirstChild()) {\r | |
481 | for (int j = 0; j < i; ++j) {\r | |
482 | cursor.toNextSibling();\r | |
483 | }\r | |
484 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();\r | |
485 | e.setName(name);\r | |
486 | e.setCName(cName);\r | |
487 | e.setGuidValue(guid);\r | |
488 | e.setHelpText(hlp);\r | |
489 | if (stringToList(archList) != null){\r | |
490 | e.setSupArchList(stringToList(archList));\r | |
491 | }\r | |
ce73a791 | 492 | else{\r |
322b7723 | 493 | if (e.isSetSupArchList()) {\r |
97796eaa | 494 | e.unsetSupArchList();\r |
322b7723 | 495 | }\r |
ce73a791 | 496 | }\r |
a13899c5 | 497 | if (stringToList(modTypeList) != null) {\r |
498 | e.setSupModuleList(stringToList(modTypeList));\r | |
499 | }\r | |
ce73a791 | 500 | else{\r |
322b7723 | 501 | if (e.isSetSupModuleList()) {\r |
97796eaa | 502 | e.unsetSupModuleList();\r |
322b7723 | 503 | }\r |
ce73a791 | 504 | }\r |
a13899c5 | 505 | }\r |
506 | cursor.dispose();\r | |
507 | }\r | |
508 | \r | |
509 | public void updateSpdPkgHdr(int i, String pkgName, String hdrName){\r | |
510 | XmlObject o = psaRoot.getPackageHeaders();\r | |
511 | if (o == null){\r | |
512 | return;\r | |
513 | }\r | |
514 | \r | |
515 | XmlCursor cursor = o.newCursor();\r | |
516 | if (cursor.toFirstChild()) {\r | |
517 | for (int j = 0; j < i; ++j) {\r | |
518 | cursor.toNextSibling();\r | |
519 | }\r | |
520 | \r | |
521 | PackageHeadersDocument.PackageHeaders.IncludePkgHeader iph = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();\r | |
522 | iph.setModuleType(ModuleTypeDef.Enum.forString(pkgName));\r | |
523 | iph.setStringValue(hdrName);\r | |
524 | }\r | |
525 | cursor.dispose();\r | |
526 | }\r | |
527 | \r | |
528 | public void updateSpdPcdDefinition(int i, String cName, String token, String dataType, String pcdItemTypes, \r | |
529 | String spaceGuid, String defaultString, String help, String archList, String modTypeList){\r | |
530 | XmlObject o = psaRoot.getPcdDeclarations();\r | |
531 | if (o == null)\r | |
532 | return;\r | |
533 | XmlCursor cursor = o.newCursor();\r | |
534 | if (cursor.toFirstChild()) {\r | |
535 | for (int j = 0; j < i; ++j) {\r | |
536 | cursor.toNextSibling();\r | |
537 | }\r | |
538 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();\r | |
539 | e.setCName(cName);\r | |
540 | e.setToken(token);\r | |
541 | e.setDatumType(PcdDataTypes.Enum.forString(dataType));\r | |
542 | if (pcdItemTypes != null && pcdItemTypes.length() > 0) {\r | |
543 | String usage[] = pcdItemTypes.split("( )+");\r | |
544 | List<String> l = new ArrayList<String>();\r | |
545 | for (int k = 0; k < usage.length; ++k) {\r | |
546 | l.add(usage[k]); \r | |
547 | }\r | |
548 | e.setValidUsage(l);\r | |
549 | }\r | |
550 | \r | |
551 | e.setTokenSpaceGuidCName(spaceGuid);\r | |
552 | e.setDefaultValue(defaultString);\r | |
553 | e.setHelpText(help);\r | |
209abc92 | 554 | if (stringToList(archList) != null){\r |
a13899c5 | 555 | e.setSupArchList(stringToList(archList));\r |
556 | }\r | |
209abc92 | 557 | else{\r |
558 | if (e.isSetSupArchList()) {\r | |
559 | e.unsetSupArchList();\r | |
560 | }\r | |
561 | }\r | |
562 | if (stringToList(modTypeList) != null) {\r | |
a13899c5 | 563 | e.setSupModuleList(stringToList(modTypeList));\r |
564 | }\r | |
209abc92 | 565 | else{\r |
566 | if (e.isSetSupModuleList()) {\r | |
567 | e.unsetSupModuleList();\r | |
568 | }\r | |
569 | }\r | |
570 | \r | |
a13899c5 | 571 | } \r |
572 | cursor.dispose();\r | |
573 | }\r | |
574 | /**\r | |
575 | Get spd file header contents into String array\r | |
576 | \r | |
577 | @param s Caller allocated String array\r | |
578 | **/\r | |
579 | public void getSpdHdrDetails(String[] s) {\r | |
580 | if (getSpdHdr() == null) {\r | |
581 | spdHdr = psaRoot.addNewSpdHeader();\r | |
582 | }\r | |
583 | s[0] = getSpdHdrPkgName();\r | |
584 | s[1] = getSpdHdr().getGuidValue();\r | |
585 | s[2] = getSpdHdrVer();\r | |
586 | // s[3] = getSpdHdr().getAbstract();\r | |
587 | s[4] = getSpdHdr().getDescription();\r | |
588 | s[5] = getSpdHdr().getCopyright();\r | |
589 | s[6] = getSpdHdrLicense();\r | |
590 | \r | |
591 | }\r | |
592 | \r | |
593 | /**\r | |
594 | Get the number of library class declarations from the size of List\r | |
595 | \r | |
596 | @return int\r | |
597 | **/\r | |
598 | public int getSpdLibClassDeclarationCount() {\r | |
599 | if (psaRoot.getLibraryClassDeclarations() == null\r | |
600 | || psaRoot.getLibraryClassDeclarations().getLibraryClassList() == null) {\r | |
601 | return 0;\r | |
602 | }\r | |
603 | return psaRoot.getLibraryClassDeclarations().getLibraryClassList().size();\r | |
604 | }\r | |
605 | \r | |
606 | /**\r | |
607 | Get available library class declaration into String array\r | |
608 | @param libClass Caller allocated two-dimentional String array\r | |
609 | **/\r | |
610 | public void getSpdLibClassDeclarations(String[][] libClass) {\r | |
611 | if (psaRoot.getLibraryClassDeclarations() == null){\r | |
612 | return;\r | |
613 | }\r | |
614 | \r | |
615 | List<LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass> l = psaRoot.getLibraryClassDeclarations().getLibraryClassList();\r | |
616 | int i = 0;\r | |
617 | ListIterator li = l.listIterator();\r | |
618 | while (li.hasNext()) {\r | |
619 | LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) li.next();\r | |
620 | if (lc != null) {\r | |
621 | libClass[i][0] = lc.getName();\r | |
622 | libClass[i][1] = lc.getIncludeHeader();\r | |
623 | libClass[i][2] = lc.getHelpText();\r | |
2f8a7517 | 624 | // LAH added logic so you cannot set the version unless the GUID is defined.\r |
97796eaa | 625 | /* LAH do not set now\r |
2f8a7517 | 626 | if (lc.getRecommendedInstanceGuid() != null) {\r |
627 | libClass[i][3] = lc.getRecommendedInstanceGuid();\r | |
628 | if (lc.getRecommendedInstanceVersion() != null) {\r | |
629 | libClass[i][4] = lc.getRecommendedInstanceVersion();\r | |
630 | }\r | |
631 | }\r | |
97796eaa | 632 | */\r |
a13899c5 | 633 | if (lc.getSupArchList() != null) {\r |
634 | libClass[i][5] = listToString(lc.getSupArchList());\r | |
635 | }\r | |
636 | if (lc.getSupModuleList() != null) {\r | |
637 | libClass[i][6] = listToString(lc.getSupModuleList());\r | |
638 | }\r | |
639 | \r | |
640 | }\r | |
641 | \r | |
642 | i++;\r | |
643 | }\r | |
644 | \r | |
645 | }\r | |
646 | \r | |
647 | /**\r | |
648 | Get the number of Msa files from the size of List\r | |
649 | \r | |
650 | @return int\r | |
651 | **/\r | |
652 | public int getSpdMsaFileCount() {\r | |
653 | if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getFilenameList() == null) {\r | |
654 | return 0;\r | |
655 | }\r | |
656 | return psaRoot.getMsaFiles().getFilenameList().size();\r | |
657 | }\r | |
658 | \r | |
659 | /**\r | |
660 | Get available Msa file into String array\r | |
661 | \r | |
662 | @param msaFile Caller allocated two-dimentional String array\r | |
663 | **/\r | |
664 | public void getSpdMsaFiles(String[][] msaFile) {\r | |
665 | if (psaRoot.getMsaFiles() == null) {\r | |
666 | return;\r | |
667 | }\r | |
668 | List<String> l = psaRoot.getMsaFiles().getFilenameList();\r | |
669 | int i = 0;\r | |
670 | ListIterator li = l.listIterator();\r | |
671 | while (li.hasNext()) {\r | |
672 | msaFile[i][0] = (String)li.next();\r | |
673 | \r | |
674 | i++;\r | |
675 | }\r | |
676 | }\r | |
677 | \r | |
678 | /**\r | |
679 | Get the number of include header files in PackageHeaders from the size of List\r | |
680 | \r | |
681 | @return int\r | |
682 | **/\r | |
683 | public int getSpdPackageHeaderCount() {\r | |
684 | if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludePkgHeaderList() == null) {\r | |
685 | return 0;\r | |
686 | }\r | |
687 | return psaRoot.getPackageHeaders().getIncludePkgHeaderList().size();\r | |
688 | }\r | |
689 | \r | |
690 | /**\r | |
691 | Get available package header contents into String array\r | |
692 | \r | |
693 | @param pkgHeader Caller allocated two-dimentional String array\r | |
694 | **/\r | |
695 | public void getSpdPackageHeaders(String[][] pkgHeader) {\r | |
696 | if (psaRoot.getPackageHeaders() == null) {\r | |
697 | return;\r | |
698 | }\r | |
699 | \r | |
700 | List<PackageHeadersDocument.PackageHeaders.IncludePkgHeader> l = psaRoot.getPackageHeaders().getIncludePkgHeaderList();\r | |
701 | int i = 0;\r | |
702 | ListIterator li = l.listIterator();\r | |
703 | while (li.hasNext()) {\r | |
704 | PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) li.next();\r | |
705 | if (ih.getModuleType() != null) {\r | |
706 | pkgHeader[i][0] = ih.getModuleType().toString();\r | |
707 | }\r | |
708 | \r | |
709 | pkgHeader[i][1] = ih.getStringValue();\r | |
710 | i++;\r | |
711 | }\r | |
712 | }\r | |
713 | \r | |
714 | /**\r | |
715 | Get the number of GUID declarations from the size of List\r | |
716 | \r | |
717 | @return int\r | |
718 | **/\r | |
719 | public int getSpdGuidDeclarationCount() {\r | |
720 | if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) {\r | |
721 | return 0;\r | |
722 | }\r | |
723 | return psaRoot.getGuidDeclarations().getEntryList().size();\r | |
724 | }\r | |
725 | \r | |
726 | /**\r | |
727 | Get available Guid declaration contents into String array\r | |
728 | \r | |
729 | @param guid Caller allocated two-dimentional String array\r | |
730 | **/\r | |
731 | public void getSpdGuidDeclarations(String[][] guid) {\r | |
732 | if (psaRoot.getGuidDeclarations() == null) {\r | |
733 | return;\r | |
734 | }\r | |
735 | \r | |
736 | List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();\r | |
737 | int i = 0;\r | |
738 | ListIterator li = l.listIterator();\r | |
739 | while (li.hasNext()) {\r | |
740 | GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li\r | |
741 | .next();\r | |
742 | guid[i][0] = e.getName();\r | |
743 | guid[i][1] = e.getCName();\r | |
744 | if (e.getGuidValue() != null) {\r | |
745 | guid[i][2] = e.getGuidValue();\r | |
746 | }\r | |
747 | guid[i][3] = e.getHelpText();\r | |
748 | guid[i][4] = listToString(e.getSupArchList());\r | |
749 | guid[i][5] = listToString(e.getSupModuleList());\r | |
750 | guid[i][6] = listToString(e.getGuidTypeList());\r | |
751 | i++;\r | |
752 | }\r | |
753 | }\r | |
754 | \r | |
755 | /**\r | |
756 | Get the number of protocol declarations from the size of List\r | |
757 | \r | |
758 | @return int\r | |
759 | **/\r | |
760 | public int getSpdProtocolDeclarationCount() {\r | |
761 | if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) {\r | |
762 | return 0;\r | |
763 | }\r | |
764 | return psaRoot.getProtocolDeclarations().getEntryList().size();\r | |
765 | }\r | |
766 | \r | |
767 | /**\r | |
768 | Get available protocol declaration contents into String array\r | |
769 | \r | |
770 | @param protocol Caller allocated two-dimentional String array\r | |
771 | **/\r | |
772 | public void getSpdProtocolDeclarations(String[][] protocol) {\r | |
773 | if (psaRoot.getProtocolDeclarations() == null) {\r | |
774 | return;\r | |
775 | }\r | |
776 | \r | |
777 | List<ProtocolDeclarationsDocument.ProtocolDeclarations.Entry> l = psaRoot.getProtocolDeclarations()\r | |
778 | .getEntryList();\r | |
779 | int i = 0;\r | |
780 | ListIterator li = l.listIterator();\r | |
781 | while (li.hasNext()) {\r | |
782 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li\r | |
783 | .next();\r | |
784 | protocol[i][0] = e.getName();\r | |
785 | protocol[i][1] = e.getCName();\r | |
786 | if (e.getGuidValue() != null) {\r | |
787 | protocol[i][2] = e.getGuidValue();\r | |
788 | }\r | |
789 | protocol[i][3] = e.getHelpText();\r | |
790 | protocol[i][4] = listToString(e.getSupArchList());\r | |
791 | protocol[i][5] = listToString(e.getSupModuleList());\r | |
792 | i++;\r | |
793 | }\r | |
794 | }\r | |
795 | \r | |
796 | /**\r | |
797 | Get the number of Ppi declarations from the size of List\r | |
798 | \r | |
799 | @return int\r | |
800 | **/\r | |
801 | public int getSpdPpiDeclarationCount() {\r | |
802 | if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) {\r | |
803 | return 0;\r | |
804 | }\r | |
805 | return psaRoot.getPpiDeclarations().getEntryList().size();\r | |
806 | }\r | |
807 | \r | |
808 | /**\r | |
809 | Get available Ppi declaration contents into String array\r | |
810 | \r | |
811 | @param ppi Caller allocated two-dimentional String array\r | |
812 | **/\r | |
813 | public void getSpdPpiDeclarations(String[][] ppi) {\r | |
814 | if (psaRoot.getPpiDeclarations() == null) {\r | |
815 | return;\r | |
816 | }\r | |
817 | \r | |
818 | List<PpiDeclarationsDocument.PpiDeclarations.Entry> l = psaRoot.getPpiDeclarations().getEntryList();\r | |
819 | int i = 0;\r | |
820 | ListIterator li = l.listIterator();\r | |
821 | while (li.hasNext()) {\r | |
822 | PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next();\r | |
823 | ppi[i][0] = e.getName();\r | |
824 | ppi[i][1] = e.getCName();\r | |
825 | if (e.getGuidValue() != null) {\r | |
826 | ppi[i][2] = e.getGuidValue();\r | |
827 | }\r | |
828 | ppi[i][3] = e.getHelpText();\r | |
829 | ppi[i][4] = listToString(e.getSupArchList());\r | |
830 | ppi[i][5] = listToString(e.getSupModuleList());\r | |
831 | \r | |
832 | i++;\r | |
833 | }\r | |
834 | }\r | |
835 | \r | |
836 | /**\r | |
837 | Get the number of Pcd definitions from the size of List\r | |
838 | \r | |
839 | @return int\r | |
840 | **/\r | |
841 | public int getSpdPcdDefinitionCount() {\r | |
842 | if (psaRoot.getPcdDeclarations() == null || psaRoot.getPcdDeclarations().getPcdEntryList() == null) {\r | |
843 | return 0;\r | |
844 | }\r | |
845 | return psaRoot.getPcdDeclarations().getPcdEntryList().size();\r | |
846 | }\r | |
847 | \r | |
848 | /**\r | |
849 | Get available Pcd definition contents into String array\r | |
850 | \r | |
851 | @param pcd Caller allocated two-dimentional String array\r | |
852 | **/\r | |
853 | public void getSpdPcdDefinitions(String[][] pcd, String pcdUsage[][]) {\r | |
854 | if (psaRoot.getPcdDeclarations() == null) {\r | |
855 | return;\r | |
856 | }\r | |
857 | \r | |
858 | List<PcdDeclarationsDocument.PcdDeclarations.PcdEntry> l = psaRoot.getPcdDeclarations().getPcdEntryList();\r | |
859 | int i = 0;\r | |
860 | while (i < l.size()) {\r | |
861 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)l.get(i);\r | |
862 | pcd[i][0] = e.getCName();\r | |
863 | pcd[i][1] = e.getToken() + ""; \r | |
864 | pcd[i][2] = e.getTokenSpaceGuidCName();\r | |
865 | if (e.getDatumType() != null) {\r | |
866 | pcd[i][3] = e.getDatumType().toString();\r | |
867 | }\r | |
868 | pcd[i][4] = e.getDefaultValue()+"";\r | |
869 | pcd[i][5] = e.getHelpText();\r | |
870 | String archList = listToString(e.getSupArchList());\r | |
871 | if (archList != null) {\r | |
872 | pcd[i][6] = archList;\r | |
873 | }\r | |
874 | String modTypeList = listToString(e.getSupModuleList());\r | |
875 | if (modTypeList != null) {\r | |
876 | pcd[i][7] = modTypeList;\r | |
877 | }\r | |
878 | \r | |
879 | int j = 0;\r | |
880 | while (j < e.getValidUsage().size() && j < 5) {\r | |
881 | pcdUsage[i][j] = (String)e.getValidUsage().get(j);\r | |
882 | ++j;\r | |
883 | }\r | |
884 | i++;\r | |
885 | }\r | |
886 | }\r | |
887 | \r | |
888 | /**\r | |
889 | Save the processed xml contents to file\r | |
890 | \r | |
891 | @param spdFile The file to save xml contents\r | |
892 | @throws IOException Exceptions during file operation\r | |
893 | **/\r | |
894 | public void saveAs(File spdFile) throws IOException {\r | |
895 | \r | |
896 | XmlOptions options = new XmlOptions();\r | |
897 | \r | |
898 | options.setCharacterEncoding("UTF-8");\r | |
899 | options.setSavePrettyPrint();\r | |
900 | options.setSavePrettyPrintIndent(2);\r | |
901 | try {\r | |
902 | psad.save(spdFile, options);\r | |
903 | } catch (IOException e) {\r | |
904 | e.printStackTrace();\r | |
905 | }\r | |
906 | \r | |
907 | }\r | |
908 | \r | |
909 | /**\r | |
910 | Generate SpdHeader contents using parameters passed in.\r | |
911 | \r | |
912 | @param pkgName PackageName \r | |
913 | @param pkgGuid Guid\r | |
914 | @param pkgVer Version\r | |
915 | @param pkgAbs Abstract\r | |
916 | @param pkgDes Description\r | |
917 | @param pkgCpRight Copyright\r | |
918 | @param pkgLicense License\r | |
919 | @param pkgCreateDate Created\r | |
920 | @param pkgUpdateDate Updated\r | |
921 | @param pkgURL URL\r | |
922 | @param pkgType PackageType\r | |
923 | @param pkgRdOnly ReadOnly\r | |
924 | @param pkgRePkg RePackage\r | |
925 | @param pkgSpec Reserved\r | |
926 | @param pkgOutDir Reserved\r | |
927 | **/\r | |
928 | public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes,\r | |
929 | String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate,\r | |
930 | String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec,\r | |
931 | String pkgOutDir) {\r | |
932 | if (getSpdHdr() == null) {\r | |
933 | spdHdr = psaRoot.addNewSpdHeader();\r | |
934 | }\r | |
935 | \r | |
936 | setSpdHdrPkgName(pkgName);\r | |
937 | setSpdHdrGuidValue(pkgGuid);\r | |
938 | setSpdHdrVer(pkgVer);\r | |
939 | setSpdHdrAbs(pkgAbs);\r | |
940 | setSpdHdrDescription(pkgDes);\r | |
941 | setSpdHdrCopyright(pkgCpRight);\r | |
942 | setSpdHdrLicense(pkgLicense);\r | |
943 | \r | |
944 | \r | |
945 | setSpdHdrSpec(pkgSpec);\r | |
946 | }\r | |
947 | \r | |
948 | /**\r | |
949 | Generate library class declaration element using parameters passed in\r | |
950 | \r | |
951 | @param libClassBaseName LibraryClass element value\r | |
952 | @param libClassUsage Reserved\r | |
953 | @param incHdrFileName IncludeHeader element value\r | |
954 | @param incHdrAttribGuid Reserved\r | |
955 | @param incHdrAttribArch Reserved\r | |
956 | @param incHdrAttribPath Reserved\r | |
957 | @param incHdrAttribClass Reserved\r | |
958 | @param incHdrAttribVer Reserved\r | |
959 | @param incHdrAttribOverrideID Reserved\r | |
960 | @param incHdrAttribModuleType Reserved\r | |
961 | **/\r | |
962 | public void genSpdLibClassDeclarations(String libClassBaseName, String instanceUsage, String incHdrFileName,\r | |
963 | String help, String incHdrAttribArch, String incHdrAttribPath,\r | |
964 | String incHdrAttribClass, String incHdrAttribVer,\r | |
965 | String incHdrAttribOverrideID, String incHdrAttribModuleType) {\r | |
966 | if (getSpdLibClassDeclarations() == null) {\r | |
967 | spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations();\r | |
968 | }\r | |
969 | //\r | |
970 | // add contents under LibraryClassDeclarations tag \r | |
971 | //\r | |
972 | setSpdLibClassDeclaration(libClassBaseName, instanceUsage, incHdrFileName, help, incHdrAttribArch,\r | |
973 | incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID,\r | |
974 | incHdrAttribModuleType, spdLibClassDeclarations);\r | |
975 | }\r | |
976 | \r | |
977 | /**\r | |
978 | Set library class declaration contents under parent tag\r | |
979 | \r | |
980 | @param clsName LibraryClass element value\r | |
981 | @param clsUsage Reserved\r | |
982 | @param hdrFile IncludeHeader element value\r | |
983 | @param hdrAttribGuid Reserved\r | |
984 | @param hdrAttribArch Reserved\r | |
985 | @param hdrAttribPath Reserved\r | |
986 | @param hdrAttribClass Reserved\r | |
987 | @param hdrAttribVer Reserved\r | |
988 | @param hdrAttribOverID Reserved\r | |
989 | @param hdrAttribModType Reserved\r | |
990 | @param parent The tag under which library class declaration goes to\r | |
991 | **/\r | |
992 | public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String help,\r | |
993 | String hdrAttribArch, String hdrAttribPath, String hdrAttribClass,\r | |
994 | String instanceVer, String hdrAttribOverID, String hdrAttribModType,\r | |
995 | XmlObject parent) {\r | |
996 | \r | |
997 | setSpdLibraryClass(clsName, hdrFile, help, clsUsage, instanceVer, hdrAttribArch, hdrAttribModType, parent);\r | |
998 | \r | |
999 | }\r | |
1000 | \r | |
1001 | /**\r | |
1002 | Set the contents of LibraryClass under parent element\r | |
1003 | \r | |
1004 | @param clsName LibraryClass element value \r | |
1005 | @param clsUsage Reserved\r | |
1006 | @param parent The tag under which library class declaration goes to\r | |
1007 | **/\r | |
1008 | public void setSpdLibraryClass(String clsName, String clsIncludeFile, String help, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType, XmlObject parent) {\r | |
1009 | LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent).addNewLibraryClass();\r | |
1010 | lc.setName(clsName);\r | |
1011 | lc.setIncludeHeader(clsIncludeFile);\r | |
1012 | lc.setHelpText(help);\r | |
2f8a7517 | 1013 | // LAH added logic so you cannot set the version unless the GUID is defined.\r |
97796eaa | 1014 | /* LAH\r |
2f8a7517 | 1015 | if (clsUsage != null) {\r |
1016 | lc.setRecommendedInstanceGuid(clsUsage);\r | |
1017 | if (instanceVer != null) {\r | |
1018 | lc.setRecommendedInstanceVersion(instanceVer);\r | |
1019 | }\r | |
1020 | }\r | |
97796eaa | 1021 | */\r |
a13899c5 | 1022 | if (hdrAttribArch != null) {\r |
1023 | lc.setSupArchList(stringToList(hdrAttribArch));\r | |
322b7723 | 1024 | } else {\r |
1025 | if (lc.isSetSupArchList()) {\r | |
1026 | lc.unsetSupArchList();\r | |
1027 | }\r | |
a13899c5 | 1028 | }\r |
322b7723 | 1029 | \r |
a13899c5 | 1030 | if (hdrAttribModType != null) {\r |
97796eaa | 1031 | lc.setSupModuleList(stringToList(hdrAttribModType));\r |
1032 | } else {\r | |
322b7723 | 1033 | if (lc.isSetSupModuleList()) {\r |
1034 | lc.unsetSupModuleList();\r | |
1035 | }\r | |
a13899c5 | 1036 | }\r |
1037 | \r | |
1038 | }\r | |
1039 | \r | |
1040 | /**\r | |
1041 | Set contents of IncludeHeader under parent element\r | |
1042 | \r | |
1043 | @param modType Reserved\r | |
1044 | @param hdrFile IncludeHeader element value\r | |
1045 | @param hdrAttribGuid Reserved\r | |
1046 | @param hdrAttribArch Reserved\r | |
1047 | @param hdrAttribPath Reserved\r | |
1048 | @param hdrAttribClass Reserved\r | |
1049 | @param hdrAttribVer Reserved\r | |
1050 | @param hdrAttribOverID Reserved\r | |
1051 | @param parent The tag under which library class declaration goes to\r | |
1052 | **/\r | |
1053 | public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r | |
1054 | String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r | |
1055 | String hdrAttribOverID, XmlObject parent) {\r | |
1056 | \r | |
1057 | if (parent instanceof LibraryClassDeclarationsDocument.LibraryClassDeclarations) {\r | |
1058 | } else if (parent instanceof PackageHeadersDocument.PackageHeaders) {\r | |
1059 | PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = null;\r | |
1060 | ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludePkgHeader();\r | |
1061 | ih.setStringValue(hdrFile);\r | |
1062 | ih.setModuleType(ModuleTypeDef.Enum.forString(modType));\r | |
1063 | } else {\r | |
1064 | return;\r | |
1065 | }\r | |
1066 | \r | |
1067 | if (hdrAttribGuid != null) {\r | |
1068 | }\r | |
1069 | if (hdrAttribPath != null) {\r | |
1070 | }\r | |
1071 | if (hdrAttribClass != null) {\r | |
1072 | }\r | |
1073 | if (hdrAttribVer != null) {\r | |
1074 | }\r | |
1075 | if (hdrAttribOverID != null) {\r | |
1076 | }\r | |
1077 | \r | |
1078 | }\r | |
1079 | \r | |
1080 | /**\r | |
1081 | Generate MsaFile element.\r | |
1082 | \r | |
1083 | @param msaFileName MsaFile element value\r | |
1084 | @param archType Reserved\r | |
1085 | **/\r | |
1086 | public void genSpdMsaFiles(String msaFileName, String moduleName, String ver, String guid) {\r | |
1087 | if (getSpdMsaFiles() == null) {\r | |
1088 | spdMsaFiles = psaRoot.addNewMsaFiles();\r | |
1089 | }\r | |
1090 | setSpdMsaFile(msaFileName, moduleName, ver, guid, spdMsaFiles);\r | |
1091 | \r | |
1092 | }\r | |
1093 | \r | |
1094 | /**\r | |
1095 | Set MsaFile contents under parent element.\r | |
1096 | \r | |
1097 | @param msaFileName MsaFile element value\r | |
1098 | @param parent Element under which MsaFile goes to\r | |
1099 | **/\r | |
1100 | public void setSpdMsaFile(String msaFileName, String moduleName, String ver, String guid, XmlObject parent) {\r | |
1101 | MsaFilesDocument.MsaFiles f = (MsaFilesDocument.MsaFiles)parent;\r | |
1102 | f.addNewFilename().setStringValue(msaFileName);\r | |
1103 | // f.setFilename(msaFileName);\r | |
1104 | // f.setModuleName(moduleName);\r | |
1105 | // f.setModuleVersion(ver);\r | |
1106 | // f.setModuleGuid(guid);\r | |
1107 | }\r | |
1108 | \r | |
1109 | /**\r | |
1110 | Generate PackageHeader element using parameters passed in.\r | |
1111 | \r | |
1112 | @param ModHdrModType ModuleType attribute of IncludeHeader element\r | |
1113 | @param hdrFile IncludeHeader element value\r | |
1114 | @param hdrAttribGuid Reserved\r | |
1115 | @param hdrAttribArch Reserved\r | |
1116 | @param hdrAttribPath Reserved\r | |
1117 | @param hdrAttribClass Reserved\r | |
1118 | @param hdrAttribVer Reserved\r | |
1119 | @param hdrAttribOverID Reserved\r | |
1120 | **/\r | |
1121 | public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r | |
1122 | String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r | |
1123 | String hdrAttribOverID) {\r | |
1124 | if (getSpdModHdrs() == null) {\r | |
1125 | spdModHdrs = psaRoot.addNewPackageHeaders();\r | |
1126 | }\r | |
1127 | \r | |
1128 | //\r | |
1129 | // add IncludeHeader under PackageHeaders element\r | |
1130 | //\r | |
1131 | setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass,\r | |
1132 | hdrAttribVer, hdrAttribOverID, spdModHdrs);\r | |
1133 | }\r | |
1134 | \r | |
1135 | /**\r | |
1136 | Generate GUID declaration element using parameters passed in.\r | |
1137 | \r | |
1138 | @param guidDeclEntryName Name attribute of Entry element\r | |
1139 | @param guidDeclCName CName element value\r | |
1140 | @param guidDeclGuid Guid element value\r | |
1141 | @param guidDeclFeatureFlag Reserved\r | |
1142 | **/\r | |
1143 | public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid,\r | |
1144 | String guidDeclHelp, Vector<String> archList, Vector<String> modTypeList,\r | |
1145 | Vector<String> guidTypeList) {\r | |
1146 | if (getSpdGuidDeclarations() == null) {\r | |
1147 | spdGuidDeclarations = psaRoot.addNewGuidDeclarations();\r | |
1148 | }\r | |
1149 | \r | |
1150 | setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclHelp, archList, modTypeList, guidTypeList, spdGuidDeclarations);\r | |
1151 | }\r | |
1152 | \r | |
1153 | /**\r | |
1154 | Generate protocol declaration element using parameters passed in.\r | |
1155 | \r | |
1156 | @param protocolDeclEntryName Name attribute of Entry element\r | |
1157 | @param protocolDeclCName CName element value\r | |
1158 | @param protocolDeclGuid Guid element value\r | |
1159 | @param protocolDeclFeatureFlag Reserved\r | |
1160 | **/\r | |
1161 | public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName,\r | |
1162 | String protocolDeclGuid, String protocolDeclFeatureFlag,\r | |
1163 | Vector<String> archList, Vector<String> modTypeList) {\r | |
1164 | if (getSpdProtocolDeclarations() == null) {\r | |
1165 | spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations();\r | |
1166 | }\r | |
1167 | \r | |
1168 | setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag,\r | |
1169 | archList, modTypeList, null, spdProtocolDeclarations);\r | |
1170 | }\r | |
1171 | \r | |
1172 | /**\r | |
1173 | Generate PPI declaration element using parameters passed in.\r | |
1174 | \r | |
1175 | @param ppiDeclEntryName Name attribute of Entry element\r | |
1176 | @param ppiDeclCName CName element value\r | |
1177 | @param ppiDeclGuid Guid element value\r | |
1178 | @param ppiDeclFeatureFlag Reserved\r | |
1179 | **/\r | |
1180 | public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid,\r | |
1181 | String ppiDeclFeatureFlag, Vector<String> archList, Vector<String> modTypeList) {\r | |
1182 | if (getSpdPpiDeclarations() == null) {\r | |
1183 | spdPpiDeclarations = psaRoot.addNewPpiDeclarations();\r | |
1184 | }\r | |
1185 | \r | |
1186 | setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, archList, modTypeList, null, spdPpiDeclarations);\r | |
1187 | }\r | |
1188 | \r | |
1189 | /**\r | |
1190 | Set Entry contents using parameters passed in\r | |
1191 | \r | |
1192 | @param entryName Name attribute of Entry element\r | |
1193 | @param cName CName element value\r | |
1194 | @param guid Guid element value\r | |
1195 | @param featureFlag Reserved\r | |
1196 | @param parent The tag under which Entry element goes to\r | |
1197 | **/\r | |
1198 | public void setSpdEntry(String entryName, String cName, String guid, String help, \r | |
1199 | Vector<String> archList, Vector<String> modTypeList,\r | |
1200 | Vector<String> guidTypeList, XmlObject parent) {\r | |
1201 | \r | |
1202 | if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {\r | |
1203 | GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry();\r | |
1204 | e.setName(entryName);\r | |
1205 | e.setCName(cName);\r | |
1206 | e.setGuidValue(guid);\r | |
1207 | e.setHelpText(help);\r | |
ce73a791 | 1208 | e.setGuidTypeList(guidTypeList);\r |
1209 | e.setSupArchList(archList);\r | |
1210 | e.setSupModuleList(modTypeList);\r | |
1211 | // if (guidTypeList != null && guidTypeList.size() > 0) {\r | |
1212 | // e.setGuidTypeList(new ArrayList<String>(guidTypeList));\r | |
1213 | // }\r | |
1214 | // if (archList != null && archList.size() > 0){\r | |
1215 | // e.setSupArchList(new ArrayList<String>(archList));\r | |
1216 | // }\r | |
1217 | // if (modTypeList != null && modTypeList.size() > 0) {\r | |
1218 | // e.setSupModuleList(new ArrayList<String>(modTypeList));\r | |
1219 | // }\r | |
a13899c5 | 1220 | return;\r |
1221 | }\r | |
1222 | if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {\r | |
1223 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent)\r | |
1224 | .addNewEntry();\r | |
1225 | pe.setName(entryName);\r | |
1226 | pe.setCName(cName);\r | |
1227 | pe.setGuidValue(guid);\r | |
1228 | pe.setHelpText(help);\r | |
ce73a791 | 1229 | pe.setSupArchList(archList);\r |
1230 | pe.setSupModuleList(modTypeList);\r | |
1231 | // if (archList != null && archList.size() > 0){\r | |
1232 | // pe.setSupArchList(new ArrayList<String>(archList));\r | |
1233 | // }\r | |
1234 | // if (modTypeList != null && modTypeList.size() > 0) {\r | |
1235 | // pe.setSupModuleList(new ArrayList<String>(modTypeList));\r | |
1236 | // }\r | |
a13899c5 | 1237 | return;\r |
1238 | }\r | |
1239 | if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {\r | |
1240 | PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent)\r | |
1241 | .addNewEntry();\r | |
1242 | ppe.setName(entryName);\r | |
1243 | ppe.setCName(cName);\r | |
1244 | ppe.setGuidValue(guid);\r | |
1245 | ppe.setHelpText(help);\r | |
ce73a791 | 1246 | ppe.setSupArchList(archList);\r |
1247 | ppe.setSupModuleList(modTypeList);\r | |
1248 | // if (archList != null && archList.size() > 0){\r | |
1249 | // ppe.setSupArchList(new ArrayList<String>(archList));\r | |
1250 | // }\r | |
1251 | // if (archList != null && modTypeList.size() > 0) {\r | |
1252 | // ppe.setSupModuleList(new ArrayList<String>(modTypeList));\r | |
1253 | // }\r | |
a13899c5 | 1254 | return;\r |
1255 | }\r | |
1256 | \r | |
1257 | return;\r | |
1258 | \r | |
1259 | }\r | |
1260 | \r | |
1261 | /**\r | |
1262 | Generate Pcd definition using parameters passed in\r | |
1263 | \r | |
1264 | @param pcdItemTypes ItemType attribute of PcdEntry element\r | |
1265 | @param cName C_Name element value\r | |
1266 | @param token Token element value\r | |
1267 | @param dataType DatumType element value\r | |
1268 | @param skuEnable Reserved\r | |
1269 | @param sku Reserved\r | |
1270 | @param maxSku Reserved\r | |
1271 | @param hiiEnable Reserved\r | |
1272 | @param varGuid Reserved\r | |
1273 | @param varName Reserved\r | |
1274 | @param defaultString DefaultString element value\r | |
1275 | **/\r | |
1276 | public void genSpdPcdDefinitions(String cName, String token, String dataType, String pcdItemTypes, \r | |
1277 | String spaceGuid, String defaultString, String help, String archList,\r | |
1278 | String modTypeList) {\r | |
1279 | if (getSpdPcdDefinitions() == null) {\r | |
1280 | spdPcdDefinitions = psaRoot.addNewPcdDeclarations();\r | |
1281 | }\r | |
1282 | \r | |
1283 | setSpdPcdEntry(pcdItemTypes, cName, token, dataType, spaceGuid, help,\r | |
1284 | defaultString, archList, modTypeList, spdPcdDefinitions);\r | |
1285 | }\r | |
1286 | \r | |
1287 | /**\r | |
1288 | Set Pcd entry contents under parent tag\r | |
1289 | \r | |
1290 | @param pcdItemTypes ItemType attribute of PcdEntry element\r | |
1291 | @param cName C_Name element value\r | |
1292 | @param token Token element value\r | |
1293 | @param dataType DatumType element value\r | |
1294 | @param spaceGuid Reserved\r | |
1295 | @param help Reserved\r | |
1296 | @param defaultString DefaultString element value\r | |
1297 | @param parent Tag under which PcdEntry goes to\r | |
1298 | **/\r | |
1299 | public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String spaceGuid, String help,\r | |
1300 | String defaultString, String archList, String modTypeList, XmlObject parent) {\r | |
1301 | \r | |
1302 | PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = ((PcdDeclarationsDocument.PcdDeclarations) parent).addNewPcdEntry();\r | |
1303 | \r | |
1304 | //ToDo: maybe multiple types in, need parse pcdItemTypes.\r | |
1305 | String usage[] = pcdItemTypes.split("( )+");\r | |
1306 | List<String> l = new ArrayList<String>();\r | |
1307 | for (int i = 0; i < usage.length; ++i) {\r | |
1308 | l.add(usage[i]); \r | |
1309 | }\r | |
1310 | pe.setValidUsage(l);\r | |
1311 | pe.setCName(cName);\r | |
1312 | pe.setToken(token);\r | |
1313 | pe.setDatumType(PcdDataTypes.Enum.forString(dataType));\r | |
1314 | pe.setDefaultValue(defaultString);\r | |
1315 | pe.setTokenSpaceGuidCName(spaceGuid);\r | |
1316 | pe.setHelpText(help);\r | |
1317 | if (archList != null){\r | |
97796eaa | 1318 | pe.setSupArchList(stringToList(archList));\r |
1319 | } else {\r | |
322b7723 | 1320 | if (pe.isSetSupArchList()) {\r |
1321 | pe.unsetSupArchList();\r | |
1322 | }\r | |
a13899c5 | 1323 | }\r |
1324 | if (modTypeList != null){\r | |
97796eaa | 1325 | pe.setSupModuleList(stringToList(modTypeList));\r |
1326 | } else {\r | |
322b7723 | 1327 | if (pe.isSetSupModuleList()) {\r |
1328 | pe.unsetSupModuleList();\r | |
1329 | }\r | |
a13899c5 | 1330 | }\r |
1331 | }\r | |
1332 | \r | |
1333 | /**\r | |
1334 | Get PpiDeclarations element\r | |
1335 | \r | |
1336 | @return PpiDeclarationsDocument.PpiDeclarations\r | |
1337 | **/\r | |
1338 | public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() {\r | |
1339 | if (spdPpiDeclarations == null) {\r | |
1340 | spdPpiDeclarations = psaRoot.getPpiDeclarations();\r | |
1341 | }\r | |
1342 | return spdPpiDeclarations;\r | |
1343 | }\r | |
1344 | \r | |
1345 | /**\r | |
1346 | Get ProtocolDeclarations element\r | |
1347 | \r | |
1348 | @return ProtocolDeclarationsDocument.ProtocolDeclarations\r | |
1349 | **/\r | |
1350 | public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() {\r | |
1351 | if (spdProtocolDeclarations == null) {\r | |
1352 | spdProtocolDeclarations = psaRoot.getProtocolDeclarations();\r | |
1353 | }\r | |
1354 | return spdProtocolDeclarations;\r | |
1355 | }\r | |
1356 | \r | |
1357 | /**\r | |
1358 | Get GuidDeclarations element\r | |
1359 | \r | |
1360 | @return GuidDeclarationsDocument.GuidDeclarations\r | |
1361 | **/\r | |
1362 | public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() {\r | |
1363 | if (spdGuidDeclarations == null) {\r | |
1364 | spdGuidDeclarations = psaRoot.getGuidDeclarations();\r | |
1365 | }\r | |
1366 | return spdGuidDeclarations;\r | |
1367 | }\r | |
1368 | \r | |
1369 | /**\r | |
1370 | Get PcdDefinitions element\r | |
1371 | \r | |
1372 | @return PcdDefinitionsDocument.PcdDefinitions\r | |
1373 | **/\r | |
1374 | public PcdDeclarationsDocument.PcdDeclarations getSpdPcdDefinitions() {\r | |
1375 | if (spdPcdDefinitions == null) {\r | |
1376 | spdPcdDefinitions = psaRoot.getPcdDeclarations();\r | |
1377 | }\r | |
1378 | return spdPcdDefinitions;\r | |
1379 | }\r | |
1380 | \r | |
1381 | /**\r | |
1382 | Get PackageHeaders element\r | |
1383 | \r | |
1384 | @return PackageHeadersDocument.PackageHeaders\r | |
1385 | **/\r | |
1386 | public PackageHeadersDocument.PackageHeaders getSpdModHdrs() {\r | |
1387 | if (spdModHdrs == null) {\r | |
1388 | spdModHdrs = psaRoot.getPackageHeaders();\r | |
1389 | }\r | |
1390 | return spdModHdrs;\r | |
1391 | }\r | |
1392 | \r | |
1393 | /**\r | |
1394 | Get MsaFiles element\r | |
1395 | \r | |
1396 | @return MsaFilesDocument.MsaFiles\r | |
1397 | **/\r | |
1398 | public MsaFilesDocument.MsaFiles getSpdMsaFiles() {\r | |
1399 | if (spdMsaFiles == null) {\r | |
1400 | spdMsaFiles = psaRoot.getMsaFiles();\r | |
1401 | }\r | |
1402 | return spdMsaFiles;\r | |
1403 | }\r | |
1404 | \r | |
1405 | /**\r | |
1406 | Get LibraryClassDeclarations element\r | |
1407 | \r | |
1408 | @return LibraryClassDeclarationsDocument.LibraryClassDeclarations\r | |
1409 | **/\r | |
1410 | public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() {\r | |
1411 | if (spdLibClassDeclarations == null) {\r | |
1412 | spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations();\r | |
1413 | }\r | |
1414 | return spdLibClassDeclarations;\r | |
1415 | }\r | |
1416 | \r | |
1417 | public PackageDefinitionsDocument.PackageDefinitions getSpdPkgDefs() {\r | |
1418 | if (spdPkgDefs == null) {\r | |
1419 | spdPkgDefs = psaRoot.addNewPackageDefinitions();\r | |
1420 | }\r | |
1421 | return spdPkgDefs;\r | |
1422 | }\r | |
1423 | /**\r | |
1424 | Get SpdHeader element\r | |
1425 | \r | |
1426 | @return SpdHeaderDocument.SpdHeader\r | |
1427 | **/\r | |
1428 | public SpdHeaderDocument.SpdHeader getSpdHdr() {\r | |
1429 | if (spdHdr == null) {\r | |
1430 | spdHdr = psaRoot.addNewSpdHeader();\r | |
1431 | }\r | |
1432 | return spdHdr;\r | |
1433 | }\r | |
1434 | \r | |
1435 | /**\r | |
1436 | Set value to Guid element\r | |
1437 | \r | |
1438 | @param guid The value set to Guid element\r | |
1439 | **/\r | |
1440 | public void setSpdHdrGuidValue(String guid) {\r | |
1441 | getSpdHdr().setGuidValue(guid);\r | |
1442 | }\r | |
1443 | \r | |
1444 | /**\r | |
1445 | Get Version element under SpdHdr\r | |
1446 | \r | |
1447 | @return String\r | |
1448 | **/\r | |
1449 | public String getSpdHdrVer() {\r | |
1450 | return getSpdHdr().getVersion();\r | |
1451 | }\r | |
1452 | \r | |
1453 | /**\r | |
1454 | Set value to Version element\r | |
1455 | \r | |
1456 | @param ver The value set to Version element\r | |
1457 | **/\r | |
1458 | public void setSpdHdrVer(String ver) {\r | |
1459 | getSpdHdr().setVersion(ver);\r | |
1460 | }\r | |
1461 | \r | |
1462 | public String getSpdHdrAbs(){\r | |
1463 | return getSpdHdr().getAbstract();\r | |
1464 | \r | |
1465 | }\r | |
1466 | \r | |
1467 | /**\r | |
1468 | Set value to Abstract element\r | |
1469 | \r | |
1470 | @param abs The value set to Abstract element\r | |
1471 | **/\r | |
1472 | public void setSpdHdrAbs(String abs) {\r | |
1473 | \r | |
1474 | getSpdHdr().setAbstract(abs);\r | |
1475 | }\r | |
1476 | \r | |
1477 | public String getSpdHdrDescription(){\r | |
1478 | return getSpdHdr().getDescription(); \r | |
1479 | }\r | |
1480 | /**\r | |
1481 | Set value to Description element\r | |
1482 | \r | |
1483 | @param des The value set to Description element\r | |
1484 | **/\r | |
1485 | public void setSpdHdrDescription(String des) {\r | |
1486 | getSpdHdr().setDescription(des);\r | |
1487 | }\r | |
1488 | \r | |
1489 | public String getSpdHdrCopyright(){\r | |
1490 | return getSpdHdr().getCopyright();\r | |
1491 | }\r | |
1492 | /**\r | |
1493 | Set value to Copyright element\r | |
1494 | \r | |
1495 | @param cpRit The value set to Copyright element\r | |
1496 | **/\r | |
1497 | public void setSpdHdrCopyright(String cpRit) {\r | |
1498 | \r | |
1499 | getSpdHdr().setCopyright(cpRit);\r | |
1500 | \r | |
1501 | }\r | |
1502 | /**\r | |
1503 | Get License element under SpdHdr\r | |
1504 | \r | |
1505 | @return String\r | |
1506 | **/\r | |
1507 | public String getSpdHdrLicense() {\r | |
1508 | if (getSpdHdr().getLicense() != null) {\r | |
1509 | return getSpdHdr().getLicense().getStringValue();\r | |
1510 | }\r | |
1511 | return null;\r | |
1512 | }\r | |
1513 | \r | |
1514 | /**\r | |
1515 | Set value to License element\r | |
1516 | \r | |
1517 | @param license The value set to License element\r | |
1518 | **/\r | |
1519 | public void setSpdHdrLicense(String license) {\r | |
1520 | if (getSpdHdr().getLicense() == null){\r | |
1521 | getSpdHdr().addNewLicense().setStringValue(license);\r | |
1522 | }\r | |
1523 | else {\r | |
1524 | getSpdHdr().getLicense().setStringValue(license);\r | |
1525 | }\r | |
1526 | }\r | |
1527 | \r | |
1528 | public String getSpdHdrUrl(){\r | |
1529 | if (getSpdHdr().getLicense() != null) {\r | |
1530 | return getSpdHdr().getLicense().getURL();\r | |
1531 | }\r | |
1532 | return null;\r | |
1533 | }\r | |
1534 | \r | |
1535 | public void setSpdHdrUrl(String url){\r | |
1536 | getSpdHdr().getLicense().setURL(url);\r | |
1537 | }\r | |
1538 | \r | |
1539 | /**\r | |
1540 | Get PackageName element under SpdHdr\r | |
1541 | \r | |
1542 | @return String\r | |
1543 | **/\r | |
1544 | public String getSpdHdrPkgName() {\r | |
1545 | \r | |
1546 | return getSpdHdr().getPackageName();\r | |
1547 | }\r | |
1548 | \r | |
1549 | /**\r | |
1550 | Set value to PackageName element\r | |
1551 | \r | |
1552 | @param pkgName The value set to PackageName element\r | |
1553 | **/\r | |
1554 | public void setSpdHdrPkgName(String pkgName) {\r | |
1555 | getSpdHdr().setPackageName(pkgName);\r | |
1556 | }\r | |
1557 | \r | |
1558 | public String getSpdHdrGuidValue(){\r | |
1559 | return getSpdHdr().getGuidValue();\r | |
1560 | }\r | |
1561 | \r | |
1562 | /**\r | |
1563 | Reserved method\r | |
1564 | \r | |
1565 | @return SpecificationDocument.Specification\r | |
1566 | **/\r | |
1567 | public String getSpdHdrSpec() {\r | |
c06e8657 | 1568 | return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r |
a13899c5 | 1569 | // return getSpdHdr().getSpecification();\r |
1570 | }\r | |
1571 | \r | |
1572 | /**\r | |
1573 | Reserved method\r | |
1574 | \r | |
1575 | @param spec \r | |
1576 | **/\r | |
1577 | public void setSpdHdrSpec(String spec) {\r | |
c06e8657 | 1578 | spec = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r |
a13899c5 | 1579 | getSpdHdr().setSpecification(spec);\r |
1580 | \r | |
1581 | }\r | |
1582 | \r | |
1583 | public String getSpdPkgDefsRdOnly(){\r | |
1584 | return getSpdPkgDefs().getReadOnly() + "";\r | |
1585 | }\r | |
1586 | /**\r | |
1587 | Set value to ReadOnly element\r | |
1588 | \r | |
1589 | @param rdOnly The value set to ReadOnly element\r | |
1590 | **/\r | |
1591 | public void setSpdPkgDefsRdOnly(String rdOnly) {\r | |
1592 | \r | |
1593 | getSpdPkgDefs().setReadOnly(new Boolean(rdOnly));\r | |
1594 | }\r | |
1595 | \r | |
1596 | public String getSpdPkgDefsRePkg(){\r | |
1597 | return getSpdPkgDefs().getRePackage() + "";\r | |
1598 | }\r | |
1599 | /**\r | |
1600 | Set value to RePackage element\r | |
1601 | \r | |
1602 | @param rePkg The value set to RePackage element\r | |
1603 | **/\r | |
1604 | public void setSpdPkgDefsRePkg(String rePkg) {\r | |
1605 | \r | |
1606 | getSpdPkgDefs().setRePackage(new Boolean(rePkg));\r | |
1607 | }\r | |
1608 | \r | |
1609 | /**\r | |
1610 | Set value to URL element\r | |
1611 | \r | |
1612 | @param url The value set to URL element\r | |
1613 | **/\r | |
1614 | // public void setSpdHdrURL(String url) {\r | |
1615 | // getSpdHdr().setURL(url);\r | |
1616 | // }\r | |
1617 | \r | |
1618 | /**\r | |
1619 | Get xml file\r | |
1620 | \r | |
1621 | @return File\r | |
1622 | **/\r | |
1623 | public File getFile() {\r | |
1624 | return file;\r | |
1625 | }\r | |
1626 | \r | |
1627 | /**\r | |
1628 | Set file\r | |
1629 | \r | |
1630 | @param file File with xml format\r | |
1631 | **/\r | |
1632 | public void setFile(File file) {\r | |
1633 | this.file = file;\r | |
1634 | }\r | |
1635 | \r | |
1636 | private List<String> stringToList(String s){\r | |
ce73a791 | 1637 | if (s == null || s.length() == 0) {\r |
a13899c5 | 1638 | return null;\r |
1639 | }\r | |
ce73a791 | 1640 | Vector<String> al = new Vector<String>();\r |
a13899c5 | 1641 | String[] sArray = s.split(" ");\r |
1642 | for(int i = 0; i < sArray.length; ++i){\r | |
1643 | al.add(sArray[i]);\r | |
1644 | }\r | |
1645 | return al; \r | |
1646 | }\r | |
1647 | \r | |
ce73a791 | 1648 | private String listToString(List l) {\r |
a13899c5 | 1649 | if (l == null) {\r |
1650 | return null;\r | |
1651 | }\r | |
1652 | String s = " ";\r | |
1653 | ListIterator li = l.listIterator();\r | |
1654 | while(li.hasNext()) {\r | |
1655 | s += li.next();\r | |
1656 | s += " ";\r | |
1657 | }\r | |
1658 | return s.trim();\r | |
1659 | }\r | |
1660 | \r | |
1661 | }\r |