001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/io/JDBCConnection.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 package org.deegree.io; 037 038 /** 039 * Class representation for an element of type "deegreejdbc:JDBCConnectionType" as defined in 040 * datastore_configuration.xsd. 041 * 042 * @author <a href="mailto:tfr@users.sourceforge.net">Torsten Friebe </a> 043 * @author last edited by: $Author: mschneider $ 044 * 045 * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $ 046 * 047 * @TODO Change the type name! 048 */ 049 public class JDBCConnection { 050 051 private String driver; 052 053 private String url; 054 055 private String user; 056 057 private String password; 058 059 private String securityConstraints; 060 061 private String encoding; 062 063 private String aliasPrefix; 064 065 private String sdeDatabase; 066 067 private String sdeVersion; 068 069 /** 070 * 071 * @param driver 072 * JDBC driver 073 * @param url 074 * JDBC connection string 075 * @param user 076 * user name 077 * @param password 078 * users password 079 * @param securityConstraints 080 * constraints to consider (not implemented yet) 081 * @param encoding 082 * encoding to be used for connection 083 * @param aliasPrefix ? 084 */ 085 public JDBCConnection( String driver, String url, String user, String password, String securityConstraints, 086 String encoding, String aliasPrefix ) { 087 this( driver, url, user, password, securityConstraints, encoding, aliasPrefix, (String) null, (String) null ); 088 } 089 090 /** 091 * 092 * @param driver 093 * JDBC driver 094 * @param url 095 * JDBC connection string 096 * @param user 097 * user name 098 * @param password 099 * users password 100 * @param securityConstraints 101 * constraints to consider (not implemented yet) 102 * @param encoding 103 * encoding to be used for connection 104 * @param aliasPrefix ? 105 * @param sdeDatabase 106 * @param sdeVersion 107 */ 108 public JDBCConnection( String driver, String url, String user, String password, String securityConstraints, 109 String encoding, String aliasPrefix, String sdeDatabase, String sdeVersion ) { 110 this.driver = driver; 111 this.url = url; 112 this.user = user; 113 this.password = password; 114 this.securityConstraints = securityConstraints; 115 this.encoding = encoding; 116 this.aliasPrefix = aliasPrefix; 117 this.sdeDatabase = sdeDatabase; 118 this.sdeVersion = sdeVersion; 119 } 120 121 /** 122 * @return driver 123 */ 124 public String getDriver() { 125 return driver; 126 } 127 128 /** 129 * @return encoding 130 */ 131 public String getEncoding() { 132 return encoding; 133 } 134 135 /** 136 * @return aliasPrefix 137 */ 138 public String getAliasPrefix() { 139 return aliasPrefix; 140 } 141 142 /** 143 * @return url 144 */ 145 public String getURL() { 146 return url; 147 } 148 149 /** 150 * @return password 151 */ 152 public String getPassword() { 153 return password; 154 } 155 156 /** 157 * @return securityConstraints 158 */ 159 public String getSecurityConstraints() { 160 return securityConstraints; 161 } 162 163 /** 164 * @return user 165 */ 166 public String getUser() { 167 return user; 168 } 169 170 /** 171 * @return sdeDatabase 172 */ 173 public String getSDEDatabase() { 174 return sdeDatabase; 175 } 176 177 /** 178 * @return sdeVersion 179 */ 180 public String getSDEVersion() { 181 return sdeVersion; 182 } 183 184 /** 185 * Indicates whether some other object is "equal to" this one. 186 * 187 * @param o 188 * the reference object with which to compare 189 * @return <code>true</code> if this object is the same as the obj argument; false otherwise 190 */ 191 @Override 192 public boolean equals( Object o ) { 193 if ( !( o instanceof JDBCConnection ) ) { 194 return false; 195 } 196 JDBCConnection that = (JDBCConnection) o; 197 if ( !this.driver.equals( that.driver ) ) { 198 return false; 199 } 200 if ( !this.url.equals( that.url ) ) { 201 return false; 202 } 203 if ( !this.user.equals( that.user ) ) { 204 return false; 205 } 206 return true; 207 } 208 209 /** 210 * Returns a string representation of the object. 211 * 212 * @return a string representation of the object 213 */ 214 @Override 215 public String toString() { 216 StringBuffer sb = new StringBuffer(); 217 sb.append( "Driver: '" ); 218 sb.append( this.driver ); 219 sb.append( "', URL: '" ); 220 sb.append( this.url ); 221 sb.append( "', User: '" ); 222 sb.append( this.user ); 223 return sb.toString(); 224 } 225 }