snifos.communication.test
Class DummyCommModule

java.lang.Object
  extended bysnifos.communication.test.DummyCommModule
All Implemented Interfaces:
CommModule, java.lang.Runnable

public class DummyCommModule
extends java.lang.Object
implements CommModule

Dummy implementation of communication module. It just simulates connections from few users, sends dummy messages from them and checks if responses are the responses which were expected.

Version:
$Id: DummyCommModule.java,v 1.3 2004/05/08 21:55:31 mwerla Exp $

Constructor Summary
DummyCommModule()
           
 
Method Summary
 void configure(java.util.Properties configuration, int commModuleId)
          Configures instance of CommModule with given parameters.
 void disconnectUser(UserId userId)
          Disconnects given user from a module.
 void run()
           
 void sendMessage(UserId userId, org.dom4j.Document message)
          Called by server to send message to user.
 void setServer(Server server)
          Sets instance of server which will be used to pass messages to applications.
 void shutdown()
          Stops communication module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyCommModule

public DummyCommModule()
Method Detail

configure

public void configure(java.util.Properties configuration,
                      int commModuleId)
Description copied from interface: CommModule
Configures instance of CommModule with given parameters.

Specified by:
configure in interface CommModule
Parameters:
configuration - Configuration which will be used.
commModuleId - Id of this instance of communication module inside the server - it is necessary to create valid user id.
See Also:
CommModule.configure(Properties, int)

setServer

public void setServer(Server server)
Description copied from interface: CommModule
Sets instance of server which will be used to pass messages to applications.

Specified by:
setServer in interface CommModule
Parameters:
server - Server instance.
See Also:
CommModule.setServer(Server)

sendMessage

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

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

disconnectUser

public void disconnectUser(UserId userId)
Description copied from interface: CommModule
Disconnects given user from a module.

Specified by:
disconnectUser in interface CommModule
Parameters:
userId - User id.
See Also:
CommModule.disconnectUser(UserId)

shutdown

public void shutdown()
Description copied from interface: CommModule
Stops communication module.

Specified by:
shutdown in interface CommModule
See Also:
CommModule.shutdown()

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.