Source Code Cross Referenced for PoolPreferences.java in  » Web-Framework » anvil » anvil » server » 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 » Web Framework » anvil » anvil.server 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: PoolPreferences.java,v 1.8 2002/09/16 08:05:06 jkl Exp $
003:         *
004:         * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
005:         *
006:         * Use is subject to license terms, as defined in
007:         * Anvil Sofware License, Version 1.1. See LICENSE 
008:         * file, or http://njet.org/license-1.1.txt
009:         */
010:        package anvil.server;
011:
012:        /**
013:         * class PoolPreferences
014:         *
015:         * @author: Jani Lehtimäki
016:         */
017:        public class PoolPreferences extends Preferences {
018:
019:            public static final String[] PREFERENCES = { "enabled", "boolean",
020:                    "driver", "string", "factory", "string", "monitor",
021:                    "string", "name", "string", "url", "string", "username",
022:                    "string", "password", "string", "min", "int", "max", "int",
023:                    "lifetime", "int", "timeout", "int", "checktimeout", "int",
024:                    "acquiretimeout", "int", };
025:
026:            private boolean _enabled = true;
027:            private String _driver = "org.gjt.mm.mysql.Driver";
028:            private String _factory = "anvil.database.jdbc.JDBCFactory";
029:            private String _monitor = "anvil.database.ConnectionMonitorImpl";
030:            private String _name = "";
031:            private String _url = "";
032:            private String _username = "nobody";
033:            private String _password = "";
034:            private int _min = 0;
035:            private int _max = 10;
036:            private int _lifetime = 600;
037:            private int _timeout = 30;
038:            private int _checkTimeout = 5;
039:            private int _acquireTimeout = 5000;
040:
041:            public PoolPreferences(Zone parent) {
042:                super (parent);
043:            }
044:
045:            public void setEnabled(boolean enabled) {
046:                _enabled = enabled;
047:            }
048:
049:            public boolean isEnabled() {
050:                return _enabled;
051:            }
052:
053:            public void setDriver(String driver) {
054:                if (driver != null) {
055:                    _driver = driver;
056:                }
057:            }
058:
059:            public String getDriver() {
060:                return _driver;
061:            }
062:
063:            public void setFactory(String factory) {
064:                if (factory != null) {
065:                    _factory = factory;
066:                }
067:            }
068:
069:            public String getFactory() {
070:                return _factory;
071:            }
072:
073:            public void setMonitor(String monitor) {
074:                _monitor = monitor;
075:            }
076:
077:            public String getMonitor() {
078:                return _monitor;
079:            }
080:
081:            public void setName(String name) {
082:                if (name != null) {
083:                    _name = name;
084:                }
085:            }
086:
087:            public String getName() {
088:                return _name;
089:            }
090:
091:            public void setURL(String url) {
092:                if (url != null) {
093:                    _url = url;
094:                }
095:            }
096:
097:            public String getURL() {
098:                return _url;
099:            }
100:
101:            public void setUsername(String username) {
102:                if (username != null) {
103:                    _username = username;
104:                }
105:            }
106:
107:            public String getUsername() {
108:                return _username;
109:            }
110:
111:            public void setPassword(String password) {
112:                if (password != null) {
113:                    _password = password;
114:                }
115:            }
116:
117:            public String getPassword() {
118:                return _password;
119:            }
120:
121:            public void setMinConnections(int min) {
122:                _min = min;
123:            }
124:
125:            public int getMinConnections() {
126:                return _min;
127:            }
128:
129:            public void setMaxConnections(int max) {
130:                _max = max;
131:            }
132:
133:            public int getMaxConnections() {
134:                return _max;
135:            }
136:
137:            public void setLifetime(int lifetime) {
138:                _lifetime = lifetime;
139:            }
140:
141:            public int getLifetime() {
142:                return _lifetime;
143:            }
144:
145:            public void setTimeout(int timeout) {
146:                _timeout = timeout;
147:            }
148:
149:            public int getTimeout() {
150:                return _timeout;
151:            }
152:
153:            public void setCheckTimeout(int timeout) {
154:                _checkTimeout = timeout;
155:            }
156:
157:            public int getCheckTimeout() {
158:                return _checkTimeout;
159:            }
160:
161:            public void setAcquireTimeout(int timeout) {
162:                _acquireTimeout = timeout;
163:            }
164:
165:            public int getAcquireTimeout() {
166:                return _acquireTimeout;
167:            }
168:
169:            public int getType() {
170:                return POOL;
171:            }
172:
173:            public String[] getPreferences() {
174:                return PREFERENCES;
175:            }
176:
177:            public boolean setPreference(String name, String value) {
178:                if (name.equalsIgnoreCase("enabled")) {
179:                    setEnabled(ConfigReader.toBoolean(value));
180:                } else if (name.equalsIgnoreCase("driver")) {
181:                    setDriver(value);
182:                } else if (name.equalsIgnoreCase("factory")) {
183:                    setFactory(value);
184:                } else if (name.equalsIgnoreCase("monitor")) {
185:                    setMonitor(value);
186:                } else if (name.equalsIgnoreCase("name")) {
187:                    setName(value);
188:                } else if (name.equalsIgnoreCase("url")) {
189:                    setURL(value);
190:                } else if (name.equalsIgnoreCase("username")) {
191:                    setUsername(value);
192:                } else if (name.equalsIgnoreCase("password")) {
193:                    setPassword(value);
194:                } else if (name.equalsIgnoreCase("min")) {
195:                    setMinConnections(ConfigReader.toInt(value));
196:                } else if (name.equalsIgnoreCase("max")) {
197:                    setMaxConnections(ConfigReader.toInt(value));
198:                } else if (name.equalsIgnoreCase("lifetime")) {
199:                    setLifetime(ConfigReader.toInt(value));
200:                } else if (name.equalsIgnoreCase("timeout")) {
201:                    setTimeout(ConfigReader.toInt(value));
202:                } else if (name.equalsIgnoreCase("checktimeout")) {
203:                    setCheckTimeout(ConfigReader.toInt(value));
204:                } else if (name.equalsIgnoreCase("acquiretimeout")) {
205:                    setAcquireTimeout(ConfigReader.toInt(value));
206:                } else {
207:                    return super .setPreference(name, value);
208:                }
209:                return true;
210:            }
211:
212:            public Object getPreference(String name) {
213:                if (name.equalsIgnoreCase("enabled")) {
214:                    return _enabled ? Boolean.TRUE : Boolean.FALSE;
215:                }
216:                if (name.equalsIgnoreCase("driver")) {
217:                    return _driver;
218:                }
219:                if (name.equalsIgnoreCase("factory")) {
220:                    return _factory;
221:                }
222:                if (name.equalsIgnoreCase("monitor")) {
223:                    return _monitor;
224:                }
225:                if (name.equalsIgnoreCase("name")) {
226:                    return _name;
227:                }
228:                if (name.equalsIgnoreCase("url")) {
229:                    return _url;
230:                }
231:                if (name.equalsIgnoreCase("username")) {
232:                    return _username;
233:                }
234:                if (name.equalsIgnoreCase("password")) {
235:                    return _password;
236:                }
237:                if (name.equalsIgnoreCase("min")) {
238:                    return new Integer(_min);
239:                }
240:                if (name.equalsIgnoreCase("max")) {
241:                    return new Integer(_max);
242:                }
243:                if (name.equalsIgnoreCase("lifetime")) {
244:                    return new Integer(_lifetime);
245:                }
246:                if (name.equalsIgnoreCase("timeout")) {
247:                    return new Integer(_timeout);
248:                }
249:                if (name.equalsIgnoreCase("checktimeout")) {
250:                    return new Integer(_checkTimeout);
251:                }
252:                if (name.equalsIgnoreCase("acquiretimeout")) {
253:                    return new Integer(_acquireTimeout);
254:                }
255:                return super .getPreference(name);
256:            }
257:
258:            public boolean configure(Configurable configurable) {
259:                return false;
260:            }
261:
262:            public void deleteConfiguration(Configurable configurable) {
263:            }
264:
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.