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