1 6 7 package SOFA.SOFAnet.Repository; 8 9 import java.util.*; 10 import SOFA.SOFAnode.TR.Impl.ComponentInfoImpl; 11 12 19 public class CompBundleMap 20 { 21 public Map map; 22 23 24 public CompBundleMap() 25 { 26 map = Collections.synchronizedMap(new HashMap()); 27 } 28 29 34 public String findBundle(String componentFullName) 35 { 36 return (String )map.get(componentFullName); 37 } 38 39 44 public void addComponents(List components, String bundleName) 45 { 46 synchronized (map) 47 { 48 synchronized (components) 49 { 50 Iterator it = components.iterator(); 51 while (it.hasNext()) 52 { 53 String componentName = ((ComponentInfoImpl)it.next()).toString(); 54 map.put(componentName, bundleName); 55 } 56 } 57 } 58 } 59 60 64 public void addBundleContent(BundleContent bundleContent) 65 { 66 List components = bundleContent.getComponents(); 67 String bundleName = bundleContent.getName(); 68 addComponents(components, bundleName); 69 } 70 71 75 public void addBundleOffer(BundleOffer bundleOffer) 76 { 77 List components = bundleOffer.getComponents(); 78 String bundleName = bundleOffer.getName(); 79 addComponents(components, bundleName); 80 } 81 82 87 public void deleteBundle(String bundleName) 88 { 89 synchronized (map) 90 { 91 Iterator it = map.values().iterator(); 92 while (it.hasNext()) 93 { 94 String name = (String )it.next(); 95 if (name.compareTo(bundleName) == 0) it.remove(); 96 } 97 } 98 } 99 100 } 101 | Popular Tags |