3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.api
.service
;
13 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationController
;
14 import eu
.etaxonomy
.cdm
.database
.CdmPersistentDataSource
;
15 import eu
.etaxonomy
.cdm
.database
.DataSourceNotFoundException
;
16 import eu
.etaxonomy
.cdm
.database
.DatabaseTypeEnum
;
17 import eu
.etaxonomy
.cdm
.database
.H2Mode
;
18 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
19 import eu
.etaxonomy
.cdm
.model
.common
.init
.TermNotFoundException
;
20 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
26 public interface IDatabaseService
{
28 //TODO removed 04.02.2009 as spring 2.5.6 does not support DriverManagerDataSource.getDriverClassName anymore
29 //Let's see if this is not needed by any other application1
31 // * Returns the databaseTypeEnum
34 // public DatabaseTypeEnum getDatabaseEnum();
38 // * Returns the database driver class name
41 // public String getDriverClassName();
44 * Returns the database URL
47 public String
getUrl();
50 * Returns the username.
53 public String
getUsername();
56 * Connect to the database with the given parameters
57 * @param databaseTypeEnum
62 * @return returns true if successful
64 public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum
, String server
,
65 String database
, String username
, String password
, int port
, String filePath
, H2Mode mode
, NomenclaturalCode code
) throws TermNotFoundException
;
68 * Connect to the database with the given parameters. Uses default port.
69 * @param databaseTypeEnum
73 * @return returns true if successful
75 public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum
, String server
, String database
, String username
, String password
) throws TermNotFoundException
;
79 * Connect to the database with the given parameters. Uses default port.
81 * @return returns true if successful
83 public boolean connectToDatasource(CdmPersistentDataSource dataSource
) throws TermNotFoundException
;
86 * Saves a new ICdmDatasource into the datasource config file.
88 * @param strDataSourceName
93 public CdmPersistentDataSource
saveDataSource(String strDataSourceName
, ICdmDataSource dataSource
);
96 * Update an already saved datasource in datasource config file
97 * @param strDataSourceName
98 * the beanId under which the dataSource should be saved
100 * the dataSource to be saved
102 * the CdmDataSource, null if not successful
103 * @throws DataSourceNotFoundException
105 public CdmPersistentDataSource
updateDataSource(String strDataSourceName
, CdmPersistentDataSource dataSource
) throws DataSourceNotFoundException
;
107 public void setApplicationController(CdmApplicationController cdmApplicationController
);