KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > proxool > ProxoolDataSource


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.proxool;
7
8 import org.apache.commons.logging.Log;
9 import org.apache.commons.logging.LogFactory;
10
11 import javax.naming.spi.ObjectFactory JavaDoc;
12 import javax.naming.Name JavaDoc;
13 import javax.naming.Context JavaDoc;
14 import javax.naming.Reference JavaDoc;
15 import javax.naming.RefAddr JavaDoc;
16 import javax.naming.StringRefAddr JavaDoc;
17 import javax.sql.DataSource JavaDoc;
18 import java.sql.Connection JavaDoc;
19 import java.sql.SQLException JavaDoc;
20 import java.util.Hashtable JavaDoc;
21 import java.util.Enumeration JavaDoc;
22 import java.util.Properties JavaDoc;
23 import java.util.StringTokenizer JavaDoc;
24 import java.io.PrintWriter JavaDoc;
25
26 /**
27  * The Proxool DataSource implementation. Supports three modes of configuration:
28  * <ul>
29  * <li>pre-configured</li>
30  * <li>bean-configured</li>
31  * <li>factory-configured</li>
32  * </ul>
33  *
34  * TODO - expand
35  * @version $Revision: 1.7 $, $Date: 2006/05/23 21:17:55 $
36  * @author bill
37  * @author $Author: billhorsman $ (current maintainer)
38  * @since Proxool 0.9
39  */

40 public class ProxoolDataSource implements DataSource JavaDoc, ObjectFactory JavaDoc {
41     private static final Log LOG = LogFactory.getLog(ProxoolDataSource.class);
42
43     private int loginTimeout;
44     private PrintWriter JavaDoc logWriter;
45
46     private String JavaDoc alias;
47     private String JavaDoc driver;
48     private String JavaDoc fatalSqlExceptionWrapperClass;
49     private int houseKeepingSleepTime;
50     private String JavaDoc houseKeepingTestSql;
51     private int maximumActiveTime;
52     private int maximumConnectionCount;
53     private int maximumConnectionLifetime;;
54     private int minimumConnectionCount;
55     private int overloadWithoutRefusalLifetime;
56     private String JavaDoc password;
57     private int prototypeCount;
58     private int recentlyStartedThreshold;
59     private int simultaneousBuildThrottle;
60     private String JavaDoc statistics;
61     private String JavaDoc statisticsLogLevel;
62     private boolean trace;
63     private String JavaDoc driverUrl;
64     private String JavaDoc user;
65     private boolean verbose;
66     private boolean jmx;
67     private String JavaDoc jmxAgentId;
68     private boolean testBeforeUse;
69     private boolean testAfterUse;
70     private Properties JavaDoc delegateProperties = new Properties JavaDoc();
71
72     /**
73      * A String of all the fatalSqlExceptions delimited by
74      * {@link ConnectionPoolDefinitionIF#FATAL_SQL_EXCEPTIONS_DELIMITER}
75      */

76     private String JavaDoc fatalSqlExceptionsAsString;
77
78     public ProxoolDataSource() {
79         reset();
80     }
81
82     public ProxoolDataSource (String JavaDoc alias) {
83         this.alias = alias;
84     }
85
86     /**
87      * @see javax.sql.DataSource#getConnection()
88      */

89     public Connection JavaDoc getConnection() throws SQLException JavaDoc {
90
91         ConnectionPool cp = null;
92         try {
93             if (!ConnectionPoolManager.getInstance().isPoolExists(alias)) {
94                 registerPool();
95             }
96             cp = ConnectionPoolManager.getInstance().getConnectionPool(alias);
97             return cp.getConnection();
98         } catch (ProxoolException e) {
99             LOG.error("Problem getting connection", e);
100             throw new SQLException JavaDoc(e.toString());
101         }
102     }
103
104     /**
105      * Register a pool using the properties of this data source. (Check that it
106      * exists first)
107      * @throws ProxoolException if the pool couldn't be registered
108      */

109     private synchronized void registerPool() throws ProxoolException {
110         if (!ConnectionPoolManager.getInstance().isPoolExists(alias)) {
111             ConnectionPoolDefinition cpd = new ConnectionPoolDefinition();
112             cpd.setAlias(getAlias());
113             cpd.setDriver(getDriver());
114             cpd.setFatalSqlExceptionsAsString(getFatalSqlExceptionsAsString());
115             cpd.setFatalSqlExceptionWrapper(getFatalSqlExceptionWrapperClass());
116             cpd.setHouseKeepingSleepTime(getHouseKeepingSleepTime());
117             cpd.setHouseKeepingTestSql(getHouseKeepingTestSql());
118             cpd.setMaximumActiveTime(getMaximumActiveTime());
119             cpd.setMaximumConnectionCount(getMaximumConnectionCount());
120             cpd.setMaximumConnectionLifetime(getMaximumConnectionLifetime());
121             cpd.setMinimumConnectionCount(getMinimumConnectionCount());
122             cpd.setOverloadWithoutRefusalLifetime(getOverloadWithoutRefusalLifetime());
123             cpd.setPassword(getPassword());
124             cpd.setPrototypeCount(getPrototypeCount());
125             cpd.setRecentlyStartedThreshold(getRecentlyStartedThreshold());
126             cpd.setSimultaneousBuildThrottle(getSimultaneousBuildThrottle());
127             cpd.setStatistics(getStatistics());
128             cpd.setStatisticsLogLevel(getStatisticsLogLevel());
129             cpd.setTrace(isTrace());
130             cpd.setUrl(getDriverUrl());
131             cpd.setUser(getUser());
132             cpd.setVerbose(isVerbose());
133             cpd.setJmx(isJmx());
134             cpd.setJmxAgentId(getJmxAgentId());
135             cpd.setTestAfterUse(isTestAfterUse());
136             cpd.setTestBeforeUse(isTestBeforeUse());
137             cpd.setDelegateProperties(delegateProperties);
138             ProxoolFacade.registerConnectionPool(cpd);
139         }
140     }
141
142
143     public Object JavaDoc getObjectInstance(Object JavaDoc refObject, Name JavaDoc name, Context JavaDoc context, Hashtable JavaDoc hashtable) throws Exception JavaDoc {
144         // we only handle references
145
if (!(refObject instanceof Reference JavaDoc)) {
146             return null;
147         }
148         Reference JavaDoc reference = (Reference JavaDoc) refObject;
149 /* Removed because JNDI implementations can not be trusted to implement reference.getFactoryClassName() correctly.
150         // check if this is relevant for us
151         if (!ProxoolDataSource.class.getName().equals(reference.getFactoryClassName())) {
152             return null;
153         }
154 */

155         // check if we've allready parsed the properties.
156
if (!ConnectionPoolManager.getInstance().isPoolExists(reference.get(ProxoolConstants.ALIAS_PROPERTY).toString())) {
157             populatePropertiesFromReference(reference);
158         }
159         return this;
160     }
161
162     /**
163      * @see ConnectionPoolDefinitionIF#getAlias
164      */

165     public String JavaDoc getAlias() {
166         return alias;
167     }
168
169     /**
170      * @see ConnectionPoolDefinitionIF#getAlias
171      */

172     public void setAlias(String JavaDoc alias) {
173         this.alias = alias;
174     }
175
176     /**
177      * @see ConnectionPoolDefinitionIF#getUrl
178      */

179     public String JavaDoc getDriverUrl() {
180         return driverUrl;
181     }
182
183     /**
184      * @see ConnectionPoolDefinitionIF#getUrl
185      */

186     public void setDriverUrl(String JavaDoc url) {
187         this.driverUrl = url;
188     }
189
190     /**
191      * @see ConnectionPoolDefinitionIF#getDriver
192      */

193     public String JavaDoc getDriver() {
194         return driver;
195     }
196
197     /**
198      * @see ConnectionPoolDefinitionIF#getDriver
199      */

200     public void setDriver(String JavaDoc driver) {
201         this.driver = driver;
202     }
203
204     /**
205      * @see ConnectionPoolDefinitionIF#getMaximumConnectionLifetime
206      */

207     public int getMaximumConnectionLifetime() {
208         return maximumConnectionLifetime;
209     }
210
211     /**
212      * @see ConnectionPoolDefinitionIF#getMaximumConnectionLifetime
213      */

214     public void setMaximumConnectionLifetime(int maximumConnectionLifetime) {
215         this.maximumConnectionLifetime = maximumConnectionLifetime;
216     }
217
218     /**
219      * @see ConnectionPoolDefinitionIF#getPrototypeCount
220      */

221     public int getPrototypeCount() {
222         return prototypeCount;
223     }
224
225     /**
226      * @see ConnectionPoolDefinitionIF#getPrototypeCount
227      */

228     public void setPrototypeCount(int prototypeCount) {
229         this.prototypeCount = prototypeCount;
230     }
231
232     /**
233      * @see ConnectionPoolDefinitionIF#getMinimumConnectionCount
234      */

235     public int getMinimumConnectionCount() {
236         return minimumConnectionCount;
237     }
238
239     /**
240      * @see ConnectionPoolDefinitionIF#getMinimumConnectionCount
241      */

242     public void setMinimumConnectionCount(int minimumConnectionCount) {
243         this.minimumConnectionCount = minimumConnectionCount;
244     }
245
246     /**
247      * @see ConnectionPoolDefinitionIF#getMaximumConnectionCount
248      */

249     public int getMaximumConnectionCount() {
250         return maximumConnectionCount;
251     }
252
253     /**
254      * @see ConnectionPoolDefinitionIF#getMaximumConnectionCount
255      */

256     public void setMaximumConnectionCount(int maximumConnectionCount) {
257         this.maximumConnectionCount = maximumConnectionCount;
258     }
259
260     /**
261      * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime
262      */

263     public int getHouseKeepingSleepTime() {
264         return houseKeepingSleepTime;
265     }
266
267     /**
268      * @see ConnectionPoolDefinitionIF#getHouseKeepingSleepTime
269      */

270     public void setHouseKeepingSleepTime(int houseKeepingSleepTime) {
271         this.houseKeepingSleepTime = houseKeepingSleepTime;
272     }
273
274     /**
275      * @see ConnectionPoolDefinitionIF#getSimultaneousBuildThrottle
276      */

277     public int getSimultaneousBuildThrottle() {
278         return simultaneousBuildThrottle;
279     }
280
281     /**
282      * @see ConnectionPoolDefinitionIF#getSimultaneousBuildThrottle
283      */

284     public void setSimultaneousBuildThrottle(int simultaneousBuildThrottle) {
285         this.simultaneousBuildThrottle = simultaneousBuildThrottle;
286     }
287
288     /**
289      * @see ConnectionPoolDefinitionIF#getRecentlyStartedThreshold
290      */

291     public int getRecentlyStartedThreshold() {
292         return recentlyStartedThreshold;
293     }
294
295     /**
296      * @see ConnectionPoolDefinitionIF#getRecentlyStartedThreshold
297      */

298     public void setRecentlyStartedThreshold(int recentlyStartedThreshold) {
299         this.recentlyStartedThreshold = recentlyStartedThreshold;
300     }
301
302     /**
303      * @see ConnectionPoolDefinitionIF#getOverloadWithoutRefusalLifetime
304      */

305     public int getOverloadWithoutRefusalLifetime() {
306         return overloadWithoutRefusalLifetime;
307     }
308
309     /**
310      * @see ConnectionPoolDefinitionIF#getOverloadWithoutRefusalLifetime
311      */

312     public void setOverloadWithoutRefusalLifetime(int overloadWithoutRefusalLifetime) {
313         this.overloadWithoutRefusalLifetime = overloadWithoutRefusalLifetime;
314     }
315
316     /**
317      * @see ConnectionPoolDefinitionIF#getMaximumActiveTime
318      */

319     public int getMaximumActiveTime() {
320         return maximumActiveTime;
321     }
322
323     /**
324      * @see ConnectionPoolDefinitionIF#getMaximumActiveTime
325      */

326     public void setMaximumActiveTime(int maximumActiveTime) {
327         this.maximumActiveTime = maximumActiveTime;
328     }
329
330     /**
331      * @see ConnectionPoolDefinitionIF#isVerbose
332      */

333     public boolean isVerbose() {
334         return verbose;
335     }
336
337     /**
338      * @see ConnectionPoolDefinitionIF#isVerbose
339      */

340     public void setVerbose(boolean verbose) {
341         this.verbose = verbose;
342     }
343
344     /**
345      * @see ConnectionPoolDefinitionIF#isTrace
346      */

347     public boolean isTrace() {
348         return trace;
349     }
350
351     /**
352      * @see ConnectionPoolDefinitionIF#isTrace
353      */

354     public void setTrace(boolean trace) {
355         this.trace = trace;
356     }
357
358     /**
359      * @see ConnectionPoolDefinitionIF#getStatistics
360      */

361     public String JavaDoc getStatistics() {
362         return statistics;
363     }
364
365     /**
366      * @see ConnectionPoolDefinitionIF#getStatistics
367      */

368     public void setStatistics(String JavaDoc statistics) {
369         this.statistics = statistics;
370     }
371
372     /**
373      * @see ConnectionPoolDefinitionIF#getStatisticsLogLevel
374      */

375     public String JavaDoc getStatisticsLogLevel() {
376         return statisticsLogLevel;
377     }
378
379     /**
380      * @see ConnectionPoolDefinitionIF#getStatisticsLogLevel
381      */

382     public void setStatisticsLogLevel(String JavaDoc statisticsLogLevel) {
383         this.statisticsLogLevel = statisticsLogLevel;
384     }
385
386     /**
387      * @see ConnectionPoolDefinitionIF#getFatalSqlExceptions
388      */

389     public String JavaDoc getFatalSqlExceptionsAsString() {
390         return fatalSqlExceptionsAsString;
391     }
392
393     /**
394      * @see ConnectionPoolDefinitionIF#getFatalSqlExceptions
395      */

396     public void setFatalSqlExceptionsAsString(String JavaDoc fatalSqlExceptionsAsString) {
397         this.fatalSqlExceptionsAsString = fatalSqlExceptionsAsString;
398     }
399
400     /**
401      * @see ConnectionPoolDefinitionIF#getFatalSqlExceptionWrapper()
402      */

403     public String JavaDoc getFatalSqlExceptionWrapperClass() {
404         return fatalSqlExceptionWrapperClass;
405     }
406
407     /**
408      * @see ConnectionPoolDefinitionIF#getFatalSqlExceptionWrapper()
409      */

410     public void setFatalSqlExceptionWrapperClass(String JavaDoc fatalSqlExceptionWrapperClass) {
411         this.fatalSqlExceptionWrapperClass = fatalSqlExceptionWrapperClass;
412     }
413
414     /**
415      * @see ConnectionPoolDefinitionIF#getHouseKeepingTestSql
416      */

417     public String JavaDoc getHouseKeepingTestSql() {
418         return houseKeepingTestSql;
419     }
420
421     /**
422      * @see ConnectionPoolDefinitionIF#getHouseKeepingTestSql
423      */

424     public void setHouseKeepingTestSql(String JavaDoc houseKeepingTestSql) {
425         this.houseKeepingTestSql = houseKeepingTestSql;
426     }
427
428     /**
429      * @see ConnectionPoolDefinitionIF#getUser
430      */

431     public String JavaDoc getUser() {
432         return user;
433     }
434
435     /**
436      * @see ConnectionPoolDefinitionIF#getUser
437      */

438     public void setUser(String JavaDoc user) {
439         this.user = user;
440     }
441
442     /**
443      * @see ConnectionPoolDefinitionIF#getPassword
444      */

445     public String JavaDoc getPassword() {
446         return password;
447     }
448
449     /**
450      * @see ConnectionPoolDefinitionIF#getPassword
451      */

452     public void setPassword(String JavaDoc password) {
453         this.password = password;
454     }
455
456     /**
457      * @see ConnectionPoolDefinitionIF#isJmx()
458      */

459     public boolean isJmx() {
460         return jmx;
461     }
462
463     /**
464      * @see ConnectionPoolDefinitionIF#isJmx()
465      */

466     public void setJmx(boolean jmx) {
467         this.jmx = jmx;
468     }
469
470     /**
471      * @see ConnectionPoolDefinitionIF#getJmxAgentId()
472      */

473     public String JavaDoc getJmxAgentId() {
474         return jmxAgentId;
475     }
476
477     /**
478      * @see ConnectionPoolDefinitionIF#getJmxAgentId()
479      */

480     public void setJmxAgentId(String JavaDoc jmxAgentId) {
481         this.jmxAgentId = jmxAgentId;
482     }
483
484     /**
485      * @see ConnectionPoolDefinitionIF#isTestBeforeUse
486      */

487     public boolean isTestBeforeUse() {
488         return testBeforeUse;
489     }
490
491     /**
492      * @see ConnectionPoolDefinitionIF#isTestBeforeUse
493      */

494     public void setTestBeforeUse(boolean testBeforeUse) {
495         this.testBeforeUse = testBeforeUse;
496     }
497
498     /**
499      * @see ConnectionPoolDefinitionIF#isTestAfterUse
500      */

501     public boolean isTestAfterUse() {
502         return testAfterUse;
503     }
504
505     /**
506      * @see ConnectionPoolDefinitionIF#isTestAfterUse
507      */

508     public void setTestAfterUse(boolean testAfterUse) {
509         this.testAfterUse = testAfterUse;
510     }
511
512     /**
513      * Set any property that should be handed to the delegate driver.
514      * E.g. <code>foo=1,bar=true</code>
515      * @param properties a comma delimited list of name=value pairs
516      * @see ConnectionPoolDefinitionIF#getDelegateProperties()
517      */

518     public void setDelegateProperties(String JavaDoc properties) {
519         StringTokenizer JavaDoc stOuter = new StringTokenizer JavaDoc(properties, ",");
520         while (stOuter.hasMoreTokens()) {
521             StringTokenizer JavaDoc stInner = new StringTokenizer JavaDoc(stOuter.nextToken(), "=");
522             if (stInner.countTokens() != 2) {
523                 throw new IllegalArgumentException JavaDoc("Unexpected delegateProperties value: '" + properties + "'. Expected 'name=value'");
524             }
525             delegateProperties.put(stInner.nextToken().trim(), stInner.nextToken().trim());
526         }
527     }
528
529     private void populatePropertiesFromReference(Reference JavaDoc reference) {
530         RefAddr JavaDoc property = reference.get(ProxoolConstants.ALIAS_PROPERTY);
531         if (property != null) {
532             setAlias(property.getContent().toString());
533         }
534         property = reference.get(ProxoolConstants.DRIVER_CLASS_PROPERTY);
535         if (property != null) {
536             setDriver(property.getContent().toString());
537         }
538         property = reference.get(ProxoolConstants.FATAL_SQL_EXCEPTION_WRAPPER_CLASS_PROPERTY);
539         if (property != null) {
540             setFatalSqlExceptionWrapperClass(property.getContent().toString());
541         }
542         property = reference.get(ProxoolConstants.HOUSE_KEEPING_SLEEP_TIME_PROPERTY);
543         if (property != null) {
544             setHouseKeepingSleepTime(Integer.valueOf(property.getContent().toString()).intValue());
545         }
546         property = reference.get(ProxoolConstants.HOUSE_KEEPING_TEST_SQL_PROPERTY);
547         if (property != null) {
548             setHouseKeepingTestSql(property.getContent().toString());
549         }
550         property = reference.get(ProxoolConstants.MAXIMUM_CONNECTION_COUNT_PROPERTY);
551         if (property != null) {
552             setMaximumConnectionCount(Integer.valueOf(property.getContent().toString()).intValue());
553         }
554         property = reference.get(ProxoolConstants.MAXIMUM_CONNECTION_LIFETIME_PROPERTY);
555         if (property != null) {
556             setMaximumConnectionLifetime(Integer.valueOf(property.getContent().toString()).intValue());
557         }
558         property = reference.get(ProxoolConstants.MAXIMUM_ACTIVE_TIME_PROPERTY);
559         if (property != null) {
560             setMaximumActiveTime(Integer.valueOf(property.getContent().toString()).intValue());
561         }
562         property = reference.get(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY);
563         if (property != null) {
564             setMinimumConnectionCount(Integer.valueOf(property.getContent().toString()).intValue());
565         }
566         property = reference.get(ProxoolConstants.OVERLOAD_WITHOUT_REFUSAL_LIFETIME_PROPERTY);
567         if (property != null) {
568             setOverloadWithoutRefusalLifetime(Integer.valueOf(property.getContent().toString()).intValue());
569         }
570         property = reference.get(ProxoolConstants.PASSWORD_PROPERTY);
571         if (property != null) {
572             setPassword(property.getContent().toString());
573         }
574         property = reference.get(ProxoolConstants.PROTOTYPE_COUNT_PROPERTY);
575         if (property != null) {
576             setPrototypeCount(Integer.valueOf(property.getContent().toString()).intValue());
577         }
578         property = reference.get(ProxoolConstants.RECENTLY_STARTED_THRESHOLD_PROPERTY);
579         if (property != null) {
580             setRecentlyStartedThreshold(Integer.valueOf(property.getContent().toString()).intValue());
581         }
582         property = reference.get(ProxoolConstants.SIMULTANEOUS_BUILD_THROTTLE_PROPERTY);
583         if (property != null) {
584             setSimultaneousBuildThrottle(Integer.valueOf(property.getContent().toString()).intValue());
585         }
586         property = reference.get(ProxoolConstants.STATISTICS_PROPERTY);
587         if (property != null) {
588             setStatistics(property.getContent().toString());
589         }
590         property = reference.get(ProxoolConstants.STATISTICS_LOG_LEVEL_PROPERTY);
591         if (property != null) {
592             setStatisticsLogLevel(property.getContent().toString());
593         }
594         property = reference.get(ProxoolConstants.TRACE_PROPERTY);
595         if (property != null) {
596             setTrace("true".equalsIgnoreCase(property.getContent().toString()));
597         }
598         property = reference.get(ProxoolConstants.DRIVER_URL_PROPERTY);
599         if (property != null) {
600             setDriverUrl(property.getContent().toString());
601         }
602         property = reference.get(ProxoolConstants.USER_PROPERTY);
603         if (property != null) {
604             setUser(property.getContent().toString());
605         }
606         property = reference.get(ProxoolConstants.VERBOSE_PROPERTY);
607         if (property != null) {
608             setVerbose("true".equalsIgnoreCase(property.getContent().toString()));
609         }
610         property = reference.get(ProxoolConstants.JMX_PROPERTY);
611         if (property != null) {
612             setJmx("true".equalsIgnoreCase(property.getContent().toString()));
613         }
614         property = reference.get(ProxoolConstants.JMX_AGENT_PROPERTY);
615         if (property != null) {
616             setJmxAgentId(property.getContent().toString());
617         }
618         property = reference.get(ProxoolConstants.TEST_BEFORE_USE_PROPERTY);
619         if (property != null) {
620             setTestBeforeUse("true".equalsIgnoreCase(property.getContent().toString()));
621         }
622         property = reference.get(ProxoolConstants.TEST_AFTER_USE_PROPERTY);
623         if (property != null) {
624             setTestAfterUse("true".equalsIgnoreCase(property.getContent().toString()));
625         }
626         // Pick up any properties that we don't recognise
627
Enumeration JavaDoc e = reference.getAll();
628         while (e.hasMoreElements()) {
629             StringRefAddr JavaDoc stringRefAddr = (StringRefAddr JavaDoc) e.nextElement();
630             String JavaDoc name = stringRefAddr.getType();
631             String JavaDoc content = stringRefAddr.getContent().toString();
632             if (name.indexOf(ProxoolConstants.PROPERTY_PREFIX) != 0) {
633                 delegateProperties.put(name, content);
634             }
635         }
636     }
637
638     /**
639      * Reset all properties to their default values
640      */

641     private void reset() {
642         driverUrl = null;
643         driver = null;
644         maximumConnectionLifetime = ConnectionPoolDefinitionIF.DEFAULT_MAXIMUM_CONNECTION_LIFETIME;
645         prototypeCount = ConnectionPoolDefinitionIF.DEFAULT_PROTOTYPE_COUNT;
646         minimumConnectionCount = ConnectionPoolDefinitionIF.DEFAULT_MINIMUM_CONNECTION_COUNT;
647         maximumConnectionCount = ConnectionPoolDefinitionIF.DEFAULT_MAXIMUM_CONNECTION_COUNT;
648         houseKeepingSleepTime = ConnectionPoolDefinitionIF.DEFAULT_HOUSE_KEEPING_SLEEP_TIME;
649         houseKeepingTestSql = null;
650         simultaneousBuildThrottle = ConnectionPoolDefinitionIF.DEFAULT_SIMULTANEOUS_BUILD_THROTTLE;
651         recentlyStartedThreshold = ConnectionPoolDefinitionIF.DEFAULT_RECENTLY_STARTED_THRESHOLD;
652         overloadWithoutRefusalLifetime = ConnectionPoolDefinitionIF.DEFAULT_OVERLOAD_WITHOUT_REFUSAL_THRESHOLD;
653         maximumActiveTime = ConnectionPoolDefinitionIF.DEFAULT_MAXIMUM_ACTIVE_TIME;
654         verbose = false;
655         trace = false;
656         statistics = null;
657         statisticsLogLevel = null;
658         delegateProperties.clear();
659     }
660
661     public PrintWriter JavaDoc getLogWriter() throws SQLException JavaDoc {
662         return this.logWriter;
663     }
664
665     public int getLoginTimeout() throws SQLException JavaDoc {
666         return this.loginTimeout;
667     }
668
669     public void setLogWriter(PrintWriter JavaDoc logWriter) throws SQLException JavaDoc {
670         this.logWriter = logWriter;
671     }
672
673     public void setLoginTimeout(int loginTimeout) throws SQLException JavaDoc {
674         this.loginTimeout = loginTimeout;
675     }
676
677     public Connection JavaDoc getConnection(String JavaDoc s, String JavaDoc s1) throws SQLException JavaDoc {
678         throw new UnsupportedOperationException JavaDoc("You should configure the username and password "
679                 + "within the proxool configuration and just call getConnection() instead.");
680     }
681 }
682
683 /*
684  Revision history:
685  $Log: ProxoolDataSource.java,v $
686  Revision 1.7 2006/05/23 21:17:55 billhorsman
687  Add in maximum-active-time. Credit to Paolo Di Tommaso.
688
689  Revision 1.6 2006/03/23 11:51:23 billhorsman
690  Allow for delegate properties
691
692  Revision 1.5 2006/01/18 14:40:01 billhorsman
693  Unbundled Jakarta's Commons Logging.
694
695  Revision 1.4 2004/08/19 12:28:28 chr32
696  Removed factory type test.
697
698  Revision 1.3 2004/03/18 17:16:58 chr32
699  Added a timy bit of doc.
700
701  Revision 1.2 2004/03/18 17:07:25 chr32
702  Now supports all three modes: pre-configured, bean-configured and factory-configured.
703
704  Revision 1.1 2004/03/15 23:54:25 chr32
705  Initail Proxool J2EE-managed DataSource. Not quite complete yet.
706
707  */
Popular Tags