Source Code Cross Referenced for JCAConnectionFactory.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » resource » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.resource 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JCAConnectionFactory.java 7599 2005-10-25 12:28:06Z danesa $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.resource;
027:
028:        // JOnAS imports
029:        import java.util.Properties;
030:
031:        import org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject;
032:        import org.objectweb.jonas.resource.pool.api.Pool;
033:
034:        /**
035:         * MBean class for JCA Connection Factory Management
036:         *
037:         * @author Adriana Danes JSR 77 (J2EE Management Standard)
038:         *
039:         */
040:        public class JCAConnectionFactory extends J2EEManagedObject {
041:
042:            // JSR 77
043:            /**
044:             * Associated ManagedConnectionFactory
045:             */
046:            private String managedConnectionFactory = null;
047:
048:            // JOnAS Specific
049:            /**
050:             * Description
051:             */
052:            private String description = null;
053:            /**
054:             * Jndi name
055:             */
056:            private String jndiname = null;
057:            /**
058:             * Properties associated with the ConnectionFactory
059:             */
060:            private Properties prop = null;
061:
062:            /**
063:             * Associated connection manager
064:             */
065:            private ConnectionManagerImpl cm = null;
066:
067:            /**
068:             * Pool associated to the connection manager
069:             */
070:            private Pool pool = null;
071:
072:            private String fileName = null;
073:            /**
074:             * Value used as sequence number by reconfiguration notifications
075:             */
076:            private long sequenceNumber = 0;
077:
078:            /**
079:             * Constructor
080:             * @param objectName String of object name
081:             * @param jndiname   String of ConnectionFactory
082:             * @param prop       Properties of the ConnectionFactory
083:             * @param description  String of ConnectionFactory description
084:             */
085:            public JCAConnectionFactory(String objectName, String jndiname,
086:                    String fileName, Properties prop, String description,
087:                    ConnectionManagerImpl cm) {
088:                super (objectName);
089:                this .jndiname = jndiname;
090:                this .prop = prop;
091:                this .description = description;
092:                this .cm = cm;
093:                this .pool = cm.getPool();
094:                this .fileName = fileName;
095:            }
096:
097:            /**
098:             * return the description
099:             * @return String description
100:             */
101:            public String getDescription() {
102:                return description;
103:            }
104:
105:            /**
106:             * return the jndi name
107:             * @return String jndi name
108:             */
109:            public String getJndiName() {
110:                return jndiname;
111:            }
112:
113:            /**
114:             * Return the ManagedConnectionFactory object name
115:             * @return String of ManagedConnectionFactory name
116:             */
117:            public String getManagedConnectionFactory() {
118:                return managedConnectionFactory;
119:            }
120:
121:            /**
122:             * return the ConnectionFactory Properties
123:             * @return Properties ConnectionFactory properties
124:             */
125:            public Properties getProperties() {
126:                return prop;
127:            }
128:
129:            /**
130:             * Set the ManagedConnectionFactory object name
131:             *
132:             * @param managedConnectionFactoryObjectName String to set
133:             */
134:            public void setManagedConnectionFactory(
135:                    String managedConnectionFactoryObjectName) {
136:                managedConnectionFactory = managedConnectionFactoryObjectName;
137:            }
138:
139:            // JDBC Connection Pool Configuration
140:
141:            /**
142:             * @return JDBC connection checking level
143:             */
144:            public Integer getJdbcConnCheckLevel() {
145:                return new Integer(cm.getCheckLevel());
146:            }
147:
148:            /**
149:             * Sets the JDBC connection checking level
150:             * @param level connection level
151:             */
152:            public void setJdbcConnCheckLevel(Integer level) {
153:                cm.setCheckLevel(level.intValue());
154:            }
155:
156:            /**
157:             * @return Connections maximum age
158:             */
159:            public Integer getConnMaxAge() {
160:                return new Integer(pool.getMaxAge());
161:            }
162:
163:            /**
164:             * @param mn Connections maximum age
165:             */
166:            public void setConnMaxAge(Integer mn) {
167:                pool.setMaxAge(mn.intValue());
168:            }
169:
170:            /**
171:             * @return max maximum size of connection pool
172:             */
173:            public Integer getMaxSize() {
174:                return new Integer(pool.getMaxSize());
175:            }
176:
177:            /**
178:             * @param max maximum size of connection pool
179:             */
180:            public void setMaxSize(Integer max) {
181:                try {
182:                    pool.setMaxSize(max.intValue());
183:                } catch (Exception ex) {
184:                }
185:            }
186:
187:            /**
188:             * @return maximum opening time of connections
189:             */
190:            public Integer getMaxOpentime() {
191:                return new Integer(pool.getMaxOpentime());
192:            }
193:
194:            /**
195:             * @param mn maximum opening time in minutes for connections
196:             */
197:            public void setMaxOpentime(Integer mn) {
198:                pool.setMaxOpentime(mn.intValue());
199:            }
200:
201:            /**
202:             * @return maximum nb of waiters allowed
203:             */
204:            public Integer getMaxWaiters() {
205:                return new Integer(pool.getMaxWaiters());
206:            }
207:
208:            /**
209:             * @param max maximum nb of waiters allowed
210:             */
211:            public void setMaxWaiters(Integer max) {
212:                pool.setMaxWaiters(max.intValue());
213:            }
214:
215:            /**
216:             * @return maximum time to wait for a connection, in seconds
217:             */
218:            public Integer getMaxWaitTime() {
219:                return new Integer(pool.getMaxWaitTime());
220:            }
221:
222:            /**
223:             * @param max maximum time to wait for a connection, in seconds
224:             */
225:            public void setMaxWaitTime(Integer max) {
226:                pool.setMaxWaitTime(max.intValue());
227:            }
228:
229:            /**
230:             * @return minimum size of connection pool
231:             */
232:            public Integer getMinSize() {
233:                return new Integer(pool.getMinSize());
234:            }
235:
236:            /**
237:             * @return initial size of connection pool
238:             */
239:            public Integer getInitSize() {
240:                return new Integer(pool.getInitSize());
241:            }
242:
243:            /**
244:             * MBean method allowing to set the minimum size of connection pool
245:             * @param min minimum size of connection pool
246:             */
247:            public void setMinSize(Integer min) {
248:                try {
249:                    pool.setMinSize(min.intValue());
250:                } catch (Exception ex) {
251:                }
252:            }
253:
254:            /**
255:             * @return sampling period for refresching pool statistics
256:             */
257:            public Integer getSamplingPeriod() {
258:                return new Integer(pool.getSamplingPeriod());
259:            }
260:
261:            /**
262:             * @param i sampling period for refresching pool statistics
263:             */
264:            public void setSamplingPeriod(Integer i) {
265:                pool.setSamplingPeriod(i.intValue());
266:            }
267:
268:            /**
269:             * @return SQL query for JDBC connections test
270:             */
271:            public String getJdbcTestStatement() {
272:                return cm.getTestStatement();
273:            }
274:
275:            /**
276:             * @param test SQL query for JDBC connections test
277:             */
278:            public void setJdbcTestStatement(String test) {
279:                cm.setTestStatement(test);
280:            }
281:
282:            // JDBC Connection Pool Statistics
283:
284:            /**
285:             * @return number of connection failures
286:             */
287:            public Integer getConnectionFailures() {
288:                return new Integer(pool.getConnectionFailures());
289:            }
290:
291:            /**
292:             * @return number of connection leaks
293:             */
294:            public Integer getConnectionLeaks() {
295:                return new Integer(pool.getConnectionLeaks());
296:            }
297:
298:            /**
299:             * @return number of busy connections
300:             */
301:            public Integer getCurrentBusy() {
302:                return new Integer(pool.getCurrentBusy());
303:            }
304:
305:            /**
306:             * @return number of busy connections
307:             */
308:            public Integer getBusyMax() {
309:                return new Integer(pool.getBusyMaxRecent());
310:            }
311:
312:            /**
313:             * @return number of busy connections
314:             */
315:            public Integer getBusyMin() {
316:                return new Integer(pool.getBusyMinRecent());
317:            }
318:
319:            /**
320:             * @return number of connections used in transactions
321:             */
322:            public Integer getCurrentInTx() {
323:                return new Integer(cm.getCurrentInTx());
324:            }
325:
326:            /**
327:             * @return number of opened connections
328:             */
329:            public Integer getCurrentOpened() {
330:                return new Integer(pool.getCurrentOpened());
331:            }
332:
333:            /**
334:             * @return current number of connection waiters
335:             */
336:            public Integer getCurrentWaiters() {
337:                return new Integer(pool.getCurrentWaiters());
338:            }
339:
340:            /**
341:             * @return number of opened physical JDBC connections
342:             */
343:            public Integer getOpenedCount() {
344:                return new Integer(pool.getOpenedCount());
345:            }
346:
347:            /**
348:             * @return number of open calls that were rejected because too many waiters
349:             */
350:            public Integer getRejectedFull() {
351:                return new Integer(pool.getRejectedFull());
352:            }
353:
354:            /**
355:             * @return total number of open calls that were rejected
356:             */
357:            public Integer getRejectedOpen() {
358:                return new Integer(pool.getRejectedOpen());
359:            }
360:
361:            /**
362:             * @return number of open calls that were rejected by an unknown reason
363:             */
364:            public Integer getRejectedOther() {
365:                return new Integer(pool.getRejectedOther());
366:            }
367:
368:            /**
369:             * @return number of open calls that were rejected by timeout
370:             */
371:            public Integer getRejectedTimeout() {
372:                return new Integer(pool.getRejectedTimeout());
373:            }
374:
375:            /**
376:             * @return number of xa connection served
377:             */
378:            public Integer getServedOpen() {
379:                return new Integer(pool.getServedOpen());
380:            }
381:
382:            /**
383:             * @return total number of waiters since datasource creation.
384:             */
385:            public Integer getWaiterCount() {
386:                return new Integer(pool.getWaiterCount());
387:            }
388:
389:            /**
390:             * @return Maximum number of waiters since datasource creation.
391:             */
392:            public Integer getWaitersHigh() {
393:                return new Integer(pool.getWaitersHigh());
394:            }
395:
396:            /**
397:             * @return Maximum nb of waiters in last sampling period
398:             */
399:            public Integer getWaitersHighRecent() {
400:                return new Integer(pool.getWaitersHighRecent());
401:            }
402:
403:            /**
404:             * @return Maximum waiting time (millisec) since datasource creation.
405:             */
406:            public Long getWaitingHigh() {
407:                return new Long(pool.getWaitingHigh());
408:            }
409:
410:            /**
411:             * @return Maximum waiting time (millisec) in last sampling period
412:             */
413:            public Long getWaitingHighRecent() {
414:                return new Long(pool.getWaitingHighRecent());
415:            }
416:
417:            /**
418:             * @return Total waiting time (millisec) since datasource creation.
419:             */
420:            public Long getWaitingTime() {
421:                return new Long(pool.getWaitingTime());
422:            }
423:
424:            /**
425:             * Gets the sequence number for reconfiguration opeartions
426:             * @return the sequence number for reconfiguration operations
427:             */
428:            protected long getSequenceNumber() {
429:                return ++sequenceNumber;
430:            }
431:
432:            /**
433:             * @return Returns the fileName.
434:             */
435:            public String getFileName() {
436:                return fileName;
437:            }
438:
439:            /**
440:             * @return Returns the PrepareStatement cache max size
441:             */
442:            public Integer getPstmtMax() {
443:                return new Integer(cm.getMaxPstmtPoolSize());
444:            }
445:
446:            /**
447:             *
448:             * @param size the PrepareStatement cache max size
449:             */
450:            public void setPstmtMax(Integer size) {
451:                cm.setMaxPstmtPoolSize(size.intValue());
452:            }
453:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.