History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/javax/sql/CommonDataSource.java (1 of 18352 files). Show all

Unified · Split

java/pkg/javax/sql/CommonDataSource.java+129−0
@@ -0,0 +1,129 @@
1+/*
2+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
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
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
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+ *
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.
24+ */
25+
26+package javax.sql;
27+
28+import java.sql.SQLException;
29+import java.io.PrintWriter;
30+import java.sql.SQLFeatureNotSupportedException;
31+import java.util.logging.Logger;
32+
33+/**
34+ * Interface that defines the methods which are common between <code>DataSource</code>,
35+ * <code>XADataSource</code> and <code>ConnectionPoolDataSource</code>.
36+ *<p>
37+ */
38+public interface CommonDataSource {
39+
40+ /**
41+ * <p>Retrieves the log writer for this <code>DataSource</code>
42+ * object.
43+ *
44+ * <p>The log writer is a character output stream to which all logging
45+ * and tracing messages for this data source will be
46+ * printed. This includes messages printed by the methods of this
47+ * object, messages printed by methods of other objects manufactured
48+ * by this object, and so on. Messages printed to a data source
49+ * specific log writer are not printed to the log writer associated
50+ * with the <code>java.sql.DriverManager</code> class. When a
51+ * <code>DataSource</code> object is
52+ * created, the log writer is initially null; in other words, the
53+ * default is for logging to be disabled.
54+ *
55+ * @return the log writer for this data source or null if
56+ * logging is disabled
57+ * @exception java.sql.SQLException if a database access error occurs
58+ * @see #setLogWriter
59+ * @since 1.4
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+ * @since 1.4
82+ */
83+ void setLogWriter(java.io.PrintWriter out) throws SQLException;
84+
85+ /**
86+ * <p>Sets the maximum time in seconds that this data source will wait
87+ * while attempting to connect to a database. A value of zero
88+ * specifies that the timeout is the default system timeout
89+ * if there is one; otherwise, it specifies that there is no timeout.
90+ * When a <code>DataSource</code> object is created, the login timeout is
91+ * initially zero.
92+ *
93+ * @param seconds the data source login time limit
94+ * @exception SQLException if a database access error occurs.
95+ * @see #getLoginTimeout
96+ * @since 1.4
97+ */
98+ void setLoginTimeout(int seconds) throws SQLException;
99+
100+ /**
101+ * Gets the maximum time in seconds that this data source can wait
102+ * while attempting to connect to a database. A value of zero
103+ * means that the timeout is the default system timeout
104+ * if there is one; otherwise, it means that there is no timeout.
105+ * When a <code>DataSource</code> object is created, the login timeout is
106+ * initially zero.
107+ *
108+ * @return the data source login time limit
109+ * @exception SQLException if a database access error occurs.
110+ * @see #setLoginTimeout
111+ * @since 1.4
112+ */
113+ int getLoginTimeout() throws SQLException;
114+
115+ //------------------------- JDBC 4.1 -----------------------------------
116+
117+ /**
118+ * Return the parent Logger of all the Loggers used by this data source. This
119+ * should be the Logger farthest from the root Logger that is
120+ * still an ancestor of all of the Loggers used by this data source. Configuring
121+ * this Logger will affect all of the log messages generated by the data source.
122+ * In the worst case, this may be the root Logger.
123+ *
124+ * @return the parent Logger for this data source
125+ * @throws SQLFeatureNotSupportedException if the data source does not use <code>java.util.logging<code>.
126+ * @since 1.7
127+ */
128+ public Logger getParentLogger() throws SQLFeatureNotSupportedException;
129+}