1 19 package org.netbeans.mdr.persistence.btreeimpl.btreestorage; 20 21 import java.util.Map ; 22 import org.netbeans.mdr.persistence.*; 23 import org.netbeans.mdr.util.Logger; 24 25 28 public class BtreeFactory implements StorageFactory { 29 public static final String DEFAULT_FILE_NAME = "mdr"; 30 public static final String STORAGE_FILE_NAME = "org.netbeans.mdr.persistence.btreeimpl.filename"; public static final String CACHE_SIZE = "org.netbeans.mdr.persistence.btreeimpl.cacheSize"; public static final String CACHE_THRESHHOLD = "org.netbeans.mdr.persistence.btreeimpl.cacheThreshHold"; public static final String CACHE_INSTANCE = "org.netbeans.mdr.persistence.btreeimpl.cacheInstance"; public static final String STORAGE_UUID = "org.netbeans.mdr.persistence.btreeimpl.uuid"; 36 static final public int SAME_PREFIX_CODE = 0; 38 static final public int INTERNAL_PREFIX_CODE = 1; 39 static final public int FIRST_EXTERNAL_CODE = 2; 40 41 42 44 static final public int FIRST_EXTERNAL_ID = 128; 45 46 47 static final public String INTERNAL_PREFIX = "00000000-0000-0000-0000-000000000000"; 49 50 public static MOFID nullMOFID = new MOFID(1, INTERNAL_PREFIX); 51 52 53 public static MOFID indexIndexId = new MOFID(2, INTERNAL_PREFIX); 54 55 56 public static MOFID classIndexId = new MOFID(3, INTERNAL_PREFIX); 57 58 61 public Storage createStorage (Map properties) throws StorageException { 62 String name = (String ) properties.get (STORAGE_FILE_NAME); 63 if (name == null) { 64 name = DEFAULT_FILE_NAME; 65 Logger.getDefault().log("Property " + STORAGE_FILE_NAME + " not specified. Using default value: " + DEFAULT_FILE_NAME); 66 } 67 Logger.getDefault().log("Storage file name: " + name); 68 return new BtreeStorage(name, properties); 69 } 70 71 72 public org.netbeans.mdr.persistence.MOFID createNullMOFID () { 73 return nullMOFID; 74 } 75 } 76 77 78 | Popular Tags |