1
|
package eu.etaxonomy.cdm.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
|
|
13
|
* Or use a running source.
|
14
|
*
|
15
|
* When changing this class please also adapt https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions
|
16
|
*
|
17
|
* @author a.mueller
|
18
|
*
|
19
|
*/
|
20
|
public class CdmModelCacherConnectionProvider extends DatasourceConnectionProviderImpl{
|
21
|
private static final long serialVersionUID = 454393966637126346L;
|
22
|
|
23
|
public CdmModelCacherConnectionProvider() {
|
24
|
super();
|
25
|
setDataSource(getDataSourcePreliminary());
|
26
|
}
|
27
|
|
28
|
private DataSource getDataSourcePreliminary() {
|
29
|
String database = "modelCacher";
|
30
|
String path = "C:\\Users\\a.mueller\\.cdmLibrary\\writableResources\\h2\\LocalH2_" + database;
|
31
|
String username = "sa";
|
32
|
CdmDataSource dataSource = CdmDataSource.NewH2EmbeddedInstance("cdmTest", username, "", path);
|
33
|
return dataSource;
|
34
|
}
|
35
|
|
36
|
|
37
|
|
38
|
}
|