snifos.server
Class SnifosServer

java.lang.Object
  extended bysnifos.server.SnifosServer
All Implemented Interfaces:
java.lang.Runnable, Server

public class SnifosServer
extends java.lang.Object
implements Server

Reference implementation of SNIFOS server interface.

Version:
$Id: SnifosServer.java,v 1.2 2004/05/08 21:55:29 mwerla Exp $

Constructor Summary
SnifosServer(java.io.InputStream configurationStream)
          Server constructor.
 
Method Summary
 void disconnectUser(UserId userId)
          Disconnects user with given id from server.
 boolean isWait()
          Method for unit test purposes only.
 void receiveMessage(UserId userId, org.dom4j.Document message)
          Called by communication module to pass message from user to appropriate application.
 void run()
           
 void sendMessage(UserId userId, org.dom4j.Document message)
          Called by application to send message to user.
 void unregisterUser(UserId userId)
          Unregisters user with given id from server application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnifosServer

public SnifosServer(java.io.InputStream configurationStream)
             throws ConfigurationException
Server constructor.

Parameters:
configurationStream - Stream from which server configurtion will be loaded.
Throws:
ConfigurationException - Thrown when configuratin is wrong.
Method Detail

isWait

public boolean isWait()
Method for unit test purposes only.

Returns:
Wait flag value.

sendMessage

public void sendMessage(UserId userId,
                        org.dom4j.Document message)
Description copied from interface: Server
Called by application to send message to user.

Specified by:
sendMessage in interface Server
Parameters:
userId - Id of user which should receive message.
message - Message to be sent.
See Also:
Server.sendMessage(snifos.common.UserId, org.dom4j.Document)

receiveMessage

public void receiveMessage(UserId userId,
                           org.dom4j.Document message)
                    throws ConfigurationException,
                           InvalidUserException
Description copied from interface: Server
Called by communication module to pass message from user to appropriate application.

Specified by:
receiveMessage in interface Server
Parameters:
userId - Id of user which sends message.
message - Received message.
Throws:
InvalidUserException - Thrown when user id is invalid.
ConfigurationException - Thrown when application instance with default configuration is created and the configuration is invalid.
See Also:
Server.receiveMessage(UserId, Document)

disconnectUser

public void disconnectUser(UserId userId)
Description copied from interface: Server
Disconnects user with given id from server.

Specified by:
disconnectUser in interface Server
Parameters:
userId - Id of the user.
See Also:
Server.disconnectUser(UserId)

unregisterUser

public void unregisterUser(UserId userId)
Description copied from interface: Server
Unregisters user with given id from server application.

Specified by:
unregisterUser in interface Server
Parameters:
userId - Id of the user.
See Also:
Server.unregisterUser(UserId)

run

public void run()
Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()


Copyright © 2001-2004 MoMaT & MWe Team. All Rights Reserved.