Revision 1a1e2ca4
Added by Andreas Müller almost 2 years ago
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CdmModelCacherConnectionProvider.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.cache; |
10 | 10 |
|
11 |
import java.net.URL; |
|
12 |
|
|
11 | 13 |
import javax.sql.DataSource; |
12 | 14 |
|
13 | 15 |
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl; |
... | ... | |
25 | 27 |
* @author a.mueller |
26 | 28 |
*/ |
27 | 29 |
public class CdmModelCacherConnectionProvider extends DatasourceConnectionProviderImpl{ |
28 |
private static final long serialVersionUID = 454393966637126346L; |
|
30 |
|
|
31 |
private static final long serialVersionUID = 454393966637126346L; |
|
29 | 32 |
|
30 | 33 |
public CdmModelCacherConnectionProvider() { |
31 |
super(); |
|
32 | 34 |
setDataSource(getDataSourcePreliminary()); |
33 | 35 |
} |
34 | 36 |
|
35 | 37 |
private DataSource getDataSourcePreliminary() { |
36 | 38 |
String database = "modelCacher"; |
37 |
String path = "C:\\Users\\a.mueller\\.cdmLibrary\\writableResources\\h2\\LocalH2_" + database; |
|
39 |
URL location = this.getClass().getProtectionDomain().getCodeSource().getLocation(); |
|
40 |
String path = location.getFile().replace("classes/", "tmp/h2/"+database); |
|
41 |
// String path = "C:\\Users\\a.mueller\\.cdmLibrary\\writableResources\\h2\\LocalH2_" + database; |
|
38 | 42 |
String username = "sa"; |
39 |
CdmDataSource dataSource = CdmDataSource.NewH2EmbeddedInstance("cdmTest", username, "", path);
|
|
43 |
CdmDataSource dataSource = CdmDataSource.NewH2EmbeddedInstance("temp", username, "", path);
|
|
40 | 44 |
return dataSource; |
41 | 45 |
} |
42 | 46 |
} |
Also available in: Unified diff
ref #6696 create CdmModelCache during maven and remove cached model from git