1 21 22 package org.webdocwf.util.loader.generator; 23 24 import javax.xml.parsers.DocumentBuilder ; 25 import javax.xml.parsers.DocumentBuilderFactory ; 26 import javax.xml.parsers.ParserConfigurationException ; 27 28 import org.w3c.dom.Document ; 29 import org.w3c.dom.Element ; 30 31 import org.webdocwf.util.loader.LoaderException; 32 import org.webdocwf.util.loader.logging.Logger; 33 import org.webdocwf.util.loader.logging.StandardLogger; 34 35 42 public class CreateIncludeDomlFiles { 43 44 private Document document; 45 private Logger logger; 46 private InputParameters generatorParameters; 47 48 53 public CreateIncludeDomlFiles(InputParameters generatorParameters) throws LoaderException { 54 55 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 56 try { 57 setLogger(); 58 this.logger.write("normal", "CreateIncludeDomlFiles is started."); 59 createIncludeDomlFiles(generatorParameters, factory); 60 this.logger.write("normal", "CreateIncludeDomlFiles is finished."); 61 62 } catch (Exception e) { 63 String msg = "Exception in class CreateIncludeDomlFiles."; 64 LoaderException le = new LoaderException(msg + e.getMessage(), (Throwable ) e); 65 throw le; 66 } 67 68 } 69 76 private void createIncludeDomlFiles(InputParameters generatorParameters, DocumentBuilderFactory factory) throws ParserConfigurationException , LoaderException { 77 78 this.logger.write("normal", "\tcreateIncludeDomlFiles method is started."); 79 DocumentBuilder builder = factory.newDocumentBuilder(); 80 document = builder.newDocument(); Element root = (Element ) document.createElement("definitionInclude"); 82 document.appendChild(root); 83 DomlDesignReader domlDesignReader = new DomlDesignReader(document, root, generatorParameters); 84 WriteXmlFile writeXmlFile; 85 if (generatorParameters.getGenerateXml().equalsIgnoreCase("true")) 86 writeXmlFile = new WriteXmlFile(document, generatorParameters); 87 this.logger.write("normal", "\tcreateIncludeDomlFiles method is finished."); 88 } 89 93 private void setLogger() { 94 this.logger = StandardLogger.getCentralLogger(); 95 } 96 97 } | Popular Tags |