1 43 package net.jforum.repository; 44 45 import java.io.IOException ; 46 import java.util.HashMap ; 47 import java.util.Map ; 48 import java.util.Properties ; 49 50 import net.jforum.ConfigLoader; 51 import net.jforum.JForumExecutionContext; 52 53 import org.apache.log4j.Logger; 54 55 59 public class ModulesRepository 60 { 61 private static final Logger logger = Logger.getLogger(ModulesRepository.class); 62 63 private static Map cache = new HashMap (); 64 private static final String ENTRIES = "entries"; 65 66 73 public static void init(String baseDir) throws IOException 74 { 75 cache.put(ENTRIES, ConfigLoader.loadModulesMapping(baseDir)); 76 } 77 78 public static int size() 79 { 80 return cache.size(); 81 } 82 83 90 public static String getModuleClass(String moduleName) { 91 Properties p = (Properties )cache.get(ENTRIES); 92 93 if (p == null) { 94 logger.error("Null modules. Askes moduleName: " + moduleName 95 + ", url=" + JForumExecutionContext.getRequest().getQueryString()); 96 return null; 97 } 98 99 return p.getProperty(moduleName); 100 } 101 } 102 | Popular Tags |