1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.asterisk.manager;
18
19 import java.util.Map;
20
21 import net.sf.asterisk.manager.event.ManagerEvent;
22
23 /***
24 * Transforms maps of attributes to instances of ManagerEvent.
25 *
26 * @see net.sf.asterisk.manager.event.ManagerEvent
27 * @author srt
28 * @version $Id: EventBuilder.java,v 1.9 2005/09/13 19:59:59 srt Exp $
29 */
30 public interface EventBuilder
31 {
32
33 /***
34 * Registers a new event class. The event this class is registered for is
35 * simply derived from the name of the class by stripping any package name
36 * (if present) and stripping the sufffix "Event". For example
37 * <code>net.sf.asterisk.manager.event.JoinEvent</code> is registered for
38 * the event "Join".
39 *
40 * @param clazz the event class to register, must extend
41 * net.sf.asterisk.manager.event.ManagerEvent.
42 */
43 void registerEventClass(Class clazz);
44
45 /***
46 * Builds the event based on the given map of attributes and the registered
47 * event classes.
48 *
49 * @param source source attribute for the event
50 * @param attributes map containing event attributes
51 * @return a concrete instance of ManagerEvent or <code>null</code> if no
52 * event class was registered for the event type.
53 */
54 ManagerEvent buildEvent(Object source, Map attributes);
55 }