1 24 25 package com.mckoi.database.control; 26 27 import java.io.File ; 28 import java.util.Hashtable ; 29 30 35 36 public class AbstractDBConfig implements DBConfig { 37 38 41 private File current_path; 42 43 46 private Hashtable key_map; 47 48 51 public AbstractDBConfig(File current_path) { 52 this.current_path = current_path; 53 this.key_map = new Hashtable (); 54 } 55 56 60 protected String getDefaultValue(String property_key) { 61 return null; 63 } 64 65 68 protected void setValue(String property_key, String val) { 69 key_map.put(property_key, val); 70 } 71 72 74 public File currentPath() { 75 return current_path; 76 } 77 78 public String getValue(String property_key) { 79 String val = (String ) key_map.get(property_key); 81 if (val == null) { 82 return getDefaultValue(property_key); 83 } 84 return val; 85 } 86 87 public DBConfig immutableCopy() { 88 AbstractDBConfig immutable_copy = new AbstractDBConfig(current_path); 89 immutable_copy.key_map = (Hashtable ) key_map.clone(); 90 return immutable_copy; 91 } 92 93 } 94 | Popular Tags |