Source Code Cross Referenced for PoolConfigImpl.java in  » Database-JDBC-Connection-Pool » Primrose » uk » org » primrose » pool » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » Primrose » uk.org.primrose.pool.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *	Library name : Primrose - A Java Database Connection Pool.
003:         *	Published by Ben Keeping, http://primrose.org.uk .
004:         *	Copyright (C) 2004 Ben Keeping, primrose.org.uk
005:         *	Email: Use "Contact Us Form" on website
006:         *
007:         *	This library is free software; you can redistribute it and/or
008:         *	modify it under the terms of the GNU Lesser General Public
009:         *	License as published by the Free Software Foundation; either
010:         *	version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *	This library is distributed in the hope that it will be useful,
013:         *	but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *	Lesser General Public License for more details.
016:         *
017:         *	You should have received a copy of the GNU Lesser General Public
018:         *	License along with this library; if not, write to the Free Software
019:         *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         */package uk.org.primrose.pool.core;
021:
022:        import java.sql.*;
023:        import java.util.*;
024:        import uk.org.primrose.pool.core.loadrules.*;
025:
026:        import uk.org.primrose.pool.core.loadrules.LoadRule;
027:
028:        /**
029:         * 
030:         * @author sedj
031:         * This class represents the Primrose Pool Config 
032:         * (commonly primrose.config or poolconfig.properties) file.
033:         * To add new config parameters, you need to add an entry here, 
034:         * and also in the Constants.POOL_CONFIG_ITEM_NAMES List<String>.
035:         * 
036:         */
037:        public class PoolConfigImpl {
038:
039:            // The 'poolName' pool config property
040:            protected String poolName = "not_set";
041:
042:            // The 'failoverPool' pool config property
043:            // If set, the primrose tries to use the other pool
044:            protected String failoverPool = null;
045:
046:            // How many connections should we open when we initialize
047:            protected int iNumberOfConnectionsToInitializeWith = 1;
048:
049:            // Address to send emails to when problems with the pool
050:            protected String adminEmail = null;
051:
052:            // SMPT Mail Exchanger to send emails via when the adminEmail property is set
053:            protected String smtpMailExchangeServer = null;
054:
055:            // Pool events to email for
056:            protected String emailEvents = null;
057:
058:            // The 'base' pool config property
059:            protected int iBase = 5;
060:
061:            // The 'log' pool config property
062:            protected String log = "";
063:
064:            // The 'idleTime' pool config property
065:            protected int iIdleTime = 120000;
066:            // The 'logLevel' pool config property
067:
068:            protected String logLevel = "info,warn,error,crisis";
069:
070:            // The 'driverClass' pool config property
071:            protected String driverClass = "";
072:
073:            // The 'driverURL' pool config property
074:            protected String driverURL = "";
075:
076:            // The 'user' pool config property
077:            protected String user = "";
078:
079:            // The 'password' pool config property
080:            protected String password = "";
081:
082:            // The 'killActiveConnectionsOverAge' pool config property
083:            protected int iKillActiveConnectionsOverAge = -1;
084:
085:            // The 'cycleConnections' pool config property
086:            protected int iCycleConnections = -1;
087:
088:            // The 'queueConnectionRequests' pool config property
089:            protected boolean bQueueConnectionRequests = true;
090:
091:            // The 'runPooledMode' pool config property
092:            protected boolean bRunPooledMode = true;
093:
094:            // The 'connectionAutoCommit' pool config property
095:            protected boolean bConnectionAutoCommit = true;
096:
097:            // The 'connectionTransactionIsolation' pool config property
098:            protected int iConnectionTransactionIsolation = -1;
099:
100:            // The 'checkSQL' pool config property
101:            protected String checkSQL = null;
102:
103:            // The 'encryptionFileKey' pool config property
104:            protected String encryptionFileKey = null;
105:
106:            // The 'waitForConnectionIfDatabaseIsDown' pool config property
107:            protected boolean bWaitForConnectionIfDatabaseIsDown = false;
108:
109:            // The 'dumpConnectionOnSQLException' property which describes
110:            // behaviour for when a SQLException occurs. If true, then the 
111:            // Pool will dump the connection when a SQLException occurs
112:            protected boolean bDumpConnectionOnSQLException = true;
113:
114:            // A SQL statement to run if failoverPool is set, to see if a DB is down
115:            // Used if you wish to email notifications of DB failures (see 'emailEvents' parameter)
116:            // or required if 'failoverPool' is used.  
117:            protected String onExceptionCheckSQL = null;
118:
119:            // A list of rules to execute when the pool starts
120:            protected List<LoadRule> loadRules = new ArrayList<LoadRule>();
121:
122:            /**
123:             *	Get the 'poolName' pool config property
124:             */
125:            public String getPoolName() {
126:                return poolName;
127:            }
128:
129:            /**
130:             *	Set the 'poolName' pool config property
131:             */
132:            public void setPoolName(String poolName) {
133:                this .poolName = poolName;
134:            }
135:
136:            /**
137:             *	Get the 'base' pool config property
138:             */
139:            public String getBase() {
140:                return iBase + "";
141:            }
142:
143:            /**
144:             *	Set the 'base' pool config property
145:             */
146:            public void setBase(String base) {
147:                this .iBase = Integer.parseInt(base);
148:            }
149:
150:            /**
151:             *	Get the 'base' pool config property
152:             */
153:            public String getEmailEvents() {
154:                return emailEvents;
155:            }
156:
157:            /**
158:             *	Set the 'base' pool config property
159:             */
160:            public void setEmailEvents(String emailEvents) {
161:                this .loadRules.add(new EmailEvents());
162:                this .emailEvents = emailEvents;
163:            }
164:
165:            /**
166:             *	Get the 'smtpMailExchangeServer' pool config property
167:             */
168:            public String getSmtpMailExchangeServer() {
169:                return this .smtpMailExchangeServer;
170:            }
171:
172:            /**
173:             *	Set the 'smtpMailExchangeServer' pool config property
174:             */
175:            public void setSmtpMailExchangeServer(String smtpMailExchangeServer) {
176:                this .smtpMailExchangeServer = smtpMailExchangeServer;
177:            }
178:
179:            /**
180:             *	Get the 'adminEmail' pool config property
181:             */
182:            public String getAdminEmail() {
183:                return this .adminEmail;
184:            }
185:
186:            /**
187:             *	Set the 'adminEmail' pool config property
188:             */
189:            public void setAdminEmail(String adminEmail) {
190:                this .adminEmail = adminEmail;
191:            }
192:
193:            /**
194:             *	Get the 'numberOfConnectionsToInitializeWith' pool config property
195:             */
196:            public String getNumberOfConnectionsToInitializeWith() {
197:                return iNumberOfConnectionsToInitializeWith + "";
198:            }
199:
200:            /**
201:             *	Set the 'numberOfConnectionsToInitializeWith' pool config property
202:             */
203:            public void setNumberOfConnectionsToInitializeWith(
204:                    String numberOfConnectionsToInitializeWith) {
205:                this .iNumberOfConnectionsToInitializeWith = Integer
206:                        .parseInt(numberOfConnectionsToInitializeWith);
207:            }
208:
209:            /**
210:             *	Get the 'log' pool config property
211:             */
212:            public String getLog() {
213:                return log;
214:            }
215:
216:            /**
217:             *	Set the 'log' pool config property
218:             */
219:            public void setLog(String log) {
220:                this .log = log;
221:            }
222:
223:            /**
224:             *	Get the 'idleTime' pool config property
225:             */
226:            public String getIdleTime() {
227:                return iIdleTime + "";
228:            }
229:
230:            /**
231:             *	Set the 'idleTime' pool config property
232:             */
233:            public void setIdleTime(String idleTime) {
234:                this .iIdleTime = Integer.parseInt(idleTime);
235:            }
236:
237:            /**
238:             *	Get the 'logLevel' pool config property
239:             */
240:            public String getLogLevel() {
241:                return logLevel;
242:            }
243:
244:            /**
245:             *	Set the 'logLevel' pool config property
246:             */
247:            public void setLogLevel(String logLevel) {
248:                this .logLevel = logLevel;
249:            }
250:
251:            /**
252:             *	Get the 'driverClass' pool config property
253:             */
254:            public String getDriverClass() {
255:                return driverClass;
256:            }
257:
258:            /**
259:             *	Set the 'driverClass' pool config property
260:             */
261:            public void setDriverClass(String driverClass) {
262:                this .driverClass = driverClass;
263:            }
264:
265:            /**
266:             *	Get the 'driverURL' pool config property
267:             */
268:            public String getDriverURL() {
269:                return driverURL;
270:            }
271:
272:            /**
273:             *	Set the 'driverURL' pool config property
274:             */
275:            public void setDriverURL(String driverURL) {
276:                this .driverURL = driverURL;
277:            }
278:
279:            /**
280:             *	Get the 'user' pool config property
281:             */
282:            public String getUser() {
283:                return user;
284:            }
285:
286:            /**
287:             *	Set the 'user' pool config property
288:             */
289:            public void setUser(String user) {
290:                this .user = user;
291:            }
292:
293:            /**
294:             *	Get the 'password' pool config property
295:             */
296:            public String getPassword() {
297:                return password;
298:            }
299:
300:            /**
301:             *	Set the 'password' pool config property
302:             */
303:            public void setPassword(String password) {
304:                this .password = password;
305:            }
306:
307:            /**
308:             *	Get the 'killActiveConnectionsOverAge' pool config property
309:             */
310:            public String getKillActiveConnectionsOverAge() {
311:                return iKillActiveConnectionsOverAge + "";
312:            }
313:
314:            /**
315:             *	Set the 'killActiveConnectionsOverAge' pool config property
316:             */
317:            public void setKillActiveConnectionsOverAge(
318:                    String killActiveConnectionsOverAge) {
319:                iKillActiveConnectionsOverAge = Integer
320:                        .parseInt(killActiveConnectionsOverAge);
321:            }
322:
323:            /**
324:             *	Get the 'cycleConnections' pool config property
325:             */
326:            public String getCycleConnections() {
327:                return iCycleConnections + "";
328:            }
329:
330:            /**
331:             *	Set the 'cycleConnections' pool config property
332:             */
333:            public void setCycleConnections(String cycleConnections) {
334:                iCycleConnections = Integer.parseInt(cycleConnections);
335:            }
336:
337:            /**
338:             *	Get the 'queueConnectionRequests' pool config property
339:             */
340:            public String getQueueConnectionRequests() {
341:                return bQueueConnectionRequests + "";
342:            }
343:
344:            /**
345:             *	Set the 'queueConnectionRequests' pool config property
346:             */
347:            public void setQueueConnectionRequests(
348:                    String queueConnectionRequests) {
349:                this .bQueueConnectionRequests = Boolean.valueOf(
350:                        queueConnectionRequests).booleanValue();
351:            }
352:
353:            /**
354:             *	Get the 'runPooledMode' pool config property
355:             */
356:            public String getRunPooledMode() {
357:                return bRunPooledMode + "";
358:            }
359:
360:            /**
361:             *	Set the 'runPooledMode' pool config property
362:             */
363:            public void setRunPooledMode(String runPooledMode) {
364:                this .bRunPooledMode = Boolean.valueOf(runPooledMode)
365:                        .booleanValue();
366:            }
367:
368:            /**
369:             *	Get the 'connectionAutoCommit' pool config property
370:             */
371:            public String getConnectionAutoCommit() {
372:                return bConnectionAutoCommit + "";
373:            }
374:
375:            /**
376:             *	Set the 'connectionAutoCommit' pool config property
377:             */
378:            public void setConnectionAutoCommit(String connectionAutoCommit) {
379:                this .bConnectionAutoCommit = Boolean.valueOf(
380:                        connectionAutoCommit).booleanValue();
381:            }
382:
383:            /**
384:             *	Get the 'connectionTransactionIsolation' pool config property
385:             */
386:            public String getConnectionTransactionIsolation() {
387:                return iConnectionTransactionIsolation + "";
388:            }
389:
390:            /**
391:             *	Set the 'connectionTransactionIsolation' pool config property
392:             */
393:            public void setConnectionTransactionIsolation(
394:                    String connectionTransactionIsolation) {
395:                //bUserSpecifiedTransIsoLevel = true;
396:                // Did the user specify they wanted a specific transaction isolation level
397:                // If not, then we won't bother checking it each time we hand a connection
398:                // out, as some drivers call the db to find out the level 
399:                //protected boolean bUserSpecifiedTransIsoLevel = false;
400:
401:                if (connectionTransactionIsolation
402:                        .equalsIgnoreCase("TRANSACTION_NONE")) {
403:                    iConnectionTransactionIsolation = Connection.TRANSACTION_NONE;
404:                } else if (connectionTransactionIsolation
405:                        .equalsIgnoreCase("TRANSACTION_READ_COMMITTED")) {
406:                    iConnectionTransactionIsolation = Connection.TRANSACTION_READ_COMMITTED;
407:                } else if (connectionTransactionIsolation
408:                        .equalsIgnoreCase("TRANSACTION_READ_UNCOMMITTED")) {
409:                    iConnectionTransactionIsolation = Connection.TRANSACTION_READ_UNCOMMITTED;
410:                } else if (connectionTransactionIsolation
411:                        .equalsIgnoreCase("TRANSACTION_REPEATABLE_READ")) {
412:                    iConnectionTransactionIsolation = Connection.TRANSACTION_REPEATABLE_READ;
413:                } else if (connectionTransactionIsolation
414:                        .equalsIgnoreCase("TRANSACTION_SERIALIZABLE")) {
415:                    iConnectionTransactionIsolation = Connection.TRANSACTION_SERIALIZABLE;
416:                } else {
417:                    iConnectionTransactionIsolation = -1;
418:                }
419:            }
420:
421:            /**
422:             *	Get the 'checkSQL' pool config property
423:             */
424:            public String getCheckSQL() {
425:                return checkSQL;
426:            }
427:
428:            /**
429:             *	Set the 'checkSQL' pool config property
430:             */
431:            public void setCheckSQL(String checkSQL) {
432:                this .checkSQL = checkSQL;
433:            }
434:
435:            /**
436:             *	Get the 'encryptionFileKey' pool config property
437:             */
438:            public String getEncryptionFileKey() {
439:                return encryptionFileKey;
440:            }
441:
442:            /**
443:             *	Set the 'encryptionFileKey' pool config property
444:             */
445:            public void setEncryptionFileKey(String encryptionFileKey) {
446:                this .encryptionFileKey = encryptionFileKey;
447:            }
448:
449:            /**
450:             *	Get the 'waitForConnectionIfDatabaseIsDown' pool config property
451:             */
452:            public String getWaitForConnectionIfDatabaseIsDown() {
453:                return bWaitForConnectionIfDatabaseIsDown + "";
454:            }
455:
456:            /**
457:             *	Set the 'waitForConnectionIfDatabaseIsDown' pool config property
458:             */
459:            public void setWaitForConnectionIfDatabaseIsDown(
460:                    String waitForConnectionIfDatabaseIsDown) {
461:                this .loadRules.add(new WaitForConnectionIfDatabaseIsDown());
462:                this .bWaitForConnectionIfDatabaseIsDown = Boolean.valueOf(
463:                        waitForConnectionIfDatabaseIsDown).booleanValue();
464:            }
465:
466:            /**
467:             *	Get the 'dumpConnectionOnSQLException' pool config property
468:             */
469:            public String getDumpConnectionOnSQLException() {
470:                return bDumpConnectionOnSQLException + "";
471:            }
472:
473:            /**
474:             *	Set the 'dumpConnectionOnSQLException' pool config property
475:             */
476:            public void setDumpConnectionOnSQLException(
477:                    String dumpConnectionOnSQLException) {
478:                this .bDumpConnectionOnSQLException = Boolean.valueOf(
479:                        dumpConnectionOnSQLException).booleanValue();
480:            }
481:
482:            /**
483:             *	Get the 'failoverPool' pool config property
484:             */
485:            public String getFailoverPool() {
486:                return failoverPool;
487:            }
488:
489:            /**
490:             *	Set the 'failoverPool' pool config property
491:             */
492:            public void setFailoverPool(String failoverPool) {
493:                this .failoverPool = failoverPool;
494:                this .loadRules.add(new FailoverPool());
495:            }
496:
497:            /**
498:             *	Get the 'onExceptionCheckSQL' pool config property
499:             */
500:            public String getOnExceptionCheckSQL() {
501:                return onExceptionCheckSQL;
502:            }
503:
504:            /**
505:             * Set the 'onExceptionCheckSQL' pool config property
506:             */
507:            public void setOnExceptionCheckSQL(String onExceptionCheckSQL) {
508:                this.onExceptionCheckSQL = onExceptionCheckSQL;
509:            }
510:
511:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.