KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > support > ConnectionFactory


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 /*
25  * ConnectionFactory.java
26  *
27  * Created on March 7, 2000, 5:09 PM
28  */

29  
30 package com.sun.jdo.api.persistence.support;
31
32 import java.lang.String JavaDoc;
33 import java.io.PrintWriter JavaDoc;
34 import java.sql.Connection JavaDoc;
35
36 /**
37  *
38  * @author Craig Russell
39  * @version 0.1
40  */

41 public interface ConnectionFactory {
42   
43   /**
44    * Returns java.sql.Connection
45    * @return connection as java.sql.Connection
46    */

47   Connection JavaDoc getConnection();
48
49   /**
50    * Sets JDBC driver name
51    * @param driverName JDBC driver name
52    */

53   void setDriverName (String JavaDoc driverName);
54
55   /**
56    * Returns JDBC driver name
57    * @return driver name
58    */

59   String JavaDoc getDriverName ();
60   
61   /**
62    * Sets JDBC connection URL
63    * @param URL connection URL
64    */

65   void setURL (String JavaDoc URL);
66
67   /**
68    * Returns connection URL
69    * @return connection URL
70    */

71   String JavaDoc getURL ();
72   
73   /**
74    * Sets database user
75    * @param userName database user
76    */

77   void setUserName (String JavaDoc userName);
78
79   /**
80    * Returns database user name
81    * @return current database user name
82    */

83   String JavaDoc getUserName ();
84   
85   /**
86    * Sets database user password
87    * @param password database user password
88    */

89   void setPassword (String JavaDoc password);
90   
91   /**
92    * Sets minimum number of connections in the connection pool
93    * @param minPool minimum number of connections
94    */

95   void setMinPool (int minPool);
96
97   /**
98    * Returns minimum number of connections in the connection pool
99    * @return connection minPool
100    */

101   int getMinPool ();
102   
103   /**
104    * Sets maximum number of connections in the connection pool
105    * @param maxPool maximum number of connections
106    */

107   void setMaxPool (int maxPool);
108
109   /**
110    * Returns maximum number of connections in the connection pool
111    * @return connection maxPool
112    */

113   int getMaxPool ();
114   
115   /**
116    * Sets the amount of time, in milliseconds, between the connection
117    * manager's attempts to get a pooled connection.
118    * @param msInterval the interval between attempts to get a database
119    * connection, in milliseconds.
120    *
121    */

122   void setMsInterval (int msInterval);
123
124   /**
125    * Returns the amount of time, in milliseconds, between the connection
126    * manager's attempts to get a pooled connection.
127    * @return the length of the interval between tries in milliseconds
128    */

129   int getMsInterval ();
130   
131   /**
132    * Sets the number of milliseconds to wait for an available connection
133    * from the connection pool before throwing an exception
134    * @param msWait number in milliseconds
135    */

136   void setMsWait (int msWait);
137
138   /**
139    * Returns the number of milliseconds to wait for an available connection
140    * from the connection pool before throwing an exception
141    * @return number in milliseconds
142    */

143   int getMsWait ();
144   
145   /**
146    * Sets the LogWriter to which messages should be sent
147    * @param pw logWriter
148    */

149   void setLogWriter (PrintWriter JavaDoc logWriter);
150
151   /**
152    * Returns the LogWriter to which messages should be sent
153    * @return logWriter
154    */

155   PrintWriter JavaDoc getLogWriter ();
156  
157   /**
158    * Sets the number of seconds to wait for a new connection to be
159    * established to the data source
160    * @param loginTimeout wait time in seconds
161    */

162   void setLoginTimeout (int loginTimeout);
163
164   /**
165    * Returns the number of seconds to wait for a new connection to be
166    * established to the data source
167    * @return wait time in seconds
168    */

169   int getLoginTimeout ();
170
171   /**
172    * Sets transaction isolation level for all connections of this ConnectionFactory.
173    * All validation is done by java.sql.Connection itself, so e.g. while Oracle
174    * will not allow to set solation level to TRANSACTION_REPEATABLE_READ, this method
175    * does not have any explicit restrictions
176    *
177    * @param level - one of the java.sql.Connection.TRANSACTION_* isolation values
178    */

179   void setTransactionIsolation (int level);
180
181   /**
182    * Returns current transaction isolation level for connections of this ConnectionFactory.
183    * @return the current transaction isolation mode value as java.sql.Connection.TRANSACTION_*
184    */

185   int getTransactionIsolation ();
186 }
187
Popular Tags