KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > appserver > server > sql > standard > DatabaseConfiguration


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  */

20 package com.lutris.appserver.server.sql.standard;
21
22 import org.enhydra.dods.CommonConstants;
23 import org.enhydra.dods.DODS;
24 import org.enhydra.dods.cache.CacheConstants;
25 import org.enhydra.dods.exceptions.AssertionDataObjectException;
26
27 import com.lutris.appserver.server.sql.DatabaseManagerConfiguration;
28 import com.lutris.appserver.server.sql.StandardDatabaseManager;
29 import com.lutris.util.Config;
30
31
32 /**
33  * TableConfiguration contains parameters about table configuration. It reads
34  * these parameters from application's configuration file, sets them to new
35  * values or returns their current values.
36  *
37  * @author Sinisa Milosevic
38  * @version 1.0 01.09.2003.
39  */

40  
41 public class DatabaseConfiguration implements CacheConstants, DriverSpecificConstants {
42     
43     /**
44      *
45      * Database name
46      */

47     private String JavaDoc dbName = null;
48     
49     /**
50      * If table is read-only, parameter readOnly is true, otherwise false.
51      * Default value is false.
52      */

53     private boolean readOnly = CacheConstants.DEFAULT_All_READONLY;
54     
55     /**
56      * If table supports lazy-loading, parameter lazyLoading is true, otherwise
57      * false.
58      * Default value is false.
59      */

60     private boolean lazyLoading = CacheConstants.DEFAULT_LAZY_LOADING;
61     
62     
63     
64     /**
65      * If table supports caseSensitive, parameter caseSensitive is true, otherwise
66      * false.
67      * Default value is false.
68      */

69     private boolean caseSensitive = CacheConstants.DEFAULT_CASE_SENSITIVE;
70     
71     
72     
73     
74     /**
75      * Maximal time in miliseconds for Event log.
76      * If query is executed longer that this time, its select statement and
77      * execution time are written to Event log for future analyzes.
78      */

79     private int maxExecuteTime = CacheConstants.DEFAULT_MAX_EXECUTE_TIME;
80     
81     private double reserveFactor = CacheConstants.DEFAULT_RESERVE_FACTOR;
82    
83     private int maxCacheSize = CacheConstants.DEFAULT_MAX_CACHE_SIZE;
84    
85     private int maxSimpleCacheSize = CacheConstants.DEFAULT_MAX_SIMPLE_QUERY_CACHE_SIZE;
86    
87     private int maxComplexCacheSize = CacheConstants.DEFAULT_MAX_COMPLEX_QUERY_CACHE_SIZE;
88     
89     private int maxMultiJoinCacheSize = CacheConstants.DEFAULT_MAX_MULTI_JOIN_QUERY_CACHE_SIZE;
90    
91     private double cachePercentage = CacheConstants.DEFAULT_CACHE_PERCENTAGE;
92     private boolean transactionCheck = CacheConstants.DEFAULT_TRANSACTION_CHECK;
93    
94     private boolean deleteCheckVersion = CacheConstants.DEFAULT_DELETE_CHECK_VERSION;
95   
96     private boolean autoSave = CacheConstants.DEFAULT_AUTO_SAVE;
97    
98     private boolean autoSaveCreateVirgin = CacheConstants.DEFAULT_AUTO_SAVE_CREATE_VIRGIN;
99    
100     private boolean autoWrite = CacheConstants.DEFAULT_AUTO_WRITE;
101     
102     private boolean transactionCaches = CacheConstants.DEFAULT_TRANSACTION_CACHES;
103    
104     private int deadlockWaitTime = CacheConstants.DEFAULT_DEADLOCK_READ_TIME;
105    
106     private int deadlockRetryCount = CacheConstants.DEFAULT_DEADLOCK_RETRY_NUMBER;
107           
108     private boolean initialAllCaches = CacheConstants.DEFAULT_INITIAL_ALL_CACHES;
109    
110     private int defaultFetchSize = CacheConstants.DEFAULT_DEFAULT_FETCH_SIZE;
111    
112     private int defaultQueryTimeout = CacheConstants.DEFAULT_QUERY_TIMEOUT;
113                             
114     private boolean defaultSelectOids = CacheConstants.DEFAULT_SELECT_OIDS;
115     
116     private boolean defaultIncrementVersions = CacheConstants.DEFAULT_INCREMENT_VERSIONS;
117
118     private Boolean JavaDoc useCursorName = null ;
119     
120     private boolean disableFetchSizeWithMaxRows = DriverSpecificConstants.DEFAULT_DISABLE_FETCH_SIZE_WITH_MAX_ROWS;
121     
122     private int resultSetType = DriverSpecificConstants.DEFAULT_RESULT_SET_TYPE;
123     
124     private int resultSetConcurrency = DriverSpecificConstants.DEFAULT_RESULT_SET_CONCURRENCY;
125   
126     private String JavaDoc DBTransactionFactoryName = null;
127     
128     private String JavaDoc connectionAllocatorName = null;
129     
130     private String JavaDoc DBConnectionFactoryName = null;
131     
132     private String JavaDoc queryCacheImplClass = null;
133
134     private int fullCacheCountLimit = CacheConstants.DEFAULT_FULL_CACHE_COUNT_LIMIT;
135
136     private int initialCacheFetchSize = CacheConstants.DEFAULT_INITIAL_CACHE_FETCH_SIZE;
137
138     private int initialDSCacheSize = CacheConstants.DEFAULT_INITIAL_DS_CACHE_SIZE;
139
140     private String JavaDoc initCachesResultSetType = null;
141     
142     private String JavaDoc initCachesResultSetConcurrency = null;
143     
144     private boolean sqlBatch = CommonConstants.DEFAULT_SQL_BATCH;
145     
146     private boolean caseInsensitiveDatabase = CommonConstants.DEFAULT_CASE_INSENSITIVE_DATABASE;
147     
148     private Integer JavaDoc queryTimeLimit = CommonConstants.DEFAULT_QUERY_TIME_LIMIT;
149
150     // - XA Support -
151

152     private int xaDefaultTimeout = CommonConstants.DEFAULT_XA_DEFAULT_TIMEOUT;
153     
154     private int xaUsageCase = CommonConstants.DEFAULT_XA_USAGE_CASE;
155     
156     private String JavaDoc xaTransactonManagerLookupName = CommonConstants.DEFAULT_XA_TM_LOOKUP_NAME;
157     
158     private String JavaDoc xaUserTransactonLookupName = CommonConstants.DEFAULT_XA_USER_TRANSACTION_LOOKUP_NAME;
159     
160     private String JavaDoc xaWrappedTransImplFactory = CommonConstants.DEFAULT_XA_WRAPPED_TRANS_IMPL_FACTORY;
161     
162     private String JavaDoc xaJtaSupport = CommonConstants.DEFAULT_XA_JTA_SUPPORT;
163     
164     // - XA Support -
165

166     private String JavaDoc dodsCacheFactory = CacheConstants.DEFAULT_DODS_CACHE_FACTORY;
167     
168     /**
169      * Returns readOnly parameter.
170      *
171      * @return true if the table is read-only, otherwise false.
172      */

173     public boolean isAllReadOnly() {
174         return readOnly;
175     }
176     
177     public DatabaseConfiguration(String JavaDoc database) {
178         if (database != null) {
179             dbName = database;
180         } else {
181             dbName = DODS.getDatabaseManager().getDefaultDB();
182         }
183         init(((StandardDatabaseManager)DODS.getDatabaseManager()).getDatabaseManagerConfiguration());
184     }
185    
186     public DatabaseConfiguration(String JavaDoc database, DatabaseManagerConfiguration DbManagerConf) {
187         if (database != null) {
188             dbName = database;
189         } else {
190             dbName = DODS.getDatabaseManager().getDefaultDB();
191         }
192         init(DbManagerConf);
193     }
194
195    
196     private void init(DatabaseManagerConfiguration stmc) {
197         readOnly = stmc.isAllReadOnly();
198         lazyLoading = stmc.isLazyLoading();
199         caseSensitive = stmc.getCaseSensitive();
200         maxExecuteTime = stmc.getMaxExecuteTime();
201         reserveFactor = stmc.getReserveFactor();
202         cachePercentage = stmc.getCachePercentage();
203         maxCacheSize = stmc.getMaxCacheSize();
204         maxSimpleCacheSize = stmc.getMaxSimpleCacheSize();
205         maxComplexCacheSize = stmc.getMaxComplexCacheSize();
206         maxMultiJoinCacheSize = stmc.getMaxMultiJoinCacheSize();
207         transactionCheck = stmc.getTransactionCheck();
208         deleteCheckVersion = stmc.getDeleteCheckVersion();
209         autoSave = stmc.getAutoSave();
210         autoSaveCreateVirgin = stmc.getAutoSaveCreateVirgin();
211         autoWrite = stmc.getAutoWrite();
212         transactionCaches = stmc.getTransactionCaches();
213         deadlockWaitTime = stmc.getDeadlockWaitTime();
214         deadlockRetryCount = stmc.getDeadlockRetryCount();
215         initialAllCaches = stmc.getInitAllCaches();
216         defaultFetchSize = stmc.getDefaultFetchSize();
217         defaultQueryTimeout = stmc.getQueryTimeout();
218         defaultSelectOids = stmc.getSelectOids();
219         defaultIncrementVersions = stmc.getIncrementVersions();
220         useCursorName = stmc.getUseCursorName();
221         DBTransactionFactoryName = stmc.getDBTransactionFactoryName();
222         connectionAllocatorName = stmc.getConnectionAllocatorName();
223         DBConnectionFactoryName = stmc.getDBConnectionFactoryName();
224         queryCacheImplClass = stmc.getQueryCacheImplClass();
225         dodsCacheFactory = stmc.getDodsCacheFactory();
226         fullCacheCountLimit = stmc.getFullCacheCountLimit();
227         initialCacheFetchSize = stmc.getInitialCacheFetchSize();
228         initialDSCacheSize = stmc.getInitialDSCacheSize();
229         initCachesResultSetType = stmc.getInitCachesResultSetType();
230         initCachesResultSetConcurrency = stmc.getInitCachesResultSetConcurrency();
231         sqlBatch = stmc.isSqlBatch();
232         caseInsensitiveDatabase = stmc.isCaseInsensitiveDatabase();
233         queryTimeLimit = stmc.getQueryTimeLimit();
234         xaDefaultTimeout = stmc.getXaDefaultTimeout();
235         xaUsageCase = stmc.getXaUsageCase();
236         xaTransactonManagerLookupName = stmc.getXaTransactonManagerLookupName();
237         xaUserTransactonLookupName = stmc.getXaUserTransactonLookupName();
238         xaWrappedTransImplFactory = stmc.getXaWrappedTransImplFactory();
239         xaJtaSupport = stmc.getXaJtaSupport();
240     }
241
242     /**
243      * Sets readOnly parameter to value newReadOnly.
244      *
245      * @param newReadOnly New read-only value.
246      * @exception AssertionDataObjectException If new value of read-only is
247      * false, but all application's tables are read-only.
248      */

249     protected void setReadOnly(boolean newReadOnly) throws AssertionDataObjectException {
250         readOnly = newReadOnly ;
251     }
252     
253     /**
254      * Returns lazyLoading parameter.
255      *
256      * @return true if the table supports lazy-loading, otherwise false.
257      */

258     public boolean isLazyLoading() {
259         return lazyLoading;
260     }
261     
262     /**
263      * Sets lazyLoading parameter to value newlazyLoading.
264      *
265      * @param newlazyLoading New lazy-loading value.
266      */

267     protected void setLazyLoading(boolean newlazyLoading) {
268         lazyLoading = newlazyLoading;
269     }
270
271     /**
272      * Returns maxExecuteTime parameter.
273      *
274      * @return Maximal time in miliseconds for Event log.
275      */

276     public int getMaxExecuteTime() {
277         return maxExecuteTime;
278     }
279     
280     /**
281      * Sets maxExecuteTime parameter to value newMaxExecuteTime.
282      *
283      * @param newMaxExecuteTime New maxExecuteTime value.
284      */

285     protected void setMaxExecuteTime(int newMaxExecuteTime) {
286         maxExecuteTime = newMaxExecuteTime;
287     }
288     
289     /**
290      * Returns maxCacheSize parameter.
291      *
292      * @return Maximal cache size.
293      */

294     public int getMaxCacheSize() {
295         return maxCacheSize;
296     }
297     
298     /**
299      * Sets maxCacheSize parameter to value newMaxCacheSize.
300      *
301      * @param newMaxCacheSize New newMaxCacheSize value.
302      */

303     protected void setMaxCacheSize(int newMaxCacheSize) {
304         maxCacheSize = newMaxCacheSize;
305     }
306     
307     /**
308      * Returns reserveFactor parameter.
309      *
310      * @return reserveFactor double value
311      */

312     public double getReserveFactor() {
313         return reserveFactor;
314     }
315     
316     /**
317      * Sets reserveFactor parameter to value newReserveFactor.
318      *
319      * @param newReserveFactor New reserveFactor value.
320      */

321     protected void setReserveFactor(double newReserveFactor) {
322         reserveFactor = newReserveFactor;
323     }
324
325     /**
326      *
327      */

328     protected void setCachePercentage(double percent) {
329         cachePercentage = percent;
330     }
331
332     /**
333      *
334      */

335     public double getCachePercentage() {
336         return cachePercentage;
337     }
338
339     /**
340      * Returns maxComplexCacheSize parameter.
341      *
342      * @return Maximal complex query cache size.
343      */

344     public int getMaxComplexCacheSize() {
345         return maxComplexCacheSize;
346     }
347     
348     /**
349      * Sets maxComplexCacheSize parameter to value newMaxCacheSize.
350      *
351      * @param newMaxCacheSize New newMaxComplexCacheSize value.
352      */

353     protected void setMaxComplexCacheSize(int newMaxCacheSize) {
354         maxComplexCacheSize = newMaxCacheSize;
355     }
356     /**
357      * Returns maxMultiJoinCacheSize parameter.
358      *
359      * @return Maximal multi join query cache size.
360      */

361     public int getMaxMultiJoinCacheSize() {
362         return maxMultiJoinCacheSize;
363     }
364     
365     /**
366      * Sets maxMultiJoinCacheSize parameter to value newMaxCacheSize.
367      *
368      * @param newMaxCacheSize New maxMultiJoinCacheSize value.
369      */

370     protected void setMaxMultiJoinCacheSize(int newMaxCacheSize) {
371         maxMultiJoinCacheSize = newMaxCacheSize;
372     }
373     
374     /**
375      * Returns maxSimpleCacheSize parameter.
376      *
377      * @return Maximal cache size.
378      */

379     public int getMaxSimpleCacheSize() {
380         return maxSimpleCacheSize;
381     }
382     
383     /**
384      * Sets maxSimpleCacheSize parameter to value newMaxCacheSize.
385      *
386      * @param newMaxCacheSize New newMaxCacheSize value.
387      */

388     protected void setMaxSimpleCacheSize(int newMaxCacheSize) {
389         maxSimpleCacheSize = newMaxCacheSize;
390     }
391
392     /**
393      * Returns TransactionCheck parameter.
394      *
395      * @return TransactionCheck value.
396      */

397     public boolean getTransactionCheck() {
398         return transactionCheck;
399     }
400     
401     /**
402      * Sets TransactionCheck parameter to value newCheck.
403      *
404      * @param newCheck New TransactionCheck value.
405      */

406     protected void setTransactionCheck(boolean newCheck) {
407         transactionCheck = newCheck;
408     }
409
410     /**
411      * Returns DeleteCheckVersion parameter.
412      *
413      * @return DeleteCheckVersion parameter value.
414      */

415     public boolean getDeleteCheckVersion() {
416         return deleteCheckVersion;
417     }
418     
419     /**
420      * Sets DeleteCheckVersion parameter to value newCheck.
421      *
422      * @param newCheck New DeleteCheckVersion value.
423      */

424     protected void setDeleteCheckVersion(boolean newCheck) {
425         deleteCheckVersion = newCheck;
426     }
427
428     /**
429      * Returns AutoSave parameter.
430      *
431      * @return AutoSave parameter value.
432      */

433     public boolean getAutoSave() {
434         return autoSave;
435     }
436     
437     /**
438      * Sets AutoSave parameter to value newCheck.
439      *
440      * @param newCheck New AutoSave value.
441      */

442     protected void setAutoSave(boolean newCheck) {
443         autoSave = newCheck;
444     }
445     
446     /**
447      * Returns AutoSaveCreateVirgin parameter.
448      *
449      * @return AutoSaveCreateVirgin parameter value.
450      */

451     public boolean getAutoSaveCreateVirgin() {
452         return autoSaveCreateVirgin;
453     }
454     
455     /**
456      * Sets AutoSaveCreateVirgin parameter to value newCheck.
457      *
458      * @param newCheck New AutoSaveCreateVirgin value.
459      */

460     protected void setAutoSaveCreateVirgin(boolean newCheck) {
461         autoSaveCreateVirgin = newCheck;
462     }
463
464     /**
465      * Returns AutoWrite parameter.
466      *
467      * @return AutoWrite parameter value.
468      */

469     public boolean getAutoWrite() {
470         return autoWrite;
471     }
472     
473     /**
474      * Sets AutoWrite parameter to value newCheck.
475      *
476      * @param newCheck New AutoWrite value.
477      */

478     protected void setAutoWrite(boolean newCheck) {
479         autoWrite = newCheck;
480     }
481     
482     /**
483      * Returns TransactionCaches parameter.
484      *
485      * @return TransactionCaches parameter value.
486      */

487     public boolean getTransactionCaches() {
488         return transactionCaches;
489     }
490     
491     /**
492      * Sets TransactionCaches parameter to value newCheck.
493      *
494      * @param newCheck New TransactionCaches value.
495      */

496     protected void setTransactionCaches(boolean newCheck) {
497         transactionCaches = newCheck;
498     }
499     
500     /**
501      * Returns DeadlockWaitTime parameter.
502      *
503      * @return DeadlockWaitTime parameter value.
504      */

505     public int getDeadlockWaitTime() {
506         return deadlockWaitTime;
507     }
508     
509     /**
510      * Sets DeadlockWaitTime parameter to value waitTime.
511      *
512      * @param waitTime New DeadlockWaitTime value.
513      */

514     protected void setDeadlockWaitTime(int waitTime) {
515         deadlockWaitTime = waitTime;
516     }
517     
518     /**
519      * Returns DeadlockRetryCount parameter.
520      *
521      * @return DeadlockRetryCount parameter value.
522      */

523     public int getDeadlockRetryCount() {
524         return deadlockRetryCount;
525     }
526     
527     /**
528      * Sets DeadlockRetryCount parameter to value newValue.
529      *
530      * @param newValue New DeadlockRetryCount value.
531      */

532     protected void setDeadlockRetryCount(int newValue) {
533         deadlockRetryCount = newValue;
534     }
535
536     /**
537      * Returns InitAllCaches parameter.
538      *
539      * @return InitAllCaches parameter value.
540      */

541     public boolean getInitAllCaches() {
542         return initialAllCaches;
543     }
544     
545     /**
546      * Sets InitAllCaches parameter to value newValue.
547      *
548      * @param newValue New InitAllCaches value.
549      */

550     protected void setInitAllCaches(boolean newValue) {
551         initialAllCaches = newValue;
552     }
553
554     /**
555      * Returns DefaultFetchSize parameter.
556      *
557      * @return DefaultFetchSize parameter value.
558      */

559     public int getDefaultFetchSize() {
560         return defaultFetchSize;
561     }
562     
563     /**
564      * Sets DefaultFetchSize parameter to value newValue.
565      *
566      * @param newValue New DefaultFetchSize value.
567      */

568     protected void setDefaultFetchSize(int newValue) {
569         defaultFetchSize = newValue;
570     }
571     
572     /**
573      * Returns QueryTimeout parameter.
574      *
575      * @return QueryTimeout parameter value.
576      */

577     public int getQueryTimeout() {
578         return defaultQueryTimeout;
579     }
580     
581     /**
582      * Sets QueryTimeout parameter to value newValue.
583      *
584      * @param newValue New QueryTimeout value.
585      */

586     protected void setQueryTimeout(int newValue) {
587         defaultQueryTimeout = newValue;
588     }
589         
590         
591     /**
592      * Returns selectOids parameter.
593      *
594      * @return selectStatement parameter value.
595      */

596     public boolean getSelectOids() {
597         return defaultSelectOids;
598     }
599     
600     /**
601      * Sets selectOids parameter.
602      *
603      * @param newValue New selectOids value.
604      */

605     protected void setSelectOids(boolean newValue) {
606         defaultSelectOids = newValue;
607     }
608         
609
610
611     /**
612      * Returns IncrementVersions parameter.
613      *
614      * @return IncrementVersions parameter value.
615      */

616     public boolean getIncrementVersions() {
617         return defaultIncrementVersions;
618     }
619     
620     /**
621      * Sets IncrementVersions parameter.
622      *
623      * @param newValue New IncrementVersions value.
624      */

625     protected void setIncrementVersions(boolean newValue) {
626         defaultIncrementVersions = newValue;
627     }
628     
629     
630     /**
631      * Returns UseCursorName parameter.
632      *
633      * @return UseCursorName parameter value.
634      */

635     public Boolean JavaDoc getUseCursorName() {
636         return useCursorName;
637     }
638
639     /**
640      * Sets UseCursorName parameter.
641      *
642      * @param newValue New UseCursorName value.
643      */

644     public void setUseCursorName(boolean newValue) {
645         useCursorName = new Boolean JavaDoc(newValue);
646     }
647
648     /**
649      * Sets UseCursorName parameter.
650      *
651      * @param newValue New UseCursorName value.
652      */

653     public void setUseCursorName(Boolean JavaDoc newValue) {
654         useCursorName = newValue;
655     }
656
657
658     /**
659      * Returns UseCursorName parameter.
660      *
661      * @return newValue New UseCursorName value.
662      */

663     public boolean getDisableFetchSizeWithMaxRows() {
664         return disableFetchSizeWithMaxRows;
665     }
666
667     /**
668      * Sets DisableFetchSizeWithMaxRows parameter.
669      *
670      * @param newValue New UseCursorName value.
671      */

672     public void setDisableFetchSizeWithMaxRows(boolean newValue) {
673         disableFetchSizeWithMaxRows = newValue;
674     }
675
676
677     /**
678      * Returns ResultSetType parameter.
679      *
680      * @return newValue New ResultSetType value.
681      */

682     public int getResultSetType() {
683         return resultSetType;
684     }
685
686     /**
687      * Sets ResultSetType parameter.
688      *
689      * @param newValue New ResultSetType value.
690      */

691     public void setResultSetType(int newValue) {
692         resultSetType = newValue;
693     }
694
695     
696
697     /**
698      * Returns ResultSetConcurrency parameter.
699      *
700      * @return newValue New ResultSetConcurrency value.
701      */

702     public int getResultSetConcurrency() {
703         return resultSetConcurrency;
704     }
705
706     /**
707      * Sets ResultSetConcurrency parameter.
708      *
709      * @param newValue New ResultSetConcurrency value.
710      */

711     public void setResultSetConcurrency(int newValue) {
712         resultSetConcurrency = newValue;
713     }
714     
715     
716     /**
717      * @return
718      */

719     public String JavaDoc getDBTransactionFactoryName() {
720         return DBTransactionFactoryName;
721     }
722
723
724     /**
725      * @param string
726      */

727     public void setDBTransactionFactoryName(String JavaDoc string) {
728         DBTransactionFactoryName = string;
729     }
730
731
732     /**
733      * @return
734      */

735     public String JavaDoc getConnectionAllocatorName() {
736         return connectionAllocatorName;
737     }
738
739
740     /**
741      * @param string
742      */

743     public void setConnectionAllocatorName(String JavaDoc string) {
744         connectionAllocatorName = string;
745     }
746
747
748     public int getFullCacheCountLimit() {
749         return fullCacheCountLimit;
750     }
751     public void setFullCacheCountLimit(int i) {
752         fullCacheCountLimit = i;
753     }
754
755
756     
757     /**
758      * Reads database configuration parameters.
759      *
760      */

761     public void readDatabaseConfiguration() {
762         Config databaseConfig = null;
763
764         try {
765             databaseConfig = (Config) DODS.getDatabaseManager().getConfig().getSection("DB."
766                     + dbName);
767         } catch (Exception JavaDoc ex) {}
768         if (databaseConfig != null) {
769             try {
770                 readOnly = databaseConfig.getBoolean(PARAMNAME_READ_ONLY);
771             } catch (Exception JavaDoc e) {}
772             try {
773                 lazyLoading = databaseConfig.getBoolean(PARAMNAME_LAZY_LOADING);
774             } catch (Exception JavaDoc e) {}
775             try {
776                 caseSensitive = databaseConfig.getBoolean(PARAMNAME_CASE_SENSITIVE);
777             } catch (Exception JavaDoc e) {}
778             try {
779                 maxExecuteTime = databaseConfig.getInt(PARAMNAME_MAX_EXECUTE_TIME);
780             } catch (Exception JavaDoc e) {}
781             
782             try {
783                 transactionCheck = databaseConfig.getBoolean(PARAMNAME_TRANSACTION_CHECK);
784             } catch (Exception JavaDoc e) {}
785             try {
786                 deleteCheckVersion = databaseConfig.getBoolean(PARAMNAME_DELETE_CHECK_VERSION);
787             } catch (Exception JavaDoc e) {}
788             try {
789                 autoSave = databaseConfig.getBoolean(PARAMNAME_AUTO_SAVE);
790             } catch (Exception JavaDoc e) {}
791             try {
792                 autoSaveCreateVirgin = databaseConfig.getBoolean(PARAMNAME_AUTO_SAVE_CREATE_VIRGIN);
793             } catch (Exception JavaDoc e) {}
794             try {
795                 autoWrite = databaseConfig.getBoolean(PARAMNAME_AUTO_WRITE);
796             } catch (Exception JavaDoc e) {}
797             try {
798                 transactionCaches = databaseConfig.getBoolean(PARAMNAME_TRANSACTION_CACHES);
799             } catch (Exception JavaDoc e) {}
800             try {
801                 deadlockWaitTime = databaseConfig.getInt(PARAMNAME_DEADLOCK_READ_TIME);
802             } catch (Exception JavaDoc e) {}
803             try {
804                 deadlockRetryCount = databaseConfig.getInt(PARAMNAME_DEADLOCK_RETRY_NUMBER);
805             } catch (Exception JavaDoc e) {}
806             try {
807                 defaultFetchSize = databaseConfig.getInt(PARAMNAME_DEFAULT_FETCH_SIZE);
808             } catch (Exception JavaDoc e) {}
809             try {
810                 defaultQueryTimeout = databaseConfig.getInt(PARAMNAME_QUERY_TIMEOUT);
811             } catch (Exception JavaDoc e) {}
812             try {
813                 defaultSelectOids = databaseConfig.getBoolean(PARAMNAME_SELECT_OIDS);
814             } catch (Exception JavaDoc e) {}
815             try {
816                 defaultIncrementVersions = databaseConfig.getBoolean(PARAMNAME_INCREMENT_VERSIONS);
817             } catch (Exception JavaDoc e) {}
818             try {
819                 boolean tmpUCrN = (databaseConfig.getBoolean(PARAMNAME_USE_CURSOR_NAME));
820                 useCursorName = new Boolean JavaDoc(tmpUCrN);
821             } catch (Exception JavaDoc e) {
822                 useCursorName = null;
823             }
824             try {
825                 DBTransactionFactoryName = (databaseConfig.getString(CommonConstants.TRANSACTION_FACTORY));
826             } catch (Exception JavaDoc e) {
827                 DBTransactionFactoryName = null;
828             }
829             try {
830                 connectionAllocatorName = (databaseConfig.getString(CommonConstants.CONNECTION_ALLOCATOR));
831             } catch (Exception JavaDoc e) {
832                 connectionAllocatorName = null;
833             }
834             try {
835                 DBConnectionFactoryName = (databaseConfig.getString(CommonConstants.CONNECTION_FACTORY));
836             } catch (Exception JavaDoc e) {
837                 DBConnectionFactoryName = null;
838             }
839             try {
840                 queryCacheImplClass = (databaseConfig.getString(CommonConstants.QUERY_CACAHE_IMPL_CLASS));
841             } catch (Exception JavaDoc e) {
842                 queryCacheImplClass = null;
843             }
844             try {
845                 fullCacheCountLimit = (databaseConfig.getInt(CacheConstants.FULL_CACHE_COUNT_LIMIT));
846             } catch (Exception JavaDoc e) {}
847             try {
848                 initCachesResultSetType = databaseConfig.getString(CommonConstants.INIT_CACHES_RESULT_SET_TYPE);
849             } catch (Exception JavaDoc e) {}
850             try {
851                 initCachesResultSetConcurrency = databaseConfig.getString(CommonConstants.INIT_CACHES_RESULT_SET_CONCURRENCY);
852             } catch (Exception JavaDoc e) {}
853             try {
854                 sqlBatch = databaseConfig.getBoolean(CommonConstants.SQL_BATCH);
855             } catch (Exception JavaDoc e) {}
856             try {
857                 caseInsensitiveDatabase = databaseConfig.getBoolean(CommonConstants.CASE_INSENSITIVE_DATABASE);
858             } catch (Exception JavaDoc e) {}
859             try {
860                 xaDefaultTimeout = databaseConfig.getInt(CommonConstants.XA_DEFAULT_TIMEOUT);
861             } catch (Exception JavaDoc e) { }
862
863             try {
864                 queryTimeLimit = new Integer JavaDoc(databaseConfig.getInt(CommonConstants.QUERY_TIME_LIMIT));
865             } catch (Exception JavaDoc e) {}
866             try {
867                 xaTransactonManagerLookupName = databaseConfig.getString(CommonConstants.XA_TM_LOOKUP_NAME);
868             } catch (Exception JavaDoc e) { }
869             try {
870                 xaUsageCase = databaseConfig.getInt(CommonConstants.XA_USAGE_CASE);
871             } catch (Exception JavaDoc e) { }
872             try {
873                 xaWrappedTransImplFactory = databaseConfig.getString(CommonConstants.XA_WRAPPED_TRANS_IMPL_FACTORY);
874             } catch (Exception JavaDoc e) { }
875             try {
876                 xaUserTransactonLookupName = databaseConfig.getString(CommonConstants.XA_USER_TRANSACTION_LOOKUP_NAME);
877             } catch (Exception JavaDoc e) { }
878             try {
879                 xaJtaSupport = databaseConfig.getString(CommonConstants.XA_JTA_SUPPORT);
880             } catch (Exception JavaDoc e) { }
881
882         }
883         try {
884             databaseConfig = (Config) DODS.getDatabaseManager().getConfig().getSection("DB."
885                     + dbName + ".cache");
886         } catch (Exception JavaDoc ex) {}
887         if (databaseConfig != null) {
888             try {
889                 maxCacheSize = databaseConfig.getInt(PARAMNAME_MAX_CACHE_SIZE);
890             } catch (Exception JavaDoc e) {}
891             try {
892                 reserveFactor = databaseConfig.getDouble(PARAMNAME_RESERVE_FACTOR);
893             } catch (Exception JavaDoc e) {}
894             try {
895                 cachePercentage = databaseConfig.getDouble(PARAMNAME_CACHE_PERCENTAGE);
896             } catch (Exception JavaDoc e) {}
897             try {
898                 maxSimpleCacheSize = databaseConfig.getInt(PARAMNAME_MAX_SIMPLE_CACHE_SIZE);
899             } catch (Exception JavaDoc e) {}
900             try {
901                 maxComplexCacheSize = databaseConfig.getInt(PARAMNAME_MAX_COMPLEX_CACHE_SIZE);
902             } catch (Exception JavaDoc e) {}
903             try {
904                 maxMultiJoinCacheSize = databaseConfig.getInt(PARAMNAME_MAX_MULTI_JOIN_CACHE_SIZE);
905             } catch (Exception JavaDoc e) {}
906             try {
907                 initialAllCaches = databaseConfig.getBoolean(PARAMNAME_INITIAL_ALL_CACHES);
908             } catch (Exception JavaDoc e) {}
909             try {
910                 initialCacheFetchSize = databaseConfig.getInt(PARAMNAME_INITIAL_CACHE_FETCH_SIZE);
911             } catch (Exception JavaDoc e) {}
912             try {
913                 initialDSCacheSize = databaseConfig.getInt(PARAMNAME_INITIAL_DS_CACHE_SIZE);
914             } catch (Exception JavaDoc e) {}
915             try {
916                 dodsCacheFactory = databaseConfig.getString(PARAMNAME_DODS_CACHE_FACTORY);
917             } catch (Exception JavaDoc e) {}
918             
919         }
920     }
921     
922     
923     /**
924      * Returns CaseSensitive parameter.
925      *
926      * @return value of CaseSensitive parameter.
927      */

928     public boolean getCaseSensitive() {
929         return caseSensitive;
930     }
931
932     /**
933      * Set CaseSensitive parameter to newValue value.
934      *
935      * @param newValue New value for CaseSensitive parameter
936      */

937     public void setCaseSensitive(boolean newValue) {
938         caseSensitive = newValue;
939     }
940
941     /**
942      * @return
943      */

944     public String JavaDoc getDBConnectionFactoryName() {
945         return DBConnectionFactoryName;
946     }
947
948     /**
949      * @param string
950      */

951     public void setDBConnectionFactoryName(String JavaDoc string) {
952         DBConnectionFactoryName = string;
953     }
954
955     /**
956      * @return
957      */

958     public int getInitialCacheFetchSize() {
959         return initialCacheFetchSize;
960     }
961
962     /**
963      * @return
964      */

965     public int getInitialDSCacheSize() {
966         return initialDSCacheSize;
967     }
968
969     /**
970      * @param i
971      */

972     public void setInitialCacheFetchSize(int i) {
973         initialCacheFetchSize = i;
974     }
975
976     /**
977      * @param i
978      */

979     public void setInitialDSCacheSize(int i) {
980         initialDSCacheSize = i;
981     }
982
983     /**
984      * @return
985      */

986     public String JavaDoc getQueryCacheImplClass() {
987         return queryCacheImplClass;
988     }
989
990     /**
991      * @param string
992      */

993     public void setQueryCacheImplClass(String JavaDoc string) {
994         queryCacheImplClass = string;
995     }
996
997     /**
998      * @return
999      */

1000    public String JavaDoc getInitCachesResultSetConcurrency() {
1001        return initCachesResultSetConcurrency;
1002    }
1003
1004    /**
1005     * @return
1006     */

1007    public String JavaDoc getInitCachesResultSetType() {
1008        return initCachesResultSetType;
1009    }
1010
1011    /**
1012     * @param string
1013     */

1014    public void setInitCachesResultSetConcurrency(String JavaDoc string) {
1015        initCachesResultSetConcurrency = string;
1016    }
1017
1018    /**
1019     * @param string
1020     */

1021    public void setInitCachesResultSetType(String JavaDoc string) {
1022        initCachesResultSetType = string;
1023    }
1024    
1025
1026    /**
1027     * @return
1028     */

1029    public boolean isSqlBatch() {
1030        return sqlBatch;
1031    }
1032
1033    
1034    /**
1035     * @param b
1036     */

1037    public void setSqlBatch(boolean b) {
1038        sqlBatch = b;
1039    }
1040
1041    
1042    /**
1043     * @return Returns the caseInsensitiveDatabase.
1044     */

1045    public boolean isCaseInsensitiveDatabase() {
1046        return caseInsensitiveDatabase;
1047    }
1048    
1049    
1050    /**
1051     * @param caseInsensitiveDatabase The caseInsensitiveDatabase to set.
1052     */

1053    public void setCaseInsensitiveDatabase(boolean caseInsensitiveDatabase) {
1054        this.caseInsensitiveDatabase = caseInsensitiveDatabase;
1055    }
1056
1057    
1058    /**
1059     * @return Returns the queryTimeLimit.
1060     */

1061    public Integer JavaDoc getQueryTimeLimit() {
1062        return queryTimeLimit;
1063    }
1064    
1065    
1066    /**
1067     * @param queryTimeLimit The queryTimeLimit to set.
1068     */

1069    public void setQueryTimeLimit(Integer JavaDoc queryTimeLimit) {
1070        this.queryTimeLimit = queryTimeLimit;
1071    }
1072    
1073    
1074    /**
1075     * @return Returns the xaDefaultTimeout.
1076     */

1077    public int getXaDefaultTimeout() {
1078        return xaDefaultTimeout;
1079    }
1080    
1081    
1082    /**
1083     * @param xaDefaultTimeout The xaDefaultTimeout to set.
1084     */

1085    public void setXaDefaultTimeout(int xaDefaultTimeout) {
1086        this.xaDefaultTimeout = xaDefaultTimeout;
1087    }
1088    
1089    
1090    /**
1091     * @return Returns the xaTransactonManagerLookupName.
1092     */

1093    public String JavaDoc getXaTransactonManagerLookupName() {
1094        return xaTransactonManagerLookupName;
1095    }
1096    
1097    
1098    /**
1099     * @param xaTransactonManagerLookupName The xaTransactonManagerLookupName to set.
1100     */

1101    public void setXaTransactonManagerLookupName(
1102            String JavaDoc xaTransactonManagerLookupName) {
1103        this.xaTransactonManagerLookupName = xaTransactonManagerLookupName;
1104    }
1105    
1106    
1107    /**
1108     * @return Returns the xaUsageCase.
1109     */

1110    public int getXaUsageCase() {
1111        return xaUsageCase;
1112    }
1113    
1114    
1115    /**
1116     * @param xaUsageCase The xaUsageCase to set.
1117     */

1118    public void setXaUsageCase(int xaUsageCase) {
1119        this.xaUsageCase = xaUsageCase;
1120    }
1121    
1122    
1123    /**
1124     * @return Returns the xaWrappedTransImplFactory.
1125     */

1126    public String JavaDoc getXaWrappedTransImplFactory() {
1127        return xaWrappedTransImplFactory;
1128    }
1129    
1130    
1131    /**
1132     * @param xaWrappedTransImplFactory The xaWrappedTransImplFactory to set.
1133     */

1134    public void setXaWrappedTransImplFactory(String JavaDoc xaWrappedTransImplFactory) {
1135        this.xaWrappedTransImplFactory = xaWrappedTransImplFactory;
1136    }
1137    
1138    
1139    /**
1140     * @return Returns the xaUserTransactonLookupName.
1141     */

1142    public String JavaDoc getXaUserTransactonLookupName() {
1143        return xaUserTransactonLookupName;
1144    }
1145    
1146    
1147    /**
1148     * @param xaUserTransactonLookupName The xaUserTransactonLookupName to set.
1149     */

1150    public void setXaUserTransactonLookupName(String JavaDoc xaUserTransactonLookupName) {
1151        this.xaUserTransactonLookupName = xaUserTransactonLookupName;
1152    }
1153    
1154    
1155    /**
1156     * @return Returns the xaJtaSupport.
1157     */

1158    public String JavaDoc getXaJtaSupport() {
1159        return xaJtaSupport;
1160    }
1161    
1162    
1163    /**
1164     * @param xaJtaSupport The xaJtaSupport to set.
1165     */

1166    public void setXaJtaSupport(String JavaDoc xaJtaSupport) {
1167        this.xaJtaSupport = xaJtaSupport;
1168    }
1169    
1170    /**
1171     * @return Returns the dods_cache_factory.
1172     */

1173    public String JavaDoc getDodsCacheFactory() {
1174        return this.dodsCacheFactory;
1175    }
1176    /**
1177     * @param dods_cache_factory The dods_cache_factory to set.
1178     */

1179    public void setDodsCacheFactory(String JavaDoc dodsCacheFactory) {
1180        this.dodsCacheFactory = dodsCacheFactory;
1181    }
1182}
1183
Popular Tags