Change to new XML Schema.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / ModuleBuildFileGenerator.java
CommitLineData
a29c47e0 1/** @file\r
2 \r
3 Copyright (c) 2006, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8\r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11 **/\r
12package org.tianocore.build;\r
13\r
14import java.io.File;\r
15import java.util.LinkedHashMap;\r
16import java.util.LinkedHashSet;\r
17import java.util.Map;\r
18import java.util.Set;\r
19\r
20import javax.xml.parsers.DocumentBuilder;\r
21import javax.xml.parsers.DocumentBuilderFactory;\r
22import javax.xml.transform.OutputKeys;\r
23import javax.xml.transform.Result;\r
24import javax.xml.transform.Source;\r
25import javax.xml.transform.Transformer;\r
26import javax.xml.transform.TransformerFactory;\r
27import javax.xml.transform.dom.DOMSource;\r
28import javax.xml.transform.stream.StreamResult;\r
29\r
30import org.apache.tools.ant.BuildException;\r
31import org.apache.tools.ant.Project;\r
32import org.tianocore.build.fpd.FpdParserTask;\r
33import org.tianocore.build.global.GlobalData;\r
34import org.tianocore.build.global.SurfaceAreaQuery;\r
35import org.tianocore.build.id.FpdModuleIdentification;\r
36import org.tianocore.build.id.ModuleIdentification;\r
37import org.tianocore.build.id.PackageIdentification;\r
38import org.w3c.dom.Comment;\r
39import org.w3c.dom.Document;\r
40import org.w3c.dom.Element;\r
41import org.w3c.dom.Node;\r
42\r
43public class ModuleBuildFileGenerator {\r
44\r
45 ///\r
46 /// Pass: TARGET, TOOLCHAIN, ARCH\r
47 /// PACKAGE, PACKAGE_GUID, PACKAGE_VERSION\r
48 ///\r
49 String[] inheritProperties = {"ARCH", "MODULE_GUID", "MODULE_VERSION", "PLATFORM", "PACKAGE_GUID", "PACKAGE_VERSION"};\r
50\r
51 ///\r
52 /// The information at the header of <em>build.xml</em>.\r
53 ///\r
54 private String info = "DO NOT EDIT \n"\r
55 + "File auto-generated by build utility\n"\r
56 + "\n"\r
57 + "Abstract:\n"\r
58 + "Auto-generated ANT build file for building of EFI Modules/Platforms\n";\r
59\r
60 private FpdModuleIdentification fpdModuleId;\r
61 \r
62 private Project project;\r
63 \r
64 private String ffsKeyword;\r
65 \r
66 public ModuleBuildFileGenerator(Project project, String ffsKeyword, FpdModuleIdentification fpdModuleId) {\r
67 this.project = project;\r
68 this.fpdModuleId = fpdModuleId;\r
69 this.ffsKeyword = ffsKeyword;\r
70 }\r
71 \r
72 /**\r
73 The whole BaseName_build.xml is composed of seven part. \r
74 <ul>\r
75 <li> ANT properties; </li>\r
76 <li> Dependent module (dependent library instances in most case); </li>\r
77 <li> Source files; </li>\r
78 <li> Sections if module is not library; </li>\r
79 <li> Output (different for library module and driver module); </li>\r
80 <li> Clean; </li>\r
81 <li> Clean all. </li>\r
82 </ul>\r
83 \r
84 @throws BuildException\r
85 Error throws during BaseName_build.xml generating. \r
86 **/\r
87 public void genBuildFile(String buildFilename) throws BuildException {\r
88 FfsProcess fp = new FfsProcess();\r
89 DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
90 try {\r
91 DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
92 Document document = dombuilder.newDocument();\r
93 Comment rootComment = document.createComment(info);\r
94 \r
95 //\r
96 // create root element and its attributes\r
97 //\r
98 Element root = document.createElement("project");\r
99 root.setAttribute("name", fpdModuleId.getModule().getName());\r
100 root.setAttribute("default", "all");\r
101 root.setAttribute("basedir", ".");\r
102 \r
103 //\r
104 // element for External ANT tasks\r
105 //\r
106 root.appendChild(document.createComment("Apply external ANT tasks"));\r
107 Element ele = document.createElement("taskdef");\r
108 ele.setAttribute("resource", "frameworktasks.tasks");\r
109 root.appendChild(ele);\r
110 ele = document.createElement("taskdef");\r
111 ele.setAttribute("resource", "cpptasks.tasks");\r
112 root.appendChild(ele);\r
113 ele = document.createElement("typedef");\r
114 ele.setAttribute("resource", "cpptasks.types");\r
115 root.appendChild(ele);\r
116 ele = document.createElement("taskdef");\r
117 ele.setAttribute("resource", "net/sf/antcontrib/antlib.xml");\r
118 root.appendChild(ele);\r
119\r
120 //\r
121 // Generate the default target,\r
122 // which depends on init, sections and output target\r
123 //\r
124 root.appendChild(document.createComment("Default target"));\r
125 ele = document.createElement("target");\r
126 ele.setAttribute("name", "all");\r
127 ele.setAttribute("depends", "libraries, sourcefiles, sections, output");\r
128 root.appendChild(ele);\r
129 \r
130 //\r
131 // compile all source files\r
132 //\r
133 root.appendChild(document.createComment("Compile all dependency Library instances."));\r
134 ele = document.createElement("target");\r
135 ele.setAttribute("name", "libraries");\r
136\r
137 //\r
138 // Parse all sourfiles but files specified in sections\r
139 //\r
140 applyLibraryInstance(document, ele);\r
141 root.appendChild(ele);\r
142\r
143 //\r
144 // compile all source files\r
145 //\r
146 root.appendChild(document.createComment("sourcefiles target"));\r
147 ele = document.createElement("target");\r
148 ele.setAttribute("name", "sourcefiles");\r
149 \r
150 //\r
151 // Parse all sourfiles but files specified in sections\r
152 //\r
153 applyCompileElement(document, ele);\r
154 root.appendChild(ele);\r
155\r
156 //\r
157 // generate the init target\r
158 // main purpose is create all nessary pathes\r
159 // generate the sections target\r
160 //\r
161 root.appendChild(document.createComment("sections target"));\r
162 ele = document.createElement("target");\r
163 ele.setAttribute("name", "sections");\r
164 applySectionsElement(document, ele, fp);\r
165 root.appendChild(ele);\r
166\r
167 //\r
168 // generate the output target\r
169 //\r
170 root.appendChild(document.createComment("output target"));\r
171 ele = document.createElement("target");\r
172 ele.setAttribute("name", "output");\r
173 applyOutputElement(document, ele, fp);\r
174 root.appendChild(ele);\r
175\r
176 \r
177 //\r
178 // generate the clean target\r
179 //\r
180 root.appendChild(document.createComment("clean target"));\r
181 ele = document.createElement("target");\r
182 ele.setAttribute("name", "clean");\r
183 applyCleanElement(document, ele);\r
184 root.appendChild(ele);\r
185 \r
186 //\r
187 // generate the Clean All target\r
188 //\r
189 root.appendChild(document.createComment("Clean All target"));\r
190 ele = document.createElement("target");\r
191 ele.setAttribute("name", "cleanall");\r
192 applyDeepcleanElement(document, ele);\r
193 root.appendChild(ele);\r
194 \r
195 //\r
196 // add the root element to the document\r
197 //\r
198 document.appendChild(rootComment);\r
199 document.appendChild(root);\r
200 //\r
201 // Prepare the DOM document for writing\r
202 //\r
203 Source source = new DOMSource(document);\r
204\r
205 //\r
206 // Prepare the output file\r
207 //\r
208 File file = new File(buildFilename);\r
209\r
210 //\r
211 // generate all directory path\r
212 //\r
213 (new File(file.getParent())).mkdirs();\r
214 Result result = new StreamResult(file);\r
215 \r
216 //\r
217 // Write the DOM document to the file\r
218 //\r
219 Transformer xformer = TransformerFactory.newInstance().newTransformer();\r
220 xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");\r
221 xformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
222 xformer.transform(source, result);\r
223 } catch (Exception ex) {\r
224 ex.printStackTrace();\r
225 throw new BuildException("Module [" + fpdModuleId.getModule().getName() + "] generating build file failed.\n" + ex.getMessage());\r
226 }\r
227 }\r
228\r
229 /**\r
230 Generate the clean elements for BaseName_build.xml. \r
231 \r
232 @param document current BaseName_build.xml XML document\r
233 @param root Root element for current\r
234 **/\r
235 private void applyCleanElement(Document document, Node root) {\r
236 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
237 for (int i = 0; i < libinstances.length; i++) {\r
238 //\r
239 // Put package file path to module identification\r
240 //\r
241 PackageIdentification packageId = libinstances[i].getPackage();\r
242 \r
243 //\r
244 // Generate ANT script to clean\r
245 //\r
246 Element ele = document.createElement("GenBuild");\r
247 ele.setAttribute("type", "clean");\r
248 \r
249 //\r
250 // Prepare pass down information\r
251 //\r
252 Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
253 for (int j = 0; j < inheritProperties.length; j ++){\r
254 passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
255 }\r
256 passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
257 passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
258 \r
259 passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
260 passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
261 \r
262 for (int j = 0; j < inheritProperties.length; j ++){\r
263 Element property = document.createElement("property");\r
264 property.setAttribute("name", inheritProperties[j]);\r
265 property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
266 ele.appendChild(property);\r
267 }\r
268\r
269 root.appendChild(ele);\r
270 }\r
271 //\r
272 // <delete includeemptydirs="true">\r
273 // <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />\r
274 // </delete>\r
275 //\r
276 Element deleteEle = document.createElement("delete");\r
277 deleteEle.setAttribute("includeemptydirs", "true");\r
278 Element filesetEle = document.createElement("fileset");\r
279 filesetEle.setAttribute("dir", "${DEST_DIR_OUTPUT}");\r
280 filesetEle.setAttribute("includes", "**/*");\r
281 filesetEle.setAttribute("excludes", "*.xml");\r
282 deleteEle.appendChild(filesetEle);\r
283 root.appendChild(deleteEle);\r
284 }\r
285\r
286 /**\r
287 Generate the cleanall elements for BaseName_build.xml. \r
288 \r
289 @param document current BaseName_build.xml XML document\r
290 @param root Root element for current\r
291 **/\r
292 private void applyDeepcleanElement(Document document, Node root) {\r
293 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
294 for (int i = 0; i < libinstances.length; i++) {\r
295 //\r
296 // Put package file path to module identification\r
297 //\r
298 PackageIdentification packageId = libinstances[i].getPackage();\r
299 \r
300 //\r
301 // Generate ANT script to clean\r
302 //\r
303 Element ele = document.createElement("GenBuild");\r
304 ele.setAttribute("type", "cleanall");\r
305 \r
306 //\r
307 // Prepare pass down information\r
308 //\r
309 Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
310 for (int j = 0; j < inheritProperties.length; j ++){\r
311 passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
312 }\r
313 \r
314 passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
315 passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
316 \r
317 passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
318 passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
319 \r
320 for (int j = 0; j < inheritProperties.length; j ++){\r
321 Element property = document.createElement("property");\r
322 property.setAttribute("name", inheritProperties[j]);\r
323 property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
324 ele.appendChild(property);\r
325 }\r
326\r
327 root.appendChild(ele);\r
328 }\r
329 //\r
330 // <delete includeemptydirs="true">\r
331 // <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />\r
332 // </delete>\r
333 //\r
334 Element deleteEle = document.createElement("delete");\r
335 deleteEle.setAttribute("includeemptydirs", "true");\r
336 Element filesetEle = document.createElement("fileset");\r
337 filesetEle.setAttribute("dir", "${DEST_DIR_OUTPUT}");\r
338 filesetEle.setAttribute("includes", "**/*");\r
339 filesetEle.setAttribute("excludes", "*.xml");\r
340 deleteEle.appendChild(filesetEle);\r
341 root.appendChild(deleteEle);\r
342 \r
343 //\r
344 // <delete includeemptydirs="true">\r
345 // <fileset dir="${DEST_DIR_DEBUG}" includes="" />\r
346 // </delete>\r
347 //\r
348 deleteEle = document.createElement("delete");\r
349 deleteEle.setAttribute("includeemptydirs", "true");\r
350 filesetEle = document.createElement("fileset");\r
351 filesetEle.setAttribute("dir", "${DEST_DIR_DEBUG}");\r
352 filesetEle.setAttribute("includes", "**/*");\r
353 deleteEle.appendChild(filesetEle);\r
354 root.appendChild(deleteEle);\r
355 }\r
356\r
357 /**\r
358 Generate the dependent library instances elements for BaseName_build.xml. \r
359 \r
360 @param document current BaseName_build.xml XML document\r
361 @param root Root element for current\r
362 **/\r
363 private void applyLibraryInstance(Document document, Node root) {\r
364 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
365// String propertyLibs = "";\r
366 for (int i = 0; i < libinstances.length; i++) {\r
367 //\r
368 // Put package file path to module identification\r
369 //\r
370 PackageIdentification packageId = libinstances[i].getPackage();\r
371 \r
372 //\r
373 // Generate ANT script to build library instances\r
374 //\r
375 Element ele = document.createElement("GenBuild");\r
376 ele.setAttribute("type", "build");\r
377// ele.setAttribute("inheritAll", "false");\r
378 \r
379 //\r
380 // Prepare pass down information\r
381 //\r
382 Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
383 for (int j = 0; j < inheritProperties.length; j ++){\r
384 passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
385 }\r
386 \r
387 passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
388 passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
389 \r
390 passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
391 passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
392 \r
393 for (int j = 0; j < inheritProperties.length; j ++){\r
394 Element property = document.createElement("property");\r
395 property.setAttribute("name", inheritProperties[j]);\r
396 property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
397 ele.appendChild(property);\r
398 }\r
399 \r
400 root.appendChild(ele);\r
401// propertyLibs += " " + project.getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib";\r
402 }\r
403// project.setProperty("LIBS", propertyLibs.replaceAll("(\\\\)", "/"));\r
404 }\r
405 \r
406 /**\r
407 Generate the build source files elements for BaseName_build.xml. \r
408 \r
409 @param document current BaseName_build.xml XML document\r
410 @param root Root element for current\r
411 **/\r
412 private void applyCompileElement(Document document, Node root) {\r
413 //\r
414 // Prepare the includes: PackageDependencies and Output debug direactory\r
415 //\r
416 Set<String> includes = new LinkedHashSet<String>();\r
417 \r
418 //\r
419 // WORKSPACE\r
420 //\r
421 includes.add("${WORKSPACE_DIR}");\r
422 \r
423 //\r
424 // Module iteself\r
425 //\r
426 includes.add("${MODULE_DIR}");\r
427 includes.add("${MODULE_DIR}" + File.separatorChar + "${ARCH}");\r
428 \r
429 //\r
430 // Packages in PackageDenpendencies\r
431 //\r
432 PackageIdentification[] packageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());\r
433 for (int i = 0; i < packageDependencies.length; i++) {\r
434 GlobalData.refreshPackageIdentification(packageDependencies[i]);\r
435 File packageFile = packageDependencies[i].getSpdFile();\r
436 includes.add(packageFile.getParent() + File.separatorChar + "Include");\r
437 includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + "${ARCH}");\r
438 }\r
439\r
440 //\r
441 // All Dependency Library Instance's PackageDependencies\r
442 //\r
443 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
444 for (int i = 0; i < libinstances.length; i++) {\r
445 SurfaceAreaQuery.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));\r
446 PackageIdentification[] libraryPackageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());\r
447 for (int j = 0; j < libraryPackageDependencies.length; j++) {\r
448 GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);\r
449 File packageFile = libraryPackageDependencies[j].getSpdFile();\r
450 includes.add(packageFile.getParent() + File.separatorChar + "Include");\r
451 includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + "${ARCH}");\r
452 }\r
453 SurfaceAreaQuery.pop();\r
454 }\r
455 \r
456 \r
457 //\r
458 // The package which the module belongs to\r
459 // TBD\r
460 includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include");\r
461 includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include" + File.separatorChar + "${ARCH}");\r
462\r
463 //\r
464 // Debug files output directory\r
465 //\r
466 includes.add("${DEST_DIR_DEBUG}");\r
467 \r
468 //\r
469 // sourceFiles[][0] is FileType, [][1] is File name relative to Module_Dir\r
470 //\r
471 String[][] sourceFiles = SurfaceAreaQuery.getSourceFiles(fpdModuleId.getArch());\r
472\r
473 FileProcess fileProcess = new FileProcess();\r
474 fileProcess.init(project, includes, document);\r
475\r
476 String moduleDir = project.getProperty("MODULE_DIR");\r
477 //\r
478 // Parse all Unicode files\r
479 //\r
480 for (int i = 0; i < sourceFiles.length; i++) {\r
481 //\r
482 // Go through all source files. Add MODULE_DIR to preffix\r
483 //\r
484 File sourceFile = new File(moduleDir + File.separatorChar + sourceFiles[i][1]);\r
485 sourceFiles[i][1] = sourceFile.getPath();\r
486 String filetype = sourceFiles[i][0];\r
487 if (filetype != null) {\r
488 fileProcess.parseFile(sourceFiles[i][1], filetype, root, true);\r
489 } else {\r
490 fileProcess.parseFile(sourceFiles[i][1], root, true);\r
491 }\r
492 }\r
493 \r
494 //\r
495 // If exist Unicode file\r
496 //\r
497 if (fileProcess.isUnicodeExist()) {\r
498 Element ele = document.createElement("Build_Unicode_Database");\r
499 ele.setAttribute("FILEPATH", ".");\r
500 ele.setAttribute("FILENAME", "${BASE_NAME}");\r
501 String[] includePaths = includes.toArray(new String[includes.size()]);\r
502 Element includesEle = document.createElement("EXTRA.INC");\r
503 for (int i = 0; i < includePaths.length; i++) {\r
504 Element includeEle = document.createElement("includepath");\r
505 includeEle.setAttribute("path", includePaths[i]);\r
506 includesEle.appendChild(includeEle);\r
507 }\r
508 ele.appendChild(includesEle);\r
509 root.appendChild(ele);\r
510 }\r
511\r
512 //\r
513 // Parse AutoGen.c & AutoGen.h\r
514 //\r
515 if ( ! fpdModuleId.getModule().getName().equalsIgnoreCase("Shell")) {\r
516 fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", root, false);\r
517 }\r
518 \r
519 //\r
520 // Parse all source files but Unicode files\r
521 //\r
522 for (int i = 0; i < sourceFiles.length; i++) {\r
523 String filetype = sourceFiles[i][0];\r
524 if (filetype != null) {\r
525 fileProcess.parseFile(sourceFiles[i][1], filetype, root, false);\r
526 } else {\r
527 fileProcess.parseFile(sourceFiles[i][1], root, false);\r
528 }\r
529 }\r
530 \r
531 //\r
532 // Initialize SOURCE_FILES for dependcy check use\r
533 //\r
534 String str = "";\r
535 for (int i = 0; i < sourceFiles.length; i++) {\r
536 str += " " + sourceFiles[i][1];\r
537 }\r
538 project.setProperty("SOURCE_FILES", str.replaceAll("(\\\\)", "/"));\r
539 }\r
540\r
541 /**\r
542 Generate the section elements for BaseName_build.xml. Library module will\r
543 skip this process. \r
544 \r
545 @param document current BaseName_build.xml XML document\r
546 @param root Root element for current\r
547 **/\r
548 private void applySectionsElement(Document document, Node root, FfsProcess fp) {\r
549 if (fpdModuleId.getModule().isLibrary()) {\r
550 return ;\r
551 }\r
552 if (fp.initSections(ffsKeyword, project, fpdModuleId)) {\r
553 String targetFilename = fpdModuleId.getModule().getGuid() + "-" + fpdModuleId.getModule().getName() + FpdParserTask.getSuffix(fpdModuleId.getModule().getModuleType());\r
554 String[] list = fp.getGenSectionElements(document, "${BASE_NAME}", fpdModuleId.getModule().getGuid(), targetFilename);\r
555\r
556 for (int i = 0; i < list.length; i++) {\r
557 Element ele = document.createElement(list[i]);\r
558 ele.setAttribute("FILEPATH", ".");\r
559 ele.setAttribute("FILENAME", "${BASE_NAME}");\r
560 root.appendChild(ele);\r
561 }\r
562 }\r
563 }\r
564\r
565 /**\r
566 Generate the output elements for BaseName_build.xml. If module is library,\r
567 call the <em>LIB</em> command, else call the <em>GenFfs</em> command. \r
568 \r
569 @param document current BaseName_build.xml XML document\r
570 @param root Root element for current\r
571 **/\r
572 private void applyOutputElement(Document document, Node root, FfsProcess fp) {\r
573 if (fpdModuleId.getModule().isLibrary()) {\r
574 //\r
575 // call Lib command\r
576 //\r
577 Element cc = document.createElement("Build_Library");\r
578 cc.setAttribute("FILENAME", fpdModuleId.getModule().getName());\r
579 root.appendChild(cc);\r
580 }\r
581 //\r
582 // if it is a module but library\r
583 //\r
584 else {\r
585 if (fp.getFfsNode() != null) {\r
586 root.appendChild(fp.getFfsNode());\r
587 }\r
588 }\r
589 }\r
590\r
591}\r