1 23 package org.objectweb.joram.mom.proxies; 24 25 import fr.dyade.aaa.agent.AgentId; 26 27 import java.util.Enumeration ; 28 import java.util.Hashtable ; 29 30 31 35 class TopicSubscription { 36 37 private Hashtable subs; 38 39 private String lastSelector = null; 40 41 42 45 TopicSubscription() { 46 this.subs = new Hashtable (); 47 } 48 49 50 56 void putSubscription(String name, String selector) { 57 if (selector == null) 58 selector = ""; 59 subs.put(name, selector); 60 } 61 62 67 void removeSubscription(String name) { 68 subs.remove(name); 69 } 70 71 72 boolean isEmpty() { 73 return subs.isEmpty(); 74 } 75 76 77 String buildSelector() { 78 String currentSel; 79 String builtSelector = null; 80 for (Enumeration names = subs.keys(); names.hasMoreElements();) { 81 currentSel = (String ) subs.get(names.nextElement()); 82 83 if (currentSel.equals("")) return ""; 84 85 if (builtSelector == null) 86 builtSelector = "(" + currentSel + ")"; 87 else 88 builtSelector = builtSelector + " OR (" + currentSel + ")"; 89 90 } 91 return builtSelector; 92 } 93 94 95 void setLastSelector(String selector) { 96 this.lastSelector = selector; 97 } 98 99 100 String getLastSelector() { 101 return lastSelector; 102 } 103 104 105 Enumeration getNames() { 106 return subs.keys(); 107 } 108 } 109 | Popular Tags |