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