MCFData.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * Initial developer(s): Eric HARDESTY
00022  * --------------------------------------------------------------------------
00023  * $Id: MCFData.java,v 1.2 2003/09/18 16:26:39 ehardesty Exp $
00024  * --------------------------------------------------------------------------
00025  */
00026 package org.objectweb.jonas.jdbc;
00027 
00028 import java.util.Enumeration;
00029 import java.util.Properties;
00030 
00031 public class MCFData {
00032 
00033     /* Properties object to hold all MCF config information */ 
00034     Properties mcfData = null;
00035     
00036     public static String dsMethodNames[] = { 
00037         "setDSClass",
00038         "setDbSpecificMethods",
00039         "setDatabaseName",
00040         "setDataSourceName",
00041         "setDescription",
00042         "setPortNumber",
00043         "setServerName",
00044         "setURL",
00045         "setUser",
00046         "setPassword",
00047         "setLoginTimeout",
00048         "setIsolationLevel",
00049         "setInitialPoolSize",
00050         "setMinPoolSize",
00051         "setMaxIdleTime",
00052         "setMaxPoolSize",
00053         "setMaxStatements",
00054         "setPropertyCycle",
00055         "setMapperName",
00056         "setLogTopic",
00057         "setConnCheckLevel",
00058         "setConnMaxAge",
00059         "setConnTestStmt",
00060     };
00061     // Config properties for JDBC drivers 
00062     public static final int DSCLASS           =  0;
00063     public static final int DBSPECIFICMETHODS =  1;
00064     public static final int DATABASENAME      =  2;
00065     public static final int DATASOURCENAME    =  3;
00066     public static final int DESCRIPTION       =  4;
00067     public static final int PORTNUMBER        =  5;
00068     public static final int SERVERNAME        =  6;
00069     public static final int URL               =  7;
00070     public static final int USER              =  8;
00071     public static final int PASSWORD          =  9;
00072     public static final int LOGINTIMEOUT      = 10;
00073     public static final int ISOLATIONLEVEL    = 11;
00074     
00075     // Config values for JDBC 3.0
00076     public static final int INITIALPOOLSIZE   = 12;
00077     public static final int MINPOOLSIZE       = 13;
00078     public static final int MAXIDLETIME       = 14;
00079     public static final int MAXPOOLSIZE       = 15;
00080     public static final int MAXSTATEMENTS     = 16;
00081     public static final int PROPERTYCYCLE     = 17;
00082 
00083     //This must be set to the last nonJOnAS config item
00084     public static final int JONASOFFSET       = 17;    
00085 
00086     // JOnAS specific items
00087     // Config values for CMP 2.0 use with JORM 
00088     public static final int MAPPERNAME        = 18;
00089     
00090     // Config values for JOnAS logger 
00091     public static final int LOGTOPIC          = 19;
00092     
00093     // Config values for JOnAS connection testing
00094     public static final int CONNCHECKLEVEL    = 20;
00095     public static final int CONNMAXAGE        = 21;
00096     public static final int CONNTESTSTMT      = 22;
00097     
00098 
00099     public MCFData() {
00100         mcfData = new Properties();
00101     }
00102 
00103 
00104     public boolean equals(Object obj) {
00105         if (obj instanceof MCFData) {
00106             return mcfData.equals(((MCFData)obj).mcfData);
00107         } else {
00108             return false;
00109         }
00110     }
00111 
00112     /* Return the specified property */
00113     public String getMCFData(int prop) {
00114         return mcfData.getProperty(""+prop);
00115     }
00116 
00117     public int hashCode() {
00118         return mcfData.hashCode();
00119     }
00120 
00121     /* Set the specified property/value combination */
00122     public void setMCFData(int prop, String val) {
00123         mcfData.setProperty(""+prop, val);
00124     }
00125     
00126     public String getProperty(String key) {
00127         return mcfData.getProperty(key);
00128     }
00129 
00130     public Enumeration getProperties() {
00131         return mcfData.propertyNames();
00132     }
00133 
00134 }

Generated on Tue Feb 15 15:05:16 2005 for JOnAS by  doxygen 1.3.9.1