org.springframework.jdbc.datasource

Class AbstractDataSource

  • java.lang.Object
    • org.springframework.jdbc.datasource.AbstractDataSource
  • All Implemented Interfaces:
    java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.DataSource
    Direct Known Subclasses:
    AbstractDriverBasedDataSource, AbstractRoutingDataSource


    public abstract class AbstractDataSource
    extends java.lang.Object
    implements javax.sql.DataSource
    Abstract base class for Spring's DataSource implementations, taking care of the padding.

    'Padding' in the context of this class means default implementations for certain methods from the DataSource interface, such as getLoginTimeout(), setLoginTimeout(int), and so forth.

    Since:
    07.05.2003
    Author:
    Juergen Hoeller
    See Also:
    DriverManagerDataSource
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected Log logger
      Logger available to subclasses.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getLoginTimeout()
      Returns 0, indicating the default system timeout is to be used.
      java.io.PrintWriter getLogWriter()
      LogWriter methods are not supported.
      java.util.logging.Logger getParentLogger() 
      boolean isWrapperFor(java.lang.Class<?> iface) 
      void setLoginTimeout(int timeout)
      Setting a login timeout is not supported.
      void setLogWriter(java.io.PrintWriter pw)
      LogWriter methods are not supported.
      <T> T unwrap(java.lang.Class<T> iface) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.sql.DataSource

        getConnection, getConnection
    • Field Detail

      • logger

        protected final Log logger
        Logger available to subclasses.
    • Constructor Detail

      • AbstractDataSource

        public AbstractDataSource()
    • Method Detail

      • getLoginTimeout

        public int getLoginTimeout()
                            throws java.sql.SQLException
        Returns 0, indicating the default system timeout is to be used.
        Specified by:
        getLoginTimeout in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLException
      • setLoginTimeout

        public void setLoginTimeout(int timeout)
                             throws java.sql.SQLException
        Setting a login timeout is not supported.
        Specified by:
        setLoginTimeout in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLException
      • getLogWriter

        public java.io.PrintWriter getLogWriter()
        LogWriter methods are not supported.
        Specified by:
        getLogWriter in interface javax.sql.CommonDataSource
      • setLogWriter

        public void setLogWriter(java.io.PrintWriter pw)
                          throws java.sql.SQLException
        LogWriter methods are not supported.
        Specified by:
        setLogWriter in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLException
      • unwrap

        public <T> T unwrap(java.lang.Class<T> iface)
                     throws java.sql.SQLException
        Specified by:
        unwrap in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • isWrapperFor

        public boolean isWrapperFor(java.lang.Class<?> iface)
                             throws java.sql.SQLException
        Specified by:
        isWrapperFor in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • getParentLogger

        public java.util.logging.Logger getParentLogger()
        Specified by:
        getParentLogger in interface javax.sql.CommonDataSource