removing @Override for compatibility with java 1.6
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / database / types / IDatabaseType.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.cdm.database.types;
11
12 import javax.sql.DataSource;
13
14 import org.hibernate.dialect.Dialect;
15
16 import eu.etaxonomy.cdm.database.ICdmDataSource;
17
18 /**
19 * @author a.mueller
20 * @created 17.12.2008
21 * @version 1.0
22 */
23 public interface IDatabaseType {
24 /**
25 * @return
26 */
27 public String getName();
28 /**
29 * @return
30 */
31 public String getClassString();
32 /**
33 * @return
34 */
35 public String getUrlString();
36 /**
37 * @return
38 */
39 public int getDefaultPort();
40
41 /**
42 * Returns the {@link Dialect hibernate dialect}
43 * @return
44 */
45 public Dialect getHibernateDialect();
46
47 /**
48 * Returns the canoncial (full path) name of the {@link Dialect hibernate dialect} class
49 * @return
50 */
51 public String getHibernateDialectCanonicalName();
52
53 /**
54 * Returns the connection String for the given parameters, using default port
55 * @param cdmDataSource represents a datasource
56 * @return the connection String
57 */
58 public String getConnectionString(ICdmDataSource cdmDataSource);
59
60
61 /**
62 * Returns the DataSource class that that the datasource needs to create a spring bean
63 * @return the DataSource class
64 */
65 public Class<? extends DataSource> getDataSourceClass();
66
67
68 /**
69 * Returns the Name of the initialization method to be used when a hibernate datasource is created for this database
70 * @return String name of the init method
71 */
72 public String getInitMethod();
73
74 /**
75 * Returns the Name of the destroying method to be used when a hibernate datasource representing this database is destroyed
76 * @return String name of the destroy method
77 */
78 public String getDestroyMethod();
79
80 /**
81 * Returns the server name for a given connection string. Null or empty string is returned if the
82 * connection string is invalid
83 * @param connectionString the connection string
84 * @return string representing the server
85 */
86 public String getServerNameByConnectionString(String connectionString);
87
88
89 /**
90 * Returns the port for a given connection string. If no port is defined the default port is returned.
91 * If connection string is <code>null</code> or unvalid -1 is returned
92 * @param connectionString the connection string
93 * @return int representing the port number
94 */
95 public int getPortByConnectionString(String connectionString);
96
97
98 /**
99 * Returns the database name for a given connection string. Null or empty string is returned if the
100 * connection string is invalid
101 * @param connectionString the connection string
102 * @return string representing the database
103 */
104 public abstract String getDatabaseNameByConnectionString(String connectionString);
105 }