+// $Id$\r
/**\r
+ * Copyright (C) 2007 EDIT\r
+ * European Distributed Institute of Taxonomy \r
+ * http://www.e-taxonomy.eu\r
* \r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
+\r
package eu.etaxonomy.cdm.api.service;\r
\r
import eu.etaxonomy.cdm.api.application.CdmApplicationController;\r
import eu.etaxonomy.cdm.database.CdmPersistentDataSource;\r
+import eu.etaxonomy.cdm.database.DataSourceNotFoundException;\r
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;\r
+import eu.etaxonomy.cdm.database.H2Mode;\r
+import eu.etaxonomy.cdm.database.ICdmDataSource;\r
import eu.etaxonomy.cdm.model.common.init.TermNotFoundException;\r
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;\r
\r
/**\r
* @author a.mueller\r
*\r
*/\r
-public interface IDatabaseService extends IService {\r
+public interface IDatabaseService {\r
\r
- /**\r
- * Returns the databaseTypeEnum\r
- * @return\r
- */\r
- public DatabaseTypeEnum getDatabaseEnum();\r
- \r
- \r
- /**\r
- * Returns the database driver class name\r
- * @return\r
- */\r
- public String getDriverClassName();\r
+//TODO removed 04.02.2009 as spring 2.5.6 does not support DriverManagerDataSource.getDriverClassName anymore\r
+//Let's see if this is not needed by any other application1\r
+// /**\r
+// * Returns the databaseTypeEnum\r
+// * @return\r
+// */\r
+// public DatabaseTypeEnum getDatabaseEnum();\r
+// \r
+// \r
+// /**\r
+// * Returns the database driver class name\r
+// * @return\r
+// */\r
+// public String getDriverClassName();\r
\r
/**\r
* Returns the database URL\r
*/\r
public String getUsername();\r
\r
- /**\r
- * Set the database connection to the local Hsqldb-database using\r
- * the default parameters (defined in Spring-configuration).\r
- * Make sure to close the application when exiting the programm, \r
- * otherwise the hsql-server might still be running, if startet by cdmLibrary.\r
- * @return true if a connection could be established\r
- */\r
- public boolean useLocalDefaultHsqldb() throws TermNotFoundException;\r
- \r
- /**\r
- * Set the database connection to the local Hsqldb-database using\r
- * the given parameters. If a parameter is missing, the default parameter\r
- * (defined in Spring-configuration) is taken.\r
- * Make sure to close the application when exiting the programm, \r
- * otherwise the hsql-server might still be running, if startet by cdmLibrary.\r
- * All paramters are optional.\r
- * @param path the path to the database files\r
- * @param databaseName name of the used database\r
- * @param silent if true, messages from the db server are send to stdout \r
- * @param startServer if true, the dbserver is started if the url can't be reached by the dbDriver\r
- * @return true if a connection could be established\r
- * TODO exceptions\r
- */\r
- public boolean useLocalHsqldb(String databasePath, String databaseName, String username, String password, boolean silent, boolean startServer) throws TermNotFoundException;\r
-\r
/**\r
* Connect to the database with the given parameters\r
* @param databaseTypeEnum\r
* @param port\r
* @return returns true if successful\r
*/\r
- public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum, String server, String database, String username, String password, int port) throws TermNotFoundException ;\r
+ public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum, String server,\r
+ String database, String username, String password, int port, String filePath, H2Mode mode, NomenclaturalCode code) throws TermNotFoundException ;\r
\r
/**\r
* Connect to the database with the given parameters. Uses default port.\r
public boolean connectToDatasource(CdmPersistentDataSource dataSource) throws TermNotFoundException;\r
\r
/**\r
- * Saves a new CdmDatasource into the datasource config file.\r
+ * Saves a new ICdmDatasource into the datasource config file.\r
+ * \r
* @param strDataSourceName\r
- * @param databaseTypeEnum\r
- * @param server\r
- * @param database\r
- * @param username\r
- * @param password\r
- * @return the CdmDataSource, null if not successful.\r
+ * @param dataSource\r
+ * @param code\r
+ * @return\r
*/\r
- public CdmPersistentDataSource saveDataSource(String strDataSourceName, DatabaseTypeEnum databaseTypeEnum, String server, String database, String username, String password) throws TermNotFoundException;\r
+ public CdmPersistentDataSource saveDataSource(String strDataSourceName, ICdmDataSource dataSource);\r
\r
/**\r
- * Saves a new hsqldb datasource into the datasource config file.\r
+ * Update an already saved datasource in datasource config file\r
* @param strDataSourceName\r
- * @param path\r
- * @param database\r
- * @param username\r
- * @param password\r
- * @return the CdmDataSource, null if not successful.\r
+ * the beanId under which the dataSource should be saved\r
+ * @param dataSource\r
+ * the dataSource to be saved\r
+ * @return\r
+ * the CdmDataSource, null if not successful\r
+ * @throws DataSourceNotFoundException \r
*/\r
- public CdmPersistentDataSource saveLocalHsqldb(String strDataSourceName, String path, String database, String username, String password, boolean silent, boolean startServer);\r
- \r
+ public CdmPersistentDataSource updateDataSource(String strDataSourceName, CdmPersistentDataSource dataSource) throws DataSourceNotFoundException;\r
+\r
public void setApplicationController(CdmApplicationController cdmApplicationController);\r
}
\ No newline at end of file