KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > container > persistence > hibernate > HibernateSetupConstants


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * ---------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * ---------------------------------------------------------
30  * $Log: HibernateSetupConstants.java,v $
31  * Revision 1.5 2005/05/10 20:07:09 colinmacleod
32  * Workaround for tomcat 5.0.x (creates
33  * copy of 'res' HSQLDB).
34  *
35  * Revision 1.4 2005/04/30 13:02:36 colinmacleod
36  * Added checking and removal of previous
37  * hibernate lock file.
38  *
39  * Revision 1.3 2005/04/27 15:08:46 colinmacleod
40  * Converted Windows file separator to /
41  *
42  * Revision 1.2 2005/04/22 09:31:53 colinmacleod
43  * Reordered the file alphabetically.
44  *
45  * Revision 1.1 2005/04/11 10:03:44 colinmacleod
46  * Added setup feature.
47  *
48  * ---------------------------------------------------------
49  */

50 package com.ivata.groupware.container.persistence.hibernate;
51
52 /**
53  * @since ivata groupware 0.11 (08-Apr-2005)
54  * @author Colin MacLeod
55  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
56  * @version $Revision: 1.5 $
57  */

58
59 public final class HibernateSetupConstants {
60     /**
61      * Dialect used when the database is created automatically.
62      */

63     public final static String JavaDoc AUTOMATIC_DATABASE_DIALECT
64         = "net.sf.hibernate.dialect.HSQLDialect";
65     /**
66      * Driver used when the database is created automatically.
67      * Refer to {@link #getAutomaticDatabaseDriver}.
68      */

69     public final static String JavaDoc AUTOMATIC_DATABASE_DRIVER
70         = "org.hsqldb.jdbcDriver";
71     /**
72      * Database URL used by default when the in-memory database is used.
73      */

74     public final static String JavaDoc AUTOMATIC_DATABASE_MEMORY_URL =
75         "jdbc:hsqldb:res:"
76         + HibernateSetupConstants.START_DB;
77     /**
78      * Database password used when the database is created automatically.
79      */

80     public final static String JavaDoc AUTOMATIC_DATABASE_PASSWORD = "";
81     /**
82      * Database URL used by default when the database is created
83      * automatically for temporary use (i.e. when the 'res' type fails
84      * on tomcat 5.0.x).
85      */

86     public final static String JavaDoc AUTOMATIC_DATABASE_TMP_URL = "jdbc:hsqldb:file:"
87         + System.getProperty("user.home").replace('\\', '/')
88         + "/.ivatagroupware/tmpdb/tmp";
89     /**
90      * Database URL used by default when the database is created
91      * automatically.
92      */

93     public final static String JavaDoc AUTOMATIC_DATABASE_URL = "jdbc:hsqldb:file:"
94         + System.getProperty("user.home").replace('\\', '/')
95         + "/.ivatagroupware/db/hsqldb";
96     /**
97      * Default database URL start - all automatic URLs must begin like this.
98      */

99    public static final String JavaDoc AUTOMATIC_DATABASE_URL_START
100        = "jdbc:hsqldb:file:";
101     /**
102      * User name used when the database is created automatically.
103      */

104     public final static String JavaDoc AUTOMATIC_DATABASE_USER_NAME = "sa";
105     /**
106      * If the program is still running with the memory database, but the user
107      * has confirmed this is OK, then an application scoped attribute is set
108      * in the page context, to the value <code>Boolean.TRUE</code>. This is
109      * the name of that attribute
110      */

111     public final static String JavaDoc CONFIRM_ATTRIBUTE = "setupConfirmed";
112     /**
113      * Names of the <strong>Hibernate</strong> dialects supported.
114      */

115     public static final String JavaDoc[] DATABASE_DIALECTS = {
116             "",
117             "net.sf.hibernate.dialect.DB2Dialect",
118             "net.sf.hibernate.dialect.DB2400Dialect",
119             "net.sf.hibernate.dialect.DB2390Dialect",
120             "net.sf.hibernate.dialect.FirebirdDialect",
121             "net.sf.hibernate.dialect.FrontbaseDialect",
122             "net.sf.hibernate.dialect.HSQLDialect",
123             "net.sf.hibernate.dialect.InformixDialect",
124             "net.sf.hibernate.dialect.IngresDialect",
125             "net.sf.hibernate.dialect.InterbaseDialect",
126             "net.sf.hibernate.dialect.MckoiDialect",
127             "net.sf.hibernate.dialect.SQLServerDialect",
128             "net.sf.hibernate.dialect.MySQLDialect",
129             "net.sf.hibernate.dialect.OracleDialect",
130             "net.sf.hibernate.dialect.Oracle9Dialect",
131             "net.sf.hibernate.dialect.PointbaseDialect",
132             "net.sf.hibernate.dialect.PostgreSQLDialect",
133             "net.sf.hibernate.dialect.ProgressDialect",
134             "net.sf.hibernate.dialect.SAPDBDialect",
135             "net.sf.hibernate.dialect.SybaseAnywhereDialect",
136             "net.sf.hibernate.dialect.SybaseDialect",
137     };
138     /**
139      * Names of the default database drivers for each dialect.
140      */

141     public static final String JavaDoc[] DATABASE_DRIVERS = {
142             "",
143             "COM.ibm.db2.jdbc.net.DB2Driver",
144             "COM.ibm.db2.jdbc.net.DB2Driver",
145             "COM.ibm.db2.jdbc.net.DB2Driver",
146             "org.firebirdsql.jdbc.FBDriver",
147             "com.frontbase.jdbc.FBJDriver",
148             "org.hsqldb.jdbcDriver",
149             "com.informix.jdbc.IfxDriver",
150             "ca.edbc.jdbc.EdbcDriver",
151             "interbase.interclient.Driver",
152             "com.mckoi.JDBCDriver",
153             "com.internetcds.jdbc.tds.Driver",
154             "org.gjt.mm.mysql.Driver",
155             "oracle.jdbc.driver.OracleDriver",
156             "oracle.jdbc.driver.OracleDriver",
157             "com.pointbase.net.netJDBCDriver",
158             "org.postgresql.Driver",
159             "com.progress.sql.jdbc.JdbcProgressDriver",
160             "com.sap.dbtech.jdbc.DriverSapDB",
161             "com.sybase.jdbc2.jdbc.SybDriver",
162             "com.sybase.jdbc2.jdbc.SybDriver"
163     };
164     /**
165      * These are the text names of the database types supported.
166      */

167     public static final String JavaDoc[] DATABASE_TYPES = {
168             "Choose one...",
169             "DB2",
170             "DB2 AS/400",
171             "DB2 OS390",
172             "Firebird",
173             "FrontBase",
174             "HypersonicSQL",
175             "Informix",
176             "Ingres",
177             "Interbase",
178             "Mckoi SQL",
179             "Microsoft SQL Server",
180             "MySQL",
181             "Oracle (any version)",
182             "Oracle 9/10g",
183             "Pointbase",
184             "PostgreSQL",
185             "Progress",
186             "SAP DB",
187             "Sybase",
188             "Sybase Anywhere"
189     };
190     /**
191      * Names of the default database URLs for each dialect.
192      */

193     public static final String JavaDoc[] DATABASE_URLS = {
194             "",
195             "jdbc:db2//{host_name}:6789/{dbname}",
196             "jdbc:db2//{host_name}:6789/{dbname}",
197             "jdbc:db2//{host_name}:6789/{dbname}",
198             "jdbc:firebirdsql:[//host[:port]/]{database}",
199             "jdbc:FrontBase://{host}:{port}/{database}",
200             "jdbc:hsqldb:http://{server}[:{1476}]",
201             "jdbc:informix-sqli://{host}:{port}/{dbname}: INFORMIXSERVER={ServerName}",
202             "jdbc:edbc://{host}:21072/{host}::{dbname}",
203             "jdbc:interbase://{server}/{full_db_path}",
204             "jdbc:mckoi://{host}[:9157][/{schema}]",
205             "jdbc:freetds:sqlserver://{hostname}[:{4100}]/{dbname}[;{property}={value}[;...]]",
206             "jdbc:mysql://{hostname}[{:3306}]/{dbname}",
207             "jdbc:oracle:thin:@{server}[:{1521}]:{dbname}",
208             "jdbc:oracle:thin:@{server}[:{1521}]:{dbname}",
209             "jdbc:pointbase:embedded:{dbname}",
210             "jdbc:postgresql:[{//host}[{:5432}/]]{dbname}",
211             "jdbc:progress:T:{host}:{port|service-name}:{dbname} -user {userid} -password {password}",
212             "jdbc:sapdb:[//host/]dbname[?name=value[&amp;name=value]*]",
213             "jdbc:sybase:Tds:{host}:{port}/{DBNAME}",
214             "jdbc:sybase:Tds:{host}:{port}?ServiceName={DBNAME}"
215     };
216     /**
217      * Webapp-relative path to the hibernate config file.
218      */

219     public static final String JavaDoc HIBERNATE_CONFIG = "/WEB-INF/classes/hibernate"
220             + ".cfg.xml";
221
222     /**
223      * Name of the hibernate dialect property.
224      */

225     public final static String JavaDoc HIBERNATE_PROPERTY_DATABASE_DIALECT =
226         "dialect";
227     /**
228      * Name of the hibernate connection driver property.
229      */

230     public final static String JavaDoc HIBERNATE_PROPERTY_DATABASE_DRIVER =
231         "hibernate.connection.driver_class";
232     /**
233      * Name of the hibernate database password property.
234      */

235     public final static String JavaDoc HIBERNATE_PROPERTY_DATABASE_PASSWORD =
236         "hibernate.connection.password";
237     /**
238      * Name of the hibernate connection URL property.
239      */

240     public final static String JavaDoc HIBERNATE_PROPERTY_DATABASE_URL =
241         "hibernate.connection.url";
242     /**
243      * Name of the hibernate connection user name property.
244      */

245     public final static String JavaDoc HIBERNATE_PROPERTY_DATABASE_USER_NAME =
246         "hibernate.connection.username";
247     /**
248      * File extension of the <strong>HypersonicSQL</strong> database lock file.
249      */

250     public static final String JavaDoc HSQLDB_LOCK_SUFFIX = ".lck.lck";
251     /**
252      * File extension of the <strong>HypersonicSQL</strong> database properties.
253      */

254     public static final String JavaDoc HSQLDB_PROPERTIES_SUFFIX = ".properties";
255     /**
256      * File extension of the <strong>HypersonicSQL</strong> database script.
257      */

258     public static final String JavaDoc HSQLDB_SCRIPT_SUFFIX = ".script";
259     /**
260      * Path and filename of the start <strong>HypersonicSQL</strong> database
261      * we'll copy over.
262      */

263     public static final String JavaDoc START_DB = "/db/igwstart";
264
265     /**
266      * Private default constructor enforces utility class behavior.
267      */

268     private HibernateSetupConstants() {
269     }
270 }
271
Popular Tags