KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > Config4Impl


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o;
22
23 import java.io.*;
24
25 import com.db4o.config.*;
26 import com.db4o.diagnostic.*;
27 import com.db4o.foundation.*;
28 import com.db4o.inside.*;
29 import com.db4o.inside.diagnostic.*;
30 import com.db4o.inside.freespace.*;
31 import com.db4o.io.*;
32 import com.db4o.messaging.*;
33 import com.db4o.reflect.*;
34 import com.db4o.reflect.generic.*;
35
36 /**
37  * Configuration template for creating new db4o files
38  *
39  * @exclude
40  */

41 public final class Config4Impl
42
43 implements Configuration, DeepClone, MessageSender, FreespaceConfiguration, QueryConfiguration {
44     
45     private KeySpecHashtable4 _config=new KeySpecHashtable4(50);
46     
47     private final static KeySpec ACTIVATION_DEPTH=new KeySpec(5);
48     
49     private final static KeySpec ALLOW_VERSION_UPDATES=new KeySpec(false);
50
51     private final static KeySpec AUTOMATIC_SHUTDOWN=new KeySpec(true);
52
53     // TODO: consider setting default to 8, it's more efficient with freespace.
54
private final static KeySpec BLOCKSIZE=new KeySpec((byte)1);
55     
56     private final static KeySpec BLOBPATH=new KeySpec(null);
57     
58     private final static KeySpec BTREE_NODE_SIZE=new KeySpec(4096);
59     
60     private final static KeySpec BTREE_CACHE_HEIGHT=new KeySpec(1);
61     
62     private final static KeySpec CALLBACKS=new KeySpec(true);
63     
64     private final static KeySpec CALL_CONSTRUCTORS=new KeySpec(YapConst.DEFAULT);
65     
66     private final static KeySpec CLASS_ACTIVATION_DEPTH_CONFIGURABLE=new KeySpec(true);
67     
68     private final static KeySpec CLASSLOADER=new KeySpec(null);
69     
70     private final static KeySpec DETECT_SCHEMA_CHANGES=new KeySpec(true);
71     
72     private final static KeySpec DIAGNOSTIC=new KeySpec(new DiagnosticProcessor());
73     
74     private final static KeySpec DISABLE_COMMIT_RECOVERY=new KeySpec(false);
75     
76     private final static KeySpec DISCARD_FREESPACE=new KeySpec(0);
77     
78     private final static KeySpec ENCODING=new KeySpec(YapConst.UNICODE);
79     
80     private final static KeySpec ENCRYPT=new KeySpec(false);
81     
82     private final static KeySpec EXCEPTIONAL_CLASSES=new KeySpec(null);
83     
84     private final static KeySpec EXCEPTIONS_ON_NOT_STORABLE=new KeySpec(false);
85     
86     private final static KeySpec FLUSH_FILE_BUFFERS=new KeySpec(true);
87     
88     private final static KeySpec FREESPACE_SYSTEM=new KeySpec(FreespaceManager.FM_DEFAULT);
89     
90     private final static KeySpec GENERATE_UUIDS=new KeySpec(0);
91     
92     private final static KeySpec GENERATE_VERSION_NUMBERS=new KeySpec(0);
93     
94     private final static KeySpec INTERN_STRINGS=new KeySpec(false);
95     
96     private final static KeySpec IS_SERVER=new KeySpec(false);
97     
98     private final static KeySpec QUERY_EVALUATION_MODE=new KeySpec(QueryEvaluationMode.IMMEDIATE);
99     
100     private final static KeySpec LOCK_FILE=new KeySpec(true);
101     
102     private final static KeySpec MESSAGE_RECIPIENT=new KeySpec(null);
103     
104     private final static KeySpec OPTIMIZE_NQ=new KeySpec(true);
105     
106     private final static KeySpec OUTSTREAM=new KeySpec(null);
107     
108     private final static KeySpec PASSWORD=new KeySpec((String JavaDoc)null);
109     
110     private static final KeySpec PREFETCH_ID_COUNT = new KeySpec(10);
111
112     private static final KeySpec PREFETCH_OBJECT_COUNT = new KeySpec(10);
113     
114     private final static KeySpec READ_AS=new KeySpec(new Hashtable4(16));
115     
116     private final static KeySpec CONFIGURED_REFLECTOR=new KeySpec(null);
117     
118     private final static KeySpec REFLECTOR=new KeySpec(null);
119     
120     private final static KeySpec RENAME=new KeySpec(null);
121     
122     private final static KeySpec RESERVED_STORAGE_SPACE=new KeySpec(0);
123     
124     private final static KeySpec SINGLE_THREADED_CLIENT=new KeySpec(false);
125     
126     private final static KeySpec TEST_CONSTRUCTORS=new KeySpec(true);
127     
128     private final static KeySpec TIMEOUT_CLIENT_SOCKET=new KeySpec(YapConst.CLIENT_SOCKET_TIMEOUT);
129     
130     private final static KeySpec TIMEOUT_PING_CLIENTS=new KeySpec(YapConst.CONNECTION_TIMEOUT);
131     
132     private final static KeySpec TIMEOUT_SERVER_SOCKET=new KeySpec(YapConst.SERVER_SOCKET_TIMEOUT);
133     
134     private final static KeySpec UPDATE_DEPTH=new KeySpec(0);
135     
136     private final static KeySpec WEAK_REFERENCE_COLLECTION_INTERVAL=new KeySpec(1000);
137     
138     private final static KeySpec WEAK_REFERENCES=new KeySpec(true);
139     
140     private final static KeySpec IOADAPTER=new KeySpec(new RandomAccessFileAdapter());
141     
142         // NOTE: activate this config to trigger the defragment failure
143
//= new NIOFileAdapter(512,3);
144

145     private final static KeySpec ALIASES=new KeySpec(null);
146
147     // is null in the global configuration until deepClone is called
148
private YapStream i_stream;
149     
150     // The following are very frequently being asked for, so they show up in the profiler.
151
// Let's keep it out of the Hashtable.
152
private int _messageLevel;
153     private boolean _readOnly;
154
155
156     public int activationDepth() {
157         return _config.getAsInt(ACTIVATION_DEPTH);
158     }
159
160     public void activationDepth(int depth) {
161         _config.put(ACTIVATION_DEPTH,depth);
162     }
163     
164     public void allowVersionUpdates(boolean flag){
165         _config.put(ALLOW_VERSION_UPDATES,flag);
166     }
167
168     public void automaticShutDown(boolean flag) {
169         _config.put(AUTOMATIC_SHUTDOWN,flag);
170     }
171     
172     public void blockSize(int bytes){
173        if (bytes < 1 || bytes > 127) {
174            Exceptions4.throwRuntimeException(1);
175        }
176        
177        if (i_stream != null) {
178            Exceptions4.throwRuntimeException(46); // see readable message for code in Messages.java
179
}
180        
181        _config.put(BLOCKSIZE,(byte)bytes);
182     }
183     
184     public void bTreeNodeSize(int size){
185         _config.put(BTREE_NODE_SIZE,size);
186     }
187     
188     public void bTreeCacheHeight(int height){
189         _config.put(BTREE_CACHE_HEIGHT,height);
190     }
191
192     public void callbacks(boolean turnOn) {
193         _config.put(CALLBACKS,turnOn);
194     }
195     
196     public void callConstructors(boolean flag){
197         _config.put(CALL_CONSTRUCTORS,(flag ? YapConst.YES : YapConst.NO));
198     }
199
200     public void classActivationDepthConfigurable(boolean turnOn) {
201         _config.put(CLASS_ACTIVATION_DEPTH_CONFIGURABLE,turnOn);
202     }
203
204     Config4Class configClass(String JavaDoc className) {
205         Config4Class config = (Config4Class)exceptionalClasses().get(className);
206
207         if (Debug.configureAllClasses) {
208             if (config == null) {
209
210                 boolean skip = false;
211
212                 Class JavaDoc[] ignore = new Class JavaDoc[] { P1HashElement.class,
213                     P1ListElement.class, P1Object.class, P1Collection.class,
214
215                     // XXX You may need the following for indexing tests.
216

217                     // P2HashMap.class,
218
// P2LinkedList.class,
219

220                     StaticClass.class, StaticField.class
221
222                 };
223                 for (int i = 0; i < ignore.length; i++) {
224                     if (ignore[i].getName().equals(className)) {
225                         skip = true;
226                         break;
227                     }
228
229                 }
230                 if (!skip) {
231                     config = (Config4Class) objectClass(className);
232                 }
233
234             }
235         }
236         return config;
237     }
238
239     public Object JavaDoc deepClone(Object JavaDoc param) {
240         Config4Impl ret = new Config4Impl();
241         ret._config=(KeySpecHashtable4)_config.deepClone(this);
242         ret._messageLevel = _messageLevel;
243         ret._readOnly = _readOnly;
244         return ret;
245     }
246     
247     public void stream(YapStream stream) {
248         i_stream=stream;
249     }
250
251     public void detectSchemaChanges(boolean flag) {
252         _config.put(DETECT_SCHEMA_CHANGES,flag);
253     }
254
255     public void disableCommitRecovery() {
256         _config.put(DISABLE_COMMIT_RECOVERY,true);
257     }
258
259     public void discardFreeSpace(int bytes) {
260         _config.put(DISCARD_FREESPACE,bytes);
261     }
262     
263     public void discardSmallerThan(int byteCount) {
264         discardFreeSpace(byteCount);
265     }
266
267     public void encrypt(boolean flag) {
268         globalSettingOnly();
269         _config.put(ENCRYPT,flag);
270     }
271     
272     void oldEncryptionOff() {
273         _config.put(ENCRYPT,false);
274     }
275
276     void ensureDirExists(String JavaDoc path) throws IOException {
277         File file = new File(path);
278         if (!file.exists()) {
279             file.mkdirs();
280         }
281         if (file.exists() && file.isDirectory()) {
282         } else {
283             throw new IOException(Messages.get(37, path));
284         }
285     }
286
287     PrintStream errStream() {
288         PrintStream outStream=outStreamOrNull();
289         return outStream == null ? System.err : outStream;
290     }
291
292     public void exceptionsOnNotStorable(boolean flag) {
293         _config.put(EXCEPTIONS_ON_NOT_STORABLE,flag);
294     }
295     
296     public void flushFileBuffers(boolean flag){
297         _config.put(FLUSH_FILE_BUFFERS,flag);
298     }
299
300     public FreespaceConfiguration freespace() {
301         return this;
302     }
303     
304     public void generateUUIDs(int setting) {
305         _config.put(GENERATE_UUIDS,setting);
306     }
307
308     public void generateVersionNumbers(int setting) {
309         _config.put(GENERATE_VERSION_NUMBERS,setting);
310     }
311
312     public MessageSender getMessageSender() {
313         return this;
314     }
315
316     private void globalSettingOnly() {
317         if (i_stream != null) {
318             new Exception JavaDoc().printStackTrace();
319             Exceptions4.throwRuntimeException(46);
320         }
321     }
322     
323     public void internStrings(boolean doIntern) {
324         _config.put(INTERN_STRINGS,doIntern);
325     }
326     
327     public void io(IoAdapter adapter){
328         globalSettingOnly();
329         _config.put(IOADAPTER,adapter);
330     }
331
332     public void lockDatabaseFile(boolean flag) {
333         _config.put(LOCK_FILE,flag);
334     }
335     
336     public void markTransient(String JavaDoc marker) {
337         Platform4.markTransient(marker);
338     }
339
340     public void messageLevel(int level) {
341         _messageLevel = level;
342         if (outStream() == null) {
343             setOut(System.out);
344         }
345     }
346
347     public void optimizeNativeQueries(boolean optimizeNQ) {
348         _config.put(OPTIMIZE_NQ,optimizeNQ);
349     }
350     
351     public boolean optimizeNativeQueries() {
352         return _config.getAsBoolean(OPTIMIZE_NQ);
353     }
354     
355     public ObjectClass objectClass(Object JavaDoc clazz) {
356         
357         String JavaDoc className = null;
358         
359         if(clazz instanceof String JavaDoc){
360             className = (String JavaDoc)clazz;
361         }else{
362             ReflectClass claxx = reflectorFor(clazz);
363             if(claxx == null){
364                 return null;
365             }
366             className = claxx.getName();
367         }
368         
369         Hashtable4 xClasses=exceptionalClasses();
370         Config4Class c4c = (Config4Class) xClasses.get(className);
371         if (c4c == null) {
372             c4c = new Config4Class(this, className);
373             xClasses.put(className, c4c);
374         }
375         return c4c;
376     }
377
378     private PrintStream outStreamOrNull() {
379         return (PrintStream)_config.get(OUTSTREAM);
380     }
381     
382     PrintStream outStream() {
383         PrintStream outStream=outStreamOrNull();
384         return outStream == null ? System.out : outStream;
385     }
386
387     public void password(String JavaDoc pw) {
388         globalSettingOnly();
389         _config.put(PASSWORD,pw);
390     }
391
392     public void readOnly(boolean flag) {
393         globalSettingOnly();
394         _readOnly = flag;
395     }
396
397     GenericReflector reflector() {
398         GenericReflector reflector=(GenericReflector)_config.get(REFLECTOR);
399         if(reflector == null){
400             Reflector configuredReflector=(Reflector)_config.get(CONFIGURED_REFLECTOR);
401             if(configuredReflector == null){
402                 configuredReflector=Platform4.createReflector(classLoader());
403                 _config.put(CONFIGURED_REFLECTOR,configuredReflector);
404             }
405             reflector=new GenericReflector(null, configuredReflector);
406             _config.put(REFLECTOR,reflector);
407             configuredReflector.setParent(reflector);
408         }
409 // TODO: transaction assignment has been moved to YapStreamBase#initialize1().
410
// implement better, more generic solution as described in COR-288
411
// if(! reflector.hasTransaction() && i_stream != null){
412
// reflector.setTransaction(i_stream.getSystemTransaction());
413
// }
414
return reflector;
415     }
416
417     public void reflectWith(Reflector reflect) {
418         
419         if(i_stream != null){
420             Exceptions4.throwRuntimeException(46); // see readable message for code in Messages.java
421
}
422         
423         if (reflect == null) {
424             throw new NullPointerException JavaDoc();
425         }
426         _config.put(CONFIGURED_REFLECTOR,reflect);
427         _config.put(REFLECTOR,null);
428     }
429
430     public void refreshClasses() {
431         if (i_stream == null) {
432             Db4o.forEachSession(new Visitor4() {
433
434                 public void visit(Object JavaDoc obj) {
435                     YapStream ys = ((Session) obj).i_stream;
436                     if (!ys.isClosed()) {
437                         ys.refreshClasses();
438                     }
439                 }
440             });
441         } else {
442             i_stream.refreshClasses();
443         }
444     }
445
446     void rename(Rename a_rename) {
447         Collection4 renameCollection=rename();
448         if (renameCollection == null) {
449             renameCollection = new Collection4();
450             _config.put(RENAME,renameCollection);
451         }
452         renameCollection.add(a_rename);
453     }
454
455     public void reserveStorageSpace(long byteCount) {
456         int reservedStorageSpace = (int) byteCount;
457         if (reservedStorageSpace < 0) {
458             reservedStorageSpace = 0;
459         }
460         _config.put(RESERVED_STORAGE_SPACE,reservedStorageSpace);
461         if (i_stream != null) {
462             i_stream.reserve(reservedStorageSpace);
463         }
464     }
465
466     /**
467      * The ConfigImpl also is our messageSender
468      */

469     public void send(Object JavaDoc obj) {
470         if (i_stream == null) {
471             Db4o.forEachSession(new Visitor4() {
472
473                 public void visit(Object JavaDoc session) {
474                     YapStream ys = ((Session) session).i_stream;
475                     if (!ys.isClosed()) {
476                         ys.send(session);
477                     }
478
479                 }
480             });
481         } else {
482             i_stream.send(obj);
483         }
484     }
485
486     public void setBlobPath(String JavaDoc path) throws IOException {
487         ensureDirExists(path);
488         _config.put(BLOBPATH,path);
489     }
490
491     public void setClassLoader(Object JavaDoc classLoader) {
492         reflectWith(Platform4.createReflector(classLoader));
493     }
494
495     public void setMessageRecipient(MessageRecipient messageRecipient) {
496         _config.put(MESSAGE_RECIPIENT,messageRecipient);
497     }
498
499     public void setOut(PrintStream outStream) {
500         _config.put(OUTSTREAM,outStream);
501         if (i_stream != null) {
502             i_stream.logMsg(19, Db4o.version());
503         } else {
504             Messages.logMsg(Db4o.i_config, 19, Db4o.version());
505         }
506     }
507
508     public void singleThreadedClient(boolean flag) {
509         _config.put(SINGLE_THREADED_CLIENT,flag);
510     }
511
512     public void testConstructors(boolean flag) {
513         _config.put(TEST_CONSTRUCTORS,flag);
514     }
515
516     public void timeoutClientSocket(int milliseconds) {
517         _config.put(TIMEOUT_CLIENT_SOCKET,milliseconds);
518     }
519
520     public void timeoutPingClients(int milliseconds) {
521         _config.put(TIMEOUT_PING_CLIENTS,milliseconds);
522     }
523
524     public void timeoutServerSocket(int milliseconds) {
525         _config.put(TIMEOUT_SERVER_SOCKET,milliseconds);
526
527     }
528
529     public void unicode(boolean unicodeOn) {
530         _config.put(ENCODING,(unicodeOn ? YapConst.UNICODE : YapConst.ISO8859));
531     }
532
533     public void updateDepth(int depth) {
534         DiagnosticProcessor dp = diagnosticProcessor();
535         if (dp.enabled()) {
536             dp.checkUpdateDepth(depth);
537         }
538         _config.put(UPDATE_DEPTH,depth);
539     }
540
541     public void useRamSystem() {
542         _config.put(FREESPACE_SYSTEM,FreespaceManager.FM_RAM);
543     }
544
545     public void useIndexSystem() {
546         _config.put(FREESPACE_SYSTEM,FreespaceManager.FM_IX);
547     }
548     
549     public void weakReferenceCollectionInterval(int milliseconds) {
550         _config.put(WEAK_REFERENCE_COLLECTION_INTERVAL,milliseconds);
551     }
552
553     public void weakReferences(boolean flag) {
554         _config.put(WEAK_REFERENCES,flag);
555     }
556     
557     private Collection4 aliases() {
558         Collection4 aliasesCollection=(Collection4)_config.get(ALIASES);
559         if (null == aliasesCollection) {
560             aliasesCollection = new Collection4();
561             _config.put(ALIASES,aliasesCollection);
562         }
563         return aliasesCollection;
564     }
565     
566     public void addAlias(Alias alias) {
567         if (null == alias) throw new com.db4o.foundation.ArgumentNullException("alias");
568         aliases().add(alias);
569     }
570     
571     public void removeAlias(Alias alias) {
572         if (null == alias) throw new com.db4o.foundation.ArgumentNullException("alias");
573         aliases().remove(alias);
574     }
575     
576     public String JavaDoc resolveAliasRuntimeName(String JavaDoc runtimeType) {
577
578         Collection4 configuredAliases=aliases();
579         if (null == configuredAliases) {
580             return runtimeType;
581         }
582         
583         Iterator4 i = configuredAliases.iterator();
584         while (i.moveNext()) {
585             String JavaDoc resolved = ((Alias)i.current()).resolveRuntimeName(runtimeType);
586             if (null != resolved){
587                 return resolved;
588             }
589         }
590         
591         return runtimeType;
592     }
593     
594     public String JavaDoc resolveAliasStoredName(String JavaDoc storedType) {
595
596         Collection4 configuredAliases=aliases();
597         if (null == configuredAliases){
598             return storedType;
599         }
600         
601         Iterator4 i = configuredAliases.iterator();
602         while (i.moveNext()) {
603             String JavaDoc resolved = ((Alias)i.current()).resolveStoredName(storedType);
604             if (null != resolved){
605                 return resolved;
606             }
607         }
608         
609         return storedType;
610     }
611     
612     ReflectClass reflectorFor(Object JavaDoc clazz) {
613         
614         clazz = Platform4.getClassForType(clazz);
615         
616         if(clazz instanceof ReflectClass){
617             return (ReflectClass)clazz;
618         }
619         
620         if(clazz instanceof Class JavaDoc){
621             return reflector().forClass((Class JavaDoc)clazz);
622         }
623         
624         if(clazz instanceof String JavaDoc){
625             return reflector().forName((String JavaDoc)clazz);
626         }
627         
628         return reflector().forObject(clazz);
629     }
630
631     public boolean allowVersionUpdates() {
632         return _config.getAsBoolean(ALLOW_VERSION_UPDATES);
633     }
634
635     boolean automaticShutDown() {
636         return _config.getAsBoolean(AUTOMATIC_SHUTDOWN);
637     }
638
639     byte blockSize() {
640         return _config.getAsByte(BLOCKSIZE);
641     }
642     
643     public int bTreeNodeSize() {
644         return _config.getAsInt(BTREE_NODE_SIZE);
645     }
646     
647     public int bTreeCacheHeight(){
648         return _config.getAsInt(BTREE_CACHE_HEIGHT);
649     }
650     
651     String JavaDoc blobPath() {
652         return _config.getAsString(BLOBPATH);
653     }
654
655     boolean callbacks() {
656         return _config.getAsBoolean(CALLBACKS);
657     }
658
659     int callConstructors() {
660         return _config.getAsInt(CALL_CONSTRUCTORS);
661     }
662
663     boolean classActivationDepthConfigurable() {
664         return _config.getAsBoolean(CLASS_ACTIVATION_DEPTH_CONFIGURABLE);
665     }
666
667     Object JavaDoc classLoader() {
668         return _config.get(CLASSLOADER);
669     }
670
671     boolean detectSchemaChanges() {
672         return _config.getAsBoolean(DETECT_SCHEMA_CHANGES);
673     }
674
675     boolean commitRecoveryDisabled() {
676         return _config.getAsBoolean(DISABLE_COMMIT_RECOVERY);
677     }
678
679     public DiagnosticConfiguration diagnostic() {
680         return (DiagnosticConfiguration)_config.get(DIAGNOSTIC);
681     }
682     
683     public DiagnosticProcessor diagnosticProcessor(){
684         return (DiagnosticProcessor)_config.get(DIAGNOSTIC);
685     }
686
687     public int discardFreeSpace() {
688         return _config.getAsInt(DISCARD_FREESPACE);
689     }
690
691     byte encoding() {
692         return _config.getAsByte(ENCODING);
693     }
694
695     boolean encrypt() {
696         return _config.getAsBoolean(ENCRYPT);
697     }
698
699     public Hashtable4 exceptionalClasses() {
700         Hashtable4 exceptionalClasses = (Hashtable4)_config.get(EXCEPTIONAL_CLASSES);
701         if(exceptionalClasses==null) {
702             exceptionalClasses=new Hashtable4(16);
703             _config.put(EXCEPTIONAL_CLASSES,exceptionalClasses);
704         }
705         return exceptionalClasses;
706     }
707
708     public boolean exceptionsOnNotStorable() {
709         return _config.getAsBoolean(EXCEPTIONS_ON_NOT_STORABLE);
710     }
711
712     public boolean flushFileBuffers() {
713         return _config.getAsBoolean(FLUSH_FILE_BUFFERS);
714     }
715
716     byte freespaceSystem() {
717         return _config.getAsByte(FREESPACE_SYSTEM);
718     }
719
720     public int generateUUIDs() {
721         return _config.getAsInt(GENERATE_UUIDS);
722     }
723
724     public int generateVersionNumbers() {
725         return _config.getAsInt(GENERATE_VERSION_NUMBERS);
726     }
727
728     public boolean internStrings() {
729         return _config.getAsBoolean(INTERN_STRINGS);
730     }
731     
732     public void isServer(boolean flag){
733         _config.put(IS_SERVER,flag);
734     }
735
736     boolean isServer() {
737         return _config.getAsBoolean(IS_SERVER);
738     }
739
740     boolean lockFile() {
741         return _config.getAsBoolean(LOCK_FILE);
742     }
743
744     int messageLevel() {
745         return _messageLevel;
746     }
747
748     public MessageRecipient messageRecipient() {
749         return (MessageRecipient)_config.get(MESSAGE_RECIPIENT);
750     }
751
752     boolean optimizeNQ() {
753         return _config.getAsBoolean(OPTIMIZE_NQ);
754     }
755
756     String JavaDoc password() {
757         return _config.getAsString(PASSWORD);
758     }
759
760     public void prefetchIDCount(int prefetchIDCount) {
761         _config.put(PREFETCH_ID_COUNT,prefetchIDCount);
762     }
763
764     public int prefetchIDCount() {
765         return _config.getAsInt(PREFETCH_ID_COUNT);
766     }
767
768     public void prefetchObjectCount(int prefetchObjectCount) {
769         _config.put(PREFETCH_OBJECT_COUNT,prefetchObjectCount);
770     }
771
772     public int prefetchObjectCount() {
773         return _config.getAsInt(PREFETCH_OBJECT_COUNT);
774     }
775
776     Hashtable4 readAs() {
777         return (Hashtable4)_config.get(READ_AS);
778     }
779
780     boolean isReadOnly() {
781         return _readOnly;
782     }
783
784     Collection4 rename() {
785         return (Collection4)_config.get(RENAME);
786     }
787
788     int reservedStorageSpace() {
789         return _config.getAsInt(RESERVED_STORAGE_SPACE);
790     }
791
792     public boolean singleThreadedClient() {
793         return _config.getAsBoolean(SINGLE_THREADED_CLIENT);
794     }
795
796     boolean testConstructors() {
797         return _config.getAsBoolean(TEST_CONSTRUCTORS);
798     }
799
800     public int timeoutClientSocket() {
801         return _config.getAsInt(TIMEOUT_CLIENT_SOCKET);
802     }
803
804     public int timeoutPingClients() {
805         return _config.getAsInt(TIMEOUT_PING_CLIENTS);
806     }
807
808     public int timeoutServerSocket() {
809         return _config.getAsInt(TIMEOUT_SERVER_SOCKET);
810     }
811
812     int updateDepth() {
813         return _config.getAsInt(UPDATE_DEPTH);
814     }
815
816     int weakReferenceCollectionInterval() {
817         return _config.getAsInt(WEAK_REFERENCE_COLLECTION_INTERVAL);
818     }
819
820     boolean weakReferences() {
821         return _config.getAsBoolean(WEAK_REFERENCES);
822     }
823
824     IoAdapter ioAdapter() {
825         return (IoAdapter)_config.get(IOADAPTER);
826     }
827     
828     public QueryConfiguration queries() {
829         return this;
830     }
831
832     public void evaluationMode(QueryEvaluationMode mode) {
833         _config.put(QUERY_EVALUATION_MODE, mode);
834     }
835     
836     public QueryEvaluationMode queryEvaluationMode() {
837         return (QueryEvaluationMode)_config.get(QUERY_EVALUATION_MODE);
838     }
839
840 }
Popular Tags