1
|
package eu.etaxonomy.taxeditor.remoting.cache;
|
2
|
|
3
|
import javax.sql.DataSource;
|
4
|
|
5
|
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
|
6
|
|
7
|
import eu.etaxonomy.cdm.database.CdmDataSource;
|
8
|
|
9
|
/**
|
10
|
* This is a very preliminary class to get the model cache running. Need to better understand how
|
11
|
* the datasource works with hibernate service registry before implementing the correct way.
|
12
|
* Or use a running source.
|
13
|
* @author a.mueller
|
14
|
*
|
15
|
*/
|
16
|
public class CdmModelCacherConnectionProvider extends DatasourceConnectionProviderImpl{
|
17
|
private static final long serialVersionUID = 454393966637126346L;
|
18
|
|
19
|
public CdmModelCacherConnectionProvider() {
|
20
|
super();
|
21
|
setDataSource(getDataSourcePreliminary());
|
22
|
}
|
23
|
|
24
|
private DataSource getDataSourcePreliminary() {
|
25
|
String database = "xyz";
|
26
|
String path = "C:\\Users\\a.mueller\\.cdmLibrary\\writableResources\\h2\\LocalH2_" + database;
|
27
|
String username = "sa";
|
28
|
CdmDataSource dataSource = CdmDataSource.NewH2EmbeddedInstance("cdmTest", username, "", path);
|
29
|
return dataSource;
|
30
|
}
|
31
|
|
32
|
|
33
|
|
34
|
}
|