001: /**
002: * Speedo: an implementation of JDO compliant personality on top of JORM generic
003: * I/O sub-system.
004: * Copyright (C) 2001-2004 France Telecom R&D
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 of the License, or (at your option) 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 USA
019: *
020: *
021: *
022: * Contact: speedo@objectweb.org
023: *
024: * Authors: S.Chassande-Barrioz.
025: *
026: */package org.objectweb.speedo.jmx.mbeans;
027:
028: import org.objectweb.perseus.pool.api.Pool;
029: import org.objectweb.perseus.pool.api.PoolAttributes;
030: import org.objectweb.speedo.api.SpeedoProperties;
031: import org.objectweb.speedo.pm.api.POManagerFactoryItf;
032:
033: import java.util.Collection;
034:
035: /**
036: *
037: *
038: * @author S.Chassande-Barrioz
039: */
040: public class Connection implements ConnectionMBean {
041:
042: private POManagerFactoryItf pmf;
043: private PoolAttributes pa;
044: private Pool pool;
045:
046: public Connection(PoolAttributes pa, Pool pool,
047: POManagerFactoryItf pmf) {
048: this .pa = pa;
049: this .pool = pool;
050: this .pmf = pmf;
051: }
052:
053: // IMPLEMENTS THE ConnectionMBean INTERFACE //
054: //------------------------------------------//
055:
056: public int getPool_Of_Connection_MaxSize() {
057: return pa.getMaxSize();
058: }
059:
060: public void setPool_Of_Connection_MaxSize(int arg0)
061: throws Exception {
062: pa.setMaxSize(arg0);
063: }
064:
065: public int getPool_Of_Connection_MinSize() {
066: return pa.getMinSize();
067: }
068:
069: public void setPool_Of_Connection_MinSize(int arg0)
070: throws Exception {
071: pa.setMinSize(arg0);
072: }
073:
074: public long getPool_Of_Connection_Timeout() {
075: return pa.getTimeout();
076: }
077:
078: public void setPool_Of_Connection_Timeout(long arg0) {
079: pa.setTimeout(arg0);
080: }
081:
082: public long getPool_Of_Connection_TTL() {
083: return pa.getTTL();
084: }
085:
086: public void setPool_Of_Connection_TTL(long arg0) {
087: pa.setTTL(arg0);
088: }
089:
090: public int getPool_Of_Connection_Current_Size() {
091: return pool.getSize();
092: }
093:
094: public int getPool_Of_Connection_Current_Free_Number() {
095: return pool.getFreeResourceNumber();
096: }
097:
098: public int getPool_Of_Connection_Current_Used_Number() {
099: return pool.getUsedResourceNumber();
100: }
101:
102: public Collection getPool_Of_Connection_User() {
103: return pool.getUsers();
104: }
105:
106: public String getConnectionFactoryName() {
107: return pmf.getProperties().getProperty(
108: SpeedoProperties.JDO_OPTION_CONNECTION_FACTORY_NAME);
109: }
110:
111: public String getJDBC_Connection_DriverClass() {
112: return pmf.getProperties().getProperty(
113: SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME);
114: }
115:
116: public String getJDBC_Connection_URL() {
117: return pmf.getProperties().getProperty(
118: SpeedoProperties.JDO_OPTION_CONNECTION_URL);
119: }
120:
121: public String getJDBC_Connection_User() {
122: return pmf.getProperties().getProperty(
123: SpeedoProperties.JDO_OPTION_CONNECTION_USER_NAME);
124: }
125:
126: public String getJDBC_Connection_MapperName() {
127: return pmf.getProperties().getProperty(
128: SpeedoProperties.MAPPER_NAME);
129: }
130: }
|