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