test connection and ICdmDatasource getters
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / database / ICdmDataSource.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.cdm.database;
11
12 import org.hibernate.cache.CacheProvider;
13 import org.springframework.beans.factory.config.BeanDefinition;
14
15 import eu.etaxonomy.cdm.database.DbSchemaValidation;
16
17 public interface ICdmDataSource {
18
19 /**
20 * Returns a BeanDefinition object of type DriverManagerDataSource that contains
21 * datsource properties (url, username, password, ...)
22 * @return BeanDefinition
23 */
24 public BeanDefinition getDatasourceBean();
25
26 /**
27 * @param hbm2dll
28 * @return BeanDefinition
29 */
30 public BeanDefinition getHibernatePropertiesBean(DbSchemaValidation hbm2dll);
31
32 /**
33 * @param hbm2dll
34 * @param showSql
35 * @param formatSql
36 * @param cacheProviderClass
37 * @return BeanDefinition
38 */
39 public BeanDefinition getHibernatePropertiesBean(DbSchemaValidation hbm2dll, Boolean showSql, Boolean formatSql, Class<? extends CacheProvider> cacheProviderClass);
40
41
42 /**
43 * The name representation of thie Datasource
44 * @return
45 */
46 public String getName();
47
48
49 /**
50 * @return
51 */
52 public String getServer();
53
54 /**
55 * @return
56 */
57 public String getDatabase();
58
59 public DatabaseTypeEnum getDatabaseType();
60
61 /**
62 * @return
63 */
64 public int getPort();
65
66 /**
67 * @return
68 */
69 public String getFilePath();
70
71 /**
72 * @return
73 */
74 public H2Mode getMode();
75
76
77 /**
78 * Tests, if a database connection can be established.
79 * @return true if test was successful, false otherwise
80 */
81 public boolean testConnection();
82
83 public String getUserName();
84
85 public String getPassword();
86
87
88 //
89 // public void setFilePath(String filePath);
90 //
91 // public void setMode(H2Mode mode);
92
93 }