removing @Override for compatibility with java 1.6
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / database / types / PostgreSQLDatabaseType.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 org.hibernate.dialect.Dialect;
13 import org.hibernate.dialect.PostgreSQL82Dialect;
14
15 import eu.etaxonomy.cdm.database.ICdmDataSource;
16
17
18 /**
19 * @author a.mueller
20 *
21 */
22 public class PostgreSQLDatabaseType extends DatabaseTypeBase {
23
24 //typeName
25 protected String typeName = "PostgreSQL";
26 //class
27 protected String classString = "org.postgresql.Driver";
28 //url
29 protected String urlString = "jdbc:postgresql://";
30 //port
31 private int defaultPort = 5432;
32 //hibernate dialect
33 private Dialect hibernateDialect = new PostgreSQL82Dialect();
34
35 private static String dbSeparator = "/";
36
37 //connection String
38 public String getConnectionString(ICdmDataSource ds, int port){
39 return urlString + ds.getServer() + ":" + port + dbSeparator + ds.getDatabase();
40 }
41
42 /* (non-Javadoc)
43 * @see eu.etaxonomy.cdm.database.types.DatabaseTypeBase#getServerNameByConnectionString(java.lang.String)
44 */
45 @Override
46 public String getDatabaseNameByConnectionString(String connectionString){
47 String result;
48 result = getDatabasePartOfConnectionString(connectionString, dbSeparator);
49 //TODO
50 // int posParams = result.indexOf("?");
51 // if (posParams != -1){
52 // result = result.substring(0, posParams);
53 // }
54 return result;
55 }
56
57
58 /**
59 * Constructor
60 */
61 public PostgreSQLDatabaseType() {
62 init (typeName, classString, urlString, defaultPort, hibernateDialect );
63 }
64
65
66
67 }