01: /*
02: * Created on 15-Jan-2006
03: */
04: package uk.org.ponder.iocevent;
05:
06: import java.util.ArrayList;
07: import java.util.HashMap;
08: import java.util.List;
09: import java.util.Map;
10:
11: /** The beetlecrusher of all listener dependencies.
12: *
13: * @author Antranig Basman (amb26@ponder.org.uk)
14: *
15: */
16:
17: public class BeetleConnector implements ListenerReporter,
18: ListenerGetter {
19: private Map listeners = new HashMap();
20:
21: public void reportListener(Object listener, Object listenerclass,
22: Object targetkey) {
23: List classlisteners = getListeners(listenerclass, targetkey);
24: classlisteners.add(listener);
25: }
26:
27: public List getListeners(Object listenerclass, Object targetkey) {
28: List classlisteners = (List) listeners.get(listenerclass);
29: if (classlisteners == null) {
30: classlisteners = new ArrayList();
31: listeners.put(listenerclass, classlisteners);
32: }
33: return classlisteners;
34: }
35:
36: }
|