001: /*
002: Copyright (C) 2007 Mobixess Inc. http://www.java-objects-database.com
003:
004: This file is part of the JODB (Java Objects Database) open source project.
005:
006: JODB is free software; you can redistribute it and/or modify it under
007: the terms of version 2 of the GNU General Public License as published
008: by the Free Software Foundation.
009:
010: JODB is distributed in the hope that it will be useful, but WITHOUT ANY
011: WARRANTY; without even the implied warranty of MERCHANTABILITY or
012: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
013: for more details.
014:
015: You should have received a copy of the GNU General Public License along
016: with this program; if not, write to the Free Software Foundation, Inc.,
017: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
018: */
019: package com.mobixess.jodb.core;
020:
021: import com.mobixess.jodb.core.io.IRandomAccessBufferFactory;
022: import com.mobixess.jodb.core.io.buffers.RandomAccessFileBufferFactory;
023:
024: /**
025: * @author Mobixess
026: * Global configuration context.
027: *
028: */
029: public class JODBConfig {
030: private static String _transactionAssembleFolder = null; //default null
031: private static long _maxWriteWait = 60000;
032: private static long _maxReadWait = 60000;
033: private static int _defaultSetDepth = 5;
034: private static int _defaultDeleteDepth = 1;
035: private static int _defaultActivationDepth = _defaultSetDepth;
036: private static boolean _generateCommitTimeStamp = false;
037: private static boolean _generateModificationTimeStamp = false;
038: private static boolean _backgroundReferenceCleaner = true;
039: private static long _referenceCleanerInterval = 5000;//5 sec by default
040: private static IRandomAccessBufferFactory _randomAccessBufferFactory = RandomAccessFileBufferFactory
041: .getInstance();
042: private static ClassLoader _customClassLoader;
043: private static boolean _useCacheOnSortOperations = true;
044:
045: public final static boolean DEBUG = false;/*ant replace*/
046:
047: /**
048: * @param assembleFolder the _transactionAssembleFolder to set
049: */
050: public static void setTransactionAssembleTempFolder(
051: String assembleFolder) {
052: _transactionAssembleFolder = assembleFolder;
053: }
054:
055: /**
056: * @return the _transactionAssembleFolder
057: */
058: public static String getTransactionAssembleTempFolder() {
059: return _transactionAssembleFolder;
060: }
061:
062: public static long getMaxWriteWait() {
063: return _maxWriteWait;
064: }
065:
066: /**
067: * @param writeWait the _maxWriteWait to set
068: */
069: public static void setMaxWriteWait(long writeWait) {
070: _maxWriteWait = writeWait;
071: }
072:
073: /**
074: * @param readwait the _maxReadwait to set
075: */
076: public static void setMaxReadWait(long readWait) {
077: _maxReadWait = readWait;
078: }
079:
080: /**
081: * @return the _maxReadwait
082: */
083: public static long getMaxReadWait() {
084: return _maxReadWait;
085: }
086:
087: public static int getDefaultSetDepth() {
088: return _defaultSetDepth;
089: }
090:
091: public static void setDefaultSetDepth(int defaultSetDepth) {
092: _defaultSetDepth = defaultSetDepth;
093: }
094:
095: public static boolean isGenerateModificationTimeStamp() {
096: return _generateModificationTimeStamp;
097: }
098:
099: public static boolean isGenerateCommitTimeStamp() {
100: return _generateCommitTimeStamp;
101: }
102:
103: public static void enableCommitTimeStamp(boolean enable) {
104: _generateCommitTimeStamp = enable;
105: }
106:
107: public static void enableModificationTimeStamp(boolean enable) {
108: _generateModificationTimeStamp = enable;
109: }
110:
111: public static void enableBackgroundReferenceCleaner(boolean isEnable) {
112: _backgroundReferenceCleaner = isEnable;
113: }
114:
115: public static boolean isBackgroundReferenceCleanerEnabled() {
116: return _backgroundReferenceCleaner;
117: }
118:
119: public static long getReferenceCleanerInterval() {
120: return _referenceCleanerInterval;
121: }
122:
123: public static void setReferenceCleanerInterval(
124: long referenceCleanerInterval) {
125: _referenceCleanerInterval = referenceCleanerInterval;
126: }
127:
128: public static int getDefaultDeleteDepth() {
129: return _defaultDeleteDepth;
130: }
131:
132: public static void setDefaultDeleteDepth(int defaultDeleteDepth) {
133: _defaultDeleteDepth = defaultDeleteDepth;
134: }
135:
136: public static int getDefaultActivationDepth() {
137: return _defaultActivationDepth;
138: }
139:
140: public static void setDefaultActivationDepth(
141: int defaultActivationDepth) {
142: _defaultActivationDepth = defaultActivationDepth;
143: }
144:
145: public static IRandomAccessBufferFactory getRandomAccessBufferFactory() {
146: return _randomAccessBufferFactory;
147: }
148:
149: public static void setRandomAccessBufferFactory(
150: IRandomAccessBufferFactory randomAccessBufferFactory) {
151: _randomAccessBufferFactory = randomAccessBufferFactory;
152: }
153:
154: public static ClassLoader getCustomClassLoader() {
155: return _customClassLoader;
156: }
157:
158: public static void setCustomClassLoader(
159: ClassLoader customClassLoader) {
160: _customClassLoader = customClassLoader;
161: }
162:
163: public static boolean useCacheOnSortOperations() {
164: return _useCacheOnSortOperations;
165: }
166:
167: public static void setCacheOnSortOperations(boolean enabled) {
168: _useCacheOnSortOperations = enabled;
169: }
170: }
|