1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
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.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.cdm.api.service;
|
12
|
|
13
|
import eu.etaxonomy.cdm.api.application.CdmApplicationDefaultController;
|
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;
|
21
|
|
22
|
/**
|
23
|
* @author a.mueller
|
24
|
*
|
25
|
*/
|
26
|
public interface IDatabaseService {
|
27
|
|
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
|
30
|
// /**
|
31
|
// * Returns the databaseTypeEnum
|
32
|
// * @return
|
33
|
// */
|
34
|
// public DatabaseTypeEnum getDatabaseEnum();
|
35
|
//
|
36
|
//
|
37
|
// /**
|
38
|
// * Returns the database driver class name
|
39
|
// * @return
|
40
|
// */
|
41
|
// public String getDriverClassName();
|
42
|
|
43
|
/**
|
44
|
* Returns the database URL
|
45
|
* @return
|
46
|
*/
|
47
|
public String getUrl();
|
48
|
|
49
|
/**
|
50
|
* Returns the username.
|
51
|
* @return
|
52
|
*/
|
53
|
public String getUsername();
|
54
|
|
55
|
/**
|
56
|
* Connect to the database with the given parameters
|
57
|
* @param databaseTypeEnum
|
58
|
* @param url
|
59
|
* @param username
|
60
|
* @param password
|
61
|
* @param port
|
62
|
* @return returns true if successful
|
63
|
*/
|
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 ;
|
66
|
|
67
|
/**
|
68
|
* Connect to the database with the given parameters. Uses default port.
|
69
|
* @param databaseTypeEnum
|
70
|
* @param url
|
71
|
* @param username
|
72
|
* @param password
|
73
|
* @return returns true if successful
|
74
|
*/
|
75
|
public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum, String server, String database, String username, String password) throws TermNotFoundException;
|
76
|
|
77
|
|
78
|
/**
|
79
|
* Connect to the database with the given parameters. Uses default port.
|
80
|
* @param dataSource
|
81
|
* @return returns true if successful
|
82
|
*/
|
83
|
public boolean connectToDatasource(CdmPersistentDataSource dataSource) throws TermNotFoundException;
|
84
|
|
85
|
/**
|
86
|
* Saves a new ICdmDatasource into the datasource config file.
|
87
|
*
|
88
|
* @param strDataSourceName
|
89
|
* @param dataSource
|
90
|
* @param code
|
91
|
* @return
|
92
|
*/
|
93
|
public CdmPersistentDataSource saveDataSource(String strDataSourceName, ICdmDataSource dataSource);
|
94
|
|
95
|
/**
|
96
|
* Update an already saved datasource in datasource config file
|
97
|
* @param strDataSourceName
|
98
|
* the beanId under which the dataSource should be saved
|
99
|
* @param dataSource
|
100
|
* the dataSource to be saved
|
101
|
* @return
|
102
|
* the CdmDataSource, null if not successful
|
103
|
* @throws DataSourceNotFoundException
|
104
|
*/
|
105
|
public CdmPersistentDataSource updateDataSource(String strDataSourceName, CdmPersistentDataSource dataSource) throws DataSourceNotFoundException;
|
106
|
|
107
|
public void setApplicationController(CdmApplicationDefaultController cdmApplicationController);
|
108
|
}
|