/** @author Andres Almiray */ public class DataSourceContributionAdapter implements DataSourceContributionHandler { private static final String DEFAULT = "default"; private DataSourceProvider provider = DefaultDataSourceProvider.getInstance(); public void setDataSourceProvider(DataSourceProvider provider) { this.provider = provider != null ? provider : DefaultDataSourceProvider.getInstance(); } public DataSourceProvider getDataSourceProvider() { return provider; } public <R> R withSql(Closure<R> closure) { return withSql(DEFAULT, closure); } public <R> R withSql(String dataSourceName, Closure<R> closure) { return provider.withSql(dataSourceName, closure); } public <R> R withSql(CallableWithArgs<R> callable) { return withSql(DEFAULT, callable); } public <R> R withSql(String dataSourceName, CallableWithArgs<R> callable) { return provider.withSql(dataSourceName, callable); } }
public void setDataSourceProvider(DataSourceProvider provider) { this.provider = provider != null ? provider : DefaultDataSourceProvider.getInstance(); }