2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.database
.types
;
12 import javax
.sql
.DataSource
;
14 import org
.hibernate
.dialect
.Dialect
;
16 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
23 public interface IDatabaseType
{
27 public String
getName();
31 public String
getClassString();
35 public String
getUrlString();
39 public int getDefaultPort();
42 * Returns the {@link Dialect hibernate dialect}
45 public Dialect
getHibernateDialect();
48 * Returns the canoncial (full path) name of the {@link Dialect hibernate dialect} class
51 public String
getHibernateDialectCanonicalName();
54 * Returns the connection String for the given parameters, using default port
55 * @param cdmDataSource represents a datasource
56 * @return the connection String
58 public String
getConnectionString(ICdmDataSource cdmDataSource
);
62 * Returns the DataSource class that that the datasource needs to create a spring bean
63 * @return the DataSource class
65 public Class
<?
extends DataSource
> getDataSourceClass();
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
72 public String
getInitMethod();
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
78 public String
getDestroyMethod();
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
86 public String
getServerNameByConnectionString(String connectionString
);
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
95 public int getPortByConnectionString(String connectionString
);
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
104 public abstract String
getDatabaseNameByConnectionString(String connectionString
);