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 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
19 public interface ICdmDataSource
{
22 * Returns a BeanDefinition object of type DriverManagerDataSource that contains
23 * datsource properties (url, username, password, ...)
24 * @return BeanDefinition
26 public BeanDefinition
getDatasourceBean();
30 * @return BeanDefinition
32 public BeanDefinition
getHibernatePropertiesBean(DbSchemaValidation hbm2dll
);
38 * @param cacheProviderClass
39 * @return BeanDefinition
41 public BeanDefinition
getHibernatePropertiesBean(DbSchemaValidation hbm2dll
, Boolean showSql
, Boolean formatSql
, Boolean registerSearchListener
, Class
<?
extends CacheProvider
> cacheProviderClass
);
45 * The name representation of thie Datasource.
48 public String
getName();
54 public String
getServer();
59 public String
getDatabase();
61 public DatabaseTypeEnum
getDatabaseType();
71 public String
getFilePath();
76 public H2Mode
getMode();
80 * Tests, if a database connection can be established.
81 * @return true if test was successful, false otherwise
84 public boolean testConnection() throws Exception
;
86 public String
getUsername();
88 public String
getPassword();
91 * Executes a query and returns the ResultSet.
92 * @return ResultSet for the query.
94 public ResultSet
executeQuery (String query
);
100 public int executeUpdate (String sqlUpdate
);
105 // public void setFilePath(String filePath);
107 // public void setMode(H2Mode mode);