delete FKs in SQL Server
[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 java.sql.ResultSet;
13
14 import org.hibernate.cache.CacheProvider;
15 import org.springframework.beans.factory.config.BeanDefinition;
16
17 import eu.etaxonomy.cdm.database.DbSchemaValidation;
18
19 public interface ICdmDataSource {
20
21 /**
22 * Returns a BeanDefinition object of type DriverManagerDataSource that contains
23 * datsource properties (url, username, password, ...)
24 * @return BeanDefinition
25 */
26 public BeanDefinition getDatasourceBean();
27
28 /**
29 * @param hbm2dll
30 * @return BeanDefinition
31 */
32 public BeanDefinition getHibernatePropertiesBean(DbSchemaValidation hbm2dll);
33
34 /**
35 * @param hbm2dll
36 * @param showSql
37 * @param formatSql
38 * @param cacheProviderClass
39 * @return BeanDefinition
40 */
41 public BeanDefinition getHibernatePropertiesBean(DbSchemaValidation hbm2dll, Boolean showSql, Boolean formatSql, Boolean registerSearchListener, Class<? extends CacheProvider> cacheProviderClass);
42
43
44 /**
45 * The name representation of thie Datasource.
46 * @return
47 */
48 public String getName();
49
50
51 /**
52 * @return
53 */
54 public String getServer();
55
56 /**
57 * @return
58 */
59 public String getDatabase();
60
61 public DatabaseTypeEnum getDatabaseType();
62
63 /**
64 * @return
65 */
66 public int getPort();
67
68 /**
69 * @return
70 */
71 public String getFilePath();
72
73 /**
74 * @return
75 */
76 public H2Mode getMode();
77
78
79 /**
80 * Tests, if a database connection can be established.
81 * @return true if test was successful, false otherwise
82 * @throws Exception
83 */
84 public boolean testConnection() throws Exception;
85
86 public String getUsername();
87
88 public String getPassword();
89
90 /**
91 * Executes a query and returns the ResultSet.
92 * @return ResultSet for the query.
93 */
94 public ResultSet executeQuery (String query);
95
96 /**
97 * Executes an update
98 * @return return code
99 */
100 public int executeUpdate (String sqlUpdate);
101
102
103
104 //
105 // public void setFilePath(String filePath);
106 //
107 // public void setMode(H2Mode mode);
108
109 }