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:
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

Field Summary
private static org.apache.commons.logging.Log log
           
private  String schemaSql
           
 
Constructor Summary
SchemaAwareDataSourceProxy()
           
 
Method Summary
 Connection getConnection()
           
 void setSchemaSql(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
 

Field Detail

log

private static final org.apache.commons.logging.Log log

schemaSql

private String schemaSql
Constructor Detail

SchemaAwareDataSourceProxy

public SchemaAwareDataSourceProxy()
Method Detail

setSchemaSql

public void setSchemaSql(String schemaSql)

getConnection

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


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