01: package org.lateralnz.messaging;
02:
03: import java.io.IOException;
04:
05: public interface MessageHandler {
06:
07: /**
08: * add a message listener to this handler.
09: * @param group the group of messages that a listener is interested in receiving
10: * @param listener the message listener object
11: */
12: public void addListener(String group, MessageListener listener);
13:
14: /**
15: * returns whether transmission will be allowed for a group based upon the
16: * allowed/disallowed regular expressions.
17: * @param group the group to test
18: */
19: public boolean willTransmit(String group);
20:
21: /**
22: * send a message
23: * @param msg the message object to send
24: */
25: public void send(Message msg) throws IOException;
26:
27: /**
28: * a regular expression describing the group(s) that are allowed to send messages.
29: * A priority is also included which, if higher than the disallowed ex
30: * @param regex a regular expression
31: * @param priority what priority the allowed expression has over the disallowed group
32: */
33: public void setAllowedGroupRegex(String regex, int priority);
34:
35: /**
36: * a regular expression describing the group(s) that are -not- allowed to send messages
37: * @param regex a regular expression
38: * @param priority what priority the disallowed expression has over the allowed group
39: */
40: public void setDisallowedGroupRegex(String regex, int priority);
41:
42: }
|