org.apache.jetspeed.components.datasource
Class SchemaAwareDataSourceProxy

java.lang.Object
  extended by org.springframework.jdbc.datasource.DelegatingDataSource
      extended by org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy
          extended by org.apache.jetspeed.components.datasource.SchemaAwareDataSourceProxy
All Implemented Interfaces:
javax.sql.DataSource, org.springframework.beans.factory.InitializingBean

public class SchemaAwareDataSourceProxy
extends org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy

The SchemaAwareDataSourceProxy optionally injects a schema selection into an existing database connection. It proxies a DataSource and executes an injected sql statement on every getConnection() call. Inspired by http://forum.springframework.org/showthread.php?t=10728, runtime schema switching was stripped.

Version:
$Id: SchemaAwareDataSourceProxy.java 601297 2007-12-05 11:20:04Z ate $
Author:
Joachim M??ller

Constructor Summary
SchemaAwareDataSourceProxy()
           
 
Method Summary
 java.sql.Connection getConnection()
           
 void setSchemaSql(java.lang.String schemaSql)
           
 
Methods inherited from class org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy
getTransactionAwareConnectionProxy
 
Methods inherited from class org.springframework.jdbc.datasource.DelegatingDataSource
afterPropertiesSet, getConnection, getLoginTimeout, getLogWriter, getTargetDataSource, setLoginTimeout, setLogWriter, setTargetDataSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaAwareDataSourceProxy

public SchemaAwareDataSourceProxy()
Method Detail

setSchemaSql

public void setSchemaSql(java.lang.String schemaSql)

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.DataSource
Overrides:
getConnection in class org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy
Throws:
java.sql.SQLException


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.