1 16 17 package org.apache.commons.chain.impl; 18 19 import java.util.HashMap ; 20 import java.util.Iterator ; 21 import java.util.Map ; 22 import org.apache.commons.chain.Catalog; 23 import org.apache.commons.chain.CatalogFactory; 24 25 31 32 public class CatalogFactoryBase extends CatalogFactory { 33 34 35 37 38 42 public CatalogFactoryBase() { } 43 44 45 47 48 51 private Catalog catalog = null; 52 53 54 57 private Map catalogs = new HashMap (); 58 59 60 62 63 public Catalog getCatalog() { 65 66 return catalog; 67 68 } 69 70 71 public void setCatalog(Catalog catalog) { 73 74 this.catalog = catalog; 75 76 } 77 78 79 public Catalog getCatalog(String name) { 81 82 synchronized (catalogs) { 83 return (Catalog) catalogs.get(name); 84 } 85 86 } 87 88 89 public void addCatalog(String name, Catalog catalog) { 91 92 synchronized (catalogs) { 93 catalogs.put(name, catalog); 94 } 95 96 } 97 98 99 public Iterator getNames() { 101 102 synchronized (catalogs) { 103 return catalogs.keySet().iterator(); 104 } 105 106 } 107 108 109 } 110 | Popular Tags |