|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| DataSourceServiceImpl.java | 100% | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
/**
|
|
| 2 |
* JFoxSOAF, Service-Oriented Application Framework
|
|
| 3 |
*
|
|
| 4 |
* Copyright (C) www.huihoo.org
|
|
| 5 |
*
|
|
| 6 |
* Distributable under GNU LGPL
|
|
| 7 |
*
|
|
| 8 |
* For more information, please visit: http://www.huihoo.org/jfox/jfoxsoaf
|
|
| 9 |
*/
|
|
| 10 |
|
|
| 11 |
package org.huihoo.jfox.soaf.services.jdbc;
|
|
| 12 |
|
|
| 13 |
import javax.sql.DataSource;
|
|
| 14 |
|
|
| 15 |
import org.huihoo.jfox.soaf.exception.DataSourceConfigurationException;
|
|
| 16 |
import org.huihoo.jfox.soaf.exception.ServiceLocatorException;
|
|
| 17 |
import org.huihoo.jfox.soaf.services.ejb.ServiceLocator;
|
|
| 18 |
|
|
| 19 |
import org.apache.commons.lang.StringUtils;
|
|
| 20 |
|
|
| 21 |
/**
|
|
| 22 |
* Database datasource serivce implementation
|
|
| 23 |
*
|
|
| 24 |
* @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
|
|
| 25 |
* @version $Revision: 1.1 $ $Date: 2004/10/28 15:12:16 $
|
|
| 26 |
* @version Revision: 1.0
|
|
| 27 |
*/
|
|
| 28 |
|
|
| 29 |
public class DataSourceServiceImpl implements DataSourceService { |
|
| 30 |
|
|
| 31 |
private ServiceLocator serviceLocator;
|
|
| 32 |
|
|
| 33 |
/**
|
|
| 34 |
* @param serviceLocator
|
|
| 35 |
*/
|
|
| 36 | 3 |
public DataSourceServiceImpl(ServiceLocator serviceLocator) {
|
| 37 | 3 |
this.serviceLocator = serviceLocator;
|
| 38 |
} |
|
| 39 |
|
|
| 40 |
/**
|
|
| 41 |
* @see org.huihoo.jfox.soaf.services.jdbc.DataSourceService#getDataSource(java.lang.String)
|
|
| 42 |
*/
|
|
| 43 | 2 |
public DataSource getDataSource(String dataSourceName)
|
| 44 |
throws DataSourceConfigurationException, ServiceLocatorException {
|
|
| 45 | 2 |
if (StringUtils.isEmpty(dataSourceName)) {
|
| 46 | 1 |
return DataSourceFactory.getDataSource();
|
| 47 |
} else {
|
|
| 48 | 1 |
return serviceLocator.getDataSource(dataSourceName);
|
| 49 |
} |
|
| 50 |
} |
|
| 51 |
|
|
| 52 |
} |
|
||||||||||