\r
package eu.etaxonomy.cdm.database;\r
\r
-import java.io.File;\r
import java.sql.Connection;\r
import java.sql.SQLException;\r
import java.util.HashMap;\r
import java.util.Map;\r
+import java.util.logging.Logger;\r
\r
import javax.sql.DataSource;\r
\r
-import org.springframework.beans.factory.xml.XmlBeanFactory;\r
-import org.springframework.core.io.FileSystemResource;\r
import org.springframework.jdbc.datasource.SimpleDriverDataSource;\r
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;\r
\r
</pre>\r
* \r
* @author a.kohlbecker\r
+ * @deprecated<b>NOTICE:</b> \r
+ * <em>This class is related to the switchable database infrastructure which allows to serve \r
+ * multiple databases with only a single instance of the cdm-remote-webapp. \r
+ * This concept however is deprecated due to several problems of which the most severe is the term loading issue.\r
+ * This class should however not deleted since we once might wish to switch back to this concept when we are \r
+ * able to deal with the implicated issues. \r
+ * \r
+ * See http://dev.e-taxonomy.eu/trac/wiki/CdmServerSwitchableDataSources for more information.</em>\r
*/\r
+@Deprecated\r
public class UpdatableRoutingDataSource extends AbstractRoutingDataSource {\r
\r
- \r
- private static final String DATASOURCE_BEANDEF_FILE = "datasources.xml";\r
- private static final String DATASOURCE_BEANDEF_PATH = System.getProperty("user.home")+File.separator+".cdmLibrary"+File.separator;\r
- \r
- private static String userdefinedBeanDefinitionFile = null;\r
- \r
+\r
private String defaultDatasourceName = "default";\r
\r
@Override\r
}\r
\r
\r
- public void setBeanDefinitionFile(String filename){\r
- userdefinedBeanDefinitionFile = filename;\r
- }\r
+\r
\r
public Map<String, DataSourceInfo> updateDataSources() {\r
\r
\r
return dataSourceInfos;\r
}\r
-\r
- /**\r
- * @return\r
- */\r
- protected Map<String, SimpleDriverDataSource> loadDataSources() {\r
-\r
- Map<String, SimpleDriverDataSource> dataSources = new HashMap<String, SimpleDriverDataSource>();\r
-\r
- String path = DATASOURCE_BEANDEF_PATH + (userdefinedBeanDefinitionFile == null ? DATASOURCE_BEANDEF_FILE : userdefinedBeanDefinitionFile);\r
- logger.info(" loading bean definition file: " + path);\r
- FileSystemResource file = new FileSystemResource(path);\r
- XmlBeanFactory beanFactory = new XmlBeanFactory(file);\r
- \r
- for(String beanName : beanFactory.getBeanDefinitionNames()){\r
- SimpleDriverDataSource datasource = (SimpleDriverDataSource)beanFactory.getBean(beanName, SimpleDriverDataSource.class);\r
- dataSources.put(beanName, datasource);\r
- }\r
- return dataSources;\r
- }\r
\r
+ protected Map<String, SimpleDriverDataSource> loadDataSources(){\r
+ return DataSourceBeanLoader.loadDataSources(SimpleDriverDataSource.class);\r
+ }\r
+\r
/**\r
* @param dataSources\r
* @return\r
return dataSourceInfos;\r
}\r
\r
+ // added for compatibility with Java 7\r
+ public Logger getParentLogger() /* throws SQLFeatureNotSupportedException (is not compatibel with parent class in Java 6)*/ {\r
+ // TODO Auto-generated method stub\r
+ return null;\r
+ }\r
+\r
}\r