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: * Initial developer(s): Eric HARDESTY
022: * --------------------------------------------------------------------------
023: * $Id: MCFData.java 3343 2003-09-18 16:26:39Z ehardesty $
024: * --------------------------------------------------------------------------
025: */
026: package org.objectweb.jonas.jdbc;
027:
028: import java.util.Enumeration;
029: import java.util.Properties;
030:
031: public class MCFData {
032:
033: /* Properties object to hold all MCF config information */
034: Properties mcfData = null;
035:
036: public static String dsMethodNames[] = { "setDSClass",
037: "setDbSpecificMethods", "setDatabaseName",
038: "setDataSourceName", "setDescription", "setPortNumber",
039: "setServerName", "setURL", "setUser", "setPassword",
040: "setLoginTimeout", "setIsolationLevel",
041: "setInitialPoolSize", "setMinPoolSize", "setMaxIdleTime",
042: "setMaxPoolSize", "setMaxStatements", "setPropertyCycle",
043: "setMapperName", "setLogTopic", "setConnCheckLevel",
044: "setConnMaxAge", "setConnTestStmt", };
045: // Config properties for JDBC drivers
046: public static final int DSCLASS = 0;
047: public static final int DBSPECIFICMETHODS = 1;
048: public static final int DATABASENAME = 2;
049: public static final int DATASOURCENAME = 3;
050: public static final int DESCRIPTION = 4;
051: public static final int PORTNUMBER = 5;
052: public static final int SERVERNAME = 6;
053: public static final int URL = 7;
054: public static final int USER = 8;
055: public static final int PASSWORD = 9;
056: public static final int LOGINTIMEOUT = 10;
057: public static final int ISOLATIONLEVEL = 11;
058:
059: // Config values for JDBC 3.0
060: public static final int INITIALPOOLSIZE = 12;
061: public static final int MINPOOLSIZE = 13;
062: public static final int MAXIDLETIME = 14;
063: public static final int MAXPOOLSIZE = 15;
064: public static final int MAXSTATEMENTS = 16;
065: public static final int PROPERTYCYCLE = 17;
066:
067: //This must be set to the last nonJOnAS config item
068: public static final int JONASOFFSET = 17;
069:
070: // JOnAS specific items
071: // Config values for CMP 2.0 use with JORM
072: public static final int MAPPERNAME = 18;
073:
074: // Config values for JOnAS logger
075: public static final int LOGTOPIC = 19;
076:
077: // Config values for JOnAS connection testing
078: public static final int CONNCHECKLEVEL = 20;
079: public static final int CONNMAXAGE = 21;
080: public static final int CONNTESTSTMT = 22;
081:
082: public MCFData() {
083: mcfData = new Properties();
084: }
085:
086: public boolean equals(Object obj) {
087: if (obj instanceof MCFData) {
088: return mcfData.equals(((MCFData) obj).mcfData);
089: } else {
090: return false;
091: }
092: }
093:
094: /* Return the specified property */
095: public String getMCFData(int prop) {
096: return mcfData.getProperty("" + prop);
097: }
098:
099: public int hashCode() {
100: return mcfData.hashCode();
101: }
102:
103: /* Set the specified property/value combination */
104: public void setMCFData(int prop, String val) {
105: mcfData.setProperty("" + prop, val);
106: }
107:
108: public String getProperty(String key) {
109: return mcfData.getProperty(key);
110: }
111:
112: public Enumeration getProperties() {
113: return mcfData.propertyNames();
114: }
115:
116: }
|