KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jdbc > MCFData


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s): Eric HARDESTY
22  * --------------------------------------------------------------------------
23  * $Id: MCFData.java,v 1.2 2003/09/18 16:26:39 ehardesty Exp $
24  * --------------------------------------------------------------------------
25  */

26 package org.objectweb.jonas.jdbc;
27
28 import java.util.Enumeration JavaDoc;
29 import java.util.Properties JavaDoc;
30
31 public class MCFData {
32
33     /* Properties object to hold all MCF config information */
34     Properties JavaDoc mcfData = null;
35     
36     public static String JavaDoc dsMethodNames[] = {
37         "setDSClass",
38         "setDbSpecificMethods",
39         "setDatabaseName",
40         "setDataSourceName",
41         "setDescription",
42         "setPortNumber",
43         "setServerName",
44         "setURL",
45         "setUser",
46         "setPassword",
47         "setLoginTimeout",
48         "setIsolationLevel",
49         "setInitialPoolSize",
50         "setMinPoolSize",
51         "setMaxIdleTime",
52         "setMaxPoolSize",
53         "setMaxStatements",
54         "setPropertyCycle",
55         "setMapperName",
56         "setLogTopic",
57         "setConnCheckLevel",
58         "setConnMaxAge",
59         "setConnTestStmt",
60     };
61     // Config properties for JDBC drivers
62
public static final int DSCLASS = 0;
63     public static final int DBSPECIFICMETHODS = 1;
64     public static final int DATABASENAME = 2;
65     public static final int DATASOURCENAME = 3;
66     public static final int DESCRIPTION = 4;
67     public static final int PORTNUMBER = 5;
68     public static final int SERVERNAME = 6;
69     public static final int URL = 7;
70     public static final int USER = 8;
71     public static final int PASSWORD = 9;
72     public static final int LOGINTIMEOUT = 10;
73     public static final int ISOLATIONLEVEL = 11;
74     
75     // Config values for JDBC 3.0
76
public static final int INITIALPOOLSIZE = 12;
77     public static final int MINPOOLSIZE = 13;
78     public static final int MAXIDLETIME = 14;
79     public static final int MAXPOOLSIZE = 15;
80     public static final int MAXSTATEMENTS = 16;
81     public static final int PROPERTYCYCLE = 17;
82
83     //This must be set to the last nonJOnAS config item
84
public static final int JONASOFFSET = 17;
85
86     // JOnAS specific items
87
// Config values for CMP 2.0 use with JORM
88
public static final int MAPPERNAME = 18;
89     
90     // Config values for JOnAS logger
91
public static final int LOGTOPIC = 19;
92     
93     // Config values for JOnAS connection testing
94
public static final int CONNCHECKLEVEL = 20;
95     public static final int CONNMAXAGE = 21;
96     public static final int CONNTESTSTMT = 22;
97     
98
99     public MCFData() {
100         mcfData = new Properties JavaDoc();
101     }
102
103
104     public boolean equals(Object JavaDoc obj) {
105         if (obj instanceof MCFData) {
106             return mcfData.equals(((MCFData)obj).mcfData);
107         } else {
108             return false;
109         }
110     }
111
112     /* Return the specified property */
113     public String JavaDoc getMCFData(int prop) {
114         return mcfData.getProperty(""+prop);
115     }
116
117     public int hashCode() {
118         return mcfData.hashCode();
119     }
120
121     /* Set the specified property/value combination */
122     public void setMCFData(int prop, String JavaDoc val) {
123         mcfData.setProperty(""+prop, val);
124     }
125     
126     public String JavaDoc getProperty(String JavaDoc key) {
127         return mcfData.getProperty(key);
128     }
129
130     public Enumeration JavaDoc getProperties() {
131         return mcfData.propertyNames();
132     }
133
134 }
Popular Tags