📄 createincludedomlfiles.java
字号:
/*
LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
Copyright (C) 2003 Together
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.webdocwf.util.loader.generator;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.webdocwf.util.loader.LoaderException;
import org.webdocwf.util.loader.logging.Logger;
import org.webdocwf.util.loader.logging.StandardLogger;
/**
* CreateIncludeDomlFiles class creates Xml(ImportDefinition.xml) and Sql( CreateTables.sql,
* CreateIntegrity.sql, CreateOisAdminData.sql, CreatePrimary.sql and CreateIndex.sql) files,
* if the input data is doml file.
* @author Radoslav Dutina
* @version 1.0
*/
public class CreateIncludeDomlFiles {
private Document document;
private Logger logger;
private InputParameters generatorParameters;
/**
* Construct object CreateIncludeDomlFiles with associated parameter.
* @param generatorParameters represents the references to InputParameter object.
* @throws LoaderException
*/
public CreateIncludeDomlFiles(InputParameters generatorParameters) throws LoaderException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
setLogger();
this.logger.write("normal", "CreateIncludeDomlFiles is started.");
createIncludeDomlFiles(generatorParameters, factory);
this.logger.write("normal", "CreateIncludeDomlFiles is finished.");
} catch (Exception e) {
String msg = "Exception in class CreateIncludeDomlFiles.";
LoaderException le = new LoaderException(msg + e.getMessage(), (Throwable) e);
throw le;
}
}
/**
* This method will generate doml file
* @param generatorParameters
* @param factory
* @throws ParserConfigurationException
* @throws LoaderException
*/
private void createIncludeDomlFiles(InputParameters generatorParameters, DocumentBuilderFactory factory) throws ParserConfigurationException, LoaderException {
this.logger.write("normal", "\tcreateIncludeDomlFiles method is started.");
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.newDocument(); // Create from whole cloth
Element root = (Element) document.createElement("definitionInclude");
document.appendChild(root);
DomlDesignReader domlDesignReader = new DomlDesignReader(document, root, generatorParameters);
WriteXmlFile writeXmlFile;
if (generatorParameters.getGenerateXml().equalsIgnoreCase("true"))
writeXmlFile = new WriteXmlFile(document, generatorParameters);
this.logger.write("normal", "\tcreateIncludeDomlFiles method is finished.");
}
/**
* This method will set logger object
* @param logger
*/
private void setLogger() {
this.logger = StandardLogger.getCentralLogger();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -