KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > gjc > common > DataSourceSpec


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.gjc.common;
25
26 import java.util.Hashtable JavaDoc;
27
28 /**
29  * Encapsulate the DataSource object details obtained from
30  * ManagedConnectionFactory.
31  *
32  * @version 1.0, 02/07/23
33  * @author Binod P.G
34  */

35 public class DataSourceSpec implements java.io.Serializable JavaDoc{
36
37     public static final int USERNAME = 1;
38     public static final int PASSWORD = 2;
39     public static final int URL = 3;
40     public static final int LOGINTIMEOUT = 4;
41     public static final int LOGWRITER = 5;
42     public static final int DATABASENAME = 6;
43     public static final int DATASOURCENAME = 7;
44     public static final int DESCRIPTION = 8;
45     public static final int NETWORKPROTOCOL = 9;
46     public static final int PORTNUMBER = 10;
47     public static final int ROLENAME = 11;
48     public static final int SERVERNAME = 12;
49     public static final int MAXSTATEMENTS = 13;
50     public static final int INITIALPOOLSIZE = 14;
51     public static final int MINPOOLSIZE = 15;
52     public static final int MAXPOOLSIZE = 16;
53     public static final int MAXIDLETIME = 17;
54     public static final int PROPERTYCYCLE = 18;
55     public static final int DRIVERPROPERTIES = 19;
56     public static final int CLASSNAME = 20;
57     public static final int DELIMITER = 21;
58     
59     public static final int XADATASOURCE = 22;
60     public static final int DATASOURCE = 23;
61     public static final int CONNECTIONPOOLDATASOURCE = 24;
62       
63     //GJCINT
64
public static final int CONNECTIONVALIDATIONREQUIRED = 25;
65     public static final int VALIDATIONMETHOD = 26;
66     public static final int VALIDATIONTABLENAME = 27;
67     
68     public static final int TRANSACTIONISOLATION = 28;
69     public static final int GUARANTEEISOLATIONLEVEL = 29;
70             
71     private Hashtable JavaDoc details = new Hashtable JavaDoc();
72     
73     /**
74      * Set the property.
75      *
76      * @param property Property Name to be set.
77      * @param value Value of property to be set.
78      */

79     public void setDetail(int property, String JavaDoc value) {
80         details.put(new Integer JavaDoc(property),value);
81     }
82     
83     /**
84      * Get the value of property
85      *
86      * @return Value of the property.
87      */

88     public String JavaDoc getDetail(int property) {
89         if (details.containsKey(new Integer JavaDoc(property))) {
90             return (String JavaDoc) details.get(new Integer JavaDoc(property));
91         } else {
92             return null;
93         }
94     }
95     
96     /**
97      * Checks whether two <code>DataSourceSpec</code> objects
98      * are equal or not.
99      *
100      * @param obj Instance of <code>DataSourceSpec</code> object.
101      */

102     public boolean equals(Object JavaDoc obj) {
103         if (obj instanceof DataSourceSpec) {
104             return this.details.equals(((DataSourceSpec)obj).details);
105         }
106         return false;
107     }
108     
109     /**
110      * Retrieves the hashCode of this <code>DataSourceSpec</code> object.
111      *
112      * @return hashCode of this object.
113      */

114     public int hashCode() {
115         return this.details.hashCode();
116     }
117 }
118
Popular Tags