| 1 10 package org.mmbase.security; 11 12 import org.mmbase.util.ResourceWatcher; 13 14 import org.mmbase.util.logging.Logger; 15 import org.mmbase.util.logging.Logging; 16 17 26 public abstract class Configurable { 27 private static final Logger log = Logging.getLoggerInstance(Configurable.class); 28 29 32 protected MMBaseCop manager; 33 34 39 protected String configResource; 41 42 45 protected java.io.File configFile; 46 47 48 51 protected ResourceWatcher configWatcher; 52 53 54 63 public final void load(MMBaseCop manager, ResourceWatcher configWatcher, String configPath) { 64 if (log.isDebugEnabled()) { 65 log.debug("Calling load() with as config file:" + configPath); 66 } 67 this.manager = manager; 68 this.configWatcher = configWatcher; 69 70 configWatcher.setDelay(10 * 1000); 71 72 if (configPath != null && !configPath.equals("")) { 73 if (configPath.startsWith("/")) { 74 configResource = "file://" + configPath; 75 } else { 76 configResource = configPath; 77 } 78 79 80 java.util.List files = configWatcher.getResourceLoader().getFiles(configResource); 81 82 if (files.size() > 0) { 83 configFile = (java.io.File ) files.get(0); 84 } 85 86 configWatcher.add(configResource); 87 } 88 89 90 load(); 91 } 92 93 99 protected abstract void load(); 100 } 101 | Popular Tags |