1 19 20 package org.netbeans.lib.java.storagebuilder; 21 22 import java.util.HashMap ; 23 import java.util.Map ; 24 import org.netbeans.api.mdr.MDRepository; 25 import org.netbeans.api.mdr.MDRManager; 26 import org.netbeans.mdr.NBMDRepositoryImpl; 27 28 public class MDRManagerImpl extends MDRManager { 29 30 private static final String JAVA_REPOSITORY = "org.netbeans.java"; 33 private Map parameters; 34 private MDRepository repository = null; 35 private String [] repositoryNames; 36 37 private void init() { 38 if (repository == null) { 39 repositoryNames = new String [] {JAVA_REPOSITORY}; 40 String storagesDir = System.getProperty("mdr.filename"); System.out.println(" " + storagesDir); if (storagesDir == null) { 43 System.out.println(); 44 System.out.println("Cannot init mdr, mdr.filename property not specified."); return; 46 } 47 parameters = new HashMap (); 48 parameters.put("storage", "org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeFactory"); parameters.put("mutexClass", "org.netbeans.modules.javacore.ExclusiveMutex"); parameters.put("org.netbeans.mdr.persistence.btreeimpl.filename", storagesDir); parameters.put("org.netbeans.mdr.persistence.btreeimpl.cacheSize", "256"); parameters.put("org.netbeans.mdr.persistence.btreeimpl.cacheThreshHold", "1000"); parameters.put("org.netbeans.mdr.persistence.btreeimpl.uuid", "66666666-6666-6666-6666-666666666666"); repository = new NBMDRepositoryImpl(parameters); 55 } 56 } 57 58 public MDRepository getRepository(String name) { 59 init(); 60 return repository; 61 } 62 63 public MDRepository getDefaultRepository() { 64 return getRepository(JAVA_REPOSITORY); 65 } 66 67 public String [] getRepositoryNames() { 68 init(); 69 return repositoryNames; 70 } 71 72 } 73 | Popular Tags |