Source Code Cross Referenced for JdbcParameters.java in  » Database-JDBC-Connection-Pool » octopus » org » webdocwf » util » loader » generator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » octopus » org.webdocwf.util.loader.generator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
003:
004:
005:         Copyright (C) 2003  Together
006:
007:         This library is free software; you can redistribute it and/or
008:         modify it under the terms of the GNU Lesser General Public
009:         License as published by the Free Software Foundation; either
010:         version 2.1 of the License, or (at your option) any later version.
011:
012:         This library is distributed in the hope that it will be useful,
013:         but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         Lesser General Public License for more details.
016:
017:         You should have received a copy of the GNU Lesser General Public
018:         License along with this library; if not, write to the Free Software
019:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         */
021:
022:        package org.webdocwf.util.loader.generator;
023:
024:        import java.util.Hashtable;
025:
026:        import org.webdocwf.util.loader.LoaderException;
027:        import org.webdocwf.util.loader.logging.Logger;
028:        import org.webdocwf.util.loader.logging.StandardLogger;
029:
030:        /**
031:         * JdbcParameters class sets the value of jdbc drivers, which can be used in Octopus.
032:         * @author Radoslav Dutina
033:         * @version 1.0
034:         */
035:        public class JdbcParameters {
036:
037:            //Creating an atribute for source tag
038:            private Hashtable parameters;
039:            private String dbVendorName = "default";
040:            private String driverName = "default";
041:
042:            private String strDriverClassName = null;
043:            private String strConnection = null;
044:            private String strUser = "default";
045:            private String strPassword = "default";
046:            //  private String strAlterTablePrimaryKey="true";
047:            private String strDbVendorsPath = null;
048:            private String fileName;
049:            private Logger logger;
050:
051:            /**
052:             *
053:             * @param destination defines the type of the path. If destonation=absolute path is absolute,
054:             * if destination=relative path is relative, and if destination=jar, application read from jar
055:             * file.
056:             * @param generatorParameters represents the references to InputParameter object.
057:             * @throws LoaderException
058:             */
059:            public JdbcParameters(String destination,
060:                    InputParameters generatorParameters) throws LoaderException {
061:                setLogger();
062:                this .logger.write("full", "JdbcParameters is started.");
063:                parameters = new Hashtable();
064:
065:                try {
066:                    if (destination.equalsIgnoreCase("source")) {
067:                        this .dbVendorName = generatorParameters.getSourceType();
068:                        this .driverName = generatorParameters
069:                                .getSourceDriverName();
070:
071:                        SearchXmlFile searchXmlFile = new SearchXmlFile(
072:                                "absolute", generatorParameters
073:                                        .getPathToSourceConf(),
074:                                generatorParameters.getConfJarStructure());
075:
076:                        generatorParameters.setExcludedTables(searchXmlFile
077:                                .getExcludedTables());
078:
079:                        if (driverName.equalsIgnoreCase("")) {
080:                            setDriverName(searchXmlFile.getDriverName());
081:                        }
082:                        searchXmlFile.getClassName(getDriverName(), this ,
083:                                generatorParameters);
084:                        setJdbcParameters("JdbcDriver", strDriverClassName);
085:                        setJdbcParameters("Connection.Url", strConnection
086:                                + generatorParameters.getSourceDataBase());
087:                        setJdbcParameters("User", generatorParameters
088:                                .getSourceUser());
089:                        setJdbcParameters("Password", generatorParameters
090:                                .getSourcePassword());
091:                    } else if (destination.equalsIgnoreCase("target")) {
092:
093:                        this .dbVendorName = generatorParameters.getTargetType();
094:                        this .driverName = generatorParameters
095:                                .getTargetDriverName();
096:
097:                        SearchXmlFile searchXmlFile = new SearchXmlFile(
098:                                "absolute", generatorParameters
099:                                        .getPathToTargetConf(),
100:                                generatorParameters.getConfJarStructure());
101:                        if (driverName.equalsIgnoreCase("")) {
102:                            setDriverName(searchXmlFile.getDriverName());
103:                        }
104:                        searchXmlFile.getClassName(getDriverName(), this ,
105:                                generatorParameters);
106:                        setJdbcParameters("JdbcDriver", strDriverClassName);
107:                        setJdbcParameters("Connection.Url", strConnection
108:                                + generatorParameters.getTargetDataBase());
109:                        setJdbcParameters("User", generatorParameters
110:                                .getTargetUser());
111:                        setJdbcParameters("Password", generatorParameters
112:                                .getTargetPassword());
113:                    }
114:                } catch (LoaderException e) {
115:                    LoaderException le = new LoaderException(
116:                            "Exception in class JdbcParameters.Error while set jdbc parameters.",
117:                            e);
118:                    this .logger.write("full",
119:                            "Exception in class JdbcParameters.Error while set jdbc parameters."
120:                                    + le.getStackTraceAsString());
121:                    throw le;
122:                }
123:                this .logger.write("full", "JdbcParameters is finished.");
124:            }
125:
126:            /**
127:             * This method sets the par (value, key) of jdbc parameters.
128:             * @param key is the first jdbc parameter.
129:             * @param value is the second jdbc parameter.
130:             */
131:            public void setJdbcParameters(String key, String value) {
132:                this .parameters.put(key, value);
133:            }
134:
135:            /**
136:             * This method read the value od jdbc parameters
137:             * @param key is the first jdbc parameter.
138:             * @return is the second jdbc parameter.
139:             */
140:            public String getJdbcParameters(String key) {
141:                return (String) this .parameters.get(key);
142:            }
143:
144:            /**
145:             * This method read the all jdbc parameters.
146:             * @return value of all jdbc parameters.
147:             */
148:            public Hashtable getAllParameters() {
149:                return this .parameters;
150:            }
151:
152:            /**
153:             * This method sets the value of dbVendor parameter.
154:             * @param db_VendorName is value of parameter.
155:             */
156:            public void setDbVendor(String db_VendorName) {
157:                dbVendorName = db_VendorName;
158:            }
159:
160:            /**
161:             * This method read the value of dbVendor parameter.
162:             * @return value of parameter.
163:             */
164:            public String getDbVendor() {
165:                return dbVendorName;
166:            }
167:
168:            /**
169:             * This method sets the value of driverName parameter.
170:             * @param driver_Name is value of parameter.
171:             */
172:            public void setDriverName(String driver_Name) {
173:                driverName = driver_Name;
174:            }
175:
176:            /**
177:             * This method read the value of driverName parameter.
178:             * @return value od parameter.
179:             */
180:            public String getDriverName() {
181:                return driverName;
182:            }
183:
184:            /**
185:             * This method sets the value of strDriverClassName parameter.
186:             * @param driver_ClassName is value of the parameter.
187:             */
188:            public void setDriverClassName(String driver_ClassName) {
189:                strDriverClassName = driver_ClassName;
190:            }
191:
192:            /**
193:             * This method sets the value of strConnection parameter.
194:             * @param _connection is the value of the parameter.
195:             */
196:            public void setConnection(String _connection) {
197:                strConnection = _connection;
198:            }
199:
200:            /**
201:             * This method will set logger object
202:             * @param logger
203:             */
204:            private void setLogger() {
205:                this.logger = StandardLogger.getCentralLogger();
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.