001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/io/JDBCConnection.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2006 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: bezema $
051     * 
052     * @version $Revision: 6259 $, $Date: 2007-03-20 10:15:15 +0100 (Di, 20 Mär 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,
093                               String securityConstraints, String encoding, String aliasPrefix ) {
094            this( driver, url, user, password, securityConstraints, encoding, aliasPrefix,
095                  (String) null, (String) null );
096        }
097    
098        /**
099         * 
100         * @param driver
101         *            JDBC driver
102         * @param url
103         *            JDBC connection string
104         * @param user
105         *            user name
106         * @param password
107         *            users password
108         * @param securityConstraints
109         *            constraints to consider (not implemented yet)
110         * @param encoding
111         *            encoding to be used for connection
112         * @param aliasPrefix ?
113         * @param sdeDatabase
114         * @param sdeVersion
115         */
116        public JDBCConnection( String driver, String url, String user, String password,
117                               String securityConstraints, String encoding, String aliasPrefix,
118                               String sdeDatabase, String sdeVersion ) {
119            this.driver = driver;
120            this.url = url;
121            this.user = user;
122            this.password = password;
123            this.securityConstraints = securityConstraints;
124            this.encoding = encoding;
125            this.aliasPrefix = aliasPrefix;
126            this.sdeDatabase = sdeDatabase;
127            this.sdeVersion = sdeVersion;
128        }
129    
130        /**
131         * @return driver
132         */
133        public String getDriver() {
134            return driver;
135        }
136    
137        /**
138         * @return encoding
139         */
140        public String getEncoding() {
141            return encoding;
142        }
143    
144        /**
145         * @return aliasPrefix
146         */
147        public String getAliasPrefix() {
148            return aliasPrefix;
149        }
150    
151        /**
152         * @return url
153         */
154        public String getURL() {
155            return url;
156        }
157    
158        /**
159         * @return password
160         */
161        public String getPassword() {
162            return password;
163        }
164    
165        /**
166         * @return securityConstraints
167         */
168        public String getSecurityConstraints() {
169            return securityConstraints;
170        }
171    
172        /**
173         * @return user
174         */
175        public String getUser() {
176            return user;
177        }
178    
179        /**
180         * @return sdeDatabase
181         */
182        public String getSDEDatabase() {
183            return sdeDatabase;
184        }
185    
186        /**
187         * @return sdeVersion
188         */
189        public String getSDEVersion() {
190            return sdeVersion;
191        }
192    
193        /**
194         * Indicates whether some other object is "equal to" this one.
195         * 
196         * @param o
197         *            the reference object with which to compare
198         * @return <code>true</code> if this object is the same as the obj argument; false otherwise
199         */
200        public boolean equals( Object o ) {
201            if ( !( o instanceof JDBCConnection ) ) {
202                return false;
203            }
204            JDBCConnection that = (JDBCConnection) o;
205            if ( !this.driver.equals( that.driver ) ) {
206                return false;
207            }
208            if ( !this.url.equals( that.url ) ) {
209                return false;
210            }
211            if ( !this.user.equals( that.user ) ) {
212                return false;
213            }
214            return true;
215        }
216    
217        /**
218         * Returns a string representation of the object.
219         * 
220         * @return a string representation of the object
221         */
222        public String toString() {
223            StringBuffer sb = new StringBuffer();
224            sb.append( "Driver: '" );
225            sb.append( this.driver );
226            sb.append( "', URL: '" );
227            sb.append( this.url );
228            sb.append( "', User: '" );
229            sb.append( this.user );
230            return sb.toString();
231        }
232    }
233    /***************************************************************************************************
234     * <code>
235     Changes to this class. What the people have been up to:
236     
237     $Log$
238     Revision 1.9  2007/03/06 11:47:27  wanhoff
239     Fixed Javadoc (@return, @param)
240    
241     Revision 1.8  2006/08/24 06:40:05  poth
242     File header corrected
243     
244     Revision 1.7  2006/05/21 19:13:03  poth
245     several changes required by implemented SDEDatastore / adapted to ArcSDE 9 java API
246     
247     Revision 1.2  2006/05/09 14:51:04  polli
248     SDE parameters added
249     
250     Revision 1.1.1.1  2006/04/12 20:37:06  polli
251     no message
252     
253     Revision 1.6  2006/04/06 20:25:31  poth
254     *** empty log message ***
255     
256     Revision 1.5  2006/04/04 20:39:44  poth
257     *** empty log message ***
258     
259     Revision 1.4  2006/03/30 21:20:28  poth
260     *** empty log message ***
261     
262     Revision 1.3  2005/11/16 13:45:01  mschneider
263     Merge of wfs development branch.
264     
265     Revision 1.1.2.1  2005/11/09 08:00:50  mschneider
266     More refactoring of 'org.deegree.io.datastore'.
267     
268     Revision 1.1 2005/10/07 10:30:41 poth
269     no message
270     
271     </code>
272     **************************************************************************************************/