KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > Setup


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: Setup.java,v 1.9.2.1 2004/01/11 20:42:30 per_nyfelt Exp $
8

9 package org.ozoneDB;
10
11 import java.util.*;
12 import org.ozoneDB.util.*;
13 import org.ozoneDB.core.Env;
14
15
16 /**
17  * Setup holds all static configuration properties plus all dynamic runtime
18  * properties of an ozone environment. Setup has methods to store/update the
19  * value of a property to handle such dynamic properties.
20  *
21  *
22  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
23  * @author <a HREF="http://www.medium.net/">Medium.net</a>
24  * @version $Revision: 1.9.2.1 $Date: 2004/01/11 20:42:30 $
25  */

26 public class Setup extends EnhProperties {
27
28     public final static String JavaDoc DB_ID = "ozoneDB.dbID";
29     public final static String JavaDoc PORT = "ozoneDB.port";
30     public final static String JavaDoc ADMIN_PORT = "ozoneDB.adminPort";
31     public final static String JavaDoc LOG_LEVEL = "ozoneDB.logLevel";
32     public final static String JavaDoc STORE = "ozoneDB.store";
33
34     public static final String JavaDoc MIN_FREE_MEMORY = "ozoneDB.vm.minFreeMemory";
35     public static final String JavaDoc TOTAL_MEMORY = "ozoneDB.vm.totalMemory";
36
37     public final static String JavaDoc XOID = "ozoneDB.xoid";
38
39     public final static String JavaDoc CS_CLUSTER_SIZE = "ozoneDB.classicStore.clusterSize";
40     public final static String JavaDoc CS_CLUSTER_SPACE_SIZE = "ozoneDB.classicStore.clusterSpaceSize";
41     public final static String JavaDoc CS_TABLE_BUFF_SIZE = "ozoneDB.classicStore.tableBufferSize";
42     public final static String JavaDoc CS_TABLE_CACHE_SIZE = "ozoneDB.classicStore.tableCacheSize";
43
44     public final static String JavaDoc WS_CLUSTER_SIZE = "ozoneDB.wizardStore.clusterSize";
45     public final static String JavaDoc WS_CLUSTER_SIZE_RATIO = "ozoneDB.wizardStore.clusterSizeRatio";
46     public final static String JavaDoc WS_TABLE_BUFF_SIZE = "ozoneDB.wizardStore.tableBufferSize";
47     public final static String JavaDoc WS_TABLE_CACHE_SIZE = "ozoneDB.wizardStore.tableCacheSize";
48     public final static String JavaDoc WS_TABLE_SUBTABLE_SIZE = "ozoneDB.wizardStore.tableSubtableSize";
49     public final static String JavaDoc WS_COMPRESS_CLUSTERS = "ozoneDB.wizardStore.compressClusters";
50
51     public final static String JavaDoc GARBAGE_COLLECTION_LEVEL = "ozoneDB.garbageCollection.level";
52
53     protected Env env;
54
55
56     public Setup( Env env ) {
57         super();
58         //TODO: is this what we should do with env?
59
this.env = env;
60     }
61
62
63     public Setup( Env env, Properties defaults ) {
64         super( defaults );
65         //TODO: is this what we should do with env?
66
this.env = env;
67     }
68
69     public String JavaDoc stringProperty(String JavaDoc _key, String JavaDoc _default) {
70         String JavaDoc property = super.stringProperty(_key, _default);
71
72         // This is to make it possible to just use e.g. MagicStore as the value in the prps file
73
// it also makes us backwards compatible with old WizardStore location
74
if (_key.equals(STORE)) {
75             if (property.matches(".*WizardStore")) {
76                 property = "org.ozoneDB.core.storage.wizardStore.WizardStore";
77             } else if (property.matches(".*MagicStore")) {
78                 property = "org.ozoneDB.core.storage.magicStore.MagicStore";
79             } else if (property.matches(".*GammaStore")) {
80                 property = "org.ozoneDB.core.storage.gammaStore.GammaStore";
81             } else if (property.matches(".*ClassicStore")) {
82                 property = "org.ozoneDB.core.storage.classicStore.ClassicStore";
83             }
84         }
85         return property;
86     }
87
88
89     public void fillWithOzoneDefaults() {
90         setStringProperty( STORE, "org.ozoneDB.core.storage.wizardStore.WizardStore");
91
92         setIntProperty( DB_ID, 0 );
93         setIntProperty( PORT, 3333 );
94         setIntProperty( ADMIN_PORT, 3000 );
95
96         setIntProperty( CS_CLUSTER_SIZE, 64 * 1024 );
97         setIntProperty( CS_CLUSTER_SPACE_SIZE, 5000 * 1024 );
98         setIntProperty( CS_TABLE_BUFF_SIZE, 50 * 256 );
99         setIntProperty( CS_TABLE_CACHE_SIZE, 4 * 1024 );
100
101         setIntProperty( WS_CLUSTER_SIZE, 64 * 1024 );
102         setIntProperty( WS_CLUSTER_SIZE_RATIO, 256 );
103         setIntProperty( WS_TABLE_BUFF_SIZE, 15 );
104         setIntArrayProperty( WS_TABLE_SUBTABLE_SIZE, new int[] {11} );
105         setIntProperty( WS_TABLE_CACHE_SIZE, 12 );
106         setBooleanProperty( WS_COMPRESS_CLUSTERS, true );
107         setIntProperty(GARBAGE_COLLECTION_LEVEL,0);
108     }
109
110 }
111
Popular Tags