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  
28  /**
29   * @author dberry
30   */
31  public abstract class AbstractDataSource extends AbstractDataSourceInfo implements DataSource {
32  
33    private PrintWriter printWriter_ = null;
34    private int timeout_ = 0;
35  
36    public AbstractDataSource(String dataSourceName) {
37      super(dataSourceName);
38    }
39  
40    public AbstractDataSource(String className, SortedMap<String, String> properties) {
41      super(className, properties);
42    }
43  
44    public AbstractDataSource(String className, Properties properties) {
45      super(className, properties);
46    }
47  
48    @Override
49    public Connection getConnection(String userName, String password) throws SQLException {
50      throw new UnsupportedOperationException("Not supported yet.");
51    }
52  
53    @Override
54    public PrintWriter getLogWriter() throws SQLException {
55      return printWriter_;
56    }
57  
58    @Override
59    public void setLogWriter(PrintWriter out) throws SQLException {
60      printWriter_ = out;
61    }
62  
63    @Override
64    public void setLoginTimeout(int seconds) throws SQLException {
65      timeout_ = seconds;
66    }
67  
68    @Override
69    public int getLoginTimeout() throws SQLException {
70      return timeout_;
71    }
72  
73    @Override
74    public <T> T unwrap(Class<T> iface) throws SQLException {
75      throw new UnsupportedOperationException("Not supported yet.");
76    }
77  
78    @Override
79    public boolean isWrapperFor(Class<?> iface) throws SQLException {
80      return false;
81    }
82  }