// Path: uncode-dal/src/main/java/cn/uncode/dal/datasource/DBContextHolder.java
// public class DBContextHolder {
// 	
// 	public static final String WRITE = "write";
// 	public static final String READ = "read";
// 	public static final String STANDBY = "standby";
// 	public static final String REPORT = "report";
// 	public static final String TRANSACTION = "transaction";
// 	
// 	private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<String>();
// 
// 	public static void swithToWrite() {
// 		if(!TRANSACTION.equals(CONTEXT_HOLDER.get())){
// 			CONTEXT_HOLDER.set(WRITE);
// 		}
// 	}
// 	
// 	public static void swithToRead() {
// 		if(!TRANSACTION.equals(CONTEXT_HOLDER.get())){
// 			CONTEXT_HOLDER.set(READ);
// 		}
// 	}
// 	
// 	public static void swithToReport() {
// 		CONTEXT_HOLDER.set(REPORT);
// 	}
// 	
// 	public static void swithTotransaction() {
// 		CONTEXT_HOLDER.set(TRANSACTION);
// 	}
// 	
// 	public static void swithTo(String dbType) {
// 		CONTEXT_HOLDER.set(dbType);
// 	}
// 
// 	public static String getCurrentDataSourceKey() {
// 		return CONTEXT_HOLDER.get();
// 	}
// 
// 	public static void clear() {
// 		CONTEXT_HOLDER.remove();
// 	}
// 	
// }


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.TransactionDefinition;
import cn.uncode.dal.datasource.DBContextHolder;
package cn.uncode.dal.jdbc.datasource;



public class DataSourceTransactionManager extends org.springframework.jdbc.datasource.DataSourceTransactionManager {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8503950636535704538L;
	
	
	private static Logger LOG = LoggerFactory.getLogger(DataSourceTransactionManager.class);
	
	/**
	 * This implementation sets the isolation level but ignores the timeout.
	 */
	@Override
	protected void doBegin(Object transaction, TransactionDefinition definition) {
// Path: uncode-dal/src/main/java/cn/uncode/dal/datasource/DBContextHolder.java
// public class DBContextHolder {
// 	
// 	public static final String WRITE = "write";
// 	public static final String READ = "read";
// 	public static final String STANDBY = "standby";
// 	public static final String REPORT = "report";
// 	public static final String TRANSACTION = "transaction";
// 	
// 	private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<String>();
// 
// 	public static void swithToWrite() {
// 		if(!TRANSACTION.equals(CONTEXT_HOLDER.get())){
// 			CONTEXT_HOLDER.set(WRITE);
// 		}
// 	}
// 	
// 	public static void swithToRead() {
// 		if(!TRANSACTION.equals(CONTEXT_HOLDER.get())){
// 			CONTEXT_HOLDER.set(READ);
// 		}
// 	}
// 	
// 	public static void swithToReport() {
// 		CONTEXT_HOLDER.set(REPORT);
// 	}
// 	
// 	public static void swithTotransaction() {
// 		CONTEXT_HOLDER.set(TRANSACTION);
// 	}
// 	
// 	public static void swithTo(String dbType) {
// 		CONTEXT_HOLDER.set(dbType);
// 	}
// 
// 	public static String getCurrentDataSourceKey() {
// 		return CONTEXT_HOLDER.get();
// 	}
// 
// 	public static void clear() {
// 		CONTEXT_HOLDER.remove();
// 	}
// 	
// }


// Path: uncode-dal/src/main/java/cn/uncode/dal/jdbc/datasource/DataSourceTransactionManager.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.TransactionDefinition;
import cn.uncode.dal.datasource.DBContextHolder;

package cn.uncode.dal.jdbc.datasource;



public class DataSourceTransactionManager extends org.springframework.jdbc.datasource.DataSourceTransactionManager {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8503950636535704538L;
	
	
	private static Logger LOG = LoggerFactory.getLogger(DataSourceTransactionManager.class);
	
	/**
	 * This implementation sets the isolation level but ignores the timeout.
	 */
	@Override
	protected void doBegin(Object transaction, TransactionDefinition definition) {
		DBContextHolder.swithTotransaction();