Source Code Cross Referenced for ConnectionInfo.java in  » Database-Client » DBBrowser » org » dbbrowser » drivermanager » 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 Client » DBBrowser » org.dbbrowser.drivermanager 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.dbbrowser.drivermanager;
002:
003:        import java.io.File;
004:        import java.io.Serializable;
005:        import java.util.Date;
006:
007:        /**
008:         * A connection info class represents the details of a JDBC connection to a database
009:         * @author amangat
010:         *
011:         */
012:        public class ConnectionInfo implements  Serializable {
013:            public static final String DES56C_ENCRYPTION_ALGORITHM = "DES56C";
014:            public static final String DES40C_ENCRYPTION_ALGORITHM = "DES40C";
015:            public static final String RC4_40_ENCRYPTION_ALGORITHM = "RC4_40";
016:            public static final String RC4_56_ENCRYPTION_ALGORITHM = "RC4_56";
017:
018:            public static final String MD5_CHECK_SUM_ALGORITHM = "MD5";
019:
020:            public static final String[] LIST_OF_ENCRYPTION_ALGORITHMS = new String[] {
021:                    DES56C_ENCRYPTION_ALGORITHM, DES40C_ENCRYPTION_ALGORITHM,
022:                    RC4_40_ENCRYPTION_ALGORITHM, RC4_56_ENCRYPTION_ALGORITHM };
023:            public static final String[] LIST_OF_CHECKSUM_ALGORITHMS = new String[] { MD5_CHECK_SUM_ALGORITHM };
024:
025:            private String driverClassName = null;
026:            private File jdbcDriverJarFileLocation = null;
027:            private String name = null;
028:            private String dbmsType = null;
029:            private String databaseURL = null;
030:            private String username = null;
031:            private String password = null;
032:            private Date lastUsed = null;
033:            private String encryptionAlgorithm = null;
034:            private String checkSumAlgorithm = null;
035:
036:            private static final long serialVersionUID = 1l;
037:
038:            /**
039:             * Constrcuter
040:             * @param driverClassName
041:             * @param jdbcDriverJarFileLocation
042:             * @param name
043:             * @param dbmsType
044:             * @param databaseURL
045:             * @param username
046:             * @param password
047:             * @param encryptionAlgorithm
048:             * @param checkSumAlgorithm
049:             */
050:            public ConnectionInfo(String driverClassName,
051:                    File jdbcDriverJarFileLocation, String name,
052:                    String dbmsType, String databaseURL, String username,
053:                    String passwordString, String encryptionAlgorithm,
054:                    String checkSumAlgorithm) {
055:                this .driverClassName = driverClassName;
056:                this .jdbcDriverJarFileLocation = jdbcDriverJarFileLocation;
057:                this .name = name;
058:                this .dbmsType = dbmsType;
059:                this .databaseURL = databaseURL;
060:                this .username = username;
061:                this .password = passwordString;
062:                this .encryptionAlgorithm = encryptionAlgorithm;
063:                this .checkSumAlgorithm = checkSumAlgorithm;
064:            }
065:
066:            /**
067:             * Return the time this connection was last used
068:             * @return
069:             */
070:            public Date getLastUsed() {
071:                return this .lastUsed;
072:            }
073:
074:            /**
075:             * Update the last time this connection was used
076:             * @param updatedLastUsedDate
077:             */
078:            public void setLastUsed(Date updatedLastUsedDate) {
079:                this .lastUsed = updatedLastUsedDate;
080:            }
081:
082:            /**
083:             * Get the driver class name, e.g. 'oracle.jdbc.OracleDriver'
084:             * @return
085:             */
086:            public String getDriverClassName() {
087:                return this .driverClassName;
088:            }
089:
090:            /**
091:             * Get the location fo the jar file, e.g. c:/drivers/ojdbc14.jar
092:             * @return
093:             */
094:            public File getJdbcDriverJarFileLocation() {
095:                return this .jdbcDriverJarFileLocation;
096:            }
097:
098:            /**
099:             * Get the name specified for this connection - any unique name.  E.g. 'Oracle connection to my database'
100:             * @return
101:             */
102:            public String getName() {
103:                return this .name;
104:            }
105:
106:            /**
107:             * Return the dbms type - e.g. Oracle, MySQL
108:             * @return
109:             */
110:            public String getDBMSType() {
111:                return this .dbmsType;
112:            }
113:
114:            /**
115:             * Get the database URL
116:             * @return
117:             */
118:            public String getDatabaseURL() {
119:                return this .databaseURL;
120:            }
121:
122:            /**
123:             * get the username
124:             * @return
125:             */
126:            public String getUsername() {
127:                return this .username;
128:            }
129:
130:            /**
131:             * Get the password
132:             * @return
133:             */
134:            public String getPassword() {
135:                return this .password;
136:            }
137:
138:            /**
139:             * Returns the encryption algorithm used, or null if there is no encryption required
140:             * @return
141:             */
142:            public String getEncryptionAlgorithm() {
143:                return this .encryptionAlgorithm;
144:            }
145:
146:            /**
147:             * Returns the checkSumAlgorithm, or null if no check sum is in use
148:             * @return
149:             */
150:            public String getCheckSumAlgorithm() {
151:                return this .checkSumAlgorithm;
152:            }
153:
154:            /**
155:             * Overrides the hashCode method of Object so it can be used as a key in a hashtable
156:             */
157:            public int hashCode() {
158:                return this .driverClassName.hashCode()
159:                        + this .databaseURL.hashCode()
160:                        + this .username.hashCode() + this .password.hashCode();
161:            }
162:
163:            /**
164:             *  Overrides the equals method of Object so it can be used as a key in a hashtable.  Only 
165:             *  uses the connectionInfo.getName() to make the comparision.  If 2 connection info objects have the same name, 
166:             *  they are equal.  The name uniquely identifies the connection info object 
167:             */
168:            public boolean equals(Object obj) {
169:                boolean equal = false;
170:                if (obj instanceof  ConnectionInfo) {
171:                    ConnectionInfo otherConnectionInfo = (ConnectionInfo) obj;
172:                    String otherConnectionInfoName = otherConnectionInfo
173:                            .getName();
174:                    if (this .getName().equals(otherConnectionInfoName)) {
175:                        equal = true;
176:                    }
177:                }
178:                return equal;
179:            }
180:
181:            /**
182:             * For debugging only
183:             * @return
184:             */
185:            public String toString() {
186:                StringBuffer buffer = new StringBuffer();
187:                buffer.append("Connection Info\n");
188:                buffer.append("Name: " + this .getName() + "\n");
189:                buffer.append("DBMS Type: " + this .getDBMSType() + "\n");
190:                buffer.append("Database URL: " + this .getDatabaseURL() + "\n");
191:                buffer.append("Driver class: " + this .getDriverClassName()
192:                        + "\n");
193:                buffer
194:                        .append("JDBC Jar location: "
195:                                + this .getJdbcDriverJarFileLocation()
196:                                        .toString() + "\n");
197:                buffer.append("Username: " + this .getUsername() + "\n");
198:                buffer.append("Password: " + this .getPassword() + "\n");
199:                buffer.append("Last used: " + this .getLastUsed() + "\n");
200:                buffer.append("Encryption algorithm: "
201:                        + this .getEncryptionAlgorithm() + "\n");
202:                buffer.append("Checksum algorithm: "
203:                        + this .getCheckSumAlgorithm() + "\n");
204:
205:                return buffer.toString();
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.