View Javadoc
1   /*
2    * Copyright (C) 2003-2012 David E. Berry
3    *
4    * This library is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Lesser General Public
6    * License as published by the Free Software Foundation; either
7    * version 2.1 of the License, or (at your option) any later version.
8    *
9    * This library is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this library; if not, write to the Free Software
16   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17   *
18   * A copy of the GNU Lesser General Public License may also be found at
19   * http://www.gnu.org/licenses/lgpl.txt
20   */
21  package org.synchronoss.cpo.jdbc;
22  
23  import javax.sql.DataSource;
24  import java.io.PrintWriter;
25  import java.sql.*;
26  import java.util.*;
27  import java.util.logging.Logger;
28  
29  /**
30   * @author dberry
31   */
32  public abstract class AbstractJdbcDataSource extends AbstractJdbcDataSourceInfo implements DataSource {
33  
34    private PrintWriter printWriter_ = null;
35    private int timeout_ = 0;
36  
37    public AbstractJdbcDataSource(String dataSourceName) {
38      super(dataSourceName);
39    }
40  
41    public AbstractJdbcDataSource(String className, SortedMap<String, String> properties) {
42      super(className, properties);
43    }
44  
45    public AbstractJdbcDataSource(String className, Properties properties) {
46      super(className, properties);
47    }
48  
49    @Override
50    public Connection getConnection(String userName, String password) throws SQLException {
51      throw new UnsupportedOperationException("Not supported yet.");
52    }
53  
54    @Override
55    public PrintWriter getLogWriter() throws SQLException {
56      return printWriter_;
57    }
58  
59    @Override
60    public void setLogWriter(PrintWriter out) throws SQLException {
61      printWriter_ = out;
62    }
63  
64    @Override
65    public void setLoginTimeout(int seconds) throws SQLException {
66      timeout_ = seconds;
67    }
68  
69    @Override
70    public int getLoginTimeout() throws SQLException {
71      return timeout_;
72    }
73  
74    @Override
75    public <T> T unwrap(Class<T> iface) throws SQLException {
76      throw new UnsupportedOperationException("Not supported yet.");
77    }
78  
79    @Override
80    public boolean isWrapperFor(Class<?> iface) throws SQLException {
81      return false;
82    }
83  
84    // Cannot use @Override if you want this to build in java 6
85    @Override
86    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
87      throw new SQLFeatureNotSupportedException();
88    }
89  }