Source Code Cross Referenced for SysProperties.java in  » Database-DBMS » h2database » org » h2 » constant » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » h2database » org.h2.constant 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
003:         * (http://h2database.com/html/license.html).
004:         * Initial Developer: H2 Group
005:         */
006:        package org.h2.constant;
007:
008:        import org.h2.engine.Constants;
009:        import org.h2.message.TraceSystem;
010:
011:        /**
012:         * The constants defined in this class are initialized from system properties.
013:         * Those properties can be set when starting the virtual machine:
014:         * <pre>
015:         * java -Dh2.baseDir=/temp
016:         * </pre>
017:         * They can be set within the application, but this must be done before loading
018:         * any classes of this database (before loading the JDBC driver):
019:         * <pre>
020:         * System.setProperty(&quot;h2.baseDir&quot;, &quot;/temp&quot;);
021:         * </pre>
022:         */
023:        public class SysProperties {
024:
025:            /**
026:             * INTERNAL
027:             */
028:            public static final String H2_MAX_QUERY_TIMEOUT = "h2.maxQueryTimeout";
029:
030:            /**
031:             * INTERNAL
032:             */
033:            public static final String H2_LOG_DELETE_DELAY = "h2.logDeleteDelay";
034:
035:            /**
036:             * INTERNAL
037:             */
038:            public static final String H2_COLLATOR_CACHE_SIZE = "h2.collatorCacheSize";
039:
040:            /**
041:             * System property <code>file.encoding</code> (default: Cp1252).<br />
042:             * It is usually set by the system and is the default encoding used for the
043:             * RunScript and CSV tool.
044:             */
045:            public static final String FILE_ENCODING = getStringSetting(
046:                    "file.encoding", "Cp1252");
047:
048:            /**
049:             * System property <code>file.separator</code> (default: /).<br />
050:             * It is usually set by the system, and used to build absolute file names.
051:             */
052:            public static final String FILE_SEPARATOR = getStringSetting(
053:                    "file.separator", "/");
054:
055:            /**
056:             * System property <code>line.separator</code> (default: \n).<br />
057:             * It is usually set by the system, and used by the script and trace tools.
058:             */
059:            public static final String LINE_SEPARATOR = getStringSetting(
060:                    "line.separator", "\n");
061:
062:            /**
063:             * System property <code>user.home</code> (default: empty string).<br />
064:             * It is usually set by the system, and used as a replacement for ~ in file
065:             * names.
066:             */
067:            public static final String USER_HOME = getStringSetting(
068:                    "user.home", "");
069:
070:            /**
071:             * System property <code>h2.aliasColumnName</code> (default: false).<br />
072:             * When enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the
073:             * real table and column name in ResultSetMetaData.getTableName() and
074:             * getColumnName(). This is disabled by default for compatibility with other
075:             * databases (HSQLDB, Apache Derby, PostgreSQL, some version of MySQL).
076:             */
077:            // TODO change in version 1.1
078:            public static final boolean ALIAS_COLUMN_NAME = getBooleanSetting(
079:                    "h2.aliasColumnName", false);
080:
081:            /**
082:             * System property <code>h2.allowBigDecimalExtensions</code> (default:
083:             * false).<br />
084:             * When enabled, classes that extend BigDecimal are supported in
085:             * PreparedStatement.setBigDecimal.
086:             */
087:            public static final boolean ALLOW_BIG_DECIMAL_EXTENSIONS = getBooleanSetting(
088:                    "h2.allowBigDecimalExtensions", false);
089:
090:            /**
091:             * System property <code>h2.allowedClasses</code> (default: *).<br />
092:             * Comma separated list of class names or prefixes.
093:             */
094:            public static final String ALLOWED_CLASSES = getStringSetting(
095:                    "h2.allowedClasses", "*");
096:
097:            /**
098:             * System property <code>h2.bindAddress</code> (default: *).<br />
099:             * Comma separated list of class names or prefixes.
100:             */
101:            public static final String BIND_ADDRESS = getStringSetting(
102:                    "h2.bindAddress", null);
103:
104:            /**
105:             * System property <code>h2.cacheSizeDefault</code> (default: 16384).<br />
106:             * The default cache size in KB.
107:             */
108:            public static final int CACHE_SIZE_DEFAULT = getIntSetting(
109:                    "h2.cacheSizeDefault", 16 * 1024);
110:
111:            /**
112:             * System property <code>h2.cacheSizeIndexShift</code> (default: 3).<br />
113:             * How many time the cache size value is divided by two to get the index
114:             * cache size. The index cache size is calculated like this: cacheSize >>
115:             * cacheSizeIndexShift.
116:             */
117:            public static final int CACHE_SIZE_INDEX_SHIFT = getIntSetting(
118:                    "h2.cacheSizeIndexShift", 3);
119:
120:            /**
121:             * INTERNAL
122:             */
123:            public static final int CACHE_SIZE_INDEX_DEFAULT = CACHE_SIZE_DEFAULT >> CACHE_SIZE_INDEX_SHIFT;
124:
125:            /**
126:             * System property <code>h2.check</code> (default: true).<br />
127:             * Assertions in the database engine.
128:             */
129:            public static final boolean CHECK = getBooleanSetting("h2.check",
130:                    true);
131:
132:            /**
133:             * System property <code>h2.check2</code> (default: true).<br />
134:             * Additional assertions in the database engine.
135:             */
136:            public static final boolean CHECK2 = getBooleanSetting("h2.check2",
137:                    false);
138:
139:            /**
140:             * System property <code>h2.clientTraceDirectory</code> (default:
141:             * trace.db/).<br />
142:             * Directory where the trace files of the JDBC client are stored (only for
143:             * client / server).
144:             */
145:            public static final String CLIENT_TRACE_DIRECTORY = getStringSetting(
146:                    "h2.clientTraceDirectory", "trace.db/");
147:
148:            /**
149:             * System property <code>h2.defaultMaxOperationMemory</code> (default:
150:             * 100000).<br />
151:             * The default for the setting MAX_OPERATION_MEMORY.
152:             */
153:            public static final int DEFAULT_MAX_OPERATION_MEMORY = getIntSetting(
154:                    "h2.defaultMaxOperationMemory", 100000);
155:
156:            /**
157:             * System property <code>h2.dataSourceTraceLevel</code> (default: 1).<br />
158:             * The trace level of the data source implementation. Default is 1 for
159:             * error.
160:             */
161:            public static final int DATASOURCE_TRACE_LEVEL = getIntSetting(
162:                    "h2.dataSourceTraceLevel", TraceSystem.ERROR);
163:
164:            /**
165:             * System property <code>h2.defaultMaxMemoryUndo</code> (default: 100000).<br />
166:             * The default value for the MAX_MEMORY_UNDO setting.
167:             */
168:            public static final int DEFAULT_MAX_MEMORY_UNDO = getIntSetting(
169:                    "h2.defaultMaxMemoryUndo", 100000);
170:
171:            /**
172:             * System property <code>h2.defaultLockMode</code> (default: 3).<br />
173:             * The default value for the LOCK_MODE setting.
174:             */
175:            public static final int DEFAULT_LOCK_MODE = getIntSetting(
176:                    "h2.defaultLockMode", Constants.LOCK_MODE_READ_COMMITTED);
177:
178:            /**
179:             * System property <code>h2.emergencySpaceInitial</code> (default: 262144).<br />
180:             * Size of 'reserve' file to detect disk full problems early.
181:             */
182:            public static final int EMERGENCY_SPACE_INITIAL = getIntSetting(
183:                    "h2.emergencySpaceInitial", 256 * 1024);
184:
185:            /**
186:             * System property <code>h2.emergencySpaceMin</code> (default: 65536).<br />
187:             * Minimum size of 'reserve' file.
188:             */
189:            public static final int EMERGENCY_SPACE_MIN = getIntSetting(
190:                    "h2.emergencySpaceMin", 64 * 1024);
191:
192:            /**
193:             * System property <code>h2.lobCloseBetweenReads</code> (default: false).<br />
194:             * Close LOB files between read operations.
195:             */
196:            public static boolean lobCloseBetweenReads = getBooleanSetting(
197:                    "h2.lobCloseBetweenReads", false);
198:
199:            /**
200:             * System property <code>h2.lobFilesInDirectories</code> (default: false).<br />
201:             * Store LOB files in subdirectories.
202:             */
203:            // TODO change in version 1.1
204:            // TODO: when removing this property, also remove 
205:            // DataHandler.allocateObjectId, createTempFile it
206:            public static final boolean LOB_FILES_IN_DIRECTORIES = getBooleanSetting(
207:                    "h2.lobFilesInDirectories", false);
208:
209:            /**
210:             * System property <code>h2.lobFilesPerDirectory</code> (default: 256).<br />
211:             * Maximum number of LOB files per directory.
212:             */
213:            public static final int LOB_FILES_PER_DIRECTORY = getIntSetting(
214:                    "h2.lobFilesPerDirectory", 256);
215:
216:            /**
217:             * System property <code>h2.logAllErrors</code> (default: false).<br />
218:             * Write stack traces of any kind of error to a file.
219:             */
220:            public static final boolean LOG_ALL_ERRORS = getBooleanSetting(
221:                    "h2.logAllErrors", false);
222:
223:            /**
224:             * System property <code>h2.logAllErrorsFile</code> (default:
225:             * h2errors.txt).<br />
226:             * File name to log errors.
227:             */
228:            public static final String LOG_ALL_ERRORS_FILE = getStringSetting(
229:                    "h2.logAllErrorsFile", "h2errors.txt");
230:
231:            /**
232:             * System property <code>h2.maxFileRetry</code> (default: 16).<br />
233:             * Number of times to retry file delete and rename.
234:             */
235:            public static final int MAX_FILE_RETRY = Math.max(1, getIntSetting(
236:                    "h2.maxFileRetry", 16));
237:
238:            /**
239:             * System property <code>h2.maxMemoryRowsDistinct</code> (default:
240:             * Integer.MAX_VALUE).<br />
241:             * The maximum number of rows kept in-memory for SELECT DISTINCT queries. If
242:             * more than this number of rows are in a result set, a temporary table is
243:             * used.
244:             */
245:            public static final int MAX_MEMORY_ROWS_DISTINCT = getIntSetting(
246:                    "h2.maxMemoryRowsDistinct", Integer.MAX_VALUE);
247:
248:            /**
249:             * System property <code>h2.maxQueryTimeout</code> (default: 0).<br />
250:             * The maximum timeout of a query. The default is 0, meaning no limit.
251:             */
252:            public static final int MAX_QUERY_TIMEOUT = getIntSetting(
253:                    H2_MAX_QUERY_TIMEOUT, 0);
254:
255:            /**
256:             * System property <code>h2.minColumnNameMap</code> (default: 3).<br />
257:             * The minimum number of columns where a hash table is created when result set
258:             * methods with column name (instead of column index) parameter are called.
259:             */
260:            public static final int MIN_COLUMN_NAME_MAP = getIntSetting(
261:                    "h2.minColumnNameMap", 3);
262:
263:            /**
264:             * System property <code>h2.minWriteDelay</code> (default: 5).<br />
265:             * The minimum write delay that causes commits to be delayed.
266:             */
267:            public static final int MIN_WRITE_DELAY = getIntSetting(
268:                    "h2.minWriteDelay", 5);
269:
270:            /**
271:             * System property <code>h2.objectCache</code> (default: true).<br />
272:             * Cache commonly used objects (integers, strings).
273:             */
274:            public static final boolean OBJECT_CACHE = getBooleanSetting(
275:                    "h2.objectCache", true);
276:
277:            /**
278:             * System property <code>h2.objectCacheMaxPerElementSize</code> (default:
279:             * 4096).<br />
280:             * Maximum size of an object in the cache.
281:             */
282:            public static final int OBJECT_CACHE_MAX_PER_ELEMENT_SIZE = getIntSetting(
283:                    "h2.objectCacheMaxPerElementSize", 4096);
284:
285:            /**
286:             * System property <code>h2.objectCacheSize</code> (default: 1024).<br />
287:             * Maximum size of an object in the cache.
288:             */
289:            public static final int OBJECT_CACHE_SIZE = getIntSetting(
290:                    "h2.objectCacheSize", 1024);
291:
292:            /**
293:             * System property <code>h2.optimizeDropDependencies</code> (default:
294:             * true).<br />
295:             * Improve the performance of DROP and DROP ALL OBJECTS by quicker scanning
296:             * if other objects depend on this object.
297:             */
298:            public static final boolean OPTIMIZE_DROP_DEPENDENCIES = getBooleanSetting(
299:                    "h2.optimizeDropDependencies", true);
300:
301:            /**
302:             * System property <code>h2.optimizeDistinct</code> (default: true).<br />
303:             * Improve the performance of simple DISTINCT queries if an index is
304:             * available for the given column. The optimization is used if:
305:             * <ul>
306:             * <li>The select is a single column query without condition </li>
307:             * <li>The query contains only one table, and no group by </li>
308:             * <li>There is only one table involved </li>
309:             * <li>There is an ascending index on the column </li>
310:             * <li>The selectivity of the column is below 20 </li>
311:             * </ul>
312:             */
313:            public static final boolean OPTIMIZE_DISTINCT = getBooleanSetting(
314:                    "h2.optimizeDistinct", true);
315:
316:            /**
317:             * System property <code>h2.optimizeEvaluatableSubqueries</code> (default:
318:             * true).<br />
319:             * Optimize subqueries that are not dependent on the outer query.
320:             */
321:            public static final boolean OPTIMIZE_EVALUATABLE_SUBQUERIES = getBooleanSetting(
322:                    "h2.optimizeEvaluatableSubqueries", true);
323:
324:            /**
325:             * System property <code>h2.optimizeGroupSorted</code> (default: false).<br />
326:             * Optimize GROUP BY queries if an index can be used that matches the group
327:             * by columns.
328:             */
329:            public static final boolean OPTIMIZE_GROUP_SORTED = getBooleanSetting(
330:                    "h2.optimizeGroupSorted", false);
331:
332:            /**
333:             * System property <code>h2.optimizeIn</code> (default: true).<br />
334:             * Optimize IN(...) comparisons.
335:             */
336:            public static final boolean OPTIMIZE_IN = getBooleanSetting(
337:                    "h2.optimizeIn", true);
338:
339:            /**
340:             * System property <code>h2.optimizeInJoin</code> (default: false).<br />
341:             * Optimize IN(...) comparisons by converting them to inner joins.
342:             */
343:            // TODO change in version 1.1
344:            public static final boolean OPTIMIZE_IN_JOIN = getBooleanSetting(
345:                    "h2.optimizeInJoin", false);
346:
347:            /**
348:             * System property <code>h2.optimizeMinMax</code> (default: true).<br />
349:             * Optimize MIN and MAX aggregate functions.
350:             */
351:            public static final boolean OPTIMIZE_MIN_MAX = getBooleanSetting(
352:                    "h2.optimizeMinMax", true);
353:
354:            /**
355:             * System property <code>h2.optimizeSubqueryCache</code> (default: true).<br />
356:             * Cache subquery results.
357:             */
358:            public static final boolean OPTIMIZE_SUBQUERY_CACHE = getBooleanSetting(
359:                    "h2.optimizeSubqueryCache", true);
360:
361:            /**
362:             * System property <code>h2.optimizeNot</code> (default: true).<br />
363:             * Optimize NOT conditions by removing the NOT and inverting the condition.
364:             */
365:            public static final boolean OPTIMIZE_NOT = getBooleanSetting(
366:                    "h2.optimizeNot", true);
367:
368:            /**
369:             * System property <code>h2.optimizeTwoEquals</code> (default: true).<br />
370:             * Optimize expressions of the form A=B AND B=1. In this case, AND A=1 is
371:             * added so an index on A can be used.
372:             */
373:            public static final boolean OPTIMIZE_TWO_EQUALS = getBooleanSetting(
374:                    "h2.optimizeTwoEquals", true);
375:
376:            /**
377:             * System property <code>h2.overflowExceptions</code> (default: true).<br />
378:             * Throw an exception on integer overflows.
379:             */
380:            public static final boolean OVERFLOW_EXCEPTIONS = getBooleanSetting(
381:                    "h2.overflowExceptions", true);
382:
383:            /**
384:             * System property <code>h2.recompileAlways</code> (default: false).<br />
385:             * Always recompile prepared statements.
386:             */
387:            public static final boolean RECOMPILE_ALWAYS = getBooleanSetting(
388:                    "h2.recompileAlways", false);
389:
390:            /**
391:             * System property <code>h2.redoBufferSize</code> (default: 262144).<br />
392:             * Size of the redo buffer (used at startup when recovering).
393:             */
394:            public static final int REDO_BUFFER_SIZE = getIntSetting(
395:                    "h2.redoBufferSize", 256 * 1024);
396:
397:            /**
398:             * System property <code>h2.reuseSpaceAfter</code> (default: 16).<br />
399:             * Reuse space in database files after this many pages are free.
400:             */
401:            public static final int REUSE_SPACE_AFTER = getIntSetting(
402:                    "h2.reuseSpaceAfter", 32);
403:
404:            /**
405:             * System property <code>h2.reuseSpaceQuickly</code> (default: true).<br />
406:             * Reuse space in database files quickly.
407:             */
408:            public static final boolean REUSE_SPACE_QUICKLY = getBooleanSetting(
409:                    "h2.reuseSpaceQuickly", true);
410:
411:            /**
412:             * System property <code>h2.runFinalize</code> (default: true).<br />
413:             * Run finalizers to detect unclosed connections.
414:             */
415:            public static boolean runFinalize = getBooleanSetting(
416:                    "h2.runFinalize", true);
417:
418:            /**
419:             * System property <code>h2.scriptDirectory</code> (default: empty
420:             * string).<br />
421:             * Relative or absolute directory where the script files are stored to or
422:             * read from.
423:             */
424:            public static String scriptDirectory = getStringSetting(
425:                    "h2.scriptDirectory", "");
426:
427:            /**
428:             * System property <code>h2.serverCachedObjects</code> (default: 64).<br />
429:             * TCP Server: number of cached objects per session.
430:             */
431:            public static final int SERVER_CACHED_OBJECTS = getIntSetting(
432:                    "h2.serverCachedObjects", 64);
433:
434:            /**
435:             * System property <code>h2.serverResultSetFetchSize</code> (default: 100).<br />
436:             * The default result set fetch size when using the server mode.
437:             */
438:            public static final int SERVER_RESULT_SET_FETCH_SIZE = getIntSetting(
439:                    "h2.serverResultSetFetchSize", 100);
440:
441:            /**
442:             * System property <code>h2.traceIO</code> (default: false).<br />
443:             * Trace all I/O operations.
444:             */
445:            public static final boolean TRACE_IO = getBooleanSetting(
446:                    "h2.traceIO", false);
447:
448:            /**
449:             * System property <code>h2.largeResultBufferSize</code> (default: 4096).<br />
450:             * Buffer size for large result sets. Set this value to 0 to disable the buffer.
451:             */
452:            public static final int LARGE_RESULT_BUFFER_SIZE = getIntSetting(
453:                    "h2.largeResultBufferSize", 4 * 1024);
454:
455:            /**
456:             * System property <code>h2.collatorCacheSize</code> (default: 10000).<br />
457:             * The cache size for collation keys (in elements). Used when a collator has
458:             * been set for the database.
459:             */
460:            public static final int COLLATOR_CACHE_SIZE = getCollatorCacheSize();
461:
462:            private static String baseDir = getStringSetting("h2.baseDir", null);
463:
464:            private static boolean getBooleanSetting(String name,
465:                    boolean defaultValue) {
466:                String s = getProperty(name);
467:                if (s != null) {
468:                    try {
469:                        return Boolean.valueOf(s).booleanValue();
470:                    } catch (NumberFormatException e) {
471:                    }
472:                }
473:                return defaultValue;
474:            }
475:
476:            private static String getProperty(String name) {
477:                try {
478:                    return System.getProperty(name);
479:                } catch (SecurityException e) {
480:                    // applets may not do that - ignore
481:                    return null;
482:                }
483:            }
484:
485:            /**
486:             * INTERNAL
487:             */
488:            public static String getStringSetting(String name,
489:                    String defaultValue) {
490:                String s = getProperty(name);
491:                return s == null ? defaultValue : s;
492:            }
493:
494:            /**
495:             * INTERNAL
496:             */
497:            public static int getIntSetting(String name, int defaultValue) {
498:                String s = getProperty(name);
499:                if (s != null) {
500:                    try {
501:                        return Integer.decode(s).intValue();
502:                    } catch (NumberFormatException e) {
503:                    }
504:                }
505:                return defaultValue;
506:            }
507:
508:            /**
509:             * INTERNAL
510:             */
511:            public static void setBaseDir(String dir) {
512:                if (!dir.endsWith("/")) {
513:                    dir += "/";
514:                }
515:                baseDir = dir;
516:            }
517:
518:            /**
519:             * INTERNAL
520:             */
521:            public static String getBaseDir() {
522:                return baseDir;
523:            }
524:
525:            /**
526:             * INTERNAL
527:             */
528:            public static int getMaxQueryTimeout() {
529:                return getIntSetting(H2_MAX_QUERY_TIMEOUT, 0);
530:            }
531:
532:            /**
533:             * INTERNAL
534:             */
535:            public static int getLogFileDeleteDelay() {
536:                return getIntSetting(H2_LOG_DELETE_DELAY, 0);
537:            }
538:
539:            /**
540:             * INTERNAL
541:             */
542:            public static int getCollatorCacheSize() {
543:                return getIntSetting(H2_COLLATOR_CACHE_SIZE, 32000);
544:            }
545:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.