001: /* ====================================================================
002: * The QueryForm License, Version 1.1
003: *
004: * Copyright (c) 1998 - 2003 David F. Glasser. All rights
005: * reserved.
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions
009: * are met:
010: *
011: * 1. Redistributions of source code must retain the above copyright
012: * notice, this list of conditions and the following disclaimer.
013: *
014: * 2. Redistributions in binary form must reproduce the above copyright
015: * notice, this list of conditions and the following disclaimer in
016: * the documentation and/or other materials provided with the
017: * distribution.
018: *
019: * 3. The end-user documentation included with the redistribution,
020: * if any, must include the following acknowledgment:
021: * "This product includes software developed by
022: * David F. Glasser."
023: * Alternately, this acknowledgment may appear in the software itself,
024: * if and wherever such third-party acknowledgments normally appear.
025: *
026: * 4. The names "QueryForm" and "David F. Glasser" must
027: * not be used to endorse or promote products derived from this
028: * software without prior written permission. For written
029: * permission, please contact dglasser@pobox.com.
030: *
031: * 5. Products derived from this software may not be called "QueryForm",
032: * nor may "QueryForm" appear in their name, without prior written
033: * permission of David F. Glasser.
034: *
035: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
036: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
037: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
038: * DISCLAIMED. IN NO EVENT SHALL DAVID F. GLASSER, THE APACHE SOFTWARE
039: * FOUNDATION OR ITS CONTRIBUTORS, OR ANY AUTHORS OR DISTRIBUTORS
040: * OF THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047: * SUCH DAMAGE.
048: * ====================================================================
049: *
050: * This product includes software developed by the
051: * Apache Software Foundation (http://www.apache.org/).
052: *
053: * ====================================================================
054: *
055: * $Source: /cvsroot/qform/qform/src/org/glasser/sql/LocalDataSourceConfig.java,v $
056: * $Revision: 1.1 $
057: * $Author: dglasser $
058: * $Date: 2003/01/25 23:35:03 $
059: *
060: * --------------------------------------------------------------------
061: */
062: package org.glasser.sql;
063:
064: import org.glasser.util.*;
065: import org.glasser.util.comparators.*;
066:
067: public class LocalDataSourceConfig implements java.io.Serializable,
068: Cloneable {
069:
070: public final static MethodComparator DISPLAY_NAME_COMPARATOR = new MethodComparator(
071: org.glasser.sql.LocalDataSourceConfig.class,
072: "getDisplayName");
073:
074: protected String displayName = null;
075:
076: protected String driverClassName = null;
077:
078: protected boolean loginRequired = false;
079:
080: protected String url = null;
081:
082: protected String user = null;
083:
084: protected String password = null;
085:
086: protected Integer maxConnections = null;
087:
088: protected Integer loginTimeout = null;
089:
090: // setters
091:
092: public void setDisplayName(String displayName) {
093: this .displayName = displayName;
094: }
095:
096: public void setDriverClassName(String driverClassName) {
097: this .driverClassName = driverClassName;
098: }
099:
100: public void setLoginRequired(boolean loginRequired) {
101: this .loginRequired = loginRequired;
102: }
103:
104: public void setUrl(String url) {
105: this .url = url;
106: }
107:
108: public void setUser(String user) {
109: this .user = user;
110: }
111:
112: public void setPassword(String password) {
113: this .password = password;
114: }
115:
116: public void setMaxConnections(Integer maxConnections) {
117: this .maxConnections = maxConnections;
118: }
119:
120: public void setLoginTimeout(Integer loginTimeout) {
121: this .loginTimeout = loginTimeout;
122: }
123:
124: // getters
125:
126: public String getDisplayName() {
127: return displayName;
128: }
129:
130: public String getDriverClassName() {
131: return driverClassName;
132: }
133:
134: public boolean isLoginRequired() {
135: return loginRequired;
136: }
137:
138: public String getUrl() {
139: return url;
140: }
141:
142: public String getUser() {
143: return user;
144: }
145:
146: public String getPassword() {
147: return password;
148: }
149:
150: public Integer getMaxConnections() {
151: return maxConnections;
152: }
153:
154: public Integer getLoginTimeout() {
155: return loginTimeout;
156: }
157:
158: public String toString() {
159: if (displayName == null)
160: return "";
161: return displayName;
162: }
163:
164: public Object clone() {
165: try {
166: return super .clone();
167: } catch (CloneNotSupportedException ex) {
168: // shouldn't happen because this class is cloneable.
169: throw new java.lang.UnknownError(getClass().getName()
170: + ".clone(): Clone failed, when it shouldn't have!");
171: }
172: }
173:
174: public String debugString() {
175: StringBuffer buffer = new StringBuffer(200);
176: buffer.append(getClass().getName());
177: buffer.append("[");
178: buffer.append("displayName=");
179: buffer.append(displayName);
180: buffer.append(",driverClassName=");
181: buffer.append(driverClassName);
182: buffer.append(",loginRequired=");
183: buffer.append(loginRequired);
184: buffer.append(",url=");
185: buffer.append(url);
186: buffer.append(",user=");
187: buffer.append(user);
188: buffer.append(",password=");
189: buffer.append(password);
190: buffer.append(",maxConnections=");
191: buffer.append(maxConnections);
192: buffer.append(",loginTimeout=");
193: buffer.append(loginTimeout);
194:
195: buffer.append("]");
196: return buffer.toString();
197: }
198:
199: }
|