KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > mbean > config > ManagedJDBCConnectionPool


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.server.core.mbean.config;
25
26 //JMX imports
27
import javax.management.*;
28
29 //Config imports
30
import com.sun.enterprise.config.ConfigException;
31 import com.sun.enterprise.config.serverbeans.ServerTags;
32 import com.sun.enterprise.config.serverbeans.ServerXPathHelper;
33
34 //Admin imports
35
import com.sun.enterprise.admin.common.ObjectNames;
36 import com.sun.enterprise.admin.common.exception.MBeanConfigException;
37 import com.sun.enterprise.admin.common.constant.ConfigAttributeName;
38
39 /**
40     This Config MBean represents a JDBC Connection Pool resource.
41     It extends ConfigMBeanBase class which provides get/set attribute(s) and getMBeanInfo services according to text descriptions.
42     ObjectName of this MBean is:
43         ias: type=jdbcpool, instance-name=<instance-name>, name=<resource-name>
44 */

45 public class ManagedJDBCConnectionPool extends ConfigMBeanBase implements ConfigAttributeName.JDBCConnectionPool
46 {
47     /**
48      * MAPLIST array defines mapping between "external" name and its location in XML relatively base node
49      */

50     private static final String JavaDoc[][] MAPLIST = {
51        {kId , ATTRIBUTE + ServerTags.NAME },
52        {kDatasourceClassName , ATTRIBUTE + ServerTags.DATASOURCE_CLASSNAME},
53        {kResType , ATTRIBUTE + ServerTags.RES_TYPE },
54        {kMinConnectionsInPool , ATTRIBUTE + ServerTags.STEADY_POOL_SIZE },
55        {kMaxConnectionsInPool , ATTRIBUTE + ServerTags.MAX_POOL_SIZE },
56        {kMaxConnectionsWaitTime , ATTRIBUTE + ServerTags.MAX_WAIT_TIME_IN_MILLIS },
57        {kConnectionsIncrement , ATTRIBUTE + ServerTags.POOL_RESIZE_QUANTITY },
58        {kConnectionIdleTimeout , ATTRIBUTE + ServerTags.IDLE_TIMEOUT_IN_SECONDS },
59        {kTransactionIsolationLevel , ATTRIBUTE + ServerTags.TRANSACTION_ISOLATION_LEVEL },
60        {kIsIsolationLevelGuaranteed , ATTRIBUTE + ServerTags.IS_ISOLATION_LEVEL_GUARANTEED },
61        {kIsConnectionValidationRequired , ATTRIBUTE + ServerTags.IS_CONNECTION_VALIDATION_REQUIRED },
62        {kConnectionValidation , ATTRIBUTE + ServerTags.CONNECTION_VALIDATION_METHOD },
63        {kValidationTableName , ATTRIBUTE + ServerTags.VALIDATION_TABLE_NAME },
64        {kFailAllConnections , ATTRIBUTE + ServerTags.FAIL_ALL_CONNECTIONS },
65        {kDescription , ATTRIBUTE + PSEUDO_ATTR_DESCRIPTION},
66       };
67
68      /**
69      * ATTRIBUTES array specifies attributes descriptions in format defined for MBeanEasyConfig
70      */

71     private static final String JavaDoc[] ATTRIBUTES = {
72         kId + " ,String, R" ,
73         kDatasourceClassName + ", String, RW" ,
74         kResType + " ,String, RW" ,
75         kMinConnectionsInPool + " ,int, RW" ,
76         kMaxConnectionsInPool + " ,int, RW" ,
77         kMaxConnectionsWaitTime + " ,int, RW" ,
78         kConnectionsIncrement + " ,int, RW" ,
79         kConnectionIdleTimeout + " ,int, RW" ,
80         kTransactionIsolationLevel + " ,String, RW" ,
81         kIsIsolationLevelGuaranteed + " ,boolean, RW" ,
82         kIsConnectionValidationRequired + " ,boolean, RW" ,
83         kConnectionValidation + " ,String, RW" ,
84         kValidationTableName + " ,String, RW" ,
85         kFailAllConnections + " ,boolean, RW" ,
86         kDescription + ", String, RW" ,
87        };
88
89     /**
90      * OPERATIONS array specifies operations descriptions in format defined for MBeanEasyConfig
91      */

92     private static final String JavaDoc[] OPERATIONS = null;
93
94     /**
95         Default constructor sets MBean description tables
96     */

97     public ManagedJDBCConnectionPool() throws MBeanConfigException
98     {
99         this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS);
100     }
101
102     /**
103         Constructs Config MBean for JDBC Connection Pool Resource.
104         @param instanceName The server instance name.
105         @param poolId Id for given pool
106     */

107     public ManagedJDBCConnectionPool(String JavaDoc instanceName, String JavaDoc poolId) throws MBeanConfigException
108     {
109         this(); //set description tables
110
initialize(ObjectNames.kJdbcConnectionPoolType, new String JavaDoc[]{instanceName, poolId});
111     }
112
113 }
114
Popular Tags