1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package nl.toolforge.karma.core.cmd.event;
20
21 import nl.toolforge.karma.core.cmd.Command;
22
23 /***
24 * Event thrown when a {@link nl.toolforge.karma.core.cmd.CommandResponse} changes. Classes interested in this event
25 * implement the {@link CommandResponseListener} interface.
26 *
27 * @author W.H.Schraal
28 * @author D.A. Smedes
29 */
30 public abstract class CommandResponseEvent implements Event {
31
32 private Command command = null;
33
34 private int priority = LEVEL_INFO;
35
36 /***
37 * Constructs a <code>CommandResponseEvent</code> and assumes the default priority to be {@link #LEVEL_INFO}.
38 *
39 * @param command The <code>Command</code> that generated
40 */
41 public CommandResponseEvent(Command command) {
42 this(command, Event.LEVEL_INFO);
43 }
44
45 /***
46 * Constructs a <code>CommandResponseEvent</code>.
47 *
48 * @param command The <code>Command</code> that generated
49 * @param priority The priority of the event.
50 */
51 public CommandResponseEvent(Command command, int priority) {
52 this.command = command;
53 this.priority = priority;
54 }
55
56 /***
57 * Gets the priority level for the event.
58 *
59 * @return The priority level for the event.
60 *
61 * @see {@link #LEVEL_VERBOSE}
62 * @see {@link #LEVEL_INFO}
63 * @see {@link #LEVEL_DEBUG}
64 */
65 public final int getPriority() {
66 return priority;
67 }
68
69 /***
70 * Implementations should return a specific {@link Message} instance.
71 * @return
72 */
73 public abstract Message getEventMessage();
74
75 /***
76 * Returns the command that generated this event.
77 *
78 * @return The {@link Command} command that generated this event.
79 */
80 public Command getCommand() {
81 return command;
82 }
83 }