]>
Commit | Line | Data |
---|---|---|
878ddf1f | 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.packaging;\r | |
14 | \r | |
15 | import java.io.File;\r | |
16 | import java.io.IOException;\r | |
17 | import java.util.List;\r | |
18 | import java.util.ListIterator;\r | |
4bf9d815 | 19 | import java.math.*;\r |
878ddf1f | 20 | import org.apache.xmlbeans.XmlObject;\r |
21 | import org.apache.xmlbeans.XmlOptions;\r | |
22 | import org.apache.xmlbeans.XmlCursor;\r | |
23 | \r | |
24 | import org.tianocore.AbstractDocument;\r | |
25 | import org.tianocore.GuidDeclarationsDocument;\r | |
26 | import org.tianocore.GuidDocument;\r | |
27 | import org.tianocore.IncludeHeaderDocument;\r | |
28 | import org.tianocore.LibraryClassDeclarationDocument;\r | |
29 | import org.tianocore.LibraryClassDeclarationsDocument;\r | |
30 | import org.tianocore.LibraryClassDocument;\r | |
31 | import org.tianocore.LibraryUsage;\r | |
32 | import org.tianocore.LicenseDocument;\r | |
33 | import org.tianocore.ModuleTypeDef;\r | |
34 | import org.tianocore.MsaFilesDocument;\r | |
35 | import org.tianocore.OutputDirectoryDocument;\r | |
36 | import org.tianocore.PackageDependenciesDocument;\r | |
37 | import org.tianocore.PackageHeadersDocument;\r | |
38 | import org.tianocore.PackageNameDocument;\r | |
39 | import org.tianocore.PackageSurfaceAreaDocument;\r | |
40 | import org.tianocore.PackageType;\r | |
41 | import org.tianocore.PackageUsage;\r | |
42 | import org.tianocore.PcdDataTypes;\r | |
43 | import org.tianocore.PcdDefinitionsDocument;\r | |
44 | import org.tianocore.PcdItemTypes;\r | |
45 | import org.tianocore.PpiDeclarationsDocument;\r | |
46 | import org.tianocore.ProtocolDeclarationsDocument;\r | |
47 | import org.tianocore.SpdHeaderDocument;\r | |
48 | import org.tianocore.SpecificationDocument;\r | |
49 | import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;\r | |
50 | \r | |
51 | /**\r | |
52 | This class processes spd file contents such as add remove xml elements.\r | |
53 | \r | |
54 | @since PackageEditor 1.0\r | |
55 | **/\r | |
56 | public class SpdFileContents {\r | |
57 | \r | |
58 | private File file = null;\r | |
59 | \r | |
60 | private PackageSurfaceAreaDocument psad = null;\r | |
61 | \r | |
62 | private PackageSurfaceAreaDocument.PackageSurfaceArea psaRoot = null;\r | |
63 | \r | |
64 | private SpdHeaderDocument.SpdHeader spdHdr = null;\r | |
65 | \r | |
4bf9d815 | 66 | private String spdHdrPkgName = null;\r |
878ddf1f | 67 | \r |
68 | private GuidDocument.Guid spdHdrGuid = null;\r | |
69 | \r | |
878ddf1f | 70 | private LicenseDocument.License spdHdrLicense = null;\r |
71 | \r | |
878ddf1f | 72 | private OutputDirectoryDocument.OutputDirectory spdHdrOutDir = null;\r |
73 | \r | |
74 | private LibraryClassDeclarationsDocument.LibraryClassDeclarations spdLibClassDeclarations = null;\r | |
75 | \r | |
76 | private PackageDependenciesDocument.PackageDependencies spdPkgDeps = null;\r | |
77 | \r | |
78 | private MsaFilesDocument.MsaFiles spdMsaFiles = null;\r | |
79 | \r | |
80 | private PackageHeadersDocument.PackageHeaders spdModHdrs = null;\r | |
81 | \r | |
82 | private GuidDeclarationsDocument.GuidDeclarations spdGuidDeclarations = null;\r | |
83 | \r | |
84 | private ProtocolDeclarationsDocument.ProtocolDeclarations spdProtocolDeclarations = null;\r | |
85 | \r | |
86 | private PpiDeclarationsDocument.PpiDeclarations spdPpiDeclarations = null;\r | |
87 | \r | |
88 | private PcdDefinitionsDocument.PcdDefinitions spdPcdDefinitions = null;\r | |
89 | \r | |
90 | /**\r | |
91 | Constructor to create a new spd file\r | |
92 | **/\r | |
93 | public SpdFileContents() {\r | |
94 | \r | |
95 | psad = PackageSurfaceAreaDocument.Factory.newInstance();\r | |
96 | psaRoot = psad.addNewPackageSurfaceArea();\r | |
97 | \r | |
98 | }\r | |
99 | \r | |
100 | /**\r | |
101 | Constructor based on an existing spd file\r | |
102 | \r | |
103 | @param f Existing spd file\r | |
104 | **/\r | |
105 | public SpdFileContents(File f) {\r | |
106 | try {\r | |
107 | psad = PackageSurfaceAreaDocument.Factory.parse(f);\r | |
108 | psaRoot = psad.getPackageSurfaceArea();\r | |
109 | file = f;\r | |
110 | } catch (Exception e) {\r | |
111 | System.out.println(e.toString());\r | |
112 | }\r | |
113 | }\r | |
114 | \r | |
115 | /**\r | |
116 | Remove existing pcd definitions elements using XmlCursor\r | |
117 | **/\r | |
118 | public void removeSpdPcdDefinition() {\r | |
119 | XmlObject o = psaRoot.getPcdDefinitions();\r | |
120 | if (o == null)\r | |
121 | return;\r | |
122 | XmlCursor cursor = o.newCursor();\r | |
123 | cursor.removeXml();\r | |
24dba7f3 | 124 | spdPcdDefinitions = null;\r |
878ddf1f | 125 | }\r |
126 | \r | |
127 | /**\r | |
128 | Remove existing ppi declarations using XmlCursor\r | |
129 | **/\r | |
130 | public void removeSpdPpiDeclaration() {\r | |
131 | XmlObject o = psaRoot.getPpiDeclarations();\r | |
132 | if (o == null)\r | |
133 | return;\r | |
134 | XmlCursor cursor = o.newCursor();\r | |
135 | cursor.removeXml();\r | |
24dba7f3 | 136 | spdPpiDeclarations = null;\r |
878ddf1f | 137 | }\r |
138 | \r | |
139 | /**\r | |
140 | Remove existing protocols declarations using XmlCursor\r | |
141 | **/\r | |
142 | public void removeSpdProtocolDeclaration() {\r | |
143 | XmlObject o = psaRoot.getProtocolDeclarations();\r | |
144 | if (o == null)\r | |
145 | return;\r | |
146 | XmlCursor cursor = o.newCursor();\r | |
147 | cursor.removeXml();\r | |
24dba7f3 | 148 | spdProtocolDeclarations = null;\r |
878ddf1f | 149 | }\r |
150 | \r | |
151 | /**\r | |
152 | Remove existing GUID declarations using XmlCursor\r | |
153 | **/\r | |
154 | public void removeSpdGuidDeclaration() {\r | |
155 | XmlObject o = psaRoot.getGuidDeclarations();\r | |
156 | if (o == null)\r | |
157 | return;\r | |
158 | XmlCursor cursor = o.newCursor();\r | |
159 | cursor.removeXml();\r | |
24dba7f3 | 160 | spdGuidDeclarations = null; \r |
878ddf1f | 161 | }\r |
162 | \r | |
163 | /**\r | |
24dba7f3 | 164 | Remove existing spd package include files using XmlCursor\r |
878ddf1f | 165 | **/\r |
166 | public void removeSpdPkgHeader() {\r | |
167 | XmlObject o = psaRoot.getPackageHeaders();\r | |
168 | if (o == null)\r | |
169 | return;\r | |
170 | XmlCursor cursor = o.newCursor();\r | |
171 | cursor.removeXml();\r | |
24dba7f3 | 172 | spdModHdrs = null;\r |
878ddf1f | 173 | }\r |
174 | \r | |
175 | /**\r | |
176 | Remove existing msa files using XmlCursor\r | |
177 | **/\r | |
178 | public void removeSpdMsaFile() {\r | |
179 | XmlObject o = psaRoot.getMsaFiles();\r | |
180 | if (o == null)\r | |
181 | return;\r | |
182 | XmlCursor cursor = o.newCursor();\r | |
183 | cursor.removeXml();\r | |
24dba7f3 | 184 | spdMsaFiles = null;\r |
878ddf1f | 185 | }\r |
186 | \r | |
187 | /**\r | |
188 | Remove existing library class declarations using XmlCursor\r | |
189 | **/\r | |
190 | public void removeSpdLibClass() {\r | |
191 | XmlObject o = psaRoot.getLibraryClassDeclarations();\r | |
192 | if (o == null)\r | |
193 | return;\r | |
194 | XmlCursor cursor = o.newCursor();\r | |
195 | cursor.removeXml();\r | |
24dba7f3 | 196 | spdLibClassDeclarations = null;\r |
878ddf1f | 197 | }\r |
198 | \r | |
199 | /**\r | |
200 | Get spd file header contents into String array\r | |
201 | \r | |
202 | @param s Caller allocated String array\r | |
203 | **/\r | |
204 | public void getSpdHdrDetails(String[] s) {\r | |
205 | if (getSpdHdr() == null) {\r | |
206 | spdHdr = psaRoot.addNewSpdHeader();\r | |
207 | }\r | |
4bf9d815 | 208 | s[0] = getSpdHdrPkgName();\r |
878ddf1f | 209 | s[1] = getSpdHdrGuid().getStringValue();\r |
210 | s[2] = getSpdHdrVer();\r | |
c082c8cf | 211 | s[3] = getSpdHdrAbs();\r |
878ddf1f | 212 | s[4] = getSpdHdr().getDescription();\r |
213 | s[5] = getSpdHdr().getCopyright();\r | |
214 | s[6] = getSpdHdrLicense().getStringValue();\r | |
215 | s[7] = getSpdHdr().getCreated();\r | |
216 | s[8] = getSpdHdr().getURL();\r | |
217 | if (getSpdHdr().getPackageType() != null) {\r | |
218 | s[9] = getSpdHdr().getPackageType().toString();\r | |
219 | }\r | |
220 | //\r | |
221 | // convert boolean to String by adding empty String ""\r | |
222 | //\r | |
223 | s[10] = getSpdHdr().getReadOnly() + "";\r | |
224 | s[11] = getSpdHdr().getReadOnly() + "";\r | |
225 | }\r | |
226 | \r | |
227 | /**\r | |
228 | Get the number of library class declarations from the size of List\r | |
229 | \r | |
230 | @return int\r | |
231 | **/\r | |
232 | public int getSpdLibClassDeclarationCount() {\r | |
233 | if (psaRoot.getLibraryClassDeclarations() == null\r | |
234 | || psaRoot.getLibraryClassDeclarations().getLibraryClassDeclarationList() == null) {\r | |
235 | return 0;\r | |
236 | }\r | |
237 | return psaRoot.getLibraryClassDeclarations().getLibraryClassDeclarationList().size();\r | |
238 | }\r | |
239 | \r | |
240 | /**\r | |
241 | Get available library class declaration into String array\r | |
242 | @param libClass Caller allocated two-dimentional String array\r | |
243 | **/\r | |
244 | public void getSpdLibClassDeclarations(String[][] libClass) {\r | |
247e0d75 | 245 | if (psaRoot.getLibraryClassDeclarations() == null){\r |
246 | return;\r | |
247 | }\r | |
878ddf1f | 248 | List<LibraryClassDeclarationDocument.LibraryClassDeclaration> l = psaRoot.getLibraryClassDeclarations()\r |
249 | .getLibraryClassDeclarationList();\r | |
250 | int i = 0;\r | |
251 | ListIterator li = l.listIterator();\r | |
252 | while (li.hasNext()) {\r | |
253 | LibraryClassDeclarationDocument.LibraryClassDeclaration lcd = (LibraryClassDeclarationDocument.LibraryClassDeclaration) li\r | |
254 | .next();\r | |
255 | if (lcd.getLibraryClass() != null) {\r | |
256 | libClass[i][0] = lcd.getLibraryClass().getStringValue();\r | |
257 | }\r | |
258 | if (lcd.getIncludeHeader() != null) {\r | |
259 | libClass[i][1] = lcd.getIncludeHeader().getStringValue();\r | |
260 | }\r | |
261 | \r | |
262 | i++;\r | |
263 | }\r | |
264 | \r | |
265 | }\r | |
266 | \r | |
267 | /**\r | |
268 | Get the number of Msa files from the size of List\r | |
269 | \r | |
270 | @return int\r | |
271 | **/\r | |
272 | public int getSpdMsaFileCount() {\r | |
273 | if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getMsaFileList() == null) {\r | |
274 | return 0;\r | |
275 | }\r | |
276 | return psaRoot.getMsaFiles().getMsaFileList().size();\r | |
277 | }\r | |
278 | \r | |
279 | /**\r | |
280 | Get available Msa file into String array\r | |
281 | \r | |
282 | @param msaFile Caller allocated two-dimentional String array\r | |
283 | **/\r | |
284 | public void getSpdMsaFiles(String[][] msaFile) {\r | |
247e0d75 | 285 | if (psaRoot.getMsaFiles() == null) {\r |
286 | return;\r | |
287 | }\r | |
878ddf1f | 288 | List<MsaFilesDocument.MsaFiles.MsaFile> l = psaRoot.getMsaFiles().getMsaFileList();\r |
289 | int i = 0;\r | |
290 | ListIterator li = l.listIterator();\r | |
291 | while (li.hasNext()) {\r | |
292 | MsaFilesDocument.MsaFiles.MsaFile m = (MsaFilesDocument.MsaFiles.MsaFile) li.next();\r | |
293 | if (m.getFilename() != null) {\r | |
294 | msaFile[i][0] = m.getFilename().getStringValue();\r | |
295 | }\r | |
296 | \r | |
297 | i++;\r | |
298 | }\r | |
299 | }\r | |
300 | \r | |
301 | /**\r | |
302 | Get the number of include header files in PackageHeaders from the size of List\r | |
303 | \r | |
304 | @return int\r | |
305 | **/\r | |
306 | public int getSpdPackageHeaderCount() {\r | |
307 | if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludeHeaderList() == null) {\r | |
308 | return 0;\r | |
309 | }\r | |
310 | return psaRoot.getPackageHeaders().getIncludeHeaderList().size();\r | |
311 | }\r | |
312 | \r | |
313 | /**\r | |
314 | Get available package header contents into String array\r | |
315 | \r | |
316 | @param pkgHeader Caller allocated two-dimentional String array\r | |
317 | **/\r | |
318 | public void getSpdPackageHeaders(String[][] pkgHeader) {\r | |
247e0d75 | 319 | if (psaRoot.getPackageHeaders() == null) {\r |
320 | return;\r | |
321 | }\r | |
322 | \r | |
878ddf1f | 323 | List<IncludeHeaderDocument.IncludeHeader> l = psaRoot.getPackageHeaders().getIncludeHeaderList();\r |
324 | int i = 0;\r | |
325 | ListIterator li = l.listIterator();\r | |
326 | while (li.hasNext()) {\r | |
327 | IncludeHeaderDocument.IncludeHeader ih = (IncludeHeaderDocument.IncludeHeader) li.next();\r | |
328 | if (ih.getModuleType() != null) {\r | |
329 | pkgHeader[i][0] = ih.getModuleType().toString();\r | |
330 | }\r | |
331 | \r | |
332 | pkgHeader[i][1] = ih.getStringValue();\r | |
333 | i++;\r | |
334 | }\r | |
335 | }\r | |
336 | \r | |
337 | /**\r | |
338 | Get the number of GUID declarations from the size of List\r | |
339 | \r | |
340 | @return int\r | |
341 | **/\r | |
342 | public int getSpdGuidDeclarationCount() {\r | |
343 | if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) {\r | |
344 | return 0;\r | |
345 | }\r | |
346 | return psaRoot.getGuidDeclarations().getEntryList().size();\r | |
347 | }\r | |
348 | \r | |
349 | /**\r | |
350 | Get available Guid declaration contents into String array\r | |
351 | \r | |
352 | @param guid Caller allocated two-dimentional String array\r | |
353 | **/\r | |
354 | public void getSpdGuidDeclarations(String[][] guid) {\r | |
247e0d75 | 355 | if (psaRoot.getGuidDeclarations() == null) {\r |
356 | return;\r | |
357 | }\r | |
358 | \r | |
878ddf1f | 359 | List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();\r |
360 | int i = 0;\r | |
361 | ListIterator li = l.listIterator();\r | |
362 | while (li.hasNext()) {\r | |
363 | GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li\r | |
364 | .next();\r | |
365 | guid[i][0] = e.getName();\r | |
366 | guid[i][1] = e.getCName();\r | |
367 | if (e.getGuid() != null) {\r | |
368 | guid[i][2] = e.getGuid().getStringValue();\r | |
369 | }\r | |
370 | i++;\r | |
371 | }\r | |
372 | }\r | |
373 | \r | |
374 | /**\r | |
375 | Get the number of protocol declarations from the size of List\r | |
376 | \r | |
377 | @return int\r | |
378 | **/\r | |
379 | public int getSpdProtocolDeclarationCount() {\r | |
380 | if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) {\r | |
381 | return 0;\r | |
382 | }\r | |
383 | return psaRoot.getProtocolDeclarations().getEntryList().size();\r | |
384 | }\r | |
385 | \r | |
386 | /**\r | |
387 | Get available protocol declaration contents into String array\r | |
388 | \r | |
389 | @param protocol Caller allocated two-dimentional String array\r | |
390 | **/\r | |
391 | public void getSpdProtocolDeclarations(String[][] protocol) {\r | |
247e0d75 | 392 | if (psaRoot.getProtocolDeclarations() == null) {\r |
393 | return;\r | |
394 | }\r | |
395 | \r | |
878ddf1f | 396 | List<ProtocolDeclarationsDocument.ProtocolDeclarations.Entry> l = psaRoot.getProtocolDeclarations()\r |
397 | .getEntryList();\r | |
398 | int i = 0;\r | |
399 | ListIterator li = l.listIterator();\r | |
400 | while (li.hasNext()) {\r | |
401 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li\r | |
402 | .next();\r | |
403 | protocol[i][0] = e.getName();\r | |
404 | protocol[i][1] = e.getCName();\r | |
405 | if (e.getGuid() != null) {\r | |
406 | protocol[i][2] = e.getGuid().getStringValue();\r | |
407 | }\r | |
408 | i++;\r | |
409 | }\r | |
410 | }\r | |
411 | \r | |
412 | /**\r | |
413 | Get the number of Ppi declarations from the size of List\r | |
414 | \r | |
415 | @return int\r | |
416 | **/\r | |
417 | public int getSpdPpiDeclarationCount() {\r | |
418 | if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) {\r | |
419 | return 0;\r | |
420 | }\r | |
421 | return psaRoot.getPpiDeclarations().getEntryList().size();\r | |
422 | }\r | |
423 | \r | |
424 | /**\r | |
425 | Get available Ppi declaration contents into String array\r | |
426 | \r | |
427 | @param ppi Caller allocated two-dimentional String array\r | |
428 | **/\r | |
429 | public void getSpdPpiDeclarations(String[][] ppi) {\r | |
247e0d75 | 430 | if (psaRoot.getPpiDeclarations() == null) {\r |
431 | return;\r | |
432 | }\r | |
433 | \r | |
878ddf1f | 434 | List<PpiDeclarationsDocument.PpiDeclarations.Entry> l = psaRoot.getPpiDeclarations().getEntryList();\r |
435 | int i = 0;\r | |
436 | ListIterator li = l.listIterator();\r | |
437 | while (li.hasNext()) {\r | |
438 | PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next();\r | |
439 | ppi[i][0] = e.getName();\r | |
440 | ppi[i][1] = e.getCName();\r | |
441 | if (e.getGuid() != null) {\r | |
442 | ppi[i][2] = e.getGuid().getStringValue();\r | |
443 | }\r | |
444 | \r | |
445 | i++;\r | |
446 | }\r | |
447 | }\r | |
448 | \r | |
449 | /**\r | |
450 | Get the number of Pcd definitions from the size of List\r | |
451 | \r | |
452 | @return int\r | |
453 | **/\r | |
454 | public int getSpdPcdDefinitionCount() {\r | |
455 | if (psaRoot.getPcdDefinitions() == null || psaRoot.getPcdDefinitions().getPcdEntryList() == null) {\r | |
456 | return 0;\r | |
457 | }\r | |
458 | return psaRoot.getPcdDefinitions().getPcdEntryList().size();\r | |
459 | }\r | |
460 | \r | |
461 | /**\r | |
462 | Get available Pcd definition contents into String array\r | |
463 | \r | |
464 | @param pcd Caller allocated two-dimentional String array\r | |
465 | **/\r | |
466 | public void getSpdPcdDefinitions(String[][] pcd) {\r | |
247e0d75 | 467 | if (psaRoot.getPcdDefinitions() == null) {\r |
468 | return;\r | |
469 | }\r | |
470 | \r | |
878ddf1f | 471 | List<PcdDefinitionsDocument.PcdDefinitions.PcdEntry> l = psaRoot.getPcdDefinitions().getPcdEntryList();\r |
472 | int i = 0;\r | |
473 | ListIterator li = l.listIterator();\r | |
474 | while (li.hasNext()) {\r | |
475 | PcdDefinitionsDocument.PcdDefinitions.PcdEntry e = (PcdDefinitionsDocument.PcdDefinitions.PcdEntry) li\r | |
476 | .next();\r | |
477 | if (e.getItemType() != null) {\r | |
478 | pcd[i][0] = e.getItemType().toString();\r | |
479 | }\r | |
480 | \r | |
481 | pcd[i][1] = e.getCName();\r | |
482 | pcd[i][2] = e.getToken();\r | |
483 | if (e.getDatumType() != null) {\r | |
484 | pcd[i][3] = e.getDatumType().toString();\r | |
485 | }\r | |
486 | \r | |
487 | if (e.getDefaultValue() != null) {\r | |
488 | pcd[i][4] = e.getDefaultValue().toString();\r | |
489 | }\r | |
490 | \r | |
491 | i++;\r | |
492 | }\r | |
493 | }\r | |
494 | \r | |
495 | /**\r | |
496 | Save the processed xml contents to file\r | |
497 | \r | |
498 | @param spdFile The file to save xml contents\r | |
499 | @throws IOException Exceptions during file operation\r | |
500 | **/\r | |
501 | public void saveAs(File spdFile) throws IOException {\r | |
502 | \r | |
503 | XmlOptions options = new XmlOptions();\r | |
504 | \r | |
505 | options.setCharacterEncoding("UTF-8");\r | |
506 | options.setSavePrettyPrint();\r | |
507 | options.setSavePrettyPrintIndent(2);\r | |
508 | try {\r | |
509 | psad.save(spdFile, options);\r | |
510 | } catch (IOException e) {\r | |
511 | e.printStackTrace();\r | |
512 | }\r | |
513 | \r | |
514 | }\r | |
515 | \r | |
516 | /**\r | |
517 | Generate SpdHeader contents using parameters passed in.\r | |
518 | \r | |
519 | @param pkgName PackageName \r | |
520 | @param pkgGuid Guid\r | |
521 | @param pkgVer Version\r | |
522 | @param pkgAbs Abstract\r | |
523 | @param pkgDes Description\r | |
524 | @param pkgCpRight Copyright\r | |
525 | @param pkgLicense License\r | |
526 | @param pkgCreateDate Created\r | |
527 | @param pkgUpdateDate Updated\r | |
528 | @param pkgURL URL\r | |
529 | @param pkgType PackageType\r | |
530 | @param pkgRdOnly ReadOnly\r | |
531 | @param pkgRePkg RePackage\r | |
532 | @param pkgSpec Reserved\r | |
533 | @param pkgOutDir Reserved\r | |
534 | **/\r | |
535 | public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes,\r | |
536 | String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate,\r | |
537 | String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec,\r | |
538 | String pkgOutDir) {\r | |
539 | if (getSpdHdr() == null) {\r | |
540 | spdHdr = psaRoot.addNewSpdHeader();\r | |
541 | }\r | |
542 | \r | |
543 | setSpdHdrPkgName(pkgName);\r | |
544 | setSpdHdrGuid(pkgGuid);\r | |
545 | setSpdHdrVer(pkgVer);\r | |
546 | setSpdHdrAbs(pkgAbs);\r | |
547 | setSpdHdrDes(pkgDes);\r | |
548 | setSpdHdrCpRit(pkgCpRight);\r | |
549 | setSpdHdrLicense(pkgLicense);\r | |
550 | setSpdHdrCreateDate(pkgCreateDate);\r | |
551 | setSpdHdrUpdateDate(pkgUpdateDate);\r | |
552 | setSpdHdrURL(pkgURL);\r | |
553 | setSpdHdrPkgType(pkgType);\r | |
554 | setSpdHdrRdOnly(pkgRdOnly);\r | |
555 | setSpdHdrRePkg(pkgRePkg);\r | |
556 | setSpdHdrSpec(pkgSpec);\r | |
557 | setSpdHdrOutDir(pkgOutDir);\r | |
558 | }\r | |
559 | \r | |
560 | /**\r | |
561 | Generate library class declaration element using parameters passed in\r | |
562 | \r | |
563 | @param libClassBaseName LibraryClass element value\r | |
564 | @param libClassUsage Reserved\r | |
565 | @param incHdrFileName IncludeHeader element value\r | |
566 | @param incHdrAttribGuid Reserved\r | |
567 | @param incHdrAttribArch Reserved\r | |
568 | @param incHdrAttribPath Reserved\r | |
569 | @param incHdrAttribClass Reserved\r | |
570 | @param incHdrAttribVer Reserved\r | |
571 | @param incHdrAttribOverrideID Reserved\r | |
572 | @param incHdrAttribModuleType Reserved\r | |
573 | **/\r | |
574 | public void genSpdLibClassDeclarations(String libClassBaseName, String libClassUsage, String incHdrFileName,\r | |
575 | String incHdrAttribGuid, String incHdrAttribArch, String incHdrAttribPath,\r | |
576 | String incHdrAttribClass, String incHdrAttribVer,\r | |
577 | String incHdrAttribOverrideID, String incHdrAttribModuleType) {\r | |
578 | if (getSpdLibClassDeclarations() == null) {\r | |
579 | spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations();\r | |
580 | }\r | |
581 | //\r | |
582 | // add contents under LibraryClassDeclarations tag \r | |
583 | //\r | |
584 | setSpdLibClassDeclaration(libClassBaseName, libClassUsage, incHdrFileName, incHdrAttribGuid, incHdrAttribArch,\r | |
585 | incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID,\r | |
586 | incHdrAttribModuleType, spdLibClassDeclarations);\r | |
587 | }\r | |
588 | \r | |
589 | /**\r | |
590 | Set library class declaration contents under parent tag\r | |
591 | \r | |
592 | @param clsName LibraryClass element value\r | |
593 | @param clsUsage Reserved\r | |
594 | @param hdrFile IncludeHeader element value\r | |
595 | @param hdrAttribGuid Reserved\r | |
596 | @param hdrAttribArch Reserved\r | |
597 | @param hdrAttribPath Reserved\r | |
598 | @param hdrAttribClass Reserved\r | |
599 | @param hdrAttribVer Reserved\r | |
600 | @param hdrAttribOverID Reserved\r | |
601 | @param hdrAttribModType Reserved\r | |
602 | @param parent The tag under which library class declaration goes to\r | |
603 | **/\r | |
604 | public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String hdrAttribGuid,\r | |
605 | String hdrAttribArch, String hdrAttribPath, String hdrAttribClass,\r | |
606 | String hdrAttribVer, String hdrAttribOverID, String hdrAttribModType,\r | |
607 | XmlObject parent) {\r | |
608 | \r | |
609 | LibraryClassDeclarationDocument.LibraryClassDeclaration lcd = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent)\r | |
610 | .addNewLibraryClassDeclaration();\r | |
611 | \r | |
612 | setSpdLibraryClass(clsName, clsUsage, lcd);\r | |
613 | \r | |
614 | setSpdIncludeHeader(null, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass, hdrAttribVer,\r | |
615 | hdrAttribOverID, lcd);\r | |
616 | }\r | |
617 | \r | |
618 | /**\r | |
619 | Set the contents of LibraryClass under parent element\r | |
620 | \r | |
621 | @param clsName LibraryClass element value \r | |
622 | @param clsUsage Reserved\r | |
623 | @param parent The tag under which library class declaration goes to\r | |
624 | **/\r | |
625 | public void setSpdLibraryClass(String clsName, String clsUsage, XmlObject parent) {\r | |
b4b11851 | 626 | LibraryClassDeclarationDocument.LibraryClassDeclaration.LibraryClass lc = ((LibraryClassDeclarationDocument.LibraryClassDeclaration) parent).addNewLibraryClass();\r |
878ddf1f | 627 | lc.setStringValue(clsName);\r |
628 | }\r | |
629 | \r | |
630 | /**\r | |
631 | Set contents of IncludeHeader under parent element\r | |
632 | \r | |
633 | @param modType Reserved\r | |
634 | @param hdrFile IncludeHeader element value\r | |
635 | @param hdrAttribGuid Reserved\r | |
636 | @param hdrAttribArch Reserved\r | |
637 | @param hdrAttribPath Reserved\r | |
638 | @param hdrAttribClass Reserved\r | |
639 | @param hdrAttribVer Reserved\r | |
640 | @param hdrAttribOverID Reserved\r | |
641 | @param parent The tag under which library class declaration goes to\r | |
642 | **/\r | |
643 | public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r | |
644 | String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r | |
645 | String hdrAttribOverID, XmlObject parent) {\r | |
646 | IncludeHeaderDocument.IncludeHeader ih = null;\r | |
647 | if (parent instanceof LibraryClassDeclarationDocument.LibraryClassDeclaration) {\r | |
648 | ih = ((LibraryClassDeclarationDocument.LibraryClassDeclaration) parent).addNewIncludeHeader();\r | |
649 | } else if (parent instanceof PackageHeadersDocument.PackageHeaders) {\r | |
650 | ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludeHeader();\r | |
651 | } else {\r | |
652 | return;\r | |
653 | }\r | |
654 | \r | |
655 | ih.setStringValue(hdrFile);\r | |
656 | if (hdrAttribGuid != null) {\r | |
657 | ih.setGuid(hdrAttribGuid);\r | |
658 | }\r | |
659 | if (hdrAttribPath != null) {\r | |
660 | ih.setPath(hdrAttribPath);\r | |
661 | }\r | |
662 | if (hdrAttribClass != null) {\r | |
663 | ih.setClass1(hdrAttribClass);\r | |
664 | }\r | |
665 | if (hdrAttribVer != null) {\r | |
666 | ih.setVersion(hdrAttribVer);\r | |
667 | }\r | |
668 | if (hdrAttribOverID != null) {\r | |
669 | ih.setOverrideID(Integer.parseInt(hdrAttribOverID));\r | |
670 | }\r | |
671 | if (modType != null) {\r | |
672 | ih.setModuleType(ModuleTypeDef.Enum.forString(modType));\r | |
673 | \r | |
674 | }\r | |
675 | \r | |
676 | }\r | |
677 | \r | |
678 | /**\r | |
679 | Reserved method\r | |
680 | \r | |
681 | @param pkgDepPkgName\r | |
682 | @param pkgDepPkgAttribGuid\r | |
683 | @param pkgDepPkgAttribVer\r | |
684 | @param pkgDepPkgAttribType\r | |
685 | @param pkgDepPkgAttribUsage\r | |
686 | @param pkgDepPkgAttribInstallDate\r | |
687 | @param pkgDepPkgAttribUpdateDate\r | |
688 | @param pkgDepPkgAttribPath\r | |
689 | **/\r | |
690 | public void genSpdPackageDependencies(String pkgDepPkgName, String pkgDepPkgAttribGuid, String pkgDepPkgAttribVer,\r | |
691 | String pkgDepPkgAttribType, String pkgDepPkgAttribUsage,\r | |
692 | String pkgDepPkgAttribInstallDate, String pkgDepPkgAttribUpdateDate,\r | |
693 | String pkgDepPkgAttribPath) {\r | |
694 | if (spdPkgDeps == null) {\r | |
695 | spdPkgDeps = psaRoot.addNewPackageDependencies();\r | |
696 | }\r | |
697 | \r | |
698 | setSpdPackageName(pkgDepPkgName, pkgDepPkgAttribGuid, pkgDepPkgAttribVer, pkgDepPkgAttribType,\r | |
699 | pkgDepPkgAttribUsage, pkgDepPkgAttribInstallDate, pkgDepPkgAttribUpdateDate,\r | |
700 | pkgDepPkgAttribPath, spdPkgDeps);\r | |
701 | }\r | |
702 | \r | |
703 | /**\r | |
704 | Reserved method\r | |
705 | \r | |
706 | @param pkgName\r | |
707 | @param pkgAttribGuid\r | |
708 | @param pkgAttribVer\r | |
709 | @param pkgAttribType\r | |
710 | @param pkgAttribUsage\r | |
711 | @param pkgAttribInstallDate\r | |
712 | @param pkgAttribUpdateDate\r | |
713 | @param pkgAttribPath\r | |
714 | @param parent\r | |
715 | **/\r | |
716 | public void setSpdPackageName(String pkgName, String pkgAttribGuid, String pkgAttribVer, String pkgAttribType,\r | |
717 | String pkgAttribUsage, String pkgAttribInstallDate, String pkgAttribUpdateDate,\r | |
718 | String pkgAttribPath, XmlObject parent) {\r | |
719 | \r | |
720 | PackageNameDocument.PackageName pn = ((PackageDependenciesDocument.PackageDependencies) parent)\r | |
721 | .addNewPackageName();\r | |
722 | pn.setStringValue(pkgName);\r | |
723 | pn.setPackageType(PackageType.Enum.forString(pkgAttribType));\r | |
724 | pn.setUsage(PackageUsage.Enum.forString(pkgAttribUsage));\r | |
725 | pn.setUpdatedDate(pkgAttribUpdateDate);\r | |
726 | }\r | |
727 | \r | |
728 | /**\r | |
729 | Generate MsaFile element.\r | |
730 | \r | |
731 | @param msaFileName MsaFile element value\r | |
732 | @param archType Reserved\r | |
733 | **/\r | |
734 | public void genSpdMsaFiles(String msaFileName, String archType) {\r | |
735 | if (getSpdMsaFiles() == null) {\r | |
736 | spdMsaFiles = psaRoot.addNewMsaFiles();\r | |
737 | }\r | |
738 | setSpdMsaFile(msaFileName, spdMsaFiles);\r | |
739 | \r | |
740 | }\r | |
741 | \r | |
742 | /**\r | |
743 | Set MsaFile contents under parent element.\r | |
744 | \r | |
745 | @param msaFileName MsaFile element value\r | |
746 | @param parent Element under which MsaFile goes to\r | |
747 | **/\r | |
748 | public void setSpdMsaFile(String msaFileName, XmlObject parent) {\r | |
749 | \r | |
750 | ((MsaFilesDocument.MsaFiles) parent).addNewMsaFile().addNewFilename().setStringValue(msaFileName);\r | |
751 | }\r | |
752 | \r | |
753 | /**\r | |
754 | Generate PackageHeader element using parameters passed in.\r | |
755 | \r | |
756 | @param ModHdrModType ModuleType attribute of IncludeHeader element\r | |
757 | @param hdrFile IncludeHeader element value\r | |
758 | @param hdrAttribGuid Reserved\r | |
759 | @param hdrAttribArch Reserved\r | |
760 | @param hdrAttribPath Reserved\r | |
761 | @param hdrAttribClass Reserved\r | |
762 | @param hdrAttribVer Reserved\r | |
763 | @param hdrAttribOverID Reserved\r | |
764 | **/\r | |
765 | public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,\r | |
766 | String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,\r | |
767 | String hdrAttribOverID) {\r | |
768 | if (getSpdModHdrs() == null) {\r | |
769 | spdModHdrs = psaRoot.addNewPackageHeaders();\r | |
770 | }\r | |
771 | \r | |
772 | //\r | |
773 | // add IncludeHeader under PackageHeaders element\r | |
774 | //\r | |
775 | setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass,\r | |
776 | hdrAttribVer, hdrAttribOverID, spdModHdrs);\r | |
777 | }\r | |
778 | \r | |
779 | /**\r | |
780 | Generate GUID declaration element using parameters passed in.\r | |
781 | \r | |
782 | @param guidDeclEntryName Name attribute of Entry element\r | |
783 | @param guidDeclCName CName element value\r | |
784 | @param guidDeclGuid Guid element value\r | |
785 | @param guidDeclFeatureFlag Reserved\r | |
786 | **/\r | |
787 | public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid,\r | |
788 | String guidDeclFeatureFlag) {\r | |
789 | if (getSpdGuidDeclarations() == null) {\r | |
790 | spdGuidDeclarations = psaRoot.addNewGuidDeclarations();\r | |
791 | }\r | |
792 | \r | |
793 | setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclFeatureFlag, spdGuidDeclarations);\r | |
794 | }\r | |
795 | \r | |
796 | /**\r | |
797 | Generate protocol declaration element using parameters passed in.\r | |
798 | \r | |
799 | @param protocolDeclEntryName Name attribute of Entry element\r | |
800 | @param protocolDeclCName CName element value\r | |
801 | @param protocolDeclGuid Guid element value\r | |
802 | @param protocolDeclFeatureFlag Reserved\r | |
803 | **/\r | |
804 | public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName,\r | |
805 | String protocolDeclGuid, String protocolDeclFeatureFlag) {\r | |
806 | if (getSpdProtocolDeclarations() == null) {\r | |
807 | spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations();\r | |
808 | }\r | |
809 | \r | |
810 | setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag,\r | |
811 | spdProtocolDeclarations);\r | |
812 | }\r | |
813 | \r | |
814 | /**\r | |
815 | Generate PPI declaration element using parameters passed in.\r | |
816 | \r | |
817 | @param ppiDeclEntryName Name attribute of Entry element\r | |
818 | @param ppiDeclCName CName element value\r | |
819 | @param ppiDeclGuid Guid element value\r | |
820 | @param ppiDeclFeatureFlag Reserved\r | |
821 | **/\r | |
822 | public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid,\r | |
823 | String ppiDeclFeatureFlag) {\r | |
824 | if (getSpdPpiDeclarations() == null) {\r | |
825 | spdPpiDeclarations = psaRoot.addNewPpiDeclarations();\r | |
826 | }\r | |
827 | \r | |
828 | setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, spdPpiDeclarations);\r | |
829 | }\r | |
830 | \r | |
831 | /**\r | |
832 | Set Entry contents using parameters passed in\r | |
833 | \r | |
834 | @param entryName Name attribute of Entry element\r | |
835 | @param cName CName element value\r | |
836 | @param guid Guid element value\r | |
837 | @param featureFlag Reserved\r | |
838 | @param parent The tag under which Entry element goes to\r | |
839 | **/\r | |
840 | public void setSpdEntry(String entryName, String cName, String guid, String featureFlag, XmlObject parent) {\r | |
841 | \r | |
842 | if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {\r | |
843 | GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry();\r | |
844 | e.setName(entryName);\r | |
845 | e.setCName(cName);\r | |
846 | e.addNewGuid().setStringValue(guid);\r | |
44570536 | 847 | \r |
878ddf1f | 848 | return;\r |
849 | }\r | |
850 | if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {\r | |
851 | ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent)\r | |
852 | .addNewEntry();\r | |
853 | pe.setName(entryName);\r | |
854 | pe.setCName(cName);\r | |
855 | pe.addNewGuid().setStringValue(guid);\r | |
44570536 | 856 | \r |
878ddf1f | 857 | }\r |
858 | if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {\r | |
859 | PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent)\r | |
860 | .addNewEntry();\r | |
861 | ppe.setName(entryName);\r | |
862 | ppe.setCName(cName);\r | |
863 | ppe.addNewGuid().setStringValue(guid);\r | |
44570536 | 864 | \r |
878ddf1f | 865 | return;\r |
866 | }\r | |
867 | \r | |
868 | return;\r | |
869 | \r | |
870 | }\r | |
871 | \r | |
872 | /**\r | |
873 | Generate Pcd definition using parameters passed in\r | |
874 | \r | |
875 | @param pcdItemTypes ItemType attribute of PcdEntry element\r | |
876 | @param cName C_Name element value\r | |
877 | @param token Token element value\r | |
878 | @param dataType DatumType element value\r | |
879 | @param skuEnable Reserved\r | |
880 | @param sku Reserved\r | |
881 | @param maxSku Reserved\r | |
882 | @param hiiEnable Reserved\r | |
883 | @param varGuid Reserved\r | |
884 | @param varName Reserved\r | |
885 | @param defaultString DefaultString element value\r | |
886 | **/\r | |
887 | public void genSpdPcdDefinitions(String pcdItemTypes, String cName, String token, String dataType,\r | |
888 | String skuEnable, String sku, String maxSku, String hiiEnable, String varGuid,\r | |
889 | String varName, String defaultString) {\r | |
890 | if (getSpdPcdDefinitions() == null) {\r | |
891 | spdPcdDefinitions = psaRoot.addNewPcdDefinitions();\r | |
892 | }\r | |
893 | \r | |
894 | setSpdPcdEntry(pcdItemTypes, cName, token, dataType, skuEnable, sku, maxSku, hiiEnable, varGuid, varName,\r | |
895 | defaultString, spdPcdDefinitions);\r | |
896 | }\r | |
897 | \r | |
898 | /**\r | |
899 | Set Pcd entry contents under parent tag\r | |
900 | \r | |
901 | @param pcdItemTypes ItemType attribute of PcdEntry element\r | |
902 | @param cName C_Name element value\r | |
903 | @param token Token element value\r | |
904 | @param dataType DatumType element value\r | |
905 | @param skuEnable Reserved\r | |
906 | @param sku Reserved\r | |
907 | @param maxSku Reserved\r | |
908 | @param hiiEnable Reserved\r | |
909 | @param varGuid Reserved\r | |
910 | @param varName Reserved\r | |
911 | @param defaultString DefaultString element value\r | |
912 | @param parent Tag under which PcdEntry goes to\r | |
913 | **/\r | |
914 | public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String skuEnable,\r | |
915 | String sku, String maxSku, String hiiEnable, String varGuid, String varName,\r | |
916 | String defaultString, XmlObject parent) {\r | |
917 | \r | |
918 | PcdDefinitionsDocument.PcdDefinitions.PcdEntry pe = ((PcdDefinitionsDocument.PcdDefinitions) parent)\r | |
919 | .addNewPcdEntry();\r | |
920 | pe.setItemType(PcdItemTypes.Enum.forString(pcdItemTypes));\r | |
921 | pe.setCName(cName);\r | |
922 | pe.setToken(token);\r | |
923 | pe.setDatumType(PcdDataTypes.Enum.forString(dataType));\r | |
924 | pe.setDefaultValue(defaultString);\r | |
925 | \r | |
926 | }\r | |
927 | \r | |
928 | /**\r | |
929 | Get PpiDeclarations element\r | |
930 | \r | |
931 | @return PpiDeclarationsDocument.PpiDeclarations\r | |
932 | **/\r | |
933 | public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() {\r | |
934 | if (spdPpiDeclarations == null) {\r | |
935 | spdPpiDeclarations = psaRoot.getPpiDeclarations();\r | |
936 | }\r | |
937 | return spdPpiDeclarations;\r | |
938 | }\r | |
939 | \r | |
940 | /**\r | |
941 | Get ProtocolDeclarations element\r | |
942 | \r | |
943 | @return ProtocolDeclarationsDocument.ProtocolDeclarations\r | |
944 | **/\r | |
945 | public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() {\r | |
946 | if (spdProtocolDeclarations == null) {\r | |
947 | spdProtocolDeclarations = psaRoot.getProtocolDeclarations();\r | |
948 | }\r | |
949 | return spdProtocolDeclarations;\r | |
950 | }\r | |
951 | \r | |
952 | /**\r | |
953 | Get GuidDeclarations element\r | |
954 | \r | |
955 | @return GuidDeclarationsDocument.GuidDeclarations\r | |
956 | **/\r | |
957 | public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() {\r | |
958 | if (spdGuidDeclarations == null) {\r | |
959 | spdGuidDeclarations = psaRoot.getGuidDeclarations();\r | |
960 | }\r | |
961 | return spdGuidDeclarations;\r | |
962 | }\r | |
963 | \r | |
964 | /**\r | |
965 | Get PcdDefinitions element\r | |
966 | \r | |
967 | @return PcdDefinitionsDocument.PcdDefinitions\r | |
968 | **/\r | |
969 | public PcdDefinitionsDocument.PcdDefinitions getSpdPcdDefinitions() {\r | |
970 | if (spdPcdDefinitions == null) {\r | |
971 | spdPcdDefinitions = psaRoot.getPcdDefinitions();\r | |
972 | }\r | |
973 | return spdPcdDefinitions;\r | |
974 | }\r | |
975 | \r | |
976 | /**\r | |
977 | Get PackageHeaders element\r | |
978 | \r | |
979 | @return PackageHeadersDocument.PackageHeaders\r | |
980 | **/\r | |
981 | public PackageHeadersDocument.PackageHeaders getSpdModHdrs() {\r | |
982 | if (spdModHdrs == null) {\r | |
983 | spdModHdrs = psaRoot.getPackageHeaders();\r | |
984 | }\r | |
985 | return spdModHdrs;\r | |
986 | }\r | |
987 | \r | |
988 | /**\r | |
989 | Get MsaFiles element\r | |
990 | \r | |
991 | @return MsaFilesDocument.MsaFiles\r | |
992 | **/\r | |
993 | public MsaFilesDocument.MsaFiles getSpdMsaFiles() {\r | |
994 | if (spdMsaFiles == null) {\r | |
995 | spdMsaFiles = psaRoot.getMsaFiles();\r | |
996 | }\r | |
997 | return spdMsaFiles;\r | |
998 | }\r | |
999 | \r | |
1000 | /**\r | |
1001 | Get LibraryClassDeclarations element\r | |
1002 | \r | |
1003 | @return LibraryClassDeclarationsDocument.LibraryClassDeclarations\r | |
1004 | **/\r | |
1005 | public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() {\r | |
1006 | if (spdLibClassDeclarations == null) {\r | |
1007 | spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations();\r | |
1008 | }\r | |
1009 | return spdLibClassDeclarations;\r | |
1010 | }\r | |
1011 | \r | |
1012 | /**\r | |
1013 | Get SpdHeader element\r | |
1014 | \r | |
1015 | @return SpdHeaderDocument.SpdHeader\r | |
1016 | **/\r | |
1017 | public SpdHeaderDocument.SpdHeader getSpdHdr() {\r | |
1018 | if (spdHdr == null) {\r | |
1019 | spdHdr = psaRoot.getSpdHeader();\r | |
1020 | }\r | |
1021 | return spdHdr;\r | |
1022 | }\r | |
1023 | \r | |
1024 | /**\r | |
1025 | Get Abstract element under tag SpdHeader\r | |
1026 | \r | |
1027 | @return AbstractDocument.Abstract\r | |
1028 | **/\r | |
c082c8cf | 1029 | public String getSpdHdrAbs() {\r |
1030 | \r | |
1031 | return getSpdHdr().getAbstract();\r | |
878ddf1f | 1032 | }\r |
1033 | \r | |
1034 | /**\r | |
1035 | Set value to Abstract element\r | |
1036 | \r | |
1037 | @param abs The value set to Abstract element\r | |
1038 | **/\r | |
1039 | public void setSpdHdrAbs(String abs) {\r | |
c082c8cf | 1040 | getSpdHdr().setAbstract(abs);\r |
878ddf1f | 1041 | }\r |
1042 | \r | |
1043 | /**\r | |
1044 | Set value to Copyright element\r | |
1045 | \r | |
1046 | @param cpRit The value set to Copyright element\r | |
1047 | **/\r | |
1048 | public void setSpdHdrCpRit(String cpRit) {\r | |
1049 | \r | |
1050 | getSpdHdr().setCopyright(cpRit);\r | |
1051 | \r | |
1052 | }\r | |
1053 | \r | |
1054 | /**\r | |
1055 | Set value to Created element\r | |
1056 | \r | |
1057 | @param createDate The value set to Created element\r | |
1058 | **/\r | |
1059 | public void setSpdHdrCreateDate(String createDate) {\r | |
1060 | \r | |
1061 | getSpdHdr().setCreated(createDate);\r | |
1062 | \r | |
1063 | }\r | |
1064 | \r | |
1065 | /**\r | |
1066 | Set value to Description element\r | |
1067 | \r | |
1068 | @param des The value set to Description element\r | |
1069 | **/\r | |
1070 | public void setSpdHdrDes(String des) {\r | |
1071 | getSpdHdr().setDescription(des);\r | |
1072 | }\r | |
1073 | \r | |
1074 | /**\r | |
1075 | Get Guid element under SpdHdr\r | |
1076 | \r | |
1077 | @return GuidDocument.Guid\r | |
1078 | **/\r | |
1079 | public GuidDocument.Guid getSpdHdrGuid() {\r | |
1080 | if (spdHdrGuid == null) {\r | |
1081 | spdHdrGuid = getSpdHdr().getGuid();\r | |
1082 | }\r | |
1083 | return spdHdrGuid;\r | |
1084 | }\r | |
1085 | \r | |
1086 | /**\r | |
1087 | Set value to Guid element\r | |
1088 | \r | |
1089 | @param guid The value set to Guid element\r | |
1090 | **/\r | |
1091 | public void setSpdHdrGuid(String guid) {\r | |
1092 | if (getSpdHdrGuid() != null) {\r | |
1093 | getSpdHdrGuid().setStringValue(guid);\r | |
1094 | } else {\r | |
1095 | spdHdrGuid = getSpdHdr().addNewGuid();\r | |
1096 | spdHdrGuid.setStringValue(guid);\r | |
1097 | }\r | |
1098 | }\r | |
1099 | \r | |
1100 | /**\r | |
1101 | Get Version element under SpdHdr\r | |
1102 | \r | |
1103 | @return String\r | |
1104 | **/\r | |
1105 | public String getSpdHdrVer() {\r | |
1106 | if (spdHdr != null)\r | |
4bf9d815 | 1107 | return spdHdr.getVersion() + "";\r |
878ddf1f | 1108 | else\r |
1109 | return null;\r | |
1110 | }\r | |
1111 | \r | |
1112 | /**\r | |
1113 | Set value to Version element\r | |
1114 | \r | |
1115 | @param ver The value set to Version element\r | |
1116 | **/\r | |
1117 | public void setSpdHdrVer(String ver) {\r | |
1118 | if (spdHdr != null) {\r | |
c082c8cf | 1119 | spdHdr.setVersion(ver);\r |
878ddf1f | 1120 | }\r |
1121 | \r | |
1122 | }\r | |
1123 | \r | |
1124 | /**\r | |
1125 | Get License element under SpdHdr\r | |
1126 | \r | |
1127 | @return LicenseDocument.License\r | |
1128 | **/\r | |
1129 | public LicenseDocument.License getSpdHdrLicense() {\r | |
1130 | if (spdHdrLicense == null) {\r | |
1131 | spdHdrLicense = getSpdHdr().getLicense();\r | |
1132 | }\r | |
1133 | return spdHdrLicense;\r | |
1134 | }\r | |
1135 | \r | |
1136 | /**\r | |
1137 | Set value to License element\r | |
1138 | \r | |
1139 | @param license The value set to License element\r | |
1140 | **/\r | |
1141 | public void setSpdHdrLicense(String license) {\r | |
1142 | if (getSpdHdrLicense() != null) {\r | |
1143 | getSpdHdrLicense().setStringValue(license);\r | |
1144 | } else {\r | |
1145 | spdHdrLicense = getSpdHdr().addNewLicense();\r | |
1146 | spdHdrLicense.setStringValue(license);\r | |
1147 | }\r | |
1148 | }\r | |
1149 | \r | |
1150 | /**\r | |
1151 | Reserved method\r | |
1152 | \r | |
1153 | @return\r | |
1154 | **/\r | |
1155 | public OutputDirectoryDocument.OutputDirectory getSpdHdrOutDir() {\r | |
1156 | return spdHdrOutDir;\r | |
1157 | }\r | |
1158 | \r | |
1159 | /**\r | |
1160 | Reserved method\r | |
1161 | \r | |
1162 | @param outdir\r | |
1163 | **/\r | |
1164 | public void setSpdHdrOutDir(String outdir) {\r | |
1165 | if (outdir == null) {\r | |
1166 | return;\r | |
1167 | }\r | |
1168 | if (getSpdHdrOutDir() != null) {\r | |
1169 | getSpdHdrOutDir().setStringValue(outdir);\r | |
1170 | } else {\r | |
1171 | spdHdrOutDir = getSpdHdr().addNewOutputDirectory();\r | |
1172 | spdHdrOutDir.setStringValue(outdir);\r | |
1173 | }\r | |
1174 | }\r | |
1175 | \r | |
1176 | /**\r | |
1177 | Get PackageName element under SpdHdr\r | |
1178 | \r | |
1179 | @return PackageNameDocument.PackageName\r | |
1180 | **/\r | |
4bf9d815 | 1181 | public String getSpdHdrPkgName() {\r |
878ddf1f | 1182 | if (spdHdrPkgName == null) {\r |
1183 | spdHdrPkgName = getSpdHdr().getPackageName();\r | |
1184 | }\r | |
1185 | return spdHdrPkgName;\r | |
1186 | }\r | |
1187 | \r | |
1188 | /**\r | |
1189 | Set value to PackageName element\r | |
1190 | \r | |
1191 | @param pkgName The value set to PackageName element\r | |
1192 | **/\r | |
1193 | public void setSpdHdrPkgName(String pkgName) {\r | |
1194 | \r | |
1195 | if (getSpdHdrPkgName() != null) {\r | |
4bf9d815 | 1196 | getSpdHdr().setPackageName(pkgName);\r |
878ddf1f | 1197 | } else {\r |
4bf9d815 | 1198 | getSpdHdr().setPackageName(pkgName);\r |
878ddf1f | 1199 | }\r |
1200 | }\r | |
1201 | \r | |
c082c8cf | 1202 | \r |
878ddf1f | 1203 | /**\r |
1204 | Reserved method\r | |
1205 | \r | |
1206 | @param spec \r | |
1207 | **/\r | |
1208 | public void setSpdHdrSpec(String spec) {\r | |
1209 | if (spec == null) {\r | |
1210 | return;\r | |
1211 | }\r | |
c082c8cf | 1212 | \r |
1213 | getSpdHdr().setSpecification(spec);\r | |
1214 | \r | |
878ddf1f | 1215 | }\r |
1216 | \r | |
1217 | /**\r | |
1218 | Set value to PackageType element\r | |
1219 | \r | |
1220 | @param pkgType The value set to PackageType element\r | |
1221 | **/\r | |
1222 | public void setSpdHdrPkgType(String pkgType) {\r | |
1223 | getSpdHdr().setPackageType(PackageType.Enum.forString(pkgType));\r | |
1224 | }\r | |
1225 | \r | |
1226 | /**\r | |
1227 | Set value to ReadOnly element\r | |
1228 | \r | |
1229 | @param rdOnly The value set to ReadOnly element\r | |
1230 | **/\r | |
1231 | public void setSpdHdrRdOnly(String rdOnly) {\r | |
1232 | \r | |
1233 | getSpdHdr().setReadOnly(new Boolean(rdOnly));\r | |
1234 | }\r | |
1235 | \r | |
1236 | /**\r | |
1237 | Set value to RePackage element\r | |
1238 | \r | |
1239 | @param rePkg The value set to RePackage element\r | |
1240 | **/\r | |
1241 | public void setSpdHdrRePkg(String rePkg) {\r | |
1242 | \r | |
1243 | getSpdHdr().setRePackage(new Boolean(rePkg));\r | |
1244 | }\r | |
1245 | \r | |
1246 | /**\r | |
1247 | Set value to Updated element\r | |
1248 | \r | |
1249 | @param updateDate The value set to Updated element\r | |
1250 | **/\r | |
1251 | public void setSpdHdrUpdateDate(String updateDate) {\r | |
1252 | getSpdHdr().setUpdated(updateDate);\r | |
1253 | }\r | |
1254 | \r | |
1255 | /**\r | |
1256 | Set value to URL element\r | |
1257 | \r | |
1258 | @param url The value set to URL element\r | |
1259 | **/\r | |
1260 | public void setSpdHdrURL(String url) {\r | |
1261 | getSpdHdr().setURL(url);\r | |
1262 | }\r | |
1263 | \r | |
1264 | /**\r | |
1265 | Get xml file\r | |
1266 | \r | |
1267 | @return File\r | |
1268 | **/\r | |
1269 | public File getFile() {\r | |
1270 | return file;\r | |
1271 | }\r | |
1272 | \r | |
1273 | /**\r | |
1274 | Set file\r | |
1275 | \r | |
1276 | @param file File with xml format\r | |
1277 | **/\r | |
1278 | public void setFile(File file) {\r | |
1279 | this.file = file;\r | |
1280 | }\r | |
1281 | \r | |
1282 | }\r |