1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package snifos.communication;
21
22 import org.dom4j.Document;
23
24 import snifos.common.UserId;
25
26 import snifos.exception.InvalidUserException;
27
28 import snifos.server.Server;
29
30 import java.util.Properties;
31
32
33 /***
34 * This interface describes communication module which can
35 * be used in SNIFOS application server.
36 * @version $Id: CommModule.java,v 1.2 2004/05/08 21:55:25 mwerla Exp $
37 */
38 public interface CommModule extends Runnable {
39 /***
40 * Configures instance of CommModule with given parameters.
41 * @param configuration Configuration which will be used.
42 * @param commModuleId Id of this instance of communication module
43 * inside the server - it is necessary to create valid user id.
44 */
45 public void configure(Properties configuration, int commModuleId);
46
47 /***
48 * Sets instance of server which will be
49 * used to pass messages to applications.
50 * @param server Server instance.
51 */
52 public void setServer(Server server);
53
54 /***
55 * Called by server to send message to user.
56 * @param userId Id of user which should receive message.
57 * @param message Message to be sent.
58 * @throws InvalidUserException Thrown when user id is invalid for this
59 * communication module instance.
60 */
61 public void sendMessage(UserId userId, Document message)
62 throws InvalidUserException;
63
64 /***
65 * Disconnects given user from a module.
66 * @param userId User id.
67 */
68 public void disconnectUser(UserId userId);
69
70 /***
71 * Stops communication module.
72 */
73 public void shutdown();
74 }