2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.database
;
12 import java
.sql
.ResultSet
;
14 import org
.hibernate
.cache
.CacheProvider
;
15 import org
.springframework
.beans
.factory
.config
.BeanDefinition
;
17 public interface ICdmDataSource
{
20 * Returns a BeanDefinition object of type DriverManagerDataSource that contains
21 * datsource properties (url, username, password, ...)
22 * @return BeanDefinition
24 public BeanDefinition
getDatasourceBean();
28 * @return BeanDefinition
30 public BeanDefinition
getHibernatePropertiesBean(DbSchemaValidation hbm2dll
);
36 * @param cacheProviderClass
37 * @return BeanDefinition
39 public BeanDefinition
getHibernatePropertiesBean(DbSchemaValidation hbm2dll
, Boolean showSql
, Boolean formatSql
, Boolean registerSearchListener
, Class
<?
extends CacheProvider
> cacheProviderClass
);
43 * The name representation of thie Datasource.
46 public String
getName();
52 public String
getServer();
57 public String
getDatabase();
59 public DatabaseTypeEnum
getDatabaseType();
69 public String
getFilePath();
74 public H2Mode
getMode();
77 * Tests, if a database connection can be established.
78 * @return true if test was successful, false otherwise
81 public boolean testConnection() throws Exception
;
83 public String
getUsername();
85 public String
getPassword();
88 * Executes a query and returns the ResultSet.
89 * @return ResultSet for the query.
91 public ResultSet
executeQuery (String query
);
97 public int executeUpdate (String sqlUpdate
);
102 // public void setFilePath(String filePath);
104 // public void setMode(H2Mode mode);