public class

DelegatingDataSource

extends Object
implements DataSource InitializingBean
java.lang.Object
   ↳ org.springframework.jdbc.datasource.DelegatingDataSource
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

JDBC javax.sql.DataSource implementation that delegates all calls to a given target javax.sql.DataSource.

This class is meant to be subclassed, with subclasses overriding only those methods (such as getConnection()) that should not simply delegate to the target DataSource.

See Also

Summary

Public Constructors
DelegatingDataSource()
Create a new DelegatingDataSource.
DelegatingDataSource(DataSource targetDataSource)
Create a new DelegatingDataSource.
Public Methods
void afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
Connection getConnection()
Connection getConnection(String username, String password)
PrintWriter getLogWriter()
int getLoginTimeout()
DataSource getTargetDataSource()
Return the target DataSource that this DataSource should delegate to.
boolean isWrapperFor(Class<?> iface)
void setLogWriter(PrintWriter out)
void setLoginTimeout(int seconds)
void setTargetDataSource(DataSource targetDataSource)
Set the target DataSource that this DataSource should delegate to.
<T> T unwrap(Class<T> iface)
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.sql.Wrapper
From interface javax.sql.CommonDataSource
From interface javax.sql.DataSource
From interface org.springframework.beans.factory.InitializingBean

Public Constructors

public DelegatingDataSource ()

Create a new DelegatingDataSource.

public DelegatingDataSource (DataSource targetDataSource)

Create a new DelegatingDataSource.

Parameters
targetDataSource the target DataSource

Public Methods

public void afterPropertiesSet ()

Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

public Connection getConnection ()

Throws
SQLException

public Connection getConnection (String username, String password)

Throws
SQLException

public PrintWriter getLogWriter ()

Throws
SQLException

public int getLoginTimeout ()

Throws
SQLException

public DataSource getTargetDataSource ()

Return the target DataSource that this DataSource should delegate to.

public boolean isWrapperFor (Class<?> iface)

Throws
SQLException

public void setLogWriter (PrintWriter out)

Throws
SQLException

public void setLoginTimeout (int seconds)

Throws
SQLException

public void setTargetDataSource (DataSource targetDataSource)

Set the target DataSource that this DataSource should delegate to.

public T unwrap (Class<T> iface)

Throws
SQLException