1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package snifos.server;
21
22 import org.dom4j.Document;
23
24 import snifos.common.UserId;
25
26 import snifos.exception.ConfigurationException;
27 import snifos.exception.InvalidUserException;
28
29
30 /***
31 * This interface describes class which can be used to run SNIFOS applications
32 * and communication modules server.
33 * @version $Id: Server.java,v 1.2 2004/05/08 21:55:29 mwerla Exp $
34 */
35 public interface Server extends Runnable {
36 /***
37 * Called by application to send message to user.
38 * @param userId Id of user which should receive message.
39 * @param message Message to be sent.
40 */
41 public void sendMessage(UserId userId, Document message);
42
43 /***
44 * Called by communication module to pass message from user
45 * to appropriate application.
46 * @param userId Id of user which sends message.
47 * @param message Received message.
48 * @throws InvalidUserException Thrown when user id is invalid.
49 * @throws ConfigurationException Thrown when application instance with
50 * default configuration is created and the configuration is invalid.
51 */
52 public void receiveMessage(UserId userId, Document message)
53 throws InvalidUserException, ConfigurationException;
54
55 /***
56 * Disconnects user with given id from server.
57 * @param userId Id of the user.
58 */
59 public void disconnectUser(UserId userId);
60
61 /***
62 * Unregisters user with given id from server application.
63 * @param userId Id of the user.
64 */
65 public void unregisterUser(UserId userId);
66 }