author | darcy |
Thu, 01 Nov 2018 20:37:45 -0700 | |
changeset 52380 | 6b31efbf833e |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
35277 | 2 |
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package javax.sql; |
|
27 |
||
28 |
import java.sql.SQLException; |
|
6540 | 29 |
import java.sql.SQLFeatureNotSupportedException; |
35277 | 30 |
import java.sql.ShardingKeyBuilder; |
6540 | 31 |
import java.util.logging.Logger; |
2 | 32 |
|
33 |
/** |
|
34 |
* Interface that defines the methods which are common between <code>DataSource</code>, |
|
35 |
* <code>XADataSource</code> and <code>ConnectionPoolDataSource</code>. |
|
20880
1b610151b316
8026812: doclint clean up for java.sql and javax.sql
lancea
parents:
18564
diff
changeset
|
36 |
* |
24968
3308660aa3f2
8046389: Add missing @since tag under javax.sql.**
henryjen
parents:
20880
diff
changeset
|
37 |
* @since 1.6 |
2 | 38 |
*/ |
39 |
public interface CommonDataSource { |
|
40 |
||
6540 | 41 |
/** |
42 |
* <p>Retrieves the log writer for this <code>DataSource</code> |
|
43 |
* object. |
|
44 |
* |
|
45 |
* <p>The log writer is a character output stream to which all logging |
|
46 |
* and tracing messages for this data source will be |
|
47 |
* printed. This includes messages printed by the methods of this |
|
48 |
* object, messages printed by methods of other objects manufactured |
|
49 |
* by this object, and so on. Messages printed to a data source |
|
50 |
* specific log writer are not printed to the log writer associated |
|
51 |
* with the <code>java.sql.DriverManager</code> class. When a |
|
52 |
* <code>DataSource</code> object is |
|
53 |
* created, the log writer is initially null; in other words, the |
|
54 |
* default is for logging to be disabled. |
|
55 |
* |
|
56 |
* @return the log writer for this data source or null if |
|
57 |
* logging is disabled |
|
58 |
* @exception java.sql.SQLException if a database access error occurs |
|
59 |
* @see #setLogWriter |
|
60 |
*/ |
|
61 |
java.io.PrintWriter getLogWriter() throws SQLException; |
|
62 |
||
63 |
/** |
|
64 |
* <p>Sets the log writer for this <code>DataSource</code> |
|
65 |
* object to the given <code>java.io.PrintWriter</code> object. |
|
66 |
* |
|
67 |
* <p>The log writer is a character output stream to which all logging |
|
68 |
* and tracing messages for this data source will be |
|
69 |
* printed. This includes messages printed by the methods of this |
|
70 |
* object, messages printed by methods of other objects manufactured |
|
71 |
* by this object, and so on. Messages printed to a data source- |
|
72 |
* specific log writer are not printed to the log writer associated |
|
73 |
* with the <code>java.sql.DriverManager</code> class. When a |
|
74 |
* <code>DataSource</code> object is created the log writer is |
|
75 |
* initially null; in other words, the default is for logging to be |
|
76 |
* disabled. |
|
77 |
* |
|
78 |
* @param out the new log writer; to disable logging, set to null |
|
79 |
* @exception SQLException if a database access error occurs |
|
80 |
* @see #getLogWriter |
|
81 |
*/ |
|
82 |
void setLogWriter(java.io.PrintWriter out) throws SQLException; |
|
2 | 83 |
|
6540 | 84 |
/** |
85 |
* <p>Sets the maximum time in seconds that this data source will wait |
|
86 |
* while attempting to connect to a database. A value of zero |
|
87 |
* specifies that the timeout is the default system timeout |
|
88 |
* if there is one; otherwise, it specifies that there is no timeout. |
|
89 |
* When a <code>DataSource</code> object is created, the login timeout is |
|
90 |
* initially zero. |
|
91 |
* |
|
92 |
* @param seconds the data source login time limit |
|
93 |
* @exception SQLException if a database access error occurs. |
|
94 |
* @see #getLoginTimeout |
|
95 |
*/ |
|
96 |
void setLoginTimeout(int seconds) throws SQLException; |
|
2 | 97 |
|
6540 | 98 |
/** |
99 |
* Gets the maximum time in seconds that this data source can wait |
|
100 |
* while attempting to connect to a database. A value of zero |
|
101 |
* means that the timeout is the default system timeout |
|
102 |
* if there is one; otherwise, it means that there is no timeout. |
|
103 |
* When a <code>DataSource</code> object is created, the login timeout is |
|
104 |
* initially zero. |
|
105 |
* |
|
106 |
* @return the data source login time limit |
|
107 |
* @exception SQLException if a database access error occurs. |
|
108 |
* @see #setLoginTimeout |
|
109 |
*/ |
|
110 |
int getLoginTimeout() throws SQLException; |
|
2 | 111 |
|
6540 | 112 |
//------------------------- JDBC 4.1 ----------------------------------- |
2 | 113 |
|
6540 | 114 |
/** |
115 |
* Return the parent Logger of all the Loggers used by this data source. This |
|
116 |
* should be the Logger farthest from the root Logger that is |
|
117 |
* still an ancestor of all of the Loggers used by this data source. Configuring |
|
118 |
* this Logger will affect all of the log messages generated by the data source. |
|
119 |
* In the worst case, this may be the root Logger. |
|
120 |
* |
|
121 |
* @return the parent Logger for this data source |
|
18564 | 122 |
* @throws SQLFeatureNotSupportedException if the data source does not use |
123 |
* {@code java.util.logging} |
|
6540 | 124 |
* @since 1.7 |
125 |
*/ |
|
126 |
public Logger getParentLogger() throws SQLFeatureNotSupportedException; |
|
35277 | 127 |
|
128 |
//------------------------- JDBC 4.3 ----------------------------------- |
|
129 |
||
130 |
/** |
|
131 |
* Creates a new {@code ShardingKeyBuilder} instance |
|
132 |
* @implSpec |
|
133 |
* The default implementation will throw a {@code SQLFeatureNotSupportedException}. |
|
134 |
* @return The ShardingKeyBuilder instance that was created |
|
135 |
* @throws SQLException if an error occurs creating the builder |
|
136 |
* @throws SQLFeatureNotSupportedException if the driver does not support this method |
|
137 |
* @since 9 |
|
138 |
* @see ShardingKeyBuilder |
|
139 |
*/ |
|
140 |
default ShardingKeyBuilder createShardingKeyBuilder() throws SQLException { |
|
141 |
throw new SQLFeatureNotSupportedException("createShardingKeyBuilder not implemented"); |
|
142 |
}; |
|
2 | 143 |
} |