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
;
13 import java
.sql
.SQLException
;
15 import org
.hibernate
.cache
.CacheProvider
;
16 import org
.springframework
.beans
.factory
.config
.BeanDefinition
;
18 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
20 public interface ICdmDataSource
{
23 * Returns a BeanDefinition object of type DataSource that contains
24 * datsource properties (url, username, password, ...)
25 * @return BeanDefinition
27 public BeanDefinition
getDatasourceBean();
31 * @return BeanDefinition
33 public BeanDefinition
getHibernatePropertiesBean(DbSchemaValidation hbm2dll
);
39 * @param cacheProviderClass
40 * @return BeanDefinition
42 public BeanDefinition
getHibernatePropertiesBean(DbSchemaValidation hbm2dll
, Boolean showSql
, Boolean formatSql
, Boolean registerSearchListener
, Class
<?
extends CacheProvider
> cacheProviderClass
);
46 * The name representation of thie Datasource.
49 public String
getName();
55 public String
getServer();
60 public String
getDatabase();
62 public DatabaseTypeEnum
getDatabaseType();
72 public String
getFilePath();
77 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 DataSourceNotFoundException
;
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
);
102 public NomenclaturalCode
getNomenclaturalCode();
104 public Object
getSingleValue(String query
) throws SQLException
;
107 // public void setFilePath(String filePath);
109 // public void setMode(H2Mode mode);