(no commit message)
[cdmlib.git] / cdmlibrary / src / main / java / eu / etaxonomy / cdm / api / service / IDatabaseService.java
1 /**
2 *
3 */
4 package eu.etaxonomy.cdm.api.service;
5
6 import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
7
8 /**
9 * @author a.mueller
10 *
11 */
12 public interface IDatabaseService extends IService {
13
14 /**
15 * @return
16 */
17 public DatabaseTypeEnum getDatabaseEnum();
18
19
20 /**
21 * @return
22 */
23 public String getDriverClassName();
24
25 /**
26 * @return
27 */
28 public String getUrl();
29
30 /**
31 * @return
32 */
33 public String getUsername();
34
35 /**
36 * Set the database connection to the local Hsqldb-database using
37 * the default parameters (defined in Spring-configuration).
38 * Make sure to close the application when exiting the programm,
39 * otherwise the hsql-server might still be running, if startet by cdmLibrary.
40 * @return true if a connection could be established
41 */
42 public boolean useLocalHsqldb();
43
44 /**
45 * Set the database connection to the local Hsqldb-database using
46 * the given parameters. If a parameter is missing, the default parameter
47 * (defined in Spring-configuration) is taken.
48 * Make sure to close the application when exiting the programm,
49 * otherwise the hsql-server might still be running, if startet by cdmLibrary.
50 * All paramters are optional.
51 * @param path the path to the database files
52 * @param databaseName name of the used database
53 * @param silent if true, messages from the db server are send to stdout
54 * @param startServer if true, the dbserver is started if the url can't be reached by the dbDriver
55 * @return true if a connection could be established
56 * TODO exceptions
57 */
58 public boolean useLocalHsqldb(String path, String databaseName, boolean silent, boolean startServer);
59
60 /**
61 * Connect to the database with the given parameters
62 * @param databaseTypeEnum
63 * @param url
64 * @param username
65 * @param password
66 * @param port
67 * @return
68 */
69 public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum, String server, String database, String username, String password, int port);
70
71 /**
72 * Connect to the database with the given parameters. Uses default port.
73 * @param databaseTypeEnum
74 * @param url
75 * @param username
76 * @param password
77 * @return
78 */
79 public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum, String server, String database, String username, String password);
80
81 }