1 /* 2 * Copyright 2002-2006 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.jdbc.datasource; 18 19 import java.io.PrintWriter; 20 import java.sql.SQLException; 21 22 import javax.sql.DataSource; 23 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 27 /** 28 * Abstract base class for Spring's DataSource implementations, 29 * taking care of the padding. 30 * 31 * @author Juergen Hoeller 32 * @since 07.05.2003 33 * @see DriverManagerDataSource 34 */ 35 public abstract class AbstractDataSource implements DataSource { 36 37 /** Logger available to subclasses */ 38 protected final Log logger = LogFactory.getLog(getClass()); 39 40 41 /** 42 * Returns 0, indicating to use the default system timeout. 43 */ 44 public int getLoginTimeout() throws SQLException { 45 return 0; 46 } 47 48 /** 49 * Setting a login timeout is not supported. 50 */ 51 public void setLoginTimeout(int timeout) throws SQLException { 52 throw new UnsupportedOperationException("setLoginTimeout"); 53 } 54 55 /** 56 * LogWriter methods are not supported. 57 */ 58 public PrintWriter getLogWriter() { 59 throw new UnsupportedOperationException("getLogWriter"); 60 } 61 62 /** 63 * LogWriter methods are not supported. 64 */ 65 public void setLogWriter(PrintWriter pw) throws SQLException { 66 throw new UnsupportedOperationException("setLogWriter"); 67 } 68 69 } 70