1 9 package org.jboss.portal.common.plugin; 10 11 import java.util.HashMap ; 12 import java.util.Map ; 13 import java.util.Set ; 14 15 19 public class AbstractPluginContainer implements PluginContainer 20 { 21 22 protected Map plugins; 23 24 public AbstractPluginContainer(Map plugins) 25 { 26 this.plugins = plugins; 27 } 28 29 public AbstractPluginContainer() 30 { 31 this(new HashMap ()); 32 } 33 34 public synchronized void addPlugin(String key, Plugin plugin) 35 { 36 Map copy = new HashMap (plugins); 37 copy.put(key, plugin); 38 plugins = copy; 39 } 40 41 public synchronized void removePlugin(String key) 42 { 43 Map copy = new HashMap (plugins); 44 copy.remove(key); 45 plugins = copy; 46 } 47 48 public Plugin getPlugin(String key) 49 { 50 return (Plugin)plugins.get(key); 51 } 52 53 public Set getPluginKeySet() 54 { 55 return plugins.keySet(); 56 } 57 } 58 | Popular Tags |