1 9 package org.ozoneDB; 10 11 import java.util.*; 12 import org.ozoneDB.util.*; 13 import org.ozoneDB.core.Env; 14 15 16 26 public class Setup extends EnhProperties { 27 28 public final static String DB_ID = "ozoneDB.dbID"; 29 public final static String PORT = "ozoneDB.port"; 30 public final static String ADMIN_PORT = "ozoneDB.adminPort"; 31 public final static String LOG_LEVEL = "ozoneDB.logLevel"; 32 public final static String STORE = "ozoneDB.store"; 33 34 public static final String MIN_FREE_MEMORY = "ozoneDB.vm.minFreeMemory"; 35 public static final String TOTAL_MEMORY = "ozoneDB.vm.totalMemory"; 36 37 public final static String XOID = "ozoneDB.xoid"; 38 39 public final static String CS_CLUSTER_SIZE = "ozoneDB.classicStore.clusterSize"; 40 public final static String CS_CLUSTER_SPACE_SIZE = "ozoneDB.classicStore.clusterSpaceSize"; 41 public final static String CS_TABLE_BUFF_SIZE = "ozoneDB.classicStore.tableBufferSize"; 42 public final static String CS_TABLE_CACHE_SIZE = "ozoneDB.classicStore.tableCacheSize"; 43 44 public final static String WS_CLUSTER_SIZE = "ozoneDB.wizardStore.clusterSize"; 45 public final static String WS_CLUSTER_SIZE_RATIO = "ozoneDB.wizardStore.clusterSizeRatio"; 46 public final static String WS_TABLE_BUFF_SIZE = "ozoneDB.wizardStore.tableBufferSize"; 47 public final static String WS_TABLE_CACHE_SIZE = "ozoneDB.wizardStore.tableCacheSize"; 48 public final static String WS_TABLE_SUBTABLE_SIZE = "ozoneDB.wizardStore.tableSubtableSize"; 49 public final static String WS_COMPRESS_CLUSTERS = "ozoneDB.wizardStore.compressClusters"; 50 51 public final static String GARBAGE_COLLECTION_LEVEL = "ozoneDB.garbageCollection.level"; 52 53 protected Env env; 54 55 56 public Setup( Env env ) { 57 super(); 58 this.env = env; 60 } 61 62 63 public Setup( Env env, Properties defaults ) { 64 super( defaults ); 65 this.env = env; 67 } 68 69 public String stringProperty(String _key, String _default) { 70 String property = super.stringProperty(_key, _default); 71 72 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 |