1
2 /*
3 LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
4
5
6 Copyright (C) 2003 Together
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 package org.webdocwf.util.loader.generator;
24
25
26 import org.webdocwf.util.loader.LoaderException;
27 import org.webdocwf.util.loader.logging.Logger;
28 import org.webdocwf.util.loader.logging.StandardLogger;
29
30 /***
31 *
32 * MappingJavaType class mapping the jdbc type of data in to java type of data.
33 * @author Radoslav Dutina
34 * @version 1.0
35 */
36 public class MappingJavaType {
37
38 private String javaType = null;
39 private String jdbcType = null;
40 private Logger logger;
41 /***
42 * Construct object MappingJavaType with associated parameters.
43 * @param sqlDataType is the type which you wont to map.
44 * @param generatorParameters represents the references to InputParameter object.
45 * @throws LoaderException
46 */
47 public MappingJavaType(InputParameters generatorParameters, String sqlDataType) throws LoaderException {
48 setLogger();
49 this.logger.write("full", "MappingJavaType is started.");
50 try {
51 SearchXmlFile searchXmlFileTarget = new SearchXmlFile("absolute",
52 generatorParameters.getPathToTargetConf(),
53 generatorParameters.getConfJarStructure());
54 //for cource conf file.
55 jdbcType = searchXmlFileTarget.getJDBCFromSQLType(sqlDataType);
56
57 SearchXmlFile searchXmlFile = new SearchXmlFile("relative",
58 generatorParameters.getPath(),
59 generatorParameters.getConfJarStructure());
60
61 setJavaType(searchXmlFile.getJAVAType(jdbcType));
62
63 } catch (Exception e) {
64 String msg = "Exception in Class MappingJavaType:";
65 LoaderException le = new LoaderException(msg + "\n" + e.getMessage(), (Throwable) e);
66 this.logger.write("full", "Exception in Class MappingJavaType."+"\n"+le.getStackTraceAsString());
67 throw le;
68 }
69 this.logger.write("full", "MappingJavaType is finished.");
70 }
71
72 /***
73 * This method sets the value of javaType parameter.
74 * @param java_Type is the value of parameter.
75 */
76 public void setJavaType(String java_Type) {
77 javaType = java_Type;
78 }
79
80 /***
81 * This method reads value of javaType parameter.
82 * @return value of parameter.
83 */
84 public String getJavaType() {
85 return this.javaType;
86 }
87 /***
88 * This method will set logger object
89 * @param logger
90 */
91 private void setLogger() {
92 this.logger = StandardLogger.getCentralLogger();
93 }
94 }
This page was automatically generated by Maven